index.js 2.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616
  1. /*!
  2. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  4. * v1.0.0-beta.97
  5. */
  6. 'use strict';
  7. Object.defineProperty(exports, '__esModule', { value: true });
  8. /*!
  9. Stencil Mock Doc v2.18.1 | MIT Licensed | https://stenciljs.com
  10. */
  11. const CONTENT_REF_ID = 'r';
  12. const ORG_LOCATION_ID = 'o';
  13. const SLOT_NODE_ID = 's';
  14. const TEXT_NODE_ID = 't';
  15. const XLINK_NS = 'http://www.w3.org/1999/xlink';
  16. const attrHandler = {
  17. get(obj, prop) {
  18. if (prop in obj) {
  19. return obj[prop];
  20. }
  21. if (typeof prop !== 'symbol' && !isNaN(prop)) {
  22. return obj.__items[prop];
  23. }
  24. return undefined;
  25. },
  26. };
  27. const createAttributeProxy = (caseInsensitive) => new Proxy(new MockAttributeMap(caseInsensitive), attrHandler);
  28. class MockAttributeMap {
  29. constructor(caseInsensitive = false) {
  30. this.caseInsensitive = caseInsensitive;
  31. this.__items = [];
  32. }
  33. get length() {
  34. return this.__items.length;
  35. }
  36. item(index) {
  37. return this.__items[index] || null;
  38. }
  39. setNamedItem(attr) {
  40. attr.namespaceURI = null;
  41. this.setNamedItemNS(attr);
  42. }
  43. setNamedItemNS(attr) {
  44. if (attr != null && attr.value != null) {
  45. attr.value = String(attr.value);
  46. }
  47. const existingAttr = this.__items.find((a) => a.name === attr.name && a.namespaceURI === attr.namespaceURI);
  48. if (existingAttr != null) {
  49. existingAttr.value = attr.value;
  50. }
  51. else {
  52. this.__items.push(attr);
  53. }
  54. }
  55. getNamedItem(attrName) {
  56. if (this.caseInsensitive) {
  57. attrName = attrName.toLowerCase();
  58. }
  59. return this.getNamedItemNS(null, attrName);
  60. }
  61. getNamedItemNS(namespaceURI, attrName) {
  62. namespaceURI = getNamespaceURI(namespaceURI);
  63. return (this.__items.find((attr) => attr.name === attrName && getNamespaceURI(attr.namespaceURI) === namespaceURI) || null);
  64. }
  65. removeNamedItem(attr) {
  66. this.removeNamedItemNS(attr);
  67. }
  68. removeNamedItemNS(attr) {
  69. for (let i = 0, ii = this.__items.length; i < ii; i++) {
  70. if (this.__items[i].name === attr.name && this.__items[i].namespaceURI === attr.namespaceURI) {
  71. this.__items.splice(i, 1);
  72. break;
  73. }
  74. }
  75. }
  76. [Symbol.iterator]() {
  77. let i = 0;
  78. return {
  79. next: () => ({
  80. done: i === this.length,
  81. value: this.item(i++),
  82. }),
  83. };
  84. }
  85. get [Symbol.toStringTag]() {
  86. return 'MockAttributeMap';
  87. }
  88. }
  89. function getNamespaceURI(namespaceURI) {
  90. return namespaceURI === XLINK_NS ? null : namespaceURI;
  91. }
  92. function cloneAttributes(srcAttrs, sortByName = false) {
  93. const dstAttrs = new MockAttributeMap(srcAttrs.caseInsensitive);
  94. if (srcAttrs != null) {
  95. const attrLen = srcAttrs.length;
  96. if (sortByName && attrLen > 1) {
  97. const sortedAttrs = [];
  98. for (let i = 0; i < attrLen; i++) {
  99. const srcAttr = srcAttrs.item(i);
  100. const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
  101. sortedAttrs.push(dstAttr);
  102. }
  103. sortedAttrs.sort(sortAttributes).forEach((attr) => {
  104. dstAttrs.setNamedItemNS(attr);
  105. });
  106. }
  107. else {
  108. for (let i = 0; i < attrLen; i++) {
  109. const srcAttr = srcAttrs.item(i);
  110. const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
  111. dstAttrs.setNamedItemNS(dstAttr);
  112. }
  113. }
  114. }
  115. return dstAttrs;
  116. }
  117. function sortAttributes(a, b) {
  118. if (a.name < b.name)
  119. return -1;
  120. if (a.name > b.name)
  121. return 1;
  122. return 0;
  123. }
  124. class MockAttr {
  125. constructor(attrName, attrValue, namespaceURI = null) {
  126. this._name = attrName;
  127. this._value = String(attrValue);
  128. this._namespaceURI = namespaceURI;
  129. }
  130. get name() {
  131. return this._name;
  132. }
  133. set name(value) {
  134. this._name = value;
  135. }
  136. get value() {
  137. return this._value;
  138. }
  139. set value(value) {
  140. this._value = String(value);
  141. }
  142. get nodeName() {
  143. return this._name;
  144. }
  145. set nodeName(value) {
  146. this._name = value;
  147. }
  148. get nodeValue() {
  149. return this._value;
  150. }
  151. set nodeValue(value) {
  152. this._value = String(value);
  153. }
  154. get namespaceURI() {
  155. return this._namespaceURI;
  156. }
  157. set namespaceURI(namespaceURI) {
  158. this._namespaceURI = namespaceURI;
  159. }
  160. }
  161. class MockClassList {
  162. constructor(elm) {
  163. this.elm = elm;
  164. }
  165. add(...classNames) {
  166. const clsNames = getItems(this.elm);
  167. let updated = false;
  168. classNames.forEach((className) => {
  169. className = String(className);
  170. validateClass(className);
  171. if (clsNames.includes(className) === false) {
  172. clsNames.push(className);
  173. updated = true;
  174. }
  175. });
  176. if (updated) {
  177. this.elm.setAttributeNS(null, 'class', clsNames.join(' '));
  178. }
  179. }
  180. remove(...classNames) {
  181. const clsNames = getItems(this.elm);
  182. let updated = false;
  183. classNames.forEach((className) => {
  184. className = String(className);
  185. validateClass(className);
  186. const index = clsNames.indexOf(className);
  187. if (index > -1) {
  188. clsNames.splice(index, 1);
  189. updated = true;
  190. }
  191. });
  192. if (updated) {
  193. this.elm.setAttributeNS(null, 'class', clsNames.filter((c) => c.length > 0).join(' '));
  194. }
  195. }
  196. contains(className) {
  197. className = String(className);
  198. return getItems(this.elm).includes(className);
  199. }
  200. toggle(className) {
  201. className = String(className);
  202. if (this.contains(className) === true) {
  203. this.remove(className);
  204. }
  205. else {
  206. this.add(className);
  207. }
  208. }
  209. get length() {
  210. return getItems(this.elm).length;
  211. }
  212. item(index) {
  213. return getItems(this.elm)[index];
  214. }
  215. toString() {
  216. return getItems(this.elm).join(' ');
  217. }
  218. }
  219. function validateClass(className) {
  220. if (className === '') {
  221. throw new Error('The token provided must not be empty.');
  222. }
  223. if (/\s/.test(className)) {
  224. throw new Error(`The token provided ('${className}') contains HTML space characters, which are not valid in tokens.`);
  225. }
  226. }
  227. function getItems(elm) {
  228. const className = elm.getAttribute('class');
  229. if (typeof className === 'string' && className.length > 0) {
  230. return className
  231. .trim()
  232. .split(' ')
  233. .filter((c) => c.length > 0);
  234. }
  235. return [];
  236. }
  237. class MockCSSStyleDeclaration {
  238. constructor() {
  239. this._styles = new Map();
  240. }
  241. setProperty(prop, value) {
  242. prop = jsCaseToCssCase(prop);
  243. if (value == null || value === '') {
  244. this._styles.delete(prop);
  245. }
  246. else {
  247. this._styles.set(prop, String(value));
  248. }
  249. }
  250. getPropertyValue(prop) {
  251. prop = jsCaseToCssCase(prop);
  252. return String(this._styles.get(prop) || '');
  253. }
  254. removeProperty(prop) {
  255. prop = jsCaseToCssCase(prop);
  256. this._styles.delete(prop);
  257. }
  258. get length() {
  259. return this._styles.size;
  260. }
  261. get cssText() {
  262. const cssText = [];
  263. this._styles.forEach((value, prop) => {
  264. cssText.push(`${prop}: ${value};`);
  265. });
  266. return cssText.join(' ').trim();
  267. }
  268. set cssText(cssText) {
  269. if (cssText == null || cssText === '') {
  270. this._styles.clear();
  271. return;
  272. }
  273. cssText.split(';').forEach((rule) => {
  274. rule = rule.trim();
  275. if (rule.length > 0) {
  276. const splt = rule.split(':');
  277. if (splt.length > 1) {
  278. const prop = splt[0].trim();
  279. const value = splt.slice(1).join(':').trim();
  280. if (prop !== '' && value !== '') {
  281. this._styles.set(jsCaseToCssCase(prop), value);
  282. }
  283. }
  284. }
  285. });
  286. }
  287. }
  288. function createCSSStyleDeclaration() {
  289. return new Proxy(new MockCSSStyleDeclaration(), cssProxyHandler);
  290. }
  291. const cssProxyHandler = {
  292. get(cssStyle, prop) {
  293. if (prop in cssStyle) {
  294. return cssStyle[prop];
  295. }
  296. prop = cssCaseToJsCase(prop);
  297. return cssStyle.getPropertyValue(prop);
  298. },
  299. set(cssStyle, prop, value) {
  300. if (prop in cssStyle) {
  301. cssStyle[prop] = value;
  302. }
  303. else {
  304. cssStyle.setProperty(prop, value);
  305. }
  306. return true;
  307. },
  308. };
  309. function cssCaseToJsCase(str) {
  310. // font-size to fontSize
  311. if (str.length > 1 && str.includes('-') === true) {
  312. str = str
  313. .toLowerCase()
  314. .split('-')
  315. .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
  316. .join('');
  317. str = str.slice(0, 1).toLowerCase() + str.slice(1);
  318. }
  319. return str;
  320. }
  321. function jsCaseToCssCase(str) {
  322. // fontSize to font-size
  323. if (str.length > 1 && str.includes('-') === false && /[A-Z]/.test(str) === true) {
  324. str = str
  325. .replace(/([A-Z])/g, (g) => ' ' + g[0])
  326. .trim()
  327. .replace(/ /g, '-')
  328. .toLowerCase();
  329. }
  330. return str;
  331. }
  332. class MockCustomElementRegistry {
  333. constructor(win) {
  334. this.win = win;
  335. }
  336. define(tagName, cstr, options) {
  337. if (tagName.toLowerCase() !== tagName) {
  338. throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': "${tagName}" is not a valid custom element name`);
  339. }
  340. if (this.__registry == null) {
  341. this.__registry = new Map();
  342. }
  343. this.__registry.set(tagName, { cstr, options });
  344. if (this.__whenDefined != null) {
  345. const whenDefinedResolveFns = this.__whenDefined.get(tagName);
  346. if (whenDefinedResolveFns != null) {
  347. whenDefinedResolveFns.forEach((whenDefinedResolveFn) => {
  348. whenDefinedResolveFn();
  349. });
  350. whenDefinedResolveFns.length = 0;
  351. this.__whenDefined.delete(tagName);
  352. }
  353. }
  354. const doc = this.win.document;
  355. if (doc != null) {
  356. const hosts = doc.querySelectorAll(tagName);
  357. hosts.forEach((host) => {
  358. if (upgradedElements.has(host) === false) {
  359. tempDisableCallbacks.add(doc);
  360. const upgradedCmp = createCustomElement(this, doc, tagName);
  361. for (let i = 0; i < host.childNodes.length; i++) {
  362. const childNode = host.childNodes[i];
  363. childNode.remove();
  364. upgradedCmp.appendChild(childNode);
  365. }
  366. tempDisableCallbacks.delete(doc);
  367. if (proxyElements.has(host)) {
  368. proxyElements.set(host, upgradedCmp);
  369. }
  370. }
  371. fireConnectedCallback(host);
  372. });
  373. }
  374. }
  375. get(tagName) {
  376. if (this.__registry != null) {
  377. const def = this.__registry.get(tagName.toLowerCase());
  378. if (def != null) {
  379. return def.cstr;
  380. }
  381. }
  382. return undefined;
  383. }
  384. upgrade(_rootNode) {
  385. //
  386. }
  387. clear() {
  388. if (this.__registry != null) {
  389. this.__registry.clear();
  390. }
  391. if (this.__whenDefined != null) {
  392. this.__whenDefined.clear();
  393. }
  394. }
  395. whenDefined(tagName) {
  396. tagName = tagName.toLowerCase();
  397. if (this.__registry != null && this.__registry.has(tagName) === true) {
  398. return Promise.resolve(this.__registry.get(tagName).cstr);
  399. }
  400. return new Promise((resolve) => {
  401. if (this.__whenDefined == null) {
  402. this.__whenDefined = new Map();
  403. }
  404. let whenDefinedResolveFns = this.__whenDefined.get(tagName);
  405. if (whenDefinedResolveFns == null) {
  406. whenDefinedResolveFns = [];
  407. this.__whenDefined.set(tagName, whenDefinedResolveFns);
  408. }
  409. whenDefinedResolveFns.push(resolve);
  410. });
  411. }
  412. }
  413. function createCustomElement(customElements, ownerDocument, tagName) {
  414. const Cstr = customElements.get(tagName);
  415. if (Cstr != null) {
  416. const cmp = new Cstr(ownerDocument);
  417. cmp.nodeName = tagName.toUpperCase();
  418. upgradedElements.add(cmp);
  419. return cmp;
  420. }
  421. const host = new Proxy({}, {
  422. get(obj, prop) {
  423. const elm = proxyElements.get(host);
  424. if (elm != null) {
  425. return elm[prop];
  426. }
  427. return obj[prop];
  428. },
  429. set(obj, prop, val) {
  430. const elm = proxyElements.get(host);
  431. if (elm != null) {
  432. elm[prop] = val;
  433. }
  434. else {
  435. obj[prop] = val;
  436. }
  437. return true;
  438. },
  439. has(obj, prop) {
  440. const elm = proxyElements.get(host);
  441. if (prop in elm) {
  442. return true;
  443. }
  444. if (prop in obj) {
  445. return true;
  446. }
  447. return false;
  448. },
  449. });
  450. const elm = new MockHTMLElement(ownerDocument, tagName);
  451. proxyElements.set(host, elm);
  452. return host;
  453. }
  454. const proxyElements = new WeakMap();
  455. const upgradedElements = new WeakSet();
  456. function connectNode(ownerDocument, node) {
  457. node.ownerDocument = ownerDocument;
  458. if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
  459. if (ownerDocument != null && node.nodeName.includes('-')) {
  460. const win = ownerDocument.defaultView;
  461. if (win != null && typeof node.connectedCallback === 'function' && node.isConnected) {
  462. fireConnectedCallback(node);
  463. }
  464. const shadowRoot = node.shadowRoot;
  465. if (shadowRoot != null) {
  466. shadowRoot.childNodes.forEach((childNode) => {
  467. connectNode(ownerDocument, childNode);
  468. });
  469. }
  470. }
  471. node.childNodes.forEach((childNode) => {
  472. connectNode(ownerDocument, childNode);
  473. });
  474. }
  475. else {
  476. node.childNodes.forEach((childNode) => {
  477. childNode.ownerDocument = ownerDocument;
  478. });
  479. }
  480. }
  481. function fireConnectedCallback(node) {
  482. if (typeof node.connectedCallback === 'function') {
  483. if (tempDisableCallbacks.has(node.ownerDocument) === false) {
  484. try {
  485. node.connectedCallback();
  486. }
  487. catch (e) {
  488. console.error(e);
  489. }
  490. }
  491. }
  492. }
  493. function disconnectNode(node) {
  494. if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
  495. if (node.nodeName.includes('-') === true && typeof node.disconnectedCallback === 'function') {
  496. if (tempDisableCallbacks.has(node.ownerDocument) === false) {
  497. try {
  498. node.disconnectedCallback();
  499. }
  500. catch (e) {
  501. console.error(e);
  502. }
  503. }
  504. }
  505. node.childNodes.forEach(disconnectNode);
  506. }
  507. }
  508. function attributeChanged(node, attrName, oldValue, newValue) {
  509. attrName = attrName.toLowerCase();
  510. const observedAttributes = node.constructor.observedAttributes;
  511. if (Array.isArray(observedAttributes) === true &&
  512. observedAttributes.some((obs) => obs.toLowerCase() === attrName) === true) {
  513. try {
  514. node.attributeChangedCallback(attrName, oldValue, newValue);
  515. }
  516. catch (e) {
  517. console.error(e);
  518. }
  519. }
  520. }
  521. function checkAttributeChanged(node) {
  522. return node.nodeName.includes('-') === true && typeof node.attributeChangedCallback === 'function';
  523. }
  524. const tempDisableCallbacks = new Set();
  525. function dataset(elm) {
  526. const ds = {};
  527. const attributes = elm.attributes;
  528. const attrLen = attributes.length;
  529. for (let i = 0; i < attrLen; i++) {
  530. const attr = attributes.item(i);
  531. const nodeName = attr.nodeName;
  532. if (nodeName.startsWith('data-')) {
  533. ds[dashToPascalCase(nodeName)] = attr.nodeValue;
  534. }
  535. }
  536. return new Proxy(ds, {
  537. get(_obj, camelCaseProp) {
  538. return ds[camelCaseProp];
  539. },
  540. set(_obj, camelCaseProp, value) {
  541. const dataAttr = toDataAttribute(camelCaseProp);
  542. elm.setAttribute(dataAttr, value);
  543. return true;
  544. },
  545. });
  546. }
  547. function toDataAttribute(str) {
  548. return ('data-' +
  549. String(str)
  550. .replace(/([A-Z0-9])/g, (g) => ' ' + g[0])
  551. .trim()
  552. .replace(/ /g, '-')
  553. .toLowerCase());
  554. }
  555. function dashToPascalCase(str) {
  556. str = String(str).slice(5);
  557. return str
  558. .split('-')
  559. .map((segment, index) => {
  560. if (index === 0) {
  561. return segment.charAt(0).toLowerCase() + segment.slice(1);
  562. }
  563. return segment.charAt(0).toUpperCase() + segment.slice(1);
  564. })
  565. .join('');
  566. }
  567. class MockEvent {
  568. constructor(type, eventInitDict) {
  569. this.bubbles = false;
  570. this.cancelBubble = false;
  571. this.cancelable = false;
  572. this.composed = false;
  573. this.currentTarget = null;
  574. this.defaultPrevented = false;
  575. this.srcElement = null;
  576. this.target = null;
  577. if (typeof type !== 'string') {
  578. throw new Error(`Event type required`);
  579. }
  580. this.type = type;
  581. this.timeStamp = Date.now();
  582. if (eventInitDict != null) {
  583. Object.assign(this, eventInitDict);
  584. }
  585. }
  586. preventDefault() {
  587. this.defaultPrevented = true;
  588. }
  589. stopPropagation() {
  590. this.cancelBubble = true;
  591. }
  592. stopImmediatePropagation() {
  593. this.cancelBubble = true;
  594. }
  595. composedPath() {
  596. const composedPath = [];
  597. let currentElement = this.target;
  598. while (currentElement) {
  599. composedPath.push(currentElement);
  600. if (!currentElement.parentElement && currentElement.nodeName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
  601. // the current element doesn't have a parent, but we've detected it's our root document node. push the window
  602. // object associated with the document onto the path
  603. composedPath.push(currentElement.defaultView);
  604. break;
  605. }
  606. currentElement = currentElement.parentElement;
  607. }
  608. return composedPath;
  609. }
  610. }
  611. class MockCustomEvent extends MockEvent {
  612. constructor(type, customEventInitDic) {
  613. super(type);
  614. this.detail = null;
  615. if (customEventInitDic != null) {
  616. Object.assign(this, customEventInitDic);
  617. }
  618. }
  619. }
  620. class MockKeyboardEvent extends MockEvent {
  621. constructor(type, keyboardEventInitDic) {
  622. super(type);
  623. this.code = '';
  624. this.key = '';
  625. this.altKey = false;
  626. this.ctrlKey = false;
  627. this.metaKey = false;
  628. this.shiftKey = false;
  629. this.location = 0;
  630. this.repeat = false;
  631. if (keyboardEventInitDic != null) {
  632. Object.assign(this, keyboardEventInitDic);
  633. }
  634. }
  635. }
  636. class MockMouseEvent extends MockEvent {
  637. constructor(type, mouseEventInitDic) {
  638. super(type);
  639. this.screenX = 0;
  640. this.screenY = 0;
  641. this.clientX = 0;
  642. this.clientY = 0;
  643. this.ctrlKey = false;
  644. this.shiftKey = false;
  645. this.altKey = false;
  646. this.metaKey = false;
  647. this.button = 0;
  648. this.buttons = 0;
  649. this.relatedTarget = null;
  650. if (mouseEventInitDic != null) {
  651. Object.assign(this, mouseEventInitDic);
  652. }
  653. }
  654. }
  655. class MockUIEvent extends MockEvent {
  656. constructor(type, uiEventInitDic) {
  657. super(type);
  658. this.detail = null;
  659. this.view = null;
  660. if (uiEventInitDic != null) {
  661. Object.assign(this, uiEventInitDic);
  662. }
  663. }
  664. }
  665. class MockFocusEvent extends MockUIEvent {
  666. constructor(type, focusEventInitDic) {
  667. super(type);
  668. this.relatedTarget = null;
  669. if (focusEventInitDic != null) {
  670. Object.assign(this, focusEventInitDic);
  671. }
  672. }
  673. }
  674. class MockEventListener {
  675. constructor(type, handler) {
  676. this.type = type;
  677. this.handler = handler;
  678. }
  679. }
  680. function addEventListener(elm, type, handler) {
  681. const target = elm;
  682. if (target.__listeners == null) {
  683. target.__listeners = [];
  684. }
  685. target.__listeners.push(new MockEventListener(type, handler));
  686. }
  687. function removeEventListener(elm, type, handler) {
  688. const target = elm;
  689. if (target != null && Array.isArray(target.__listeners) === true) {
  690. const elmListener = target.__listeners.find((e) => e.type === type && e.handler === handler);
  691. if (elmListener != null) {
  692. const index = target.__listeners.indexOf(elmListener);
  693. target.__listeners.splice(index, 1);
  694. }
  695. }
  696. }
  697. function resetEventListeners(target) {
  698. if (target != null && target.__listeners != null) {
  699. target.__listeners = null;
  700. }
  701. }
  702. function triggerEventListener(elm, ev) {
  703. if (elm == null || ev.cancelBubble === true) {
  704. return;
  705. }
  706. const target = elm;
  707. ev.currentTarget = elm;
  708. if (Array.isArray(target.__listeners) === true) {
  709. const listeners = target.__listeners.filter((e) => e.type === ev.type);
  710. listeners.forEach((listener) => {
  711. try {
  712. listener.handler.call(target, ev);
  713. }
  714. catch (err) {
  715. console.error(err);
  716. }
  717. });
  718. }
  719. if (ev.bubbles === false) {
  720. return;
  721. }
  722. if (elm.nodeName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
  723. triggerEventListener(elm.defaultView, ev);
  724. }
  725. else {
  726. triggerEventListener(elm.parentElement, ev);
  727. }
  728. }
  729. function dispatchEvent(currentTarget, ev) {
  730. ev.target = currentTarget;
  731. triggerEventListener(currentTarget, ev);
  732. return true;
  733. }
  734. // Parse5 6.0.1
  735. const e=function(e){const t=[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 n="�",s={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533},r=function(e){return e>=55296&&e<=57343},i=function(e){return 32!==e&&10!==e&&13!==e&&9!==e&&12!==e&&e>=1&&e<=31||e>=127&&e<=159},o=function(e){return e>=64976&&e<=65007||t.indexOf(e)>-1},a="unexpected-null-character",T="invalid-first-character-of-tag-name",E="missing-semicolon-after-character-reference",h="eof-before-tag-name",c="eof-in-tag",_="missing-whitespace-after-doctype-public-keyword",l="missing-whitespace-between-doctype-public-and-system-identifiers",m="missing-whitespace-after-doctype-system-keyword",p="missing-quote-before-doctype-public-identifier",A="missing-quote-before-doctype-system-identifier",u="missing-doctype-public-identifier",N="missing-doctype-system-identifier",d="abrupt-doctype-public-identifier",C="abrupt-doctype-system-identifier",O="eof-in-script-html-comment-like-text",f="eof-in-doctype",S="abrupt-closing-of-empty-comment",R="eof-in-comment",I="absence-of-digits-in-numeric-character-reference",L="end-tag-without-matching-open-element",k="misplaced-start-tag-for-head-element";const M=s;var g=new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4e3,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,1e4,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13e3,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204]);const P=s,H={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]},D={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},F="DATA_STATE",U="RCDATA_STATE",G="RAWTEXT_STATE",B="SCRIPT_DATA_STATE",K="PLAINTEXT_STATE",b="TAG_OPEN_STATE",x="END_TAG_OPEN_STATE",y="TAG_NAME_STATE",v="RCDATA_LESS_THAN_SIGN_STATE",Y="RCDATA_END_TAG_OPEN_STATE",w="RCDATA_END_TAG_NAME_STATE",Q="RAWTEXT_LESS_THAN_SIGN_STATE",X="RAWTEXT_END_TAG_OPEN_STATE",W="RAWTEXT_END_TAG_NAME_STATE",V="SCRIPT_DATA_LESS_THAN_SIGN_STATE",j="SCRIPT_DATA_END_TAG_OPEN_STATE",z="SCRIPT_DATA_END_TAG_NAME_STATE",q="SCRIPT_DATA_ESCAPE_START_STATE",J="SCRIPT_DATA_ESCAPE_START_DASH_STATE",Z="SCRIPT_DATA_ESCAPED_STATE",$="SCRIPT_DATA_ESCAPED_DASH_STATE",ee="SCRIPT_DATA_ESCAPED_DASH_DASH_STATE",te="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE",ne="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE",se="SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE",re="SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE",ie="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",oe="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE",ae="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE",Te="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",Ee="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE",he="BEFORE_ATTRIBUTE_NAME_STATE",ce="ATTRIBUTE_NAME_STATE",_e="AFTER_ATTRIBUTE_NAME_STATE",le="BEFORE_ATTRIBUTE_VALUE_STATE",me="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE",pe="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE",Ae="ATTRIBUTE_VALUE_UNQUOTED_STATE",ue="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE",Ne="SELF_CLOSING_START_TAG_STATE",de="BOGUS_COMMENT_STATE",Ce="MARKUP_DECLARATION_OPEN_STATE",Oe="COMMENT_START_STATE",fe="COMMENT_START_DASH_STATE",Se="COMMENT_STATE",Re="COMMENT_LESS_THAN_SIGN_STATE",Ie="COMMENT_LESS_THAN_SIGN_BANG_STATE",Le="COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE",ke="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE",Me="COMMENT_END_DASH_STATE",ge="COMMENT_END_STATE",Pe="COMMENT_END_BANG_STATE",He="DOCTYPE_STATE",De="BEFORE_DOCTYPE_NAME_STATE",Fe="DOCTYPE_NAME_STATE",Ue="AFTER_DOCTYPE_NAME_STATE",Ge="AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE",Be="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE",Ke="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE",be="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE",xe="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE",ye="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE",ve="AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE",Ye="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE",we="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE",Qe="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE",Xe="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE",We="BOGUS_DOCTYPE_STATE",Ve="CDATA_SECTION_STATE",je="CDATA_SECTION_BRACKET_STATE",ze="CDATA_SECTION_END_STATE",qe="CHARACTER_REFERENCE_STATE",Je="NAMED_CHARACTER_REFERENCE_STATE",Ze="AMBIGUOS_AMPERSAND_STATE",$e="NUMERIC_CHARACTER_REFERENCE_STATE",et="HEXADEMICAL_CHARACTER_REFERENCE_START_STATE",tt="DECIMAL_CHARACTER_REFERENCE_START_STATE",nt="HEXADEMICAL_CHARACTER_REFERENCE_STATE",st="DECIMAL_CHARACTER_REFERENCE_STATE",rt="NUMERIC_CHARACTER_REFERENCE_END_STATE";function it(e){return e===P.SPACE||e===P.LINE_FEED||e===P.TABULATION||e===P.FORM_FEED}function ot(e){return e>=P.DIGIT_0&&e<=P.DIGIT_9}function at(e){return e>=P.LATIN_CAPITAL_A&&e<=P.LATIN_CAPITAL_Z}function Tt(e){return e>=P.LATIN_SMALL_A&&e<=P.LATIN_SMALL_Z}function Et(e){return Tt(e)||at(e)}function ht(e){return Et(e)||ot(e)}function ct(e){return e>=P.LATIN_CAPITAL_A&&e<=P.LATIN_CAPITAL_F}function _t(e){return e>=P.LATIN_SMALL_A&&e<=P.LATIN_SMALL_F}function lt(e){return e+32}function mt(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(e>>>10&1023|55296)+String.fromCharCode(56320|1023&e))}function pt(e){return String.fromCharCode(lt(e))}function At(e,t){const n=g[++e];let s=++e,r=s+n-1;for(;s<=r;){const e=s+r>>>1,i=g[e];if(i<t)s=e+1;else {if(!(i>t))return g[e+n];r=e-1;}}return -1}class ut{constructor(){this.preprocessor=new class{constructor(){this.html=null,this.pos=-1,this.lastGapPos=-1,this.lastCharPos=-1,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=65536;}_err(){}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos;}_processSurrogate(e){if(this.pos!==this.lastCharPos){const t=this.html.charCodeAt(this.pos+1);if(function(e){return e>=56320&&e<=57343}(t))return this.pos++,this._addGap(),1024*(e-55296)+9216+t}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,M.EOF;return this._err("surrogate-in-input-stream"),e}dropParsedChunk(){this.pos>this.bufferWaterline&&(this.lastCharPos-=this.pos,this.html=this.html.substring(this.pos),this.pos=0,this.lastGapPos=-1,this.gapStack=[]);}write(e,t){this.html?this.html+=e:this.html=e,this.lastCharPos=this.html.length-1,this.endOfChunkHit=!1,this.lastChunkWritten=t;}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1,this.html.length),this.lastCharPos=this.html.length-1,this.endOfChunkHit=!1;}advance(){if(this.pos++,this.pos>this.lastCharPos)return this.endOfChunkHit=!this.lastChunkWritten,M.EOF;let e=this.html.charCodeAt(this.pos);return this.skipNextNewLine&&e===M.LINE_FEED?(this.skipNextNewLine=!1,this._addGap(),this.advance()):e===M.CARRIAGE_RETURN?(this.skipNextNewLine=!0,M.LINE_FEED):(this.skipNextNewLine=!1,r(e)&&(e=this._processSurrogate(e)),e>31&&e<127||e===M.LINE_FEED||e===M.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){i(e)?this._err("control-character-in-input-stream"):o(e)&&this._err("noncharacter-in-input-stream");}retreat(){this.pos===this.lastGapPos&&(this.lastGapPos=this.gapStack.pop(),this.pos--),this.pos--;}},this.tokenQueue=[],this.allowCDATA=!1,this.state=F,this.returnState="",this.charRefCode=-1,this.tempBuff=[],this.lastStartTagName="",this.consumedAfterSnapshot=-1,this.active=!1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr=null;}_err(){}_errOnNextCodePoint(e){this._consume(),this._err(e),this._unconsume();}getNextToken(){for(;!this.tokenQueue.length&&this.active;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this[this.state](e);}return this.tokenQueue.shift()}write(e,t){this.active=!0,this.preprocessor.write(e,t);}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e);}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();return this.active=!1,this.tokenQueue.push({type:ut.HIBERNATION_TOKEN}),!0}return !1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--,this.preprocessor.retreat();}_reconsumeInState(e){this.state=e,this._unconsume();}_consumeSequenceIfMatch(e,t,n){let s=0,r=!0;const i=e.length;let o,a=0,T=t;for(;a<i;a++){if(a>0&&(T=this._consume(),s++),T===P.EOF){r=!1;break}if(o=e[a],T!==o&&(n||T!==lt(o))){r=!1;break}}if(!r)for(;s--;)this._unconsume();return r}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==H.SCRIPT_STRING.length)return !1;for(let e=0;e<this.tempBuff.length;e++)if(this.tempBuff[e]!==H.SCRIPT_STRING[e])return !1;return !0}_createStartTagToken(){this.currentToken={type:ut.START_TAG_TOKEN,tagName:"",selfClosing:!1,ackSelfClosing:!1,attrs:[]};}_createEndTagToken(){this.currentToken={type:ut.END_TAG_TOKEN,tagName:"",selfClosing:!1,attrs:[]};}_createCommentToken(){this.currentToken={type:ut.COMMENT_TOKEN,data:""};}_createDoctypeToken(e){this.currentToken={type:ut.DOCTYPE_TOKEN,name:e,forceQuirks:!1,publicId:null,systemId:null};}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t};}_createEOFToken(){this.currentToken={type:ut.EOF_TOKEN};}_createAttr(e){this.currentAttr={name:e,value:""};}_leaveAttrName(e){null===ut.getTokenAttr(this.currentToken,this.currentAttr.name)?this.currentToken.attrs.push(this.currentAttr):this._err("duplicate-attribute"),this.state=e;}_leaveAttrValue(e){this.state=e;}_emitCurrentToken(){this._emitCurrentCharacterToken();const e=this.currentToken;this.currentToken=null,e.type===ut.START_TAG_TOKEN?this.lastStartTagName=e.tagName:e.type===ut.END_TAG_TOKEN&&(e.attrs.length>0&&this._err("end-tag-with-attributes"),e.selfClosing&&this._err("end-tag-with-trailing-solidus")),this.tokenQueue.push(e);}_emitCurrentCharacterToken(){this.currentCharacterToken&&(this.tokenQueue.push(this.currentCharacterToken),this.currentCharacterToken=null);}_emitEOFToken(){this._createEOFToken(),this._emitCurrentToken();}_appendCharToCurrentCharacterToken(e,t){this.currentCharacterToken&&this.currentCharacterToken.type!==e&&this._emitCurrentCharacterToken(),this.currentCharacterToken?this.currentCharacterToken.chars+=t:this._createCharacterToken(e,t);}_emitCodePoint(e){let t=ut.CHARACTER_TOKEN;it(e)?t=ut.WHITESPACE_CHARACTER_TOKEN:e===P.NULL&&(t=ut.NULL_CHARACTER_TOKEN),this._appendCharToCurrentCharacterToken(t,mt(e));}_emitSeveralCodePoints(e){for(let t=0;t<e.length;t++)this._emitCodePoint(e[t]);}_emitChars(e){this._appendCharToCurrentCharacterToken(ut.CHARACTER_TOKEN,e);}_matchNamedCharacterReference(e){let t=null,n=1,s=At(0,e);for(this.tempBuff.push(e);s>-1;){const e=g[s],r=e<7;r&&1&e&&(t=2&e?[g[++s],g[++s]]:[g[++s]],n=0);const i=this._consume();if(this.tempBuff.push(i),n++,i===P.EOF)break;s=r?4&e?At(s,i):-1:i===e?++s:-1;}for(;n--;)this.tempBuff.pop(),this._unconsume();return t}_isCharacterReferenceInAttribute(){return this.returnState===me||this.returnState===pe||this.returnState===Ae}_isCharacterReferenceAttributeQuirk(e){if(!e&&this._isCharacterReferenceInAttribute()){const e=this._consume();return this._unconsume(),e===P.EQUALS_SIGN||ht(e)}return !1}_flushCodePointsConsumedAsCharacterReference(){if(this._isCharacterReferenceInAttribute())for(let e=0;e<this.tempBuff.length;e++)this.currentAttr.value+=mt(this.tempBuff[e]);else this._emitSeveralCodePoints(this.tempBuff);this.tempBuff=[];}[F](e){this.preprocessor.dropParsedChunk(),e===P.LESS_THAN_SIGN?this.state=b:e===P.AMPERSAND?(this.returnState=F,this.state=qe):e===P.NULL?(this._err(a),this._emitCodePoint(e)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[U](e){this.preprocessor.dropParsedChunk(),e===P.AMPERSAND?(this.returnState=U,this.state=qe):e===P.LESS_THAN_SIGN?this.state=v:e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[G](e){this.preprocessor.dropParsedChunk(),e===P.LESS_THAN_SIGN?this.state=Q:e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[B](e){this.preprocessor.dropParsedChunk(),e===P.LESS_THAN_SIGN?this.state=V:e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[K](e){this.preprocessor.dropParsedChunk(),e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?this._emitEOFToken():this._emitCodePoint(e);}[b](e){e===P.EXCLAMATION_MARK?this.state=Ce:e===P.SOLIDUS?this.state=x:Et(e)?(this._createStartTagToken(),this._reconsumeInState(y)):e===P.QUESTION_MARK?(this._err("unexpected-question-mark-instead-of-tag-name"),this._createCommentToken(),this._reconsumeInState(de)):e===P.EOF?(this._err(h),this._emitChars("<"),this._emitEOFToken()):(this._err(T),this._emitChars("<"),this._reconsumeInState(F));}[x](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(y)):e===P.GREATER_THAN_SIGN?(this._err("missing-end-tag-name"),this.state=F):e===P.EOF?(this._err(h),this._emitChars("</"),this._emitEOFToken()):(this._err(T),this._createCommentToken(),this._reconsumeInState(de));}[y](e){it(e)?this.state=he:e===P.SOLIDUS?this.state=Ne:e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):at(e)?this.currentToken.tagName+=pt(e):e===P.NULL?(this._err(a),this.currentToken.tagName+=n):e===P.EOF?(this._err(c),this._emitEOFToken()):this.currentToken.tagName+=mt(e);}[v](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=Y):(this._emitChars("<"),this._reconsumeInState(U));}[Y](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(w)):(this._emitChars("</"),this._reconsumeInState(U));}[w](e){if(at(e))this.currentToken.tagName+=pt(e),this.tempBuff.push(e);else if(Tt(e))this.currentToken.tagName+=mt(e),this.tempBuff.push(e);else {if(this.lastStartTagName===this.currentToken.tagName){if(it(e))return void(this.state=he);if(e===P.SOLIDUS)return void(this.state=Ne);if(e===P.GREATER_THAN_SIGN)return this.state=F,void this._emitCurrentToken()}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(U);}}[Q](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=X):(this._emitChars("<"),this._reconsumeInState(G));}[X](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(W)):(this._emitChars("</"),this._reconsumeInState(G));}[W](e){if(at(e))this.currentToken.tagName+=pt(e),this.tempBuff.push(e);else if(Tt(e))this.currentToken.tagName+=mt(e),this.tempBuff.push(e);else {if(this.lastStartTagName===this.currentToken.tagName){if(it(e))return void(this.state=he);if(e===P.SOLIDUS)return void(this.state=Ne);if(e===P.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=F)}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(G);}}[V](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=j):e===P.EXCLAMATION_MARK?(this.state=q,this._emitChars("<!")):(this._emitChars("<"),this._reconsumeInState(B));}[j](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(z)):(this._emitChars("</"),this._reconsumeInState(B));}[z](e){if(at(e))this.currentToken.tagName+=pt(e),this.tempBuff.push(e);else if(Tt(e))this.currentToken.tagName+=mt(e),this.tempBuff.push(e);else {if(this.lastStartTagName===this.currentToken.tagName){if(it(e))return void(this.state=he);if(e===P.SOLIDUS)return void(this.state=Ne);if(e===P.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=F)}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(B);}}[q](e){e===P.HYPHEN_MINUS?(this.state=J,this._emitChars("-")):this._reconsumeInState(B);}[J](e){e===P.HYPHEN_MINUS?(this.state=ee,this._emitChars("-")):this._reconsumeInState(B);}[Z](e){e===P.HYPHEN_MINUS?(this.state=$,this._emitChars("-")):e===P.LESS_THAN_SIGN?this.state=te:e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):this._emitCodePoint(e);}[$](e){e===P.HYPHEN_MINUS?(this.state=ee,this._emitChars("-")):e===P.LESS_THAN_SIGN?this.state=te:e===P.NULL?(this._err(a),this.state=Z,this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):(this.state=Z,this._emitCodePoint(e));}[ee](e){e===P.HYPHEN_MINUS?this._emitChars("-"):e===P.LESS_THAN_SIGN?this.state=te:e===P.GREATER_THAN_SIGN?(this.state=B,this._emitChars(">")):e===P.NULL?(this._err(a),this.state=Z,this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):(this.state=Z,this._emitCodePoint(e));}[te](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=ne):Et(e)?(this.tempBuff=[],this._emitChars("<"),this._reconsumeInState(re)):(this._emitChars("<"),this._reconsumeInState(Z));}[ne](e){Et(e)?(this._createEndTagToken(),this._reconsumeInState(se)):(this._emitChars("</"),this._reconsumeInState(Z));}[se](e){if(at(e))this.currentToken.tagName+=pt(e),this.tempBuff.push(e);else if(Tt(e))this.currentToken.tagName+=mt(e),this.tempBuff.push(e);else {if(this.lastStartTagName===this.currentToken.tagName){if(it(e))return void(this.state=he);if(e===P.SOLIDUS)return void(this.state=Ne);if(e===P.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=F)}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(Z);}}[re](e){it(e)||e===P.SOLIDUS||e===P.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?ie:Z,this._emitCodePoint(e)):at(e)?(this.tempBuff.push(lt(e)),this._emitCodePoint(e)):Tt(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState(Z);}[ie](e){e===P.HYPHEN_MINUS?(this.state=oe,this._emitChars("-")):e===P.LESS_THAN_SIGN?(this.state=Te,this._emitChars("<")):e===P.NULL?(this._err(a),this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):this._emitCodePoint(e);}[oe](e){e===P.HYPHEN_MINUS?(this.state=ae,this._emitChars("-")):e===P.LESS_THAN_SIGN?(this.state=Te,this._emitChars("<")):e===P.NULL?(this._err(a),this.state=ie,this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):(this.state=ie,this._emitCodePoint(e));}[ae](e){e===P.HYPHEN_MINUS?this._emitChars("-"):e===P.LESS_THAN_SIGN?(this.state=Te,this._emitChars("<")):e===P.GREATER_THAN_SIGN?(this.state=B,this._emitChars(">")):e===P.NULL?(this._err(a),this.state=ie,this._emitChars(n)):e===P.EOF?(this._err(O),this._emitEOFToken()):(this.state=ie,this._emitCodePoint(e));}[Te](e){e===P.SOLIDUS?(this.tempBuff=[],this.state=Ee,this._emitChars("/")):this._reconsumeInState(ie);}[Ee](e){it(e)||e===P.SOLIDUS||e===P.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?Z:ie,this._emitCodePoint(e)):at(e)?(this.tempBuff.push(lt(e)),this._emitCodePoint(e)):Tt(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState(ie);}[he](e){it(e)||(e===P.SOLIDUS||e===P.GREATER_THAN_SIGN||e===P.EOF?this._reconsumeInState(_e):e===P.EQUALS_SIGN?(this._err("unexpected-equals-sign-before-attribute-name"),this._createAttr("="),this.state=ce):(this._createAttr(""),this._reconsumeInState(ce)));}[ce](e){it(e)||e===P.SOLIDUS||e===P.GREATER_THAN_SIGN||e===P.EOF?(this._leaveAttrName(_e),this._unconsume()):e===P.EQUALS_SIGN?this._leaveAttrName(le):at(e)?this.currentAttr.name+=pt(e):e===P.QUOTATION_MARK||e===P.APOSTROPHE||e===P.LESS_THAN_SIGN?(this._err("unexpected-character-in-attribute-name"),this.currentAttr.name+=mt(e)):e===P.NULL?(this._err(a),this.currentAttr.name+=n):this.currentAttr.name+=mt(e);}[_e](e){it(e)||(e===P.SOLIDUS?this.state=Ne:e===P.EQUALS_SIGN?this.state=le:e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(c),this._emitEOFToken()):(this._createAttr(""),this._reconsumeInState(ce)));}[le](e){it(e)||(e===P.QUOTATION_MARK?this.state=me:e===P.APOSTROPHE?this.state=pe:e===P.GREATER_THAN_SIGN?(this._err("missing-attribute-value"),this.state=F,this._emitCurrentToken()):this._reconsumeInState(Ae));}[me](e){e===P.QUOTATION_MARK?this.state=ue:e===P.AMPERSAND?(this.returnState=me,this.state=qe):e===P.NULL?(this._err(a),this.currentAttr.value+=n):e===P.EOF?(this._err(c),this._emitEOFToken()):this.currentAttr.value+=mt(e);}[pe](e){e===P.APOSTROPHE?this.state=ue:e===P.AMPERSAND?(this.returnState=pe,this.state=qe):e===P.NULL?(this._err(a),this.currentAttr.value+=n):e===P.EOF?(this._err(c),this._emitEOFToken()):this.currentAttr.value+=mt(e);}[Ae](e){it(e)?this._leaveAttrValue(he):e===P.AMPERSAND?(this.returnState=Ae,this.state=qe):e===P.GREATER_THAN_SIGN?(this._leaveAttrValue(F),this._emitCurrentToken()):e===P.NULL?(this._err(a),this.currentAttr.value+=n):e===P.QUOTATION_MARK||e===P.APOSTROPHE||e===P.LESS_THAN_SIGN||e===P.EQUALS_SIGN||e===P.GRAVE_ACCENT?(this._err("unexpected-character-in-unquoted-attribute-value"),this.currentAttr.value+=mt(e)):e===P.EOF?(this._err(c),this._emitEOFToken()):this.currentAttr.value+=mt(e);}[ue](e){it(e)?this._leaveAttrValue(he):e===P.SOLIDUS?this._leaveAttrValue(Ne):e===P.GREATER_THAN_SIGN?(this._leaveAttrValue(F),this._emitCurrentToken()):e===P.EOF?(this._err(c),this._emitEOFToken()):(this._err("missing-whitespace-between-attributes"),this._reconsumeInState(he));}[Ne](e){e===P.GREATER_THAN_SIGN?(this.currentToken.selfClosing=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(c),this._emitEOFToken()):(this._err("unexpected-solidus-in-tag"),this._reconsumeInState(he));}[de](e){e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.EOF?(this._emitCurrentToken(),this._emitEOFToken()):e===P.NULL?(this._err(a),this.currentToken.data+=n):this.currentToken.data+=mt(e);}[Ce](e){this._consumeSequenceIfMatch(H.DASH_DASH_STRING,e,!0)?(this._createCommentToken(),this.state=Oe):this._consumeSequenceIfMatch(H.DOCTYPE_STRING,e,!1)?this.state=He:this._consumeSequenceIfMatch(H.CDATA_START_STRING,e,!0)?this.allowCDATA?this.state=Ve:(this._err("cdata-in-html-content"),this._createCommentToken(),this.currentToken.data="[CDATA[",this.state=de):this._ensureHibernation()||(this._err("incorrectly-opened-comment"),this._createCommentToken(),this._reconsumeInState(de));}[Oe](e){e===P.HYPHEN_MINUS?this.state=fe:e===P.GREATER_THAN_SIGN?(this._err(S),this.state=F,this._emitCurrentToken()):this._reconsumeInState(Se);}[fe](e){e===P.HYPHEN_MINUS?this.state=ge:e===P.GREATER_THAN_SIGN?(this._err(S),this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(Se));}[Se](e){e===P.HYPHEN_MINUS?this.state=Me:e===P.LESS_THAN_SIGN?(this.currentToken.data+="<",this.state=Re):e===P.NULL?(this._err(a),this.currentToken.data+=n):e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.data+=mt(e);}[Re](e){e===P.EXCLAMATION_MARK?(this.currentToken.data+="!",this.state=Ie):e===P.LESS_THAN_SIGN?this.currentToken.data+="!":this._reconsumeInState(Se);}[Ie](e){e===P.HYPHEN_MINUS?this.state=Le:this._reconsumeInState(Se);}[Le](e){e===P.HYPHEN_MINUS?this.state=ke:this._reconsumeInState(Me);}[ke](e){e!==P.GREATER_THAN_SIGN&&e!==P.EOF&&this._err("nested-comment"),this._reconsumeInState(ge);}[Me](e){e===P.HYPHEN_MINUS?this.state=ge:e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(Se));}[ge](e){e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.EXCLAMATION_MARK?this.state=Pe:e===P.HYPHEN_MINUS?this.currentToken.data+="-":e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--",this._reconsumeInState(Se));}[Pe](e){e===P.HYPHEN_MINUS?(this.currentToken.data+="--!",this.state=Me):e===P.GREATER_THAN_SIGN?(this._err("incorrectly-closed-comment"),this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(R),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--!",this._reconsumeInState(Se));}[He](e){it(e)?this.state=De:e===P.GREATER_THAN_SIGN?this._reconsumeInState(De):e===P.EOF?(this._err(f),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err("missing-whitespace-before-doctype-name"),this._reconsumeInState(De));}[De](e){it(e)||(at(e)?(this._createDoctypeToken(pt(e)),this.state=Fe):e===P.NULL?(this._err(a),this._createDoctypeToken(n),this.state=Fe):e===P.GREATER_THAN_SIGN?(this._err("missing-doctype-name"),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._createDoctypeToken(mt(e)),this.state=Fe));}[Fe](e){it(e)?this.state=Ue:e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):at(e)?this.currentToken.name+=pt(e):e===P.NULL?(this._err(a),this.currentToken.name+=n):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.name+=mt(e);}[Ue](e){it(e)||(e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this._consumeSequenceIfMatch(H.PUBLIC_STRING,e,!1)?this.state=Ge:this._consumeSequenceIfMatch(H.SYSTEM_STRING,e,!1)?this.state=ve:this._ensureHibernation()||(this._err("invalid-character-sequence-after-doctype-name"),this.currentToken.forceQuirks=!0,this._reconsumeInState(We)));}[Ge](e){it(e)?this.state=Be:e===P.QUOTATION_MARK?(this._err(_),this.currentToken.publicId="",this.state=Ke):e===P.APOSTROPHE?(this._err(_),this.currentToken.publicId="",this.state=be):e===P.GREATER_THAN_SIGN?(this._err(u),this.currentToken.forceQuirks=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(p),this.currentToken.forceQuirks=!0,this._reconsumeInState(We));}[Be](e){it(e)||(e===P.QUOTATION_MARK?(this.currentToken.publicId="",this.state=Ke):e===P.APOSTROPHE?(this.currentToken.publicId="",this.state=be):e===P.GREATER_THAN_SIGN?(this._err(u),this.currentToken.forceQuirks=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(p),this.currentToken.forceQuirks=!0,this._reconsumeInState(We)));}[Ke](e){e===P.QUOTATION_MARK?this.state=xe:e===P.NULL?(this._err(a),this.currentToken.publicId+=n):e===P.GREATER_THAN_SIGN?(this._err(d),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=mt(e);}[be](e){e===P.APOSTROPHE?this.state=xe:e===P.NULL?(this._err(a),this.currentToken.publicId+=n):e===P.GREATER_THAN_SIGN?(this._err(d),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=mt(e);}[xe](e){it(e)?this.state=ye:e===P.GREATER_THAN_SIGN?(this.state=F,this._emitCurrentToken()):e===P.QUOTATION_MARK?(this._err(l),this.currentToken.systemId="",this.state=we):e===P.APOSTROPHE?(this._err(l),this.currentToken.systemId="",this.state=Qe):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(A),this.currentToken.forceQuirks=!0,this._reconsumeInState(We));}[ye](e){it(e)||(e===P.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=F):e===P.QUOTATION_MARK?(this.currentToken.systemId="",this.state=we):e===P.APOSTROPHE?(this.currentToken.systemId="",this.state=Qe):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(A),this.currentToken.forceQuirks=!0,this._reconsumeInState(We)));}[ve](e){it(e)?this.state=Ye:e===P.QUOTATION_MARK?(this._err(m),this.currentToken.systemId="",this.state=we):e===P.APOSTROPHE?(this._err(m),this.currentToken.systemId="",this.state=Qe):e===P.GREATER_THAN_SIGN?(this._err(N),this.currentToken.forceQuirks=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(A),this.currentToken.forceQuirks=!0,this._reconsumeInState(We));}[Ye](e){it(e)||(e===P.QUOTATION_MARK?(this.currentToken.systemId="",this.state=we):e===P.APOSTROPHE?(this.currentToken.systemId="",this.state=Qe):e===P.GREATER_THAN_SIGN?(this._err(N),this.currentToken.forceQuirks=!0,this.state=F,this._emitCurrentToken()):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(A),this.currentToken.forceQuirks=!0,this._reconsumeInState(We)));}[we](e){e===P.QUOTATION_MARK?this.state=Xe:e===P.NULL?(this._err(a),this.currentToken.systemId+=n):e===P.GREATER_THAN_SIGN?(this._err(C),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=mt(e);}[Qe](e){e===P.APOSTROPHE?this.state=Xe:e===P.NULL?(this._err(a),this.currentToken.systemId+=n):e===P.GREATER_THAN_SIGN?(this._err(C),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=mt(e);}[Xe](e){it(e)||(e===P.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=F):e===P.EOF?(this._err(f),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err("unexpected-character-after-doctype-system-identifier"),this._reconsumeInState(We)));}[We](e){e===P.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=F):e===P.NULL?this._err(a):e===P.EOF&&(this._emitCurrentToken(),this._emitEOFToken());}[Ve](e){e===P.RIGHT_SQUARE_BRACKET?this.state=je:e===P.EOF?(this._err("eof-in-cdata"),this._emitEOFToken()):this._emitCodePoint(e);}[je](e){e===P.RIGHT_SQUARE_BRACKET?this.state=ze:(this._emitChars("]"),this._reconsumeInState(Ve));}[ze](e){e===P.GREATER_THAN_SIGN?this.state=F:e===P.RIGHT_SQUARE_BRACKET?this._emitChars("]"):(this._emitChars("]]"),this._reconsumeInState(Ve));}[qe](e){this.tempBuff=[P.AMPERSAND],e===P.NUMBER_SIGN?(this.tempBuff.push(e),this.state=$e):ht(e)?this._reconsumeInState(Je):(this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState));}[Je](e){const t=this._matchNamedCharacterReference(e);if(this._ensureHibernation())this.tempBuff=[P.AMPERSAND];else if(t){const e=this.tempBuff[this.tempBuff.length-1]===P.SEMICOLON;this._isCharacterReferenceAttributeQuirk(e)||(e||this._errOnNextCodePoint(E),this.tempBuff=t),this._flushCodePointsConsumedAsCharacterReference(),this.state=this.returnState;}else this._flushCodePointsConsumedAsCharacterReference(),this.state=Ze;}[Ze](e){ht(e)?this._isCharacterReferenceInAttribute()?this.currentAttr.value+=mt(e):this._emitCodePoint(e):(e===P.SEMICOLON&&this._err("unknown-named-character-reference"),this._reconsumeInState(this.returnState));}[$e](e){this.charRefCode=0,e===P.LATIN_SMALL_X||e===P.LATIN_CAPITAL_X?(this.tempBuff.push(e),this.state=et):this._reconsumeInState(tt);}[et](e){!function(e){return ot(e)||ct(e)||_t(e)}(e)?(this._err(I),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)):this._reconsumeInState(nt);}[tt](e){ot(e)?this._reconsumeInState(st):(this._err(I),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState));}[nt](e){ct(e)?this.charRefCode=16*this.charRefCode+e-55:_t(e)?this.charRefCode=16*this.charRefCode+e-87:ot(e)?this.charRefCode=16*this.charRefCode+e-48:e===P.SEMICOLON?this.state=rt:(this._err(E),this._reconsumeInState(rt));}[st](e){ot(e)?this.charRefCode=10*this.charRefCode+e-48:e===P.SEMICOLON?this.state=rt:(this._err(E),this._reconsumeInState(rt));}[rt](){if(this.charRefCode===P.NULL)this._err("null-character-reference"),this.charRefCode=P.REPLACEMENT_CHARACTER;else if(this.charRefCode>1114111)this._err("character-reference-outside-unicode-range"),this.charRefCode=P.REPLACEMENT_CHARACTER;else if(r(this.charRefCode))this._err("surrogate-character-reference"),this.charRefCode=P.REPLACEMENT_CHARACTER;else if(o(this.charRefCode))this._err("noncharacter-character-reference");else if(i(this.charRefCode)||this.charRefCode===P.CARRIAGE_RETURN){this._err("control-character-reference");const e=D[this.charRefCode];e&&(this.charRefCode=e);}this.tempBuff=[this.charRefCode],this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState);}}ut.CHARACTER_TOKEN="CHARACTER_TOKEN",ut.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN",ut.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN",ut.START_TAG_TOKEN="START_TAG_TOKEN",ut.END_TAG_TOKEN="END_TAG_TOKEN",ut.COMMENT_TOKEN="COMMENT_TOKEN",ut.DOCTYPE_TOKEN="DOCTYPE_TOKEN",ut.EOF_TOKEN="EOF_TOKEN",ut.HIBERNATION_TOKEN="HIBERNATION_TOKEN",ut.MODE={DATA:F,RCDATA:U,RAWTEXT:G,SCRIPT_DATA:B,PLAINTEXT:K},ut.getTokenAttr=function(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null};var Nt=ut;function dt(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var Ct=dt((function(e,t){const n=t.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};t.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"},t.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};const s=t.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};t.SPECIAL_ELEMENTS={[n.HTML]:{[s.ADDRESS]:!0,[s.APPLET]:!0,[s.AREA]:!0,[s.ARTICLE]:!0,[s.ASIDE]:!0,[s.BASE]:!0,[s.BASEFONT]:!0,[s.BGSOUND]:!0,[s.BLOCKQUOTE]:!0,[s.BODY]:!0,[s.BR]:!0,[s.BUTTON]:!0,[s.CAPTION]:!0,[s.CENTER]:!0,[s.COL]:!0,[s.COLGROUP]:!0,[s.DD]:!0,[s.DETAILS]:!0,[s.DIR]:!0,[s.DIV]:!0,[s.DL]:!0,[s.DT]:!0,[s.EMBED]:!0,[s.FIELDSET]:!0,[s.FIGCAPTION]:!0,[s.FIGURE]:!0,[s.FOOTER]:!0,[s.FORM]:!0,[s.FRAME]:!0,[s.FRAMESET]:!0,[s.H1]:!0,[s.H2]:!0,[s.H3]:!0,[s.H4]:!0,[s.H5]:!0,[s.H6]:!0,[s.HEAD]:!0,[s.HEADER]:!0,[s.HGROUP]:!0,[s.HR]:!0,[s.HTML]:!0,[s.IFRAME]:!0,[s.IMG]:!0,[s.INPUT]:!0,[s.LI]:!0,[s.LINK]:!0,[s.LISTING]:!0,[s.MAIN]:!0,[s.MARQUEE]:!0,[s.MENU]:!0,[s.META]:!0,[s.NAV]:!0,[s.NOEMBED]:!0,[s.NOFRAMES]:!0,[s.NOSCRIPT]:!0,[s.OBJECT]:!0,[s.OL]:!0,[s.P]:!0,[s.PARAM]:!0,[s.PLAINTEXT]:!0,[s.PRE]:!0,[s.SCRIPT]:!0,[s.SECTION]:!0,[s.SELECT]:!0,[s.SOURCE]:!0,[s.STYLE]:!0,[s.SUMMARY]:!0,[s.TABLE]:!0,[s.TBODY]:!0,[s.TD]:!0,[s.TEMPLATE]:!0,[s.TEXTAREA]:!0,[s.TFOOT]:!0,[s.TH]:!0,[s.THEAD]:!0,[s.TITLE]:!0,[s.TR]:!0,[s.TRACK]:!0,[s.UL]:!0,[s.WBR]:!0,[s.XMP]:!0},[n.MATHML]:{[s.MI]:!0,[s.MO]:!0,[s.MN]:!0,[s.MS]:!0,[s.MTEXT]:!0,[s.ANNOTATION_XML]:!0},[n.SVG]:{[s.TITLE]:!0,[s.FOREIGN_OBJECT]:!0,[s.DESC]:!0}};}));const Ot=Ct.TAG_NAMES,ft=Ct.NAMESPACES;function St(e){switch(e.length){case 1:return e===Ot.P;case 2:return e===Ot.RB||e===Ot.RP||e===Ot.RT||e===Ot.DD||e===Ot.DT||e===Ot.LI;case 3:return e===Ot.RTC;case 6:return e===Ot.OPTION;case 8:return e===Ot.OPTGROUP}return !1}function Rt(e){switch(e.length){case 1:return e===Ot.P;case 2:return e===Ot.RB||e===Ot.RP||e===Ot.RT||e===Ot.DD||e===Ot.DT||e===Ot.LI||e===Ot.TD||e===Ot.TH||e===Ot.TR;case 3:return e===Ot.RTC;case 5:return e===Ot.TBODY||e===Ot.TFOOT||e===Ot.THEAD;case 6:return e===Ot.OPTION;case 7:return e===Ot.CAPTION;case 8:return e===Ot.OPTGROUP||e===Ot.COLGROUP}return !1}function It(e,t){switch(e.length){case 2:if(e===Ot.TD||e===Ot.TH)return t===ft.HTML;if(e===Ot.MI||e===Ot.MO||e===Ot.MN||e===Ot.MS)return t===ft.MATHML;break;case 4:if(e===Ot.HTML)return t===ft.HTML;if(e===Ot.DESC)return t===ft.SVG;break;case 5:if(e===Ot.TABLE)return t===ft.HTML;if(e===Ot.MTEXT)return t===ft.MATHML;if(e===Ot.TITLE)return t===ft.SVG;break;case 6:return (e===Ot.APPLET||e===Ot.OBJECT)&&t===ft.HTML;case 7:return (e===Ot.CAPTION||e===Ot.MARQUEE)&&t===ft.HTML;case 8:return e===Ot.TEMPLATE&&t===ft.HTML;case 13:return e===Ot.FOREIGN_OBJECT&&t===ft.SVG;case 14:return e===Ot.ANNOTATION_XML&&t===ft.MATHML}return !1}class Lt{constructor(e){this.length=0,this.entries=[],this.treeAdapter=e,this.bookmark=null;}_getNoahArkConditionCandidates(e){const t=[];if(this.length>=3){const n=this.treeAdapter.getAttrList(e).length,s=this.treeAdapter.getTagName(e),r=this.treeAdapter.getNamespaceURI(e);for(let e=this.length-1;e>=0;e--){const i=this.entries[e];if(i.type===Lt.MARKER_ENTRY)break;const o=i.element,a=this.treeAdapter.getAttrList(o);this.treeAdapter.getTagName(o)===s&&this.treeAdapter.getNamespaceURI(o)===r&&a.length===n&&t.push({idx:e,attrs:a});}}return t.length<3?[]:t}_ensureNoahArkCondition(e){const t=this._getNoahArkConditionCandidates(e);let n=t.length;if(n){const s=this.treeAdapter.getAttrList(e),r=s.length,i=Object.create(null);for(let e=0;e<r;e++){const t=s[e];i[t.name]=t.value;}for(let e=0;e<r;e++)for(let s=0;s<n;s++){const r=t[s].attrs[e];if(i[r.name]!==r.value&&(t.splice(s,1),n--),t.length<3)return}for(let e=n-1;e>=2;e--)this.entries.splice(t[e].idx,1),this.length--;}}insertMarker(){this.entries.push({type:Lt.MARKER_ENTRY}),this.length++;}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.push({type:Lt.ELEMENT_ENTRY,element:e,token:t}),this.length++;}insertElementAfterBookmark(e,t){let n=this.length-1;for(;n>=0&&this.entries[n]!==this.bookmark;n--);this.entries.splice(n+1,0,{type:Lt.ELEMENT_ENTRY,element:e,token:t}),this.length++;}removeEntry(e){for(let t=this.length-1;t>=0;t--)if(this.entries[t]===e){this.entries.splice(t,1),this.length--;break}}clearToLastMarker(){for(;this.length;){const e=this.entries.pop();if(this.length--,e.type===Lt.MARKER_ENTRY)break}}getElementEntryInScopeWithTagName(e){for(let t=this.length-1;t>=0;t--){const n=this.entries[t];if(n.type===Lt.MARKER_ENTRY)return null;if(this.treeAdapter.getTagName(n.element)===e)return n}return null}getElementEntry(e){for(let t=this.length-1;t>=0;t--){const n=this.entries[t];if(n.type===Lt.ELEMENT_ENTRY&&n.element===e)return n}return null}}Lt.MARKER_ENTRY="MARKER_ENTRY",Lt.ELEMENT_ENTRY="ELEMENT_ENTRY";var kt=Lt;class Mt{constructor(e){const t={},n=this._getOverriddenMethods(this,t);for(const s of Object.keys(n))"function"==typeof n[s]&&(t[s]=e[s],e[s]=n[s]);}_getOverriddenMethods(){throw new Error("Not implemented")}}Mt.install=function(e,t,n){e.__mixins||(e.__mixins=[]);for(let n=0;n<e.__mixins.length;n++)if(e.__mixins[n].constructor===t)return e.__mixins[n];const s=new t(e,n);return e.__mixins.push(s),s};var gt=Mt,Pt=class extends gt{constructor(e){super(e),this.preprocessor=e,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.offset=0,this.col=0,this.line=1;}_getOverriddenMethods(e,t){return {advance(){const n=this.pos+1,s=this.html[n];return e.isEol&&(e.isEol=!1,e.line++,e.lineStartPos=n),("\n"===s||"\r"===s&&"\n"!==this.html[n+1])&&(e.isEol=!0),e.col=n-e.lineStartPos+1,e.offset=e.droppedBufferSize+n,t.advance.call(this)},retreat(){t.retreat.call(this),e.isEol=!1,e.col=this.pos-e.lineStartPos+1;},dropParsedChunk(){const n=this.pos;t.dropParsedChunk.call(this);const s=n-this.pos;e.lineStartPos-=s,e.droppedBufferSize+=s,e.offset=e.droppedBufferSize+this.pos;}}}},Ht=class extends gt{constructor(e){super(e),this.tokenizer=e,this.posTracker=gt.install(e.preprocessor,Pt),this.currentAttrLocation=null,this.ctLoc=null;}_getCurrentLocation(){return {startLine:this.posTracker.line,startCol:this.posTracker.col,startOffset:this.posTracker.offset,endLine:-1,endCol:-1,endOffset:-1}}_attachCurrentAttrLocationInfo(){this.currentAttrLocation.endLine=this.posTracker.line,this.currentAttrLocation.endCol=this.posTracker.col,this.currentAttrLocation.endOffset=this.posTracker.offset;const e=this.tokenizer.currentToken,t=this.tokenizer.currentAttr;e.location.attrs||(e.location.attrs=Object.create(null)),e.location.attrs[t.name]=this.currentAttrLocation;}_getOverriddenMethods(e,t){const n={_createStartTagToken(){t._createStartTagToken.call(this),this.currentToken.location=e.ctLoc;},_createEndTagToken(){t._createEndTagToken.call(this),this.currentToken.location=e.ctLoc;},_createCommentToken(){t._createCommentToken.call(this),this.currentToken.location=e.ctLoc;},_createDoctypeToken(n){t._createDoctypeToken.call(this,n),this.currentToken.location=e.ctLoc;},_createCharacterToken(n,s){t._createCharacterToken.call(this,n,s),this.currentCharacterToken.location=e.ctLoc;},_createEOFToken(){t._createEOFToken.call(this),this.currentToken.location=e._getCurrentLocation();},_createAttr(n){t._createAttr.call(this,n),e.currentAttrLocation=e._getCurrentLocation();},_leaveAttrName(n){t._leaveAttrName.call(this,n),e._attachCurrentAttrLocationInfo();},_leaveAttrValue(n){t._leaveAttrValue.call(this,n),e._attachCurrentAttrLocationInfo();},_emitCurrentToken(){const n=this.currentToken.location;this.currentCharacterToken&&(this.currentCharacterToken.location.endLine=n.startLine,this.currentCharacterToken.location.endCol=n.startCol,this.currentCharacterToken.location.endOffset=n.startOffset),this.currentToken.type===Nt.EOF_TOKEN?(n.endLine=n.startLine,n.endCol=n.startCol,n.endOffset=n.startOffset):(n.endLine=e.posTracker.line,n.endCol=e.posTracker.col+1,n.endOffset=e.posTracker.offset+1),t._emitCurrentToken.call(this);},_emitCurrentCharacterToken(){const n=this.currentCharacterToken&&this.currentCharacterToken.location;n&&-1===n.endOffset&&(n.endLine=e.posTracker.line,n.endCol=e.posTracker.col,n.endOffset=e.posTracker.offset),t._emitCurrentCharacterToken.call(this);}};return Object.keys(Nt.MODE).forEach((s=>{const r=Nt.MODE[s];n[r]=function(n){e.ctLoc=e._getCurrentLocation(),t[r].call(this,n);};})),n}},Dt=class extends gt{constructor(e,t){super(e),this.onItemPop=t.onItemPop;}_getOverriddenMethods(e,t){return {pop(){e.onItemPop(this.current),t.pop.call(this);},popAllUpToHtmlElement(){for(let t=this.stackTop;t>0;t--)e.onItemPop(this.items[t]);t.popAllUpToHtmlElement.call(this);},remove(n){e.onItemPop(this.current),t.remove.call(this,n);}}}};const Ft=Ct.TAG_NAMES;var Ut=class extends gt{constructor(e){super(e),this.parser=e,this.treeAdapter=this.parser.treeAdapter,this.posTracker=null,this.lastStartTagToken=null,this.lastFosterParentingLocation=null,this.currentToken=null;}_setStartLocation(e){let t=null;this.lastStartTagToken&&(t=Object.assign({},this.lastStartTagToken.location),t.startTag=this.lastStartTagToken.location),this.treeAdapter.setNodeSourceCodeLocation(e,t);}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){const n=t.location,s=this.treeAdapter.getTagName(e),r={};t.type===Nt.END_TAG_TOKEN&&s===t.tagName?(r.endTag=Object.assign({},n),r.endLine=n.endLine,r.endCol=n.endCol,r.endOffset=n.endOffset):(r.endLine=n.startLine,r.endCol=n.startCol,r.endOffset=n.startOffset),this.treeAdapter.updateNodeSourceCodeLocation(e,r);}}_getOverriddenMethods(e,t){return {_bootstrap(n,s){t._bootstrap.call(this,n,s),e.lastStartTagToken=null,e.lastFosterParentingLocation=null,e.currentToken=null;const r=gt.install(this.tokenizer,Ht);e.posTracker=r.posTracker,gt.install(this.openElements,Dt,{onItemPop:function(t){e._setEndLocation(t,e.currentToken);}});},_runParsingLoop(n){t._runParsingLoop.call(this,n);for(let t=this.openElements.stackTop;t>=0;t--)e._setEndLocation(this.openElements.items[t],e.currentToken);},_processTokenInForeignContent(n){e.currentToken=n,t._processTokenInForeignContent.call(this,n);},_processToken(n){if(e.currentToken=n,t._processToken.call(this,n),n.type===Nt.END_TAG_TOKEN&&(n.tagName===Ft.HTML||n.tagName===Ft.BODY&&this.openElements.hasInScope(Ft.BODY)))for(let t=this.openElements.stackTop;t>=0;t--){const s=this.openElements.items[t];if(this.treeAdapter.getTagName(s)===n.tagName){e._setEndLocation(s,n);break}}},_setDocumentType(e){t._setDocumentType.call(this,e);const n=this.treeAdapter.getChildNodes(this.document),s=n.length;for(let t=0;t<s;t++){const s=n[t];if(this.treeAdapter.isDocumentTypeNode(s)){this.treeAdapter.setNodeSourceCodeLocation(s,e.location);break}}},_attachElementToTree(n){e._setStartLocation(n),e.lastStartTagToken=null,t._attachElementToTree.call(this,n);},_appendElement(n,s){e.lastStartTagToken=n,t._appendElement.call(this,n,s);},_insertElement(n,s){e.lastStartTagToken=n,t._insertElement.call(this,n,s);},_insertTemplate(n){e.lastStartTagToken=n,t._insertTemplate.call(this,n);const s=this.treeAdapter.getTemplateContent(this.openElements.current);this.treeAdapter.setNodeSourceCodeLocation(s,null);},_insertFakeRootElement(){t._insertFakeRootElement.call(this),this.treeAdapter.setNodeSourceCodeLocation(this.openElements.current,null);},_appendCommentNode(e,n){t._appendCommentNode.call(this,e,n);const s=this.treeAdapter.getChildNodes(n),r=s[s.length-1];this.treeAdapter.setNodeSourceCodeLocation(r,e.location);},_findFosterParentingLocation(){return e.lastFosterParentingLocation=t._findFosterParentingLocation.call(this),e.lastFosterParentingLocation},_insertCharacters(n){t._insertCharacters.call(this,n);const s=this._shouldFosterParentOnInsertion(),r=s&&e.lastFosterParentingLocation.parent||this.openElements.currentTmplContent||this.openElements.current,i=this.treeAdapter.getChildNodes(r),o=s&&e.lastFosterParentingLocation.beforeElement?i.indexOf(e.lastFosterParentingLocation.beforeElement)-1:i.length-1,a=i[o];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:e,endCol:t,endOffset:s}=n.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:e,endCol:t,endOffset:s});}else this.treeAdapter.setNodeSourceCodeLocation(a,n.location);}}}},Gt=class extends gt{constructor(e,t){super(e),this.posTracker=null,this.onParseError=t.onParseError;}_setErrorLocation(e){e.startLine=e.endLine=this.posTracker.line,e.startCol=e.endCol=this.posTracker.col,e.startOffset=e.endOffset=this.posTracker.offset;}_reportError(e){const t={code:e,startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1};this._setErrorLocation(t),this.onParseError(t);}_getOverriddenMethods(e){return {_err(t){e._reportError(t);}}}},Bt=class extends Gt{constructor(e,t){super(e,t),this.posTracker=gt.install(e,Pt),this.lastErrOffset=-1;}_reportError(e){this.lastErrOffset!==this.posTracker.offset&&(this.lastErrOffset=this.posTracker.offset,super._reportError(e));}},Kt=class extends Gt{constructor(e,t){super(e,t);const n=gt.install(e.preprocessor,Bt,t);this.posTracker=n.posTracker;}},bt=class extends Gt{constructor(e,t){super(e,t),this.opts=t,this.ctLoc=null,this.locBeforeToken=!1;}_setErrorLocation(e){this.ctLoc&&(e.startLine=this.ctLoc.startLine,e.startCol=this.ctLoc.startCol,e.startOffset=this.ctLoc.startOffset,e.endLine=this.locBeforeToken?this.ctLoc.startLine:this.ctLoc.endLine,e.endCol=this.locBeforeToken?this.ctLoc.startCol:this.ctLoc.endCol,e.endOffset=this.locBeforeToken?this.ctLoc.startOffset:this.ctLoc.endOffset);}_getOverriddenMethods(e,t){return {_bootstrap(n,s){t._bootstrap.call(this,n,s),gt.install(this.tokenizer,Kt,e.opts),gt.install(this.tokenizer,Ht);},_processInputToken(n){e.ctLoc=n.location,t._processInputToken.call(this,n);},_err(t,n){e.locBeforeToken=n&&n.beforeToken,e._reportError(t);}}}},xt=dt((function(e,t){const{DOCUMENT_MODE:n}=Ct;t.createDocument=function(){return {nodeName:"#document",mode:n.NO_QUIRKS,childNodes:[]}},t.createDocumentFragment=function(){return {nodeName:"#document-fragment",childNodes:[]}},t.createElement=function(e,t,n){return {nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},t.createCommentNode=function(e){return {nodeName:"#comment",data:e,parentNode:null}};const s=function(e){return {nodeName:"#text",value:e,parentNode:null}},r=t.appendChild=function(e,t){e.childNodes.push(t),t.parentNode=e;},i=t.insertBefore=function(e,t,n){const s=e.childNodes.indexOf(n);e.childNodes.splice(s,0,t),t.parentNode=e;};t.setTemplateContent=function(e,t){e.content=t;},t.getTemplateContent=function(e){return e.content},t.setDocumentType=function(e,t,n,s){let i=null;for(let t=0;t<e.childNodes.length;t++)if("#documentType"===e.childNodes[t].nodeName){i=e.childNodes[t];break}i?(i.name=t,i.publicId=n,i.systemId=s):r(e,{nodeName:"#documentType",name:t,publicId:n,systemId:s});},t.setDocumentMode=function(e,t){e.mode=t;},t.getDocumentMode=function(e){return e.mode},t.detachNode=function(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null;}},t.insertText=function(e,t){if(e.childNodes.length){const n=e.childNodes[e.childNodes.length-1];if("#text"===n.nodeName)return void(n.value+=t)}r(e,s(t));},t.insertTextBefore=function(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&"#text"===r.nodeName?r.value+=t:i(e,s(t),n);},t.adoptAttributes=function(e,t){const n=[];for(let t=0;t<e.attrs.length;t++)n.push(e.attrs[t].name);for(let s=0;s<t.length;s++)-1===n.indexOf(t[s].name)&&e.attrs.push(t[s]);},t.getFirstChild=function(e){return e.childNodes[0]},t.getChildNodes=function(e){return e.childNodes},t.getParentNode=function(e){return e.parentNode},t.getAttrList=function(e){return e.attrs},t.getTagName=function(e){return e.tagName},t.getNamespaceURI=function(e){return e.namespaceURI},t.getTextNodeContent=function(e){return e.value},t.getCommentNodeContent=function(e){return e.data},t.getDocumentTypeNodeName=function(e){return e.name},t.getDocumentTypeNodePublicId=function(e){return e.publicId},t.getDocumentTypeNodeSystemId=function(e){return e.systemId},t.isTextNode=function(e){return "#text"===e.nodeName},t.isCommentNode=function(e){return "#comment"===e.nodeName},t.isDocumentTypeNode=function(e){return "#documentType"===e.nodeName},t.isElementNode=function(e){return !!e.tagName},t.setNodeSourceCodeLocation=function(e,t){e.sourceCodeLocation=t;},t.getNodeSourceCodeLocation=function(e){return e.sourceCodeLocation},t.updateNodeSourceCodeLocation=function(e,t){e.sourceCodeLocation=Object.assign(e.sourceCodeLocation,t);};}));const{DOCUMENT_MODE:yt}=Ct,vt="html",Yt=["+//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//"],wt=Yt.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]),Qt=["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"],Xt=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],Wt=Xt.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);function Vt(e,t){for(let n=0;n<t.length;n++)if(0===e.indexOf(t[n]))return !0;return !1}var jt=dt((function(e,t){const n=Ct.TAG_NAMES,s=Ct.NAMESPACES,r=Ct.ATTRS,i={attributename:"attributeName",attributetype:"attributeType",basefrequency:"baseFrequency",baseprofile:"baseProfile",calcmode:"calcMode",clippathunits:"clipPathUnits",diffuseconstant:"diffuseConstant",edgemode:"edgeMode",filterunits:"filterUnits",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",limitingconeangle:"limitingConeAngle",markerheight:"markerHeight",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textlength:"textLength",viewbox:"viewBox",viewtarget:"viewTarget",xchannelselector:"xChannelSelector",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan"},o={"xlink:actuate":{prefix:"xlink",name:"actuate",namespace:s.XLINK},"xlink:arcrole":{prefix:"xlink",name:"arcrole",namespace:s.XLINK},"xlink:href":{prefix:"xlink",name:"href",namespace:s.XLINK},"xlink:role":{prefix:"xlink",name:"role",namespace:s.XLINK},"xlink:show":{prefix:"xlink",name:"show",namespace:s.XLINK},"xlink:title":{prefix:"xlink",name:"title",namespace:s.XLINK},"xlink:type":{prefix:"xlink",name:"type",namespace:s.XLINK},"xml:base":{prefix:"xml",name:"base",namespace:s.XML},"xml:lang":{prefix:"xml",name:"lang",namespace:s.XML},"xml:space":{prefix:"xml",name:"space",namespace:s.XML},xmlns:{prefix:"",name:"xmlns",namespace:s.XMLNS},"xmlns:xlink":{prefix:"xmlns",name:"xlink",namespace:s.XMLNS}},a=t.SVG_TAG_NAMES_ADJUSTMENT_MAP={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath"},T={[n.B]:!0,[n.BIG]:!0,[n.BLOCKQUOTE]:!0,[n.BODY]:!0,[n.BR]:!0,[n.CENTER]:!0,[n.CODE]:!0,[n.DD]:!0,[n.DIV]:!0,[n.DL]:!0,[n.DT]:!0,[n.EM]:!0,[n.EMBED]:!0,[n.H1]:!0,[n.H2]:!0,[n.H3]:!0,[n.H4]:!0,[n.H5]:!0,[n.H6]:!0,[n.HEAD]:!0,[n.HR]:!0,[n.I]:!0,[n.IMG]:!0,[n.LI]:!0,[n.LISTING]:!0,[n.MENU]:!0,[n.META]:!0,[n.NOBR]:!0,[n.OL]:!0,[n.P]:!0,[n.PRE]:!0,[n.RUBY]:!0,[n.S]:!0,[n.SMALL]:!0,[n.SPAN]:!0,[n.STRONG]:!0,[n.STRIKE]:!0,[n.SUB]:!0,[n.SUP]:!0,[n.TABLE]:!0,[n.TT]:!0,[n.U]:!0,[n.UL]:!0,[n.VAR]:!0};t.causesExit=function(e){const t=e.tagName;return !(t!==n.FONT||null===Nt.getTokenAttr(e,r.COLOR)&&null===Nt.getTokenAttr(e,r.SIZE)&&null===Nt.getTokenAttr(e,r.FACE))||T[t]},t.adjustTokenMathMLAttrs=function(e){for(let t=0;t<e.attrs.length;t++)if("definitionurl"===e.attrs[t].name){e.attrs[t].name="definitionURL";break}},t.adjustTokenSVGAttrs=function(e){for(let t=0;t<e.attrs.length;t++){const n=i[e.attrs[t].name];n&&(e.attrs[t].name=n);}},t.adjustTokenXMLAttrs=function(e){for(let t=0;t<e.attrs.length;t++){const n=o[e.attrs[t].name];n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace);}},t.adjustTokenSVGTagName=function(e){const t=a[e.tagName];t&&(e.tagName=t);},t.isIntegrationPoint=function(e,t,i,o){return !(o&&o!==s.HTML||!function(e,t,i){if(t===s.MATHML&&e===n.ANNOTATION_XML)for(let e=0;e<i.length;e++)if(i[e].name===r.ENCODING){const t=i[e].value.toLowerCase();return "text/html"===t||"application/xhtml+xml"===t}return t===s.SVG&&(e===n.FOREIGN_OBJECT||e===n.DESC||e===n.TITLE)}(e,t,i))||!(o&&o!==s.MATHML||!function(e,t){return t===s.MATHML&&(e===n.MI||e===n.MO||e===n.MN||e===n.MS||e===n.MTEXT)}(e,t))};}));const zt=Ct.TAG_NAMES,qt=Ct.NAMESPACES,Jt=Ct.ATTRS,Zt={scriptingEnabled:!0,sourceCodeLocationInfo:!1,onParseError:null,treeAdapter:xt},$t="hidden",en="INITIAL_MODE",tn="BEFORE_HTML_MODE",nn="BEFORE_HEAD_MODE",sn="IN_HEAD_MODE",rn="IN_HEAD_NO_SCRIPT_MODE",on="AFTER_HEAD_MODE",an="IN_BODY_MODE",Tn="TEXT_MODE",En="IN_TABLE_MODE",hn="IN_TABLE_TEXT_MODE",cn="IN_CAPTION_MODE",_n="IN_COLUMN_GROUP_MODE",ln="IN_TABLE_BODY_MODE",mn="IN_ROW_MODE",pn="IN_CELL_MODE",An="IN_SELECT_MODE",un="IN_SELECT_IN_TABLE_MODE",Nn="IN_TEMPLATE_MODE",dn="AFTER_BODY_MODE",Cn="IN_FRAMESET_MODE",On="AFTER_FRAMESET_MODE",fn="AFTER_AFTER_BODY_MODE",Sn="AFTER_AFTER_FRAMESET_MODE",Rn={[zt.TR]:mn,[zt.TBODY]:ln,[zt.THEAD]:ln,[zt.TFOOT]:ln,[zt.CAPTION]:cn,[zt.COLGROUP]:_n,[zt.TABLE]:En,[zt.BODY]:an,[zt.FRAMESET]:Cn},In={[zt.CAPTION]:En,[zt.COLGROUP]:En,[zt.TBODY]:En,[zt.TFOOT]:En,[zt.THEAD]:En,[zt.COL]:_n,[zt.TR]:ln,[zt.TD]:mn,[zt.TH]:mn},Ln={[en]:{[Nt.CHARACTER_TOKEN]:vn,[Nt.NULL_CHARACTER_TOKEN]:vn,[Nt.WHITESPACE_CHARACTER_TOKEN]:Gn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:function(e,t){e._setDocumentType(t);const n=t.forceQuirks?Ct.DOCUMENT_MODE.QUIRKS:function(e){if(e.name!==vt)return yt.QUIRKS;const t=e.systemId;if(t&&"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"===t.toLowerCase())return yt.QUIRKS;let n=e.publicId;if(null!==n){if(n=n.toLowerCase(),Qt.indexOf(n)>-1)return yt.QUIRKS;let e=null===t?wt:Yt;if(Vt(n,e))return yt.QUIRKS;if(e=null===t?Xt:Wt,Vt(n,e))return yt.LIMITED_QUIRKS}return yt.NO_QUIRKS}(t);(function(e){return e.name===vt&&null===e.publicId&&(null===e.systemId||"about:legacy-compat"===e.systemId)})(t)||e._err("non-conforming-doctype"),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=tn;},[Nt.START_TAG_TOKEN]:vn,[Nt.END_TAG_TOKEN]:vn,[Nt.EOF_TOKEN]:vn},[tn]:{[Nt.CHARACTER_TOKEN]:Yn,[Nt.NULL_CHARACTER_TOKEN]:Yn,[Nt.WHITESPACE_CHARACTER_TOKEN]:Gn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML?(e._insertElement(t,qt.HTML),e.insertionMode=nn):Yn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n!==zt.HTML&&n!==zt.HEAD&&n!==zt.BODY&&n!==zt.BR||Yn(e,t);},[Nt.EOF_TOKEN]:Yn},[nn]:{[Nt.CHARACTER_TOKEN]:wn,[Nt.NULL_CHARACTER_TOKEN]:wn,[Nt.WHITESPACE_CHARACTER_TOKEN]:Gn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Bn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.HEAD?(e._insertElement(t,qt.HTML),e.headElement=e.openElements.current,e.insertionMode=sn):wn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HEAD||n===zt.BODY||n===zt.HTML||n===zt.BR?wn(e,t):e._err(L);},[Nt.EOF_TOKEN]:wn},[sn]:{[Nt.CHARACTER_TOKEN]:Wn,[Nt.NULL_CHARACTER_TOKEN]:Wn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Bn,[Nt.START_TAG_TOKEN]:Qn,[Nt.END_TAG_TOKEN]:Xn,[Nt.EOF_TOKEN]:Wn},[rn]:{[Nt.CHARACTER_TOKEN]:Vn,[Nt.NULL_CHARACTER_TOKEN]:Vn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Bn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.BASEFONT||n===zt.BGSOUND||n===zt.HEAD||n===zt.LINK||n===zt.META||n===zt.NOFRAMES||n===zt.STYLE?Qn(e,t):n===zt.NOSCRIPT?e._err("nested-noscript-in-head"):Vn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.NOSCRIPT?(e.openElements.pop(),e.insertionMode=sn):n===zt.BR?Vn(e,t):e._err(L);},[Nt.EOF_TOKEN]:Vn},[on]:{[Nt.CHARACTER_TOKEN]:jn,[Nt.NULL_CHARACTER_TOKEN]:jn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Bn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.BODY?(e._insertElement(t,qt.HTML),e.framesetOk=!1,e.insertionMode=an):n===zt.FRAMESET?(e._insertElement(t,qt.HTML),e.insertionMode=Cn):n===zt.BASE||n===zt.BASEFONT||n===zt.BGSOUND||n===zt.LINK||n===zt.META||n===zt.NOFRAMES||n===zt.SCRIPT||n===zt.STYLE||n===zt.TEMPLATE||n===zt.TITLE?(e._err("abandoned-head-element-child"),e.openElements.push(e.headElement),Qn(e,t),e.openElements.remove(e.headElement)):n===zt.HEAD?e._err(k):jn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.BODY||n===zt.HTML||n===zt.BR?jn(e,t):n===zt.TEMPLATE?Xn(e,t):e._err(L);},[Nt.EOF_TOKEN]:jn},[an]:{[Nt.CHARACTER_TOKEN]:qn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:as,[Nt.END_TAG_TOKEN]:cs,[Nt.EOF_TOKEN]:_s},[Tn]:{[Nt.CHARACTER_TOKEN]:xn,[Nt.NULL_CHARACTER_TOKEN]:xn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Gn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:Gn,[Nt.END_TAG_TOKEN]:function(e,t){t.tagName===zt.SCRIPT&&(e.pendingScript=e.openElements.current),e.openElements.pop(),e.insertionMode=e.originalInsertionMode;},[Nt.EOF_TOKEN]:function(e,t){e._err("eof-in-element-that-can-contain-only-text"),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e._processToken(t);}},[En]:{[Nt.CHARACTER_TOKEN]:ls,[Nt.NULL_CHARACTER_TOKEN]:ls,[Nt.WHITESPACE_CHARACTER_TOKEN]:ls,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:ms,[Nt.END_TAG_TOKEN]:ps,[Nt.EOF_TOKEN]:_s},[hn]:{[Nt.CHARACTER_TOKEN]:function(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0;},[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:function(e,t){e.pendingCharacterTokens.push(t);},[Nt.COMMENT_TOKEN]:us,[Nt.DOCTYPE_TOKEN]:us,[Nt.START_TAG_TOKEN]:us,[Nt.END_TAG_TOKEN]:us,[Nt.EOF_TOKEN]:us},[cn]:{[Nt.CHARACTER_TOKEN]:qn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.COL||n===zt.COLGROUP||n===zt.TBODY||n===zt.TD||n===zt.TFOOT||n===zt.TH||n===zt.THEAD||n===zt.TR?e.openElements.hasInTableScope(zt.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(zt.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=En,e._processToken(t)):as(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.TABLE?e.openElements.hasInTableScope(zt.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(zt.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=En,n===zt.TABLE&&e._processToken(t)):n!==zt.BODY&&n!==zt.COL&&n!==zt.COLGROUP&&n!==zt.HTML&&n!==zt.TBODY&&n!==zt.TD&&n!==zt.TFOOT&&n!==zt.TH&&n!==zt.THEAD&&n!==zt.TR&&cs(e,t);},[Nt.EOF_TOKEN]:_s},[_n]:{[Nt.CHARACTER_TOKEN]:Ns,[Nt.NULL_CHARACTER_TOKEN]:Ns,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.COL?(e._appendElement(t,qt.HTML),t.ackSelfClosing=!0):n===zt.TEMPLATE?Qn(e,t):Ns(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.COLGROUP?e.openElements.currentTagName===zt.COLGROUP&&(e.openElements.pop(),e.insertionMode=En):n===zt.TEMPLATE?Xn(e,t):n!==zt.COL&&Ns(e,t);},[Nt.EOF_TOKEN]:_s},[ln]:{[Nt.CHARACTER_TOKEN]:ls,[Nt.NULL_CHARACTER_TOKEN]:ls,[Nt.WHITESPACE_CHARACTER_TOKEN]:ls,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TR?(e.openElements.clearBackToTableBodyContext(),e._insertElement(t,qt.HTML),e.insertionMode=mn):n===zt.TH||n===zt.TD?(e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(zt.TR),e.insertionMode=mn,e._processToken(t)):n===zt.CAPTION||n===zt.COL||n===zt.COLGROUP||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD?e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=En,e._processToken(t)):ms(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD?e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=En):n===zt.TABLE?e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=En,e._processToken(t)):(n!==zt.BODY&&n!==zt.CAPTION&&n!==zt.COL&&n!==zt.COLGROUP||n!==zt.HTML&&n!==zt.TD&&n!==zt.TH&&n!==zt.TR)&&ps(e,t);},[Nt.EOF_TOKEN]:_s},[mn]:{[Nt.CHARACTER_TOKEN]:ls,[Nt.NULL_CHARACTER_TOKEN]:ls,[Nt.WHITESPACE_CHARACTER_TOKEN]:ls,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TH||n===zt.TD?(e.openElements.clearBackToTableRowContext(),e._insertElement(t,qt.HTML),e.insertionMode=pn,e.activeFormattingElements.insertMarker()):n===zt.CAPTION||n===zt.COL||n===zt.COLGROUP||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR?e.openElements.hasInTableScope(zt.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ln,e._processToken(t)):ms(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TR?e.openElements.hasInTableScope(zt.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ln):n===zt.TABLE?e.openElements.hasInTableScope(zt.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ln,e._processToken(t)):n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD?(e.openElements.hasInTableScope(n)||e.openElements.hasInTableScope(zt.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ln,e._processToken(t)):(n!==zt.BODY&&n!==zt.CAPTION&&n!==zt.COL&&n!==zt.COLGROUP||n!==zt.HTML&&n!==zt.TD&&n!==zt.TH)&&ps(e,t);},[Nt.EOF_TOKEN]:_s},[pn]:{[Nt.CHARACTER_TOKEN]:qn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.COL||n===zt.COLGROUP||n===zt.TBODY||n===zt.TD||n===zt.TFOOT||n===zt.TH||n===zt.THEAD||n===zt.TR?(e.openElements.hasInTableScope(zt.TD)||e.openElements.hasInTableScope(zt.TH))&&(e._closeTableCell(),e._processToken(t)):as(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.TD||n===zt.TH?e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=mn):n===zt.TABLE||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR?e.openElements.hasInTableScope(n)&&(e._closeTableCell(),e._processToken(t)):n!==zt.BODY&&n!==zt.CAPTION&&n!==zt.COL&&n!==zt.COLGROUP&&n!==zt.HTML&&cs(e,t);},[Nt.EOF_TOKEN]:_s},[An]:{[Nt.CHARACTER_TOKEN]:xn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:ds,[Nt.END_TAG_TOKEN]:Cs,[Nt.EOF_TOKEN]:_s},[un]:{[Nt.CHARACTER_TOKEN]:xn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.TABLE||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR||n===zt.TD||n===zt.TH?(e.openElements.popUntilTagNamePopped(zt.SELECT),e._resetInsertionMode(),e._processToken(t)):ds(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.CAPTION||n===zt.TABLE||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR||n===zt.TD||n===zt.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(zt.SELECT),e._resetInsertionMode(),e._processToken(t)):Cs(e,t);},[Nt.EOF_TOKEN]:_s},[Nn]:{[Nt.CHARACTER_TOKEN]:qn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;if(n===zt.BASE||n===zt.BASEFONT||n===zt.BGSOUND||n===zt.LINK||n===zt.META||n===zt.NOFRAMES||n===zt.SCRIPT||n===zt.STYLE||n===zt.TEMPLATE||n===zt.TITLE)Qn(e,t);else {const s=In[n]||an;e._popTmplInsertionMode(),e._pushTmplInsertionMode(s),e.insertionMode=s,e._processToken(t);}},[Nt.END_TAG_TOKEN]:function(e,t){t.tagName===zt.TEMPLATE&&Xn(e,t);},[Nt.EOF_TOKEN]:Os},[dn]:{[Nt.CHARACTER_TOKEN]:fs,[Nt.NULL_CHARACTER_TOKEN]:fs,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:function(e,t){e._appendCommentNode(t,e.openElements.items[0]);},[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML?as(e,t):fs(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML?e.fragmentContext||(e.insertionMode=fn):fs(e,t);},[Nt.EOF_TOKEN]:yn},[Cn]:{[Nt.CHARACTER_TOKEN]:Gn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.FRAMESET?e._insertElement(t,qt.HTML):n===zt.FRAME?(e._appendElement(t,qt.HTML),t.ackSelfClosing=!0):n===zt.NOFRAMES&&Qn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){t.tagName!==zt.FRAMESET||e.openElements.isRootHtmlElementCurrent()||(e.openElements.pop(),e.fragmentContext||e.openElements.currentTagName===zt.FRAMESET||(e.insertionMode=On));},[Nt.EOF_TOKEN]:yn},[On]:{[Nt.CHARACTER_TOKEN]:Gn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:xn,[Nt.COMMENT_TOKEN]:Kn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.NOFRAMES&&Qn(e,t);},[Nt.END_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML&&(e.insertionMode=Sn);},[Nt.EOF_TOKEN]:yn},[fn]:{[Nt.CHARACTER_TOKEN]:Ss,[Nt.NULL_CHARACTER_TOKEN]:Ss,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:bn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){t.tagName===zt.HTML?as(e,t):Ss(e,t);},[Nt.END_TAG_TOKEN]:Ss,[Nt.EOF_TOKEN]:yn},[Sn]:{[Nt.CHARACTER_TOKEN]:Gn,[Nt.NULL_CHARACTER_TOKEN]:Gn,[Nt.WHITESPACE_CHARACTER_TOKEN]:zn,[Nt.COMMENT_TOKEN]:bn,[Nt.DOCTYPE_TOKEN]:Gn,[Nt.START_TAG_TOKEN]:function(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.NOFRAMES&&Qn(e,t);},[Nt.END_TAG_TOKEN]:Gn,[Nt.EOF_TOKEN]:yn}};var kn=class{constructor(e){this.options=function(e,t){return [e,t=t||Object.create(null)].reduce(((e,t)=>(Object.keys(t).forEach((n=>{e[n]=t[n];})),e)),Object.create(null))}(Zt,e),this.treeAdapter=this.options.treeAdapter,this.pendingScript=null,this.options.sourceCodeLocationInfo&&gt.install(this,Ut),this.options.onParseError&&gt.install(this,bt,{onParseError:this.options.onParseError});}parse(e){const t=this.treeAdapter.createDocument();return this._bootstrap(t,null),this.tokenizer.write(e,!0),this._runParsingLoop(null),t}parseFragment(e,t){t||(t=this.treeAdapter.createElement(zt.TEMPLATE,qt.HTML,[]));const n=this.treeAdapter.createElement("documentmock",qt.HTML,[]);this._bootstrap(n,t),this.treeAdapter.getTagName(t)===zt.TEMPLATE&&this._pushTmplInsertionMode(Nn),this._initTokenizerForFragmentParsing(),this._insertFakeRootElement(),this._resetInsertionMode(),this._findFormInFragmentContext(),this.tokenizer.write(e,!0),this._runParsingLoop(null);const s=this.treeAdapter.getFirstChild(n),r=this.treeAdapter.createDocumentFragment();return this._adoptNodes(s,r),r}_bootstrap(e,t){this.tokenizer=new Nt(this.options),this.stopped=!1,this.insertionMode=en,this.originalInsertionMode="",this.document=e,this.fragmentContext=t,this.headElement=null,this.formElement=null,this.openElements=new class{constructor(e,t){this.stackTop=-1,this.items=[],this.current=e,this.currentTagName=null,this.currentTmplContent=null,this.tmplCount=0,this.treeAdapter=t;}_indexOf(e){let t=-1;for(let n=this.stackTop;n>=0;n--)if(this.items[n]===e){t=n;break}return t}_isInTemplate(){return this.currentTagName===Ot.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===ft.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagName=this.current&&this.treeAdapter.getTagName(this.current),this.currentTmplContent=this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):null;}push(e){this.items[++this.stackTop]=e,this._updateCurrentElement(),this._isInTemplate()&&this.tmplCount++;}pop(){this.stackTop--,this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this._updateCurrentElement();}replace(e,t){const n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&this._updateCurrentElement();}insertAfter(e,t){const n=this._indexOf(e)+1;this.items.splice(n,0,t),n===++this.stackTop&&this._updateCurrentElement();}popUntilTagNamePopped(e){for(;this.stackTop>-1;){const t=this.currentTagName,n=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),t===e&&n===ft.HTML)break}}popUntilElementPopped(e){for(;this.stackTop>-1;){const t=this.current;if(this.pop(),t===e)break}}popUntilNumberedHeaderPopped(){for(;this.stackTop>-1;){const e=this.currentTagName,t=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),e===Ot.H1||e===Ot.H2||e===Ot.H3||e===Ot.H4||e===Ot.H5||e===Ot.H6&&t===ft.HTML)break}}popUntilTableCellPopped(){for(;this.stackTop>-1;){const e=this.currentTagName,t=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),e===Ot.TD||e===Ot.TH&&t===ft.HTML)break}}popAllUpToHtmlElement(){this.stackTop=0,this._updateCurrentElement();}clearBackToTableContext(){for(;this.currentTagName!==Ot.TABLE&&this.currentTagName!==Ot.TEMPLATE&&this.currentTagName!==Ot.HTML||this.treeAdapter.getNamespaceURI(this.current)!==ft.HTML;)this.pop();}clearBackToTableBodyContext(){for(;this.currentTagName!==Ot.TBODY&&this.currentTagName!==Ot.TFOOT&&this.currentTagName!==Ot.THEAD&&this.currentTagName!==Ot.TEMPLATE&&this.currentTagName!==Ot.HTML||this.treeAdapter.getNamespaceURI(this.current)!==ft.HTML;)this.pop();}clearBackToTableRowContext(){for(;this.currentTagName!==Ot.TR&&this.currentTagName!==Ot.TEMPLATE&&this.currentTagName!==Ot.HTML||this.treeAdapter.getNamespaceURI(this.current)!==ft.HTML;)this.pop();}remove(e){for(let t=this.stackTop;t>=0;t--)if(this.items[t]===e){this.items.splice(t,1),this.stackTop--,this._updateCurrentElement();break}}tryPeekProperlyNestedBodyElement(){const e=this.items[1];return e&&this.treeAdapter.getTagName(e)===Ot.BODY?e:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e);return --t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return 0===this.stackTop&&this.currentTagName===Ot.HTML}hasInScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(n===e&&s===ft.HTML)return !0;if(It(n,s))return !1}return !0}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const t=this.treeAdapter.getTagName(this.items[e]),n=this.treeAdapter.getNamespaceURI(this.items[e]);if((t===Ot.H1||t===Ot.H2||t===Ot.H3||t===Ot.H4||t===Ot.H5||t===Ot.H6)&&n===ft.HTML)return !0;if(It(t,n))return !1}return !0}hasInListItemScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(n===e&&s===ft.HTML)return !0;if((n===Ot.UL||n===Ot.OL)&&s===ft.HTML||It(n,s))return !1}return !0}hasInButtonScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(n===e&&s===ft.HTML)return !0;if(n===Ot.BUTTON&&s===ft.HTML||It(n,s))return !1}return !0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]);if(this.treeAdapter.getNamespaceURI(this.items[t])===ft.HTML){if(n===e)return !0;if(n===Ot.TABLE||n===Ot.TEMPLATE||n===Ot.HTML)return !1}}return !0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--){const t=this.treeAdapter.getTagName(this.items[e]);if(this.treeAdapter.getNamespaceURI(this.items[e])===ft.HTML){if(t===Ot.TBODY||t===Ot.THEAD||t===Ot.TFOOT)return !0;if(t===Ot.TABLE||t===Ot.HTML)return !1}}return !0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--){const n=this.treeAdapter.getTagName(this.items[t]);if(this.treeAdapter.getNamespaceURI(this.items[t])===ft.HTML){if(n===e)return !0;if(n!==Ot.OPTION&&n!==Ot.OPTGROUP)return !1}}return !0}generateImpliedEndTags(){for(;St(this.currentTagName);)this.pop();}generateImpliedEndTagsThoroughly(){for(;Rt(this.currentTagName);)this.pop();}generateImpliedEndTagsWithExclusion(e){for(;St(this.currentTagName)&&this.currentTagName!==e;)this.pop();}}(this.document,this.treeAdapter),this.activeFormattingElements=new kt(this.treeAdapter),this.tmplInsertionModeStack=[],this.tmplInsertionModeStackTop=-1,this.currentTmplInsertionMode=null,this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1;}_err(){}_runParsingLoop(e){for(;!this.stopped;){this._setupTokenizerCDATAMode();const t=this.tokenizer.getNextToken();if(t.type===Nt.HIBERNATION_TOKEN)break;if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.type===Nt.WHITESPACE_CHARACTER_TOKEN&&"\n"===t.chars[0])){if(1===t.chars.length)continue;t.chars=t.chars.substr(1);}if(this._processInputToken(t),e&&this.pendingScript)break}}runParsingLoopForCurrentChunk(e,t){if(this._runParsingLoop(t),t&&this.pendingScript){const e=this.pendingScript;return this.pendingScript=null,void t(e)}e&&e();}_setupTokenizerCDATAMode(){const e=this._getAdjustedCurrentElement();this.tokenizer.allowCDATA=e&&e!==this.document&&this.treeAdapter.getNamespaceURI(e)!==qt.HTML&&!this._isIntegrationPoint(e);}_switchToTextParsing(e,t){this._insertElement(e,qt.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Tn;}switchToPlaintextParsing(){this.insertionMode=Tn,this.originalInsertionMode=an,this.tokenizer.state=Nt.MODE.PLAINTEXT;}_getAdjustedCurrentElement(){return 0===this.openElements.stackTop&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;do{if(this.treeAdapter.getTagName(e)===zt.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e);}while(e)}_initTokenizerForFragmentParsing(){if(this.treeAdapter.getNamespaceURI(this.fragmentContext)===qt.HTML){const e=this.treeAdapter.getTagName(this.fragmentContext);e===zt.TITLE||e===zt.TEXTAREA?this.tokenizer.state=Nt.MODE.RCDATA:e===zt.STYLE||e===zt.XMP||e===zt.IFRAME||e===zt.NOEMBED||e===zt.NOFRAMES||e===zt.NOSCRIPT?this.tokenizer.state=Nt.MODE.RAWTEXT:e===zt.SCRIPT?this.tokenizer.state=Nt.MODE.SCRIPT_DATA:e===zt.PLAINTEXT&&(this.tokenizer.state=Nt.MODE.PLAINTEXT);}}_setDocumentType(e){const t=e.name||"",n=e.publicId||"",s=e.systemId||"";this.treeAdapter.setDocumentType(this.document,t,n,s);}_attachElementToTree(e){if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else {const t=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.appendChild(t,e);}}_appendElement(e,t){const n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n);}_insertElement(e,t){const n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n),this.openElements.push(n);}_insertFakeElement(e){const t=this.treeAdapter.createElement(e,qt.HTML,[]);this._attachElementToTree(t),this.openElements.push(t);}_insertTemplate(e){const t=this.treeAdapter.createElement(e.tagName,qt.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t),this.openElements.push(t);}_insertFakeRootElement(){const e=this.treeAdapter.createElement(zt.HTML,qt.HTML,[]);this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e);}_appendCommentNode(e,t){const n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n);}_insertCharacters(e){if(this._shouldFosterParentOnInsertion())this._fosterParentText(e.chars);else {const t=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.insertText(t,e.chars);}}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n);}_shouldProcessTokenInForeignContent(e){const t=this._getAdjustedCurrentElement();if(!t||t===this.document)return !1;const n=this.treeAdapter.getNamespaceURI(t);if(n===qt.HTML)return !1;if(this.treeAdapter.getTagName(t)===zt.ANNOTATION_XML&&n===qt.MATHML&&e.type===Nt.START_TAG_TOKEN&&e.tagName===zt.SVG)return !1;const s=e.type===Nt.CHARACTER_TOKEN||e.type===Nt.NULL_CHARACTER_TOKEN||e.type===Nt.WHITESPACE_CHARACTER_TOKEN;return !((e.type===Nt.START_TAG_TOKEN&&e.tagName!==zt.MGLYPH&&e.tagName!==zt.MALIGNMARK||s)&&this._isIntegrationPoint(t,qt.MATHML)||(e.type===Nt.START_TAG_TOKEN||s)&&this._isIntegrationPoint(t,qt.HTML)||e.type===Nt.EOF_TOKEN)}_processToken(e){Ln[this.insertionMode][e.type](this,e);}_processTokenInBodyMode(e){Ln.IN_BODY_MODE[e.type](this,e);}_processTokenInForeignContent(e){e.type===Nt.CHARACTER_TOKEN?function(e,t){e._insertCharacters(t),e.framesetOk=!1;}(this,e):e.type===Nt.NULL_CHARACTER_TOKEN?function(e,t){t.chars=n,e._insertCharacters(t);}(this,e):e.type===Nt.WHITESPACE_CHARACTER_TOKEN?xn(this,e):e.type===Nt.COMMENT_TOKEN?Kn(this,e):e.type===Nt.START_TAG_TOKEN?function(e,t){if(jt.causesExit(t)&&!e.fragmentContext){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==qt.HTML&&!e._isIntegrationPoint(e.openElements.current);)e.openElements.pop();e._processToken(t);}else {const n=e._getAdjustedCurrentElement(),s=e.treeAdapter.getNamespaceURI(n);s===qt.MATHML?jt.adjustTokenMathMLAttrs(t):s===qt.SVG&&(jt.adjustTokenSVGTagName(t),jt.adjustTokenSVGAttrs(t)),jt.adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,s):e._insertElement(t,s),t.ackSelfClosing=!0;}}(this,e):e.type===Nt.END_TAG_TOKEN&&function(e,t){for(let n=e.openElements.stackTop;n>0;n--){const s=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(s)===qt.HTML){e._processToken(t);break}if(e.treeAdapter.getTagName(s).toLowerCase()===t.tagName){e.openElements.popUntilElementPopped(s);break}}}(this,e);}_processInputToken(e){this._shouldProcessTokenInForeignContent(e)?this._processTokenInForeignContent(e):this._processToken(e),e.type===Nt.START_TAG_TOKEN&&e.selfClosing&&!e.ackSelfClosing&&this._err("non-void-html-element-start-tag-with-trailing-solidus");}_isIntegrationPoint(e,t){const n=this.treeAdapter.getTagName(e),s=this.treeAdapter.getNamespaceURI(e),r=this.treeAdapter.getAttrList(e);return jt.isIntegrationPoint(n,s,r,t)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.length;if(e){let t=e,n=null;do{if(t--,n=this.activeFormattingElements.entries[t],n.type===kt.MARKER_ENTRY||this.openElements.contains(n.element)){t++;break}}while(t>0);for(let s=t;s<e;s++)n=this.activeFormattingElements.entries[s],this._insertElement(n.token,this.treeAdapter.getNamespaceURI(n.element)),n.element=this.openElements.current;}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=mn;}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(zt.P),this.openElements.popUntilTagNamePopped(zt.P);}_resetInsertionMode(){for(let e=this.openElements.stackTop,t=!1;e>=0;e--){let n=this.openElements.items[e];0===e&&(t=!0,this.fragmentContext&&(n=this.fragmentContext));const s=this.treeAdapter.getTagName(n),r=Rn[s];if(r){this.insertionMode=r;break}if(!(t||s!==zt.TD&&s!==zt.TH)){this.insertionMode=pn;break}if(!t&&s===zt.HEAD){this.insertionMode=sn;break}if(s===zt.SELECT){this._resetInsertionModeForSelect(e);break}if(s===zt.TEMPLATE){this.insertionMode=this.currentTmplInsertionMode;break}if(s===zt.HTML){this.insertionMode=this.headElement?on:nn;break}if(t){this.insertionMode=an;break}}}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){const e=this.openElements.items[t],n=this.treeAdapter.getTagName(e);if(n===zt.TEMPLATE)break;if(n===zt.TABLE)return void(this.insertionMode=un)}this.insertionMode=An;}_pushTmplInsertionMode(e){this.tmplInsertionModeStack.push(e),this.tmplInsertionModeStackTop++,this.currentTmplInsertionMode=e;}_popTmplInsertionMode(){this.tmplInsertionModeStack.pop(),this.tmplInsertionModeStackTop--,this.currentTmplInsertionMode=this.tmplInsertionModeStack[this.tmplInsertionModeStackTop];}_isElementCausesFosterParenting(e){const t=this.treeAdapter.getTagName(e);return t===zt.TABLE||t===zt.TBODY||t===zt.TFOOT||t===zt.THEAD||t===zt.TR}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.current)}_findFosterParentingLocation(){const e={parent:null,beforeElement:null};for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t],s=this.treeAdapter.getTagName(n),r=this.treeAdapter.getNamespaceURI(n);if(s===zt.TEMPLATE&&r===qt.HTML){e.parent=this.treeAdapter.getTemplateContent(n);break}if(s===zt.TABLE){e.parent=this.treeAdapter.getParentNode(n),e.parent?e.beforeElement=n:e.parent=this.openElements.items[t-1];break}}return e.parent||(e.parent=this.openElements.items[0]),e}_fosterParentElement(e){const t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e);}_fosterParentText(e){const t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertTextBefore(t.parent,e,t.beforeElement):this.treeAdapter.insertText(t.parent,e);}_isSpecialElement(e){const t=this.treeAdapter.getTagName(e),n=this.treeAdapter.getNamespaceURI(e);return Ct.SPECIAL_ELEMENTS[n][t]}};function Mn(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagName)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):hs(e,t),n}function gn(e,t){let n=null;for(let s=e.openElements.stackTop;s>=0;s--){const r=e.openElements.items[s];if(r===t.element)break;e._isSpecialElement(r)&&(n=r);}return n||(e.openElements.popUntilElementPopped(t.element),e.activeFormattingElements.removeEntry(t)),n}function Pn(e,t,n){let s=t,r=e.openElements.getCommonAncestor(t);for(let i=0,o=r;o!==n;i++,o=r){r=e.openElements.getCommonAncestor(o);const n=e.activeFormattingElements.getElementEntry(o),a=n&&i>=3;!n||a?(a&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=Hn(e,n),s===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(s),e.treeAdapter.appendChild(o,s),s=o);}return s}function Hn(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),s=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,s),t.element=s,s}function Dn(e,t,n){if(e._isElementCausesFosterParenting(t))e._fosterParentElement(n);else {const s=e.treeAdapter.getTagName(t),r=e.treeAdapter.getNamespaceURI(t);s===zt.TEMPLATE&&r===qt.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n);}}function Fn(e,t,n){const s=e.treeAdapter.getNamespaceURI(n.element),r=n.token,i=e.treeAdapter.createElement(r.tagName,s,r.attrs);e._adoptNodes(t,i),e.treeAdapter.appendChild(t,i),e.activeFormattingElements.insertElementAfterBookmark(i,n.token),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,i);}function Un(e,t){let n;for(let s=0;s<8&&(n=Mn(e,t),n);s++){const t=gn(e,n);if(!t)break;e.activeFormattingElements.bookmark=n;const s=Pn(e,t,n.element),r=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(s),Dn(e,r,s),Fn(e,t,n);}}function Gn(){}function Bn(e){e._err("misplaced-doctype");}function Kn(e,t){e._appendCommentNode(t,e.openElements.currentTmplContent||e.openElements.current);}function bn(e,t){e._appendCommentNode(t,e.document);}function xn(e,t){e._insertCharacters(t);}function yn(e){e.stopped=!0;}function vn(e,t){e._err("missing-doctype",{beforeToken:!0}),e.treeAdapter.setDocumentMode(e.document,Ct.DOCUMENT_MODE.QUIRKS),e.insertionMode=tn,e._processToken(t);}function Yn(e,t){e._insertFakeRootElement(),e.insertionMode=nn,e._processToken(t);}function wn(e,t){e._insertFakeElement(zt.HEAD),e.headElement=e.openElements.current,e.insertionMode=sn,e._processToken(t);}function Qn(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.BASE||n===zt.BASEFONT||n===zt.BGSOUND||n===zt.LINK||n===zt.META?(e._appendElement(t,qt.HTML),t.ackSelfClosing=!0):n===zt.TITLE?e._switchToTextParsing(t,Nt.MODE.RCDATA):n===zt.NOSCRIPT?e.options.scriptingEnabled?e._switchToTextParsing(t,Nt.MODE.RAWTEXT):(e._insertElement(t,qt.HTML),e.insertionMode=rn):n===zt.NOFRAMES||n===zt.STYLE?e._switchToTextParsing(t,Nt.MODE.RAWTEXT):n===zt.SCRIPT?e._switchToTextParsing(t,Nt.MODE.SCRIPT_DATA):n===zt.TEMPLATE?(e._insertTemplate(t,qt.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Nn,e._pushTmplInsertionMode(Nn)):n===zt.HEAD?e._err(k):Wn(e,t);}function Xn(e,t){const n=t.tagName;n===zt.HEAD?(e.openElements.pop(),e.insertionMode=on):n===zt.BODY||n===zt.BR||n===zt.HTML?Wn(e,t):n===zt.TEMPLATE&&e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagName!==zt.TEMPLATE&&e._err("closing-of-element-with-open-child-elements"),e.openElements.popUntilTagNamePopped(zt.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e._popTmplInsertionMode(),e._resetInsertionMode()):e._err(L);}function Wn(e,t){e.openElements.pop(),e.insertionMode=on,e._processToken(t);}function Vn(e,t){const n=t.type===Nt.EOF_TOKEN?"open-elements-left-after-eof":"disallowed-content-in-noscript-in-head";e._err(n),e.openElements.pop(),e.insertionMode=sn,e._processToken(t);}function jn(e,t){e._insertFakeElement(zt.BODY),e.insertionMode=an,e._processToken(t);}function zn(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t);}function qn(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1;}function Jn(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML);}function Zn(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML),e.skipNextNewLine=!0,e.framesetOk=!1;}function $n(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);}function es(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1;}function ts(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,qt.HTML),e.framesetOk=!1,t.ackSelfClosing=!0;}function ns(e,t){e._appendElement(t,qt.HTML),t.ackSelfClosing=!0;}function ss(e,t){e._switchToTextParsing(t,Nt.MODE.RAWTEXT);}function rs(e,t){e.openElements.currentTagName===zt.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML);}function is(e,t){e.openElements.hasInScope(zt.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,qt.HTML);}function os(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML);}function as(e,t){const n=t.tagName;switch(n.length){case 1:n===zt.I||n===zt.S||n===zt.B||n===zt.U?$n(e,t):n===zt.P?Jn(e,t):n===zt.A?function(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(zt.A);n&&(Un(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);}(e,t):os(e,t);break;case 2:n===zt.DL||n===zt.OL||n===zt.UL?Jn(e,t):n===zt.H1||n===zt.H2||n===zt.H3||n===zt.H4||n===zt.H5||n===zt.H6?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement();const n=e.openElements.currentTagName;n!==zt.H1&&n!==zt.H2&&n!==zt.H3&&n!==zt.H4&&n!==zt.H5&&n!==zt.H6||e.openElements.pop(),e._insertElement(t,qt.HTML);}(e,t):n===zt.LI||n===zt.DD||n===zt.DT?function(e,t){e.framesetOk=!1;const n=t.tagName;for(let t=e.openElements.stackTop;t>=0;t--){const s=e.openElements.items[t],r=e.treeAdapter.getTagName(s);let i=null;if(n===zt.LI&&r===zt.LI?i=zt.LI:n!==zt.DD&&n!==zt.DT||r!==zt.DD&&r!==zt.DT||(i=r),i){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(r!==zt.ADDRESS&&r!==zt.DIV&&r!==zt.P&&e._isSpecialElement(s))break}e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML);}(e,t):n===zt.EM||n===zt.TT?$n(e,t):n===zt.BR?ts(e,t):n===zt.HR?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._appendElement(t,qt.HTML),e.framesetOk=!1,t.ackSelfClosing=!0;}(e,t):n===zt.RB?is(e,t):n===zt.RT||n===zt.RP?function(e,t){e.openElements.hasInScope(zt.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(zt.RTC),e._insertElement(t,qt.HTML);}(e,t):n!==zt.TH&&n!==zt.TD&&n!==zt.TR&&os(e,t);break;case 3:n===zt.DIV||n===zt.DIR||n===zt.NAV?Jn(e,t):n===zt.PRE?Zn(e,t):n===zt.BIG?$n(e,t):n===zt.IMG||n===zt.WBR?ts(e,t):n===zt.XMP?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Nt.MODE.RAWTEXT);}(e,t):n===zt.SVG?function(e,t){e._reconstructActiveFormattingElements(),jt.adjustTokenSVGAttrs(t),jt.adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,qt.SVG):e._insertElement(t,qt.SVG),t.ackSelfClosing=!0;}(e,t):n===zt.RTC?is(e,t):n!==zt.COL&&os(e,t);break;case 4:n===zt.HTML?function(e,t){0===e.openElements.tmplCount&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs);}(e,t):n===zt.BASE||n===zt.LINK||n===zt.META?Qn(e,t):n===zt.BODY?function(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&0===e.openElements.tmplCount&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs));}(e,t):n===zt.MAIN||n===zt.MENU?Jn(e,t):n===zt.FORM?function(e,t){const n=e.openElements.tmplCount>0;e.formElement&&!n||(e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML),n||(e.formElement=e.openElements.current));}(e,t):n===zt.CODE||n===zt.FONT?$n(e,t):n===zt.NOBR?function(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(zt.NOBR)&&(Un(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,qt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);}(e,t):n===zt.AREA?ts(e,t):n===zt.MATH?function(e,t){e._reconstructActiveFormattingElements(),jt.adjustTokenMathMLAttrs(t),jt.adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,qt.MATHML):e._insertElement(t,qt.MATHML),t.ackSelfClosing=!0;}(e,t):n===zt.MENU?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML);}(e,t):n!==zt.HEAD&&os(e,t);break;case 5:n===zt.STYLE||n===zt.TITLE?Qn(e,t):n===zt.ASIDE?Jn(e,t):n===zt.SMALL?$n(e,t):n===zt.TABLE?function(e,t){e.treeAdapter.getDocumentMode(e.document)!==Ct.DOCUMENT_MODE.QUIRKS&&e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML),e.framesetOk=!1,e.insertionMode=En;}(e,t):n===zt.EMBED?ts(e,t):n===zt.INPUT?function(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,qt.HTML);const n=Nt.getTokenAttr(t,Jt.TYPE);n&&n.toLowerCase()===$t||(e.framesetOk=!1),t.ackSelfClosing=!0;}(e,t):n===zt.PARAM||n===zt.TRACK?ns(e,t):n===zt.IMAGE?function(e,t){t.tagName=zt.IMG,ts(e,t);}(e,t):n!==zt.FRAME&&n!==zt.TBODY&&n!==zt.TFOOT&&n!==zt.THEAD&&os(e,t);break;case 6:n===zt.SCRIPT?Qn(e,t):n===zt.CENTER||n===zt.FIGURE||n===zt.FOOTER||n===zt.HEADER||n===zt.HGROUP||n===zt.DIALOG?Jn(e,t):n===zt.BUTTON?function(e,t){e.openElements.hasInScope(zt.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(zt.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.framesetOk=!1;}(e,t):n===zt.STRIKE||n===zt.STRONG?$n(e,t):n===zt.APPLET||n===zt.OBJECT?es(e,t):n===zt.KEYGEN?ts(e,t):n===zt.SOURCE?ns(e,t):n===zt.IFRAME?function(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Nt.MODE.RAWTEXT);}(e,t):n===zt.SELECT?function(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,qt.HTML),e.framesetOk=!1,e.insertionMode===En||e.insertionMode===cn||e.insertionMode===ln||e.insertionMode===mn||e.insertionMode===pn?e.insertionMode=un:e.insertionMode=An;}(e,t):n===zt.OPTION?rs(e,t):os(e,t);break;case 7:n===zt.BGSOUND?Qn(e,t):n===zt.DETAILS||n===zt.ADDRESS||n===zt.ARTICLE||n===zt.SECTION||n===zt.SUMMARY?Jn(e,t):n===zt.LISTING?Zn(e,t):n===zt.MARQUEE?es(e,t):n===zt.NOEMBED?ss(e,t):n!==zt.CAPTION&&os(e,t);break;case 8:n===zt.BASEFONT?Qn(e,t):n===zt.FRAMESET?function(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,qt.HTML),e.insertionMode=Cn);}(e,t):n===zt.FIELDSET?Jn(e,t):n===zt.TEXTAREA?function(e,t){e._insertElement(t,qt.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Nt.MODE.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Tn;}(e,t):n===zt.TEMPLATE?Qn(e,t):n===zt.NOSCRIPT?e.options.scriptingEnabled?ss(e,t):os(e,t):n===zt.OPTGROUP?rs(e,t):n!==zt.COLGROUP&&os(e,t);break;case 9:n===zt.PLAINTEXT?function(e,t){e.openElements.hasInButtonScope(zt.P)&&e._closePElement(),e._insertElement(t,qt.HTML),e.tokenizer.state=Nt.MODE.PLAINTEXT;}(e,t):os(e,t);break;case 10:n===zt.BLOCKQUOTE||n===zt.FIGCAPTION?Jn(e,t):os(e,t);break;default:os(e,t);}}function Ts(e,t){const n=t.tagName;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n));}function Es(e,t){const n=t.tagName;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker());}function hs(e,t){const n=t.tagName;for(let t=e.openElements.stackTop;t>0;t--){const s=e.openElements.items[t];if(e.treeAdapter.getTagName(s)===n){e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilElementPopped(s);break}if(e._isSpecialElement(s))break}}function cs(e,t){const n=t.tagName;switch(n.length){case 1:n===zt.A||n===zt.B||n===zt.I||n===zt.S||n===zt.U?Un(e,t):n===zt.P?function(e){e.openElements.hasInButtonScope(zt.P)||e._insertFakeElement(zt.P),e._closePElement();}(e):hs(e,t);break;case 2:n===zt.DL||n===zt.UL||n===zt.OL?Ts(e,t):n===zt.LI?function(e){e.openElements.hasInListItemScope(zt.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(zt.LI),e.openElements.popUntilTagNamePopped(zt.LI));}(e):n===zt.DD||n===zt.DT?function(e,t){const n=t.tagName;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n));}(e,t):n===zt.H1||n===zt.H2||n===zt.H3||n===zt.H4||n===zt.H5||n===zt.H6?function(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped());}(e):n===zt.BR?function(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(zt.BR),e.openElements.pop(),e.framesetOk=!1;}(e):n===zt.EM||n===zt.TT?Un(e,t):hs(e,t);break;case 3:n===zt.BIG?Un(e,t):n===zt.DIR||n===zt.DIV||n===zt.NAV||n===zt.PRE?Ts(e,t):hs(e,t);break;case 4:n===zt.BODY?function(e){e.openElements.hasInScope(zt.BODY)&&(e.insertionMode=dn);}(e):n===zt.HTML?function(e,t){e.openElements.hasInScope(zt.BODY)&&(e.insertionMode=dn,e._processToken(t));}(e,t):n===zt.FORM?function(e){const t=e.openElements.tmplCount>0,n=e.formElement;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(zt.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(zt.FORM):e.openElements.remove(n));}(e):n===zt.CODE||n===zt.FONT||n===zt.NOBR?Un(e,t):n===zt.MAIN||n===zt.MENU?Ts(e,t):hs(e,t);break;case 5:n===zt.ASIDE?Ts(e,t):n===zt.SMALL?Un(e,t):hs(e,t);break;case 6:n===zt.CENTER||n===zt.FIGURE||n===zt.FOOTER||n===zt.HEADER||n===zt.HGROUP||n===zt.DIALOG?Ts(e,t):n===zt.APPLET||n===zt.OBJECT?Es(e,t):n===zt.STRIKE||n===zt.STRONG?Un(e,t):hs(e,t);break;case 7:n===zt.ADDRESS||n===zt.ARTICLE||n===zt.DETAILS||n===zt.SECTION||n===zt.SUMMARY||n===zt.LISTING?Ts(e,t):n===zt.MARQUEE?Es(e,t):hs(e,t);break;case 8:n===zt.FIELDSET?Ts(e,t):n===zt.TEMPLATE?Xn(e,t):hs(e,t);break;case 10:n===zt.BLOCKQUOTE||n===zt.FIGCAPTION?Ts(e,t):hs(e,t);break;default:hs(e,t);}}function _s(e,t){e.tmplInsertionModeStackTop>-1?Os(e,t):e.stopped=!0;}function ls(e,t){const n=e.openElements.currentTagName;n===zt.TABLE||n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD||n===zt.TR?(e.pendingCharacterTokens=[],e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=hn,e._processToken(t)):As(e,t);}function ms(e,t){const n=t.tagName;switch(n.length){case 2:n===zt.TD||n===zt.TH||n===zt.TR?function(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(zt.TBODY),e.insertionMode=ln,e._processToken(t);}(e,t):As(e,t);break;case 3:n===zt.COL?function(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(zt.COLGROUP),e.insertionMode=_n,e._processToken(t);}(e,t):As(e,t);break;case 4:n===zt.FORM?function(e,t){e.formElement||0!==e.openElements.tmplCount||(e._insertElement(t,qt.HTML),e.formElement=e.openElements.current,e.openElements.pop());}(e,t):As(e,t);break;case 5:n===zt.TABLE?function(e,t){e.openElements.hasInTableScope(zt.TABLE)&&(e.openElements.popUntilTagNamePopped(zt.TABLE),e._resetInsertionMode(),e._processToken(t));}(e,t):n===zt.STYLE?Qn(e,t):n===zt.TBODY||n===zt.TFOOT||n===zt.THEAD?function(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,qt.HTML),e.insertionMode=ln;}(e,t):n===zt.INPUT?function(e,t){const n=Nt.getTokenAttr(t,Jt.TYPE);n&&n.toLowerCase()===$t?e._appendElement(t,qt.HTML):As(e,t),t.ackSelfClosing=!0;}(e,t):As(e,t);break;case 6:n===zt.SCRIPT?Qn(e,t):As(e,t);break;case 7:n===zt.CAPTION?function(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,qt.HTML),e.insertionMode=cn;}(e,t):As(e,t);break;case 8:n===zt.COLGROUP?function(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,qt.HTML),e.insertionMode=_n;}(e,t):n===zt.TEMPLATE?Qn(e,t):As(e,t);break;default:As(e,t);}}function ps(e,t){const n=t.tagName;n===zt.TABLE?e.openElements.hasInTableScope(zt.TABLE)&&(e.openElements.popUntilTagNamePopped(zt.TABLE),e._resetInsertionMode()):n===zt.TEMPLATE?Xn(e,t):n!==zt.BODY&&n!==zt.CAPTION&&n!==zt.COL&&n!==zt.COLGROUP&&n!==zt.HTML&&n!==zt.TBODY&&n!==zt.TD&&n!==zt.TFOOT&&n!==zt.TH&&n!==zt.THEAD&&n!==zt.TR&&As(e,t);}function As(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,e._processTokenInBodyMode(t),e.fosterParentingEnabled=n;}function us(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)As(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t);}function Ns(e,t){e.openElements.currentTagName===zt.COLGROUP&&(e.openElements.pop(),e.insertionMode=En,e._processToken(t));}function ds(e,t){const n=t.tagName;n===zt.HTML?as(e,t):n===zt.OPTION?(e.openElements.currentTagName===zt.OPTION&&e.openElements.pop(),e._insertElement(t,qt.HTML)):n===zt.OPTGROUP?(e.openElements.currentTagName===zt.OPTION&&e.openElements.pop(),e.openElements.currentTagName===zt.OPTGROUP&&e.openElements.pop(),e._insertElement(t,qt.HTML)):n===zt.INPUT||n===zt.KEYGEN||n===zt.TEXTAREA||n===zt.SELECT?e.openElements.hasInSelectScope(zt.SELECT)&&(e.openElements.popUntilTagNamePopped(zt.SELECT),e._resetInsertionMode(),n!==zt.SELECT&&e._processToken(t)):n!==zt.SCRIPT&&n!==zt.TEMPLATE||Qn(e,t);}function Cs(e,t){const n=t.tagName;if(n===zt.OPTGROUP){const t=e.openElements.items[e.openElements.stackTop-1],n=t&&e.treeAdapter.getTagName(t);e.openElements.currentTagName===zt.OPTION&&n===zt.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagName===zt.OPTGROUP&&e.openElements.pop();}else n===zt.OPTION?e.openElements.currentTagName===zt.OPTION&&e.openElements.pop():n===zt.SELECT&&e.openElements.hasInSelectScope(zt.SELECT)?(e.openElements.popUntilTagNamePopped(zt.SELECT),e._resetInsertionMode()):n===zt.TEMPLATE&&Xn(e,t);}function Os(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(zt.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e._popTmplInsertionMode(),e._resetInsertionMode(),e._processToken(t)):e.stopped=!0;}function fs(e,t){e.insertionMode=an,e._processToken(t);}function Ss(e,t){e.insertionMode=an,e._processToken(t);}return Ct.TAG_NAMES,Ct.NAMESPACES,e.parse=function(e,t){return new kn(t).parse(e)},e.parseFragment=function(e,t,n){return "string"==typeof e&&(n=t,t=e,e=null),new kn(n).parseFragment(t,e)},Object.defineProperty(e,"__esModule",{value:!0}),e}({});const parse=e.parse;const parseFragment=e.parseFragment;
  736. const docParser = new WeakMap();
  737. function parseDocumentUtil(ownerDocument, html) {
  738. const doc = parse(html.trim(), getParser(ownerDocument));
  739. doc.documentElement = doc.firstElementChild;
  740. doc.head = doc.documentElement.firstElementChild;
  741. doc.body = doc.head.nextElementSibling;
  742. return doc;
  743. }
  744. function parseFragmentUtil(ownerDocument, html) {
  745. if (typeof html === 'string') {
  746. html = html.trim();
  747. }
  748. else {
  749. html = '';
  750. }
  751. const frag = parseFragment(html, getParser(ownerDocument));
  752. return frag;
  753. }
  754. function getParser(ownerDocument) {
  755. let parseOptions = docParser.get(ownerDocument);
  756. if (parseOptions != null) {
  757. return parseOptions;
  758. }
  759. const treeAdapter = {
  760. createDocument() {
  761. const doc = ownerDocument.createElement("#document" /* NODE_NAMES.DOCUMENT_NODE */);
  762. doc['x-mode'] = 'no-quirks';
  763. return doc;
  764. },
  765. setNodeSourceCodeLocation(node, location) {
  766. node.sourceCodeLocation = location;
  767. },
  768. getNodeSourceCodeLocation(node) {
  769. return node.sourceCodeLocation;
  770. },
  771. createDocumentFragment() {
  772. return ownerDocument.createDocumentFragment();
  773. },
  774. createElement(tagName, namespaceURI, attrs) {
  775. const elm = ownerDocument.createElementNS(namespaceURI, tagName);
  776. for (let i = 0; i < attrs.length; i++) {
  777. const attr = attrs[i];
  778. if (attr.namespace == null || attr.namespace === 'http://www.w3.org/1999/xhtml') {
  779. elm.setAttribute(attr.name, attr.value);
  780. }
  781. else {
  782. elm.setAttributeNS(attr.namespace, attr.name, attr.value);
  783. }
  784. }
  785. return elm;
  786. },
  787. createCommentNode(data) {
  788. return ownerDocument.createComment(data);
  789. },
  790. appendChild(parentNode, newNode) {
  791. parentNode.appendChild(newNode);
  792. },
  793. insertBefore(parentNode, newNode, referenceNode) {
  794. parentNode.insertBefore(newNode, referenceNode);
  795. },
  796. setTemplateContent(templateElement, contentElement) {
  797. templateElement.content = contentElement;
  798. },
  799. getTemplateContent(templateElement) {
  800. return templateElement.content;
  801. },
  802. setDocumentType(doc, name, publicId, systemId) {
  803. let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */);
  804. if (doctypeNode == null) {
  805. doctypeNode = ownerDocument.createDocumentTypeNode();
  806. doc.insertBefore(doctypeNode, doc.firstChild);
  807. }
  808. doctypeNode.nodeValue = '!DOCTYPE';
  809. doctypeNode['x-name'] = name;
  810. doctypeNode['x-publicId'] = publicId;
  811. doctypeNode['x-systemId'] = systemId;
  812. },
  813. setDocumentMode(doc, mode) {
  814. doc['x-mode'] = mode;
  815. },
  816. getDocumentMode(doc) {
  817. return doc['x-mode'];
  818. },
  819. detachNode(node) {
  820. node.remove();
  821. },
  822. insertText(parentNode, text) {
  823. const lastChild = parentNode.lastChild;
  824. if (lastChild != null && lastChild.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
  825. lastChild.nodeValue += text;
  826. }
  827. else {
  828. parentNode.appendChild(ownerDocument.createTextNode(text));
  829. }
  830. },
  831. insertTextBefore(parentNode, text, referenceNode) {
  832. const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
  833. if (prevNode != null && prevNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
  834. prevNode.nodeValue += text;
  835. }
  836. else {
  837. parentNode.insertBefore(ownerDocument.createTextNode(text), referenceNode);
  838. }
  839. },
  840. adoptAttributes(recipient, attrs) {
  841. for (let i = 0; i < attrs.length; i++) {
  842. const attr = attrs[i];
  843. if (recipient.hasAttributeNS(attr.namespace, attr.name) === false) {
  844. recipient.setAttributeNS(attr.namespace, attr.name, attr.value);
  845. }
  846. }
  847. },
  848. getFirstChild(node) {
  849. return node.childNodes[0];
  850. },
  851. getChildNodes(node) {
  852. return node.childNodes;
  853. },
  854. getParentNode(node) {
  855. return node.parentNode;
  856. },
  857. getAttrList(element) {
  858. const attrs = element.attributes.__items.map((attr) => {
  859. return {
  860. name: attr.name,
  861. value: attr.value,
  862. namespace: attr.namespaceURI,
  863. prefix: null,
  864. };
  865. });
  866. return attrs;
  867. },
  868. getTagName(element) {
  869. if (element.namespaceURI === 'http://www.w3.org/1999/xhtml') {
  870. return element.nodeName.toLowerCase();
  871. }
  872. else {
  873. return element.nodeName;
  874. }
  875. },
  876. getNamespaceURI(element) {
  877. return element.namespaceURI;
  878. },
  879. getTextNodeContent(textNode) {
  880. return textNode.nodeValue;
  881. },
  882. getCommentNodeContent(commentNode) {
  883. return commentNode.nodeValue;
  884. },
  885. getDocumentTypeNodeName(doctypeNode) {
  886. return doctypeNode['x-name'];
  887. },
  888. getDocumentTypeNodePublicId(doctypeNode) {
  889. return doctypeNode['x-publicId'];
  890. },
  891. getDocumentTypeNodeSystemId(doctypeNode) {
  892. return doctypeNode['x-systemId'];
  893. },
  894. isTextNode(node) {
  895. return node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */;
  896. },
  897. isCommentNode(node) {
  898. return node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */;
  899. },
  900. isDocumentTypeNode(node) {
  901. return node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
  902. },
  903. isElementNode(node) {
  904. return node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */;
  905. },
  906. };
  907. parseOptions = {
  908. treeAdapter: treeAdapter,
  909. };
  910. docParser.set(ownerDocument, parseOptions);
  911. return parseOptions;
  912. }
  913. // Sizzle 2.3.6
  914. const Sizzle = (function() {
  915. const window = {
  916. document: {
  917. createElement() {
  918. return {};
  919. },
  920. nodeType: 9,
  921. documentElement: {
  922. nodeType: 1,
  923. nodeName: 'HTML'
  924. }
  925. }
  926. };
  927. const module = { exports: {} };
  928. /*! Sizzle v2.3.6 | (c) JS Foundation and other contributors | js.foundation */
  929. !function(e){var t,n,r,i,o,u,l,a,c,s,d,f,p,h,g,m,y,v,w,b="sizzle"+1*new Date,N=e.document,C=0,x=0,E=ae(),A=ae(),S=ae(),D=ae(),T=function(e,t){return e===t&&(d=!0),0},L={}.hasOwnProperty,q=[],I=q.pop,B=q.push,R=q.push,$=q.slice,k=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return -1},H="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",P="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",z="\\["+M+"*("+P+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+P+"))|)"+M+"*\\]",F=":("+P+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+z+")*)|.*)\\)|)",O=new RegExp(M+"+","g"),j=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),G=new RegExp("^"+M+"*,"+M+"*"),U=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),V=new RegExp(M+"|>"),X=new RegExp(F),J=new RegExp("^"+P+"$"),K={ID:new RegExp("^#("+P+")"),CLASS:new RegExp("^\\.("+P+")"),TAG:new RegExp("^("+P+"|[*])"),ATTR:new RegExp("^"+z),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+H+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Q=/HTML$/i,W=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){f();},ue=ve(function(e){return !0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{R.apply(q=$.call(N.childNodes),N.childNodes),q[N.childNodes.length].nodeType;}catch(e){R={apply:q.length?function(e,t){B.apply(e,$.call(t));}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1;}};}function le(e,t,r,i){var o,l,c,s,d,h,y,v=t&&t.ownerDocument,N=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==N&&9!==N&&11!==N)return r;if(!i&&(f(t),t=t||p,g)){if(11!==N&&(d=_.exec(e)))if(o=d[1]){if(9===N){if(!(c=t.getElementById(o)))return r;if(c.id===o)return r.push(c),r}else if(v&&(c=v.getElementById(o))&&w(t,c)&&c.id===o)return r.push(c),r}else {if(d[2])return R.apply(r,t.getElementsByTagName(e)),r;if((o=d[3])&&n.getElementsByClassName&&t.getElementsByClassName)return R.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!D[e+" "]&&(!m||!m.test(e))&&(1!==N||"object"!==t.nodeName.toLowerCase())){if(y=e,v=t,1===N&&(V.test(e)||U.test(e))){(v=ee.test(e)&&ge(t.parentNode)||t)===t&&n.scope||((s=t.getAttribute("id"))?s=s.replace(re,ie):t.setAttribute("id",s=b)),l=(h=u(e)).length;while(l--)h[l]=(s?"#"+s:":scope")+" "+ye(h[l]);y=h.join(",");}try{return R.apply(r,v.querySelectorAll(y)),r}catch(t){D(e,!0);}finally{s===b&&t.removeAttribute("id");}}}return a(e.replace(j,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function ce(e){return e[b]=!0,e}function se(e){var t=p.createElement("fieldset");try{return !!e(t)}catch(e){return !1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null;}}function de(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t;}function fe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return -1;return e?1:-1}function pe(e){return function(t){return "form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ue(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return ce(function(t){return t=+t,ce(function(n,r){var i,o=e([],n.length,t),u=o.length;while(u--)n[i=o[u]]&&(n[i]=!(r[i]=n[i]));})})}function ge(e){return e&&void 0!==e.getElementsByTagName&&e}n=le.support={},o=le.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return !Q.test(t||n&&n.nodeName||"HTML")},f=le.setDocument=function(e){var t,i,u=e?e.ownerDocument||e:N;return u!=p&&9===u.nodeType&&u.documentElement?(p=u,h=p.documentElement,g=!o(p),N!=p&&(i=p.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",oe,!1):i.attachEvent&&i.attachEvent("onunload",oe)),n.scope=se(function(e){return h.appendChild(e).appendChild(p.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),n.attributes=se(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=se(function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Z.test(p.getElementsByClassName),n.getById=se(function(e){return h.appendChild(e).id=b,!p.getElementsByName||!p.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return [o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return [o]}return []}}),r.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&g)return t.getElementsByClassName(e)},y=[],m=[],(n.qsa=Z.test(p.querySelectorAll))&&(se(function(e){var t;h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+M+"*(?:value|"+H+")"),e.querySelectorAll("[id~="+b+"-]").length||m.push("~="),(t=p.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||m.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||m.push(".#.+[+~]"),e.querySelectorAll("\\\f"),m.push("[\\r\\n\\f]");}),se(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&m.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:");})),(n.matchesSelector=Z.test(v=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&se(function(e){n.disconnectedMatch=v.call(e,"*"),v.call(e,"[s!='']:x"),y.push("!=",F);}),m=m.length&&new RegExp(m.join("|")),y=y.length&&new RegExp(y.join("|")),t=Z.test(h.compareDocumentPosition),w=t||Z.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return !0;return !1},T=t?function(e,t){if(e===t)return d=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e==p||e.ownerDocument==N&&w(N,e)?-1:t==p||t.ownerDocument==N&&w(N,t)?1:s?k(s,e)-k(s,t):0:4&r?-1:1)}:function(e,t){if(e===t)return d=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,u=[e],l=[t];if(!i||!o)return e==p?-1:t==p?1:i?-1:o?1:s?k(s,e)-k(s,t):0;if(i===o)return fe(e,t);n=e;while(n=n.parentNode)u.unshift(n);n=t;while(n=n.parentNode)l.unshift(n);while(u[r]===l[r])r++;return r?fe(u[r],l[r]):u[r]==N?-1:l[r]==N?1:0},p):p},le.matches=function(e,t){return le(e,null,null,t)},le.matchesSelector=function(e,t){if(f(e),n.matchesSelector&&g&&!D[t+" "]&&(!y||!y.test(t))&&(!m||!m.test(t)))try{var r=v.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){D(t,!0);}return le(t,p,null,[e]).length>0},le.contains=function(e,t){return (e.ownerDocument||e)!=p&&f(e),w(e,t)},le.attr=function(e,t){(e.ownerDocument||e)!=p&&f(e);var i=r.attrHandle[t.toLowerCase()],o=i&&L.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},le.escape=function(e){return (e+"").replace(re,ie)},le.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},le.uniqueSort=function(e){var t,r=[],i=0,o=0;if(d=!n.detectDuplicates,s=!n.sortStable&&e.slice(0),e.sort(T),d){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1);}return s=null,e},i=le.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e);}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=le.selectors={cacheLength:50,createPseudo:ce,match:K,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||le.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&le.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return K.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=u(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return "*"===e?function(){return !0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=le.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(O," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),u="last"!==e.slice(-4),l="of-type"===t;return 1===r&&0===i?function(e){return !!e.parentNode}:function(t,n,a){var c,s,d,f,p,h,g=o!==u?"nextSibling":"previousSibling",m=t.parentNode,y=l&&t.nodeName.toLowerCase(),v=!a&&!l,w=!1;if(m){if(o){while(g){f=t;while(f=f[g])if(l?f.nodeName.toLowerCase()===y:1===f.nodeType)return !1;h=g="only"===e&&!h&&"nextSibling";}return !0}if(h=[u?m.firstChild:m.lastChild],u&&v){w=(p=(c=(s=(d=(f=m)[b]||(f[b]={}))[f.uniqueID]||(d[f.uniqueID]={}))[e]||[])[0]===C&&c[1])&&c[2],f=p&&m.childNodes[p];while(f=++p&&f&&f[g]||(w=p=0)||h.pop())if(1===f.nodeType&&++w&&f===t){s[e]=[C,p,w];break}}else if(v&&(w=p=(c=(s=(d=(f=t)[b]||(f[b]={}))[f.uniqueID]||(d[f.uniqueID]={}))[e]||[])[0]===C&&c[1]),!1===w)while(f=++p&&f&&f[g]||(w=p=0)||h.pop())if((l?f.nodeName.toLowerCase()===y:1===f.nodeType)&&++w&&(v&&((s=(d=f[b]||(f[b]={}))[f.uniqueID]||(d[f.uniqueID]={}))[e]=[C,w]),f===t))break;return (w-=i)===r||w%r==0&&w/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||le.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?ce(function(e,n){var r,o=i(e,t),u=o.length;while(u--)e[r=k(e,o[u])]=!(n[r]=o[u]);}):function(e){return i(e,0,n)}):i}},pseudos:{not:ce(function(e){var t=[],n=[],r=l(e.replace(j,"$1"));return r[b]?ce(function(e,t,n,i){var o,u=r(e,null,i,[]),l=e.length;while(l--)(o=u[l])&&(e[l]=!(t[l]=o));}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:ce(function(e){return function(t){return le(e,t).length>0}}),contains:ce(function(e){return e=e.replace(te,ne),function(t){return (t.textContent||i(t)).indexOf(e)>-1}}),lang:ce(function(e){return J.test(e||"")||le.error("unsupported lang: "+e),e=e.replace(te,ne).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return (n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return !1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:pe(!1),disabled:pe(!0),checked:function(e){var t=e.nodeName.toLowerCase();return "input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return !1;return !0},parent:function(e){return !r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return W.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return "input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return "input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return [0]}),last:he(function(e,t){return [t-1]}),eq:he(function(e,t,n){return [n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n>t?t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in {radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=function(e){return function(t){return "input"===t.nodeName.toLowerCase()&&t.type===e}}(t);for(t in {submit:!0,reset:!0})r.pseudos[t]=function(e){return function(t){var n=t.nodeName.toLowerCase();return ("input"===n||"button"===n)&&t.type===e}}(t);function me(){}me.prototype=r.filters=r.pseudos,r.setFilters=new me,u=le.tokenize=function(e,t){var n,i,o,u,l,a,c,s=A[e+" "];if(s)return t?0:s.slice(0);l=e,a=[],c=r.preFilter;while(l){n&&!(i=G.exec(l))||(i&&(l=l.slice(i[0].length)||l),a.push(o=[])),n=!1,(i=U.exec(l))&&(n=i.shift(),o.push({value:n,type:i[0].replace(j," ")}),l=l.slice(n.length));for(u in r.filter)!(i=K[u].exec(l))||c[u]&&!(i=c[u](i))||(n=i.shift(),o.push({value:n,type:u,matches:i}),l=l.slice(n.length));if(!n)break}return t?l.length:l?le.error(e):A(e,a).slice(0)};function ye(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function ve(e,t,n){var r=t.dir,i=t.next,o=i||r,u=n&&"parentNode"===o,l=x++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||u)return e(t,n,i);return !1}:function(t,n,a){var c,s,d,f=[C,l];if(a){while(t=t[r])if((1===t.nodeType||u)&&e(t,n,a))return !0}else while(t=t[r])if(1===t.nodeType||u)if(d=t[b]||(t[b]={}),s=d[t.uniqueID]||(d[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else {if((c=s[o])&&c[0]===C&&c[1]===l)return f[2]=c[2];if(s[o]=f,f[2]=e(t,n,a))return !0}return !1}}function we(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return !1;return !0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)le(e,t[r],n);return n}function Ne(e,t,n,r,i){for(var o,u=[],l=0,a=e.length,c=null!=t;l<a;l++)(o=e[l])&&(n&&!n(o,r,i)||(u.push(o),c&&t.push(l)));return u}function Ce(e,t,n,r,i,o){return r&&!r[b]&&(r=Ce(r)),i&&!i[b]&&(i=Ce(i,o)),ce(function(o,u,l,a){var c,s,d,f=[],p=[],h=u.length,g=o||be(t||"*",l.nodeType?[l]:l,[]),m=!e||!o&&t?g:Ne(g,f,e,l,a),y=n?i||(o?e:h||r)?[]:u:m;if(n&&n(m,y,l,a),r){c=Ne(y,p),r(c,[],l,a),s=c.length;while(s--)(d=c[s])&&(y[p[s]]=!(m[p[s]]=d));}if(o){if(i||e){if(i){c=[],s=y.length;while(s--)(d=y[s])&&c.push(m[s]=d);i(null,y=[],c,a);}s=y.length;while(s--)(d=y[s])&&(c=i?k(o,d):f[s])>-1&&(o[c]=!(u[c]=d));}}else y=Ne(y===u?y.splice(h,y.length):y),i?i(null,u,y,a):R.apply(u,y);})}function xe(e){for(var t,n,i,o=e.length,u=r.relative[e[0].type],l=u||r.relative[" "],a=u?1:0,s=ve(function(e){return e===t},l,!0),d=ve(function(e){return k(t,e)>-1},l,!0),f=[function(e,n,r){var i=!u&&(r||n!==c)||((t=n).nodeType?s(e,n,r):d(e,n,r));return t=null,i}];a<o;a++)if(n=r.relative[e[a].type])f=[ve(we(f),n)];else {if((n=r.filter[e[a].type].apply(null,e[a].matches))[b]){for(i=++a;i<o;i++)if(r.relative[e[i].type])break;return Ce(a>1&&we(f),a>1&&ye(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(j,"$1"),n,a<i&&xe(e.slice(a,i)),i<o&&xe(e=e.slice(i)),i<o&&ye(e))}f.push(n);}return we(f)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,u,l,a,s){var d,h,m,y=0,v="0",w=o&&[],b=[],N=c,x=o||i&&r.find.TAG("*",s),E=C+=null==N?1:Math.random()||.1,A=x.length;for(s&&(c=u==p||u||s);v!==A&&null!=(d=x[v]);v++){if(i&&d){h=0,u||d.ownerDocument==p||(f(d),l=!g);while(m=e[h++])if(m(d,u||p,l)){a.push(d);break}s&&(C=E);}n&&((d=!m&&d)&&y--,o&&w.push(d));}if(y+=v,n&&v!==y){h=0;while(m=t[h++])m(w,b,u,l);if(o){if(y>0)while(v--)w[v]||b[v]||(b[v]=I.call(a));b=Ne(b);}R.apply(a,b),s&&!o&&b.length>0&&y+t.length>1&&le.uniqueSort(a);}return s&&(C=E,c=N),w};return n?ce(o):o}l=le.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=u(e)),n=t.length;while(n--)(o=xe(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e;}return o},a=le.select=function(e,t,n,i){var o,a,c,s,d,f="function"==typeof e&&e,p=!i&&u(e=f.selector||e);if(n=n||[],1===p.length){if((a=p[0]=p[0].slice(0)).length>2&&"ID"===(c=a[0]).type&&9===t.nodeType&&g&&r.relative[a[1].type]){if(!(t=(r.find.ID(c.matches[0].replace(te,ne),t)||[])[0]))return n;f&&(t=t.parentNode),e=e.slice(a.shift().value.length);}o=K.needsContext.test(e)?0:a.length;while(o--){if(c=a[o],r.relative[s=c.type])break;if((d=r.find[s])&&(i=d(c.matches[0].replace(te,ne),ee.test(a[0].type)&&ge(t.parentNode)||t))){if(a.splice(o,1),!(e=i.length&&ye(a)))return R.apply(n,i),n;break}}}return (f||l(e,p))(i,t,!g,n,!t||ee.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(T).join("")===b,n.detectDuplicates=!!d,f(),n.sortDetached=se(function(e){return 1&e.compareDocumentPosition(p.createElement("fieldset"))}),se(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||de("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&se(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||de("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),se(function(e){return null==e.getAttribute("disabled")})||de(H,function(e,t,n){var r;if(!n)return !0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null});var Ae=e.Sizzle;le.noConflict=function(){return e.Sizzle===le&&(e.Sizzle=Ae),le},"function"==typeof define&&define.amd?define(function(){return le}):"undefined"!=typeof module&&module.exports?module.exports=le:e.Sizzle=le;}(window);
  930. //# sourceMappingURL=sizzle.min.map
  931. return module.exports;
  932. })();
  933. function matches(selector, elm) {
  934. const r = Sizzle.matches(selector, [elm]);
  935. return r.length > 0;
  936. }
  937. function selectOne(selector, elm) {
  938. const r = Sizzle(selector, elm);
  939. return r[0] || null;
  940. }
  941. function selectAll(selector, elm) {
  942. return Sizzle(selector, elm);
  943. }
  944. function serializeNodeToHtml(elm, opts = {}) {
  945. const output = {
  946. currentLineWidth: 0,
  947. indent: 0,
  948. isWithinBody: false,
  949. text: [],
  950. };
  951. if (opts.prettyHtml) {
  952. if (typeof opts.indentSpaces !== 'number') {
  953. opts.indentSpaces = 2;
  954. }
  955. if (typeof opts.newLines !== 'boolean') {
  956. opts.newLines = true;
  957. }
  958. opts.approximateLineWidth = -1;
  959. }
  960. else {
  961. opts.prettyHtml = false;
  962. if (typeof opts.newLines !== 'boolean') {
  963. opts.newLines = false;
  964. }
  965. if (typeof opts.indentSpaces !== 'number') {
  966. opts.indentSpaces = 0;
  967. }
  968. }
  969. if (typeof opts.approximateLineWidth !== 'number') {
  970. opts.approximateLineWidth = -1;
  971. }
  972. if (typeof opts.removeEmptyAttributes !== 'boolean') {
  973. opts.removeEmptyAttributes = true;
  974. }
  975. if (typeof opts.removeAttributeQuotes !== 'boolean') {
  976. opts.removeAttributeQuotes = false;
  977. }
  978. if (typeof opts.removeBooleanAttributeQuotes !== 'boolean') {
  979. opts.removeBooleanAttributeQuotes = false;
  980. }
  981. if (typeof opts.removeHtmlComments !== 'boolean') {
  982. opts.removeHtmlComments = false;
  983. }
  984. if (typeof opts.serializeShadowRoot !== 'boolean') {
  985. opts.serializeShadowRoot = false;
  986. }
  987. if (opts.outerHtml) {
  988. serializeToHtml(elm, opts, output, false);
  989. }
  990. else {
  991. for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
  992. serializeToHtml(elm.childNodes[i], opts, output, false);
  993. }
  994. }
  995. if (output.text[0] === '\n') {
  996. output.text.shift();
  997. }
  998. if (output.text[output.text.length - 1] === '\n') {
  999. output.text.pop();
  1000. }
  1001. return output.text.join('');
  1002. }
  1003. function serializeToHtml(node, opts, output, isShadowRoot) {
  1004. if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ || isShadowRoot) {
  1005. const tagName = isShadowRoot ? 'mock:shadow-root' : getTagName(node);
  1006. if (tagName === 'body') {
  1007. output.isWithinBody = true;
  1008. }
  1009. const ignoreTag = opts.excludeTags != null && opts.excludeTags.includes(tagName);
  1010. if (ignoreTag === false) {
  1011. const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
  1012. if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
  1013. output.text.push('\n');
  1014. output.currentLineWidth = 0;
  1015. }
  1016. if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
  1017. for (let i = 0; i < output.indent; i++) {
  1018. output.text.push(' ');
  1019. }
  1020. output.currentLineWidth += output.indent;
  1021. }
  1022. output.text.push('<' + tagName);
  1023. output.currentLineWidth += tagName.length + 1;
  1024. const attrsLength = node.attributes.length;
  1025. const attributes = opts.prettyHtml && attrsLength > 1
  1026. ? cloneAttributes(node.attributes, true)
  1027. : node.attributes;
  1028. for (let i = 0; i < attrsLength; i++) {
  1029. const attr = attributes.item(i);
  1030. const attrName = attr.name;
  1031. if (attrName === 'style') {
  1032. continue;
  1033. }
  1034. let attrValue = attr.value;
  1035. if (opts.removeEmptyAttributes && attrValue === '' && REMOVE_EMPTY_ATTR.has(attrName)) {
  1036. continue;
  1037. }
  1038. const attrNamespaceURI = attr.namespaceURI;
  1039. if (attrNamespaceURI == null) {
  1040. output.currentLineWidth += attrName.length + 1;
  1041. if (opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
  1042. output.text.push('\n' + attrName);
  1043. output.currentLineWidth = 0;
  1044. }
  1045. else {
  1046. output.text.push(' ' + attrName);
  1047. }
  1048. }
  1049. else if (attrNamespaceURI === 'http://www.w3.org/XML/1998/namespace') {
  1050. output.text.push(' xml:' + attrName);
  1051. output.currentLineWidth += attrName.length + 5;
  1052. }
  1053. else if (attrNamespaceURI === 'http://www.w3.org/2000/xmlns/') {
  1054. if (attrName !== 'xmlns') {
  1055. output.text.push(' xmlns:' + attrName);
  1056. output.currentLineWidth += attrName.length + 7;
  1057. }
  1058. else {
  1059. output.text.push(' ' + attrName);
  1060. output.currentLineWidth += attrName.length + 1;
  1061. }
  1062. }
  1063. else if (attrNamespaceURI === XLINK_NS) {
  1064. output.text.push(' xlink:' + attrName);
  1065. output.currentLineWidth += attrName.length + 7;
  1066. }
  1067. else {
  1068. output.text.push(' ' + attrNamespaceURI + ':' + attrName);
  1069. output.currentLineWidth += attrNamespaceURI.length + attrName.length + 2;
  1070. }
  1071. if (opts.prettyHtml && attrName === 'class') {
  1072. attrValue = attr.value = attrValue
  1073. .split(' ')
  1074. .filter((t) => t !== '')
  1075. .sort()
  1076. .join(' ')
  1077. .trim();
  1078. }
  1079. if (attrValue === '') {
  1080. if (opts.removeBooleanAttributeQuotes && BOOLEAN_ATTR.has(attrName)) {
  1081. continue;
  1082. }
  1083. if (opts.removeEmptyAttributes && attrName.startsWith('data-')) {
  1084. continue;
  1085. }
  1086. }
  1087. if (opts.removeAttributeQuotes && CAN_REMOVE_ATTR_QUOTES.test(attrValue)) {
  1088. output.text.push('=' + escapeString(attrValue, true));
  1089. output.currentLineWidth += attrValue.length + 1;
  1090. }
  1091. else {
  1092. output.text.push('="' + escapeString(attrValue, true) + '"');
  1093. output.currentLineWidth += attrValue.length + 3;
  1094. }
  1095. }
  1096. if (node.hasAttribute('style')) {
  1097. const cssText = node.style.cssText;
  1098. if (opts.approximateLineWidth > 0 &&
  1099. output.currentLineWidth + cssText.length + 10 > opts.approximateLineWidth) {
  1100. output.text.push(`\nstyle="${cssText}">`);
  1101. output.currentLineWidth = 0;
  1102. }
  1103. else {
  1104. output.text.push(` style="${cssText}">`);
  1105. output.currentLineWidth += cssText.length + 10;
  1106. }
  1107. }
  1108. else {
  1109. output.text.push('>');
  1110. output.currentLineWidth += 1;
  1111. }
  1112. }
  1113. if (EMPTY_ELEMENTS.has(tagName) === false) {
  1114. if (opts.serializeShadowRoot && node.shadowRoot != null) {
  1115. output.indent = output.indent + opts.indentSpaces;
  1116. serializeToHtml(node.shadowRoot, opts, output, true);
  1117. output.indent = output.indent - opts.indentSpaces;
  1118. if (opts.newLines &&
  1119. (node.childNodes.length === 0 ||
  1120. (node.childNodes.length === 1 &&
  1121. node.childNodes[0].nodeType === 3 /* NODE_TYPES.TEXT_NODE */ &&
  1122. node.childNodes[0].nodeValue.trim() === ''))) {
  1123. output.text.push('\n');
  1124. output.currentLineWidth = 0;
  1125. for (let i = 0; i < output.indent; i++) {
  1126. output.text.push(' ');
  1127. }
  1128. output.currentLineWidth += output.indent;
  1129. }
  1130. }
  1131. if (opts.excludeTagContent == null || opts.excludeTagContent.includes(tagName) === false) {
  1132. const childNodes = tagName === 'template' ? node.content.childNodes : node.childNodes;
  1133. const childNodeLength = childNodes.length;
  1134. if (childNodeLength > 0) {
  1135. if (childNodeLength === 1 &&
  1136. childNodes[0].nodeType === 3 /* NODE_TYPES.TEXT_NODE */ &&
  1137. (typeof childNodes[0].nodeValue !== 'string' || childNodes[0].nodeValue.trim() === '')) ;
  1138. else {
  1139. const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
  1140. if (!isWithinWhitespaceSensitiveNode && opts.indentSpaces > 0 && ignoreTag === false) {
  1141. output.indent = output.indent + opts.indentSpaces;
  1142. }
  1143. for (let i = 0; i < childNodeLength; i++) {
  1144. serializeToHtml(childNodes[i], opts, output, false);
  1145. }
  1146. if (ignoreTag === false) {
  1147. if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
  1148. output.text.push('\n');
  1149. output.currentLineWidth = 0;
  1150. }
  1151. if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
  1152. output.indent = output.indent - opts.indentSpaces;
  1153. for (let i = 0; i < output.indent; i++) {
  1154. output.text.push(' ');
  1155. }
  1156. output.currentLineWidth += output.indent;
  1157. }
  1158. }
  1159. }
  1160. }
  1161. if (ignoreTag === false) {
  1162. output.text.push('</' + tagName + '>');
  1163. output.currentLineWidth += tagName.length + 3;
  1164. }
  1165. }
  1166. }
  1167. if (opts.approximateLineWidth > 0 && STRUCTURE_ELEMENTS.has(tagName)) {
  1168. output.text.push('\n');
  1169. output.currentLineWidth = 0;
  1170. }
  1171. if (tagName === 'body') {
  1172. output.isWithinBody = false;
  1173. }
  1174. }
  1175. else if (node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
  1176. let textContent = node.nodeValue;
  1177. if (typeof textContent === 'string') {
  1178. const trimmedTextContent = textContent.trim();
  1179. if (trimmedTextContent === '') {
  1180. // this text node is whitespace only
  1181. if (isWithinWhitespaceSensitive(node)) {
  1182. // whitespace matters within this element
  1183. // just add the exact text we were given
  1184. output.text.push(textContent);
  1185. output.currentLineWidth += textContent.length;
  1186. }
  1187. else if (opts.approximateLineWidth > 0 && !output.isWithinBody) ;
  1188. else if (!opts.prettyHtml) {
  1189. // this text node is only whitespace, and it's not
  1190. // within a whitespace sensitive element like <pre> or <code>
  1191. // so replace the entire white space with a single new line
  1192. output.currentLineWidth += 1;
  1193. if (opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
  1194. // good enough for a new line
  1195. // for perf these are all just estimates
  1196. // we don't care to ensure exact line lengths
  1197. output.text.push('\n');
  1198. output.currentLineWidth = 0;
  1199. }
  1200. else {
  1201. // let's keep it all on the same line yet
  1202. output.text.push(' ');
  1203. }
  1204. }
  1205. }
  1206. else {
  1207. // this text node has text content
  1208. const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 || opts.prettyHtml ? isWithinWhitespaceSensitive(node) : false;
  1209. if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
  1210. output.text.push('\n');
  1211. output.currentLineWidth = 0;
  1212. }
  1213. if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
  1214. for (let i = 0; i < output.indent; i++) {
  1215. output.text.push(' ');
  1216. }
  1217. output.currentLineWidth += output.indent;
  1218. }
  1219. let textContentLength = textContent.length;
  1220. if (textContentLength > 0) {
  1221. // this text node has text content
  1222. const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */
  1223. ? node.parentNode.nodeName
  1224. : null;
  1225. if (NON_ESCAPABLE_CONTENT.has(parentTagName)) {
  1226. // this text node cannot have its content escaped since it's going
  1227. // into an element like <style> or <script>
  1228. if (isWithinWhitespaceSensitive(node)) {
  1229. output.text.push(textContent);
  1230. }
  1231. else {
  1232. output.text.push(trimmedTextContent);
  1233. textContentLength = trimmedTextContent.length;
  1234. }
  1235. output.currentLineWidth += textContentLength;
  1236. }
  1237. else {
  1238. // this text node is going into a normal element and html can be escaped
  1239. if (opts.prettyHtml && !isWithinWhitespaceSensitiveNode) {
  1240. // pretty print the text node
  1241. output.text.push(escapeString(textContent.replace(/\s\s+/g, ' ').trim(), false));
  1242. output.currentLineWidth += textContentLength;
  1243. }
  1244. else {
  1245. // not pretty printing the text node
  1246. if (isWithinWhitespaceSensitive(node)) {
  1247. output.currentLineWidth += textContentLength;
  1248. }
  1249. else {
  1250. // this element is not a whitespace sensitive one, like <pre> or <code> so
  1251. // any whitespace at the start and end can be cleaned up to just be one space
  1252. if (/\s/.test(textContent.charAt(0))) {
  1253. textContent = ' ' + textContent.trimLeft();
  1254. }
  1255. textContentLength = textContent.length;
  1256. if (textContentLength > 1) {
  1257. if (/\s/.test(textContent.charAt(textContentLength - 1))) {
  1258. if (opts.approximateLineWidth > 0 &&
  1259. output.currentLineWidth + textContentLength > opts.approximateLineWidth) {
  1260. textContent = textContent.trimRight() + '\n';
  1261. output.currentLineWidth = 0;
  1262. }
  1263. else {
  1264. textContent = textContent.trimRight() + ' ';
  1265. }
  1266. }
  1267. }
  1268. output.currentLineWidth += textContentLength;
  1269. }
  1270. output.text.push(escapeString(textContent, false));
  1271. }
  1272. }
  1273. }
  1274. }
  1275. }
  1276. }
  1277. else if (node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
  1278. const nodeValue = node.nodeValue;
  1279. if (opts.removeHtmlComments) {
  1280. const isHydrateAnnotation = nodeValue.startsWith(CONTENT_REF_ID + '.') ||
  1281. nodeValue.startsWith(ORG_LOCATION_ID + '.') ||
  1282. nodeValue.startsWith(SLOT_NODE_ID + '.') ||
  1283. nodeValue.startsWith(TEXT_NODE_ID + '.');
  1284. if (!isHydrateAnnotation) {
  1285. return;
  1286. }
  1287. }
  1288. const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
  1289. if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
  1290. output.text.push('\n');
  1291. output.currentLineWidth = 0;
  1292. }
  1293. if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
  1294. for (let i = 0; i < output.indent; i++) {
  1295. output.text.push(' ');
  1296. }
  1297. output.currentLineWidth += output.indent;
  1298. }
  1299. output.text.push('<!--' + nodeValue + '-->');
  1300. output.currentLineWidth += nodeValue.length + 7;
  1301. }
  1302. else if (node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
  1303. output.text.push('<!doctype html>');
  1304. }
  1305. }
  1306. const AMP_REGEX = /&/g;
  1307. const NBSP_REGEX = /\u00a0/g;
  1308. const DOUBLE_QUOTE_REGEX = /"/g;
  1309. const LT_REGEX = /</g;
  1310. const GT_REGEX = />/g;
  1311. const CAN_REMOVE_ATTR_QUOTES = /^[^ \t\n\f\r"'`=<>\/\\-]+$/;
  1312. function getTagName(element) {
  1313. if (element.namespaceURI === 'http://www.w3.org/1999/xhtml') {
  1314. return element.nodeName.toLowerCase();
  1315. }
  1316. else {
  1317. return element.nodeName;
  1318. }
  1319. }
  1320. function escapeString(str, attrMode) {
  1321. str = str.replace(AMP_REGEX, '&amp;').replace(NBSP_REGEX, '&nbsp;');
  1322. if (attrMode) {
  1323. return str.replace(DOUBLE_QUOTE_REGEX, '&quot;');
  1324. }
  1325. return str.replace(LT_REGEX, '&lt;').replace(GT_REGEX, '&gt;');
  1326. }
  1327. function isWithinWhitespaceSensitive(node) {
  1328. while (node != null) {
  1329. if (WHITESPACE_SENSITIVE.has(node.nodeName)) {
  1330. return true;
  1331. }
  1332. node = node.parentNode;
  1333. }
  1334. return false;
  1335. }
  1336. /*@__PURE__*/ const NON_ESCAPABLE_CONTENT = new Set([
  1337. 'STYLE',
  1338. 'SCRIPT',
  1339. 'IFRAME',
  1340. 'NOSCRIPT',
  1341. 'XMP',
  1342. 'NOEMBED',
  1343. 'NOFRAMES',
  1344. 'PLAINTEXT',
  1345. ]);
  1346. /*@__PURE__*/ const WHITESPACE_SENSITIVE = new Set([
  1347. 'CODE',
  1348. 'OUTPUT',
  1349. 'PLAINTEXT',
  1350. 'PRE',
  1351. 'SCRIPT',
  1352. 'TEMPLATE',
  1353. 'TEXTAREA',
  1354. ]);
  1355. /*@__PURE__*/ const EMPTY_ELEMENTS = new Set([
  1356. 'area',
  1357. 'base',
  1358. 'basefont',
  1359. 'bgsound',
  1360. 'br',
  1361. 'col',
  1362. 'embed',
  1363. 'frame',
  1364. 'hr',
  1365. 'img',
  1366. 'input',
  1367. 'keygen',
  1368. 'link',
  1369. 'meta',
  1370. 'param',
  1371. 'source',
  1372. 'trace',
  1373. 'wbr',
  1374. ]);
  1375. /*@__PURE__*/ const REMOVE_EMPTY_ATTR = new Set(['class', 'dir', 'id', 'lang', 'name', 'title']);
  1376. /*@__PURE__*/ const BOOLEAN_ATTR = new Set([
  1377. 'allowfullscreen',
  1378. 'async',
  1379. 'autofocus',
  1380. 'autoplay',
  1381. 'checked',
  1382. 'compact',
  1383. 'controls',
  1384. 'declare',
  1385. 'default',
  1386. 'defaultchecked',
  1387. 'defaultmuted',
  1388. 'defaultselected',
  1389. 'defer',
  1390. 'disabled',
  1391. 'enabled',
  1392. 'formnovalidate',
  1393. 'hidden',
  1394. 'indeterminate',
  1395. 'inert',
  1396. 'ismap',
  1397. 'itemscope',
  1398. 'loop',
  1399. 'multiple',
  1400. 'muted',
  1401. 'nohref',
  1402. 'nomodule',
  1403. 'noresize',
  1404. 'noshade',
  1405. 'novalidate',
  1406. 'nowrap',
  1407. 'open',
  1408. 'pauseonexit',
  1409. 'readonly',
  1410. 'required',
  1411. 'reversed',
  1412. 'scoped',
  1413. 'seamless',
  1414. 'selected',
  1415. 'sortable',
  1416. 'truespeed',
  1417. 'typemustmatch',
  1418. 'visible',
  1419. ]);
  1420. /*@__PURE__*/ const STRUCTURE_ELEMENTS = new Set([
  1421. 'html',
  1422. 'body',
  1423. 'head',
  1424. 'iframe',
  1425. 'meta',
  1426. 'link',
  1427. 'base',
  1428. 'title',
  1429. 'script',
  1430. 'style',
  1431. ]);
  1432. class MockNode {
  1433. constructor(ownerDocument, nodeType, nodeName, nodeValue) {
  1434. this.ownerDocument = ownerDocument;
  1435. this.nodeType = nodeType;
  1436. this.nodeName = nodeName;
  1437. this._nodeValue = nodeValue;
  1438. this.parentNode = null;
  1439. this.childNodes = [];
  1440. }
  1441. appendChild(newNode) {
  1442. if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
  1443. const nodes = newNode.childNodes.slice();
  1444. for (const child of nodes) {
  1445. this.appendChild(child);
  1446. }
  1447. }
  1448. else {
  1449. newNode.remove();
  1450. newNode.parentNode = this;
  1451. this.childNodes.push(newNode);
  1452. connectNode(this.ownerDocument, newNode);
  1453. }
  1454. return newNode;
  1455. }
  1456. append(...items) {
  1457. items.forEach((item) => {
  1458. const isNode = typeof item === 'object' && item !== null && 'nodeType' in item;
  1459. this.appendChild(isNode ? item : this.ownerDocument.createTextNode(String(item)));
  1460. });
  1461. }
  1462. prepend(...items) {
  1463. const firstChild = this.firstChild;
  1464. items.forEach((item) => {
  1465. const isNode = typeof item === 'object' && item !== null && 'nodeType' in item;
  1466. if (firstChild) {
  1467. this.insertBefore(isNode ? item : this.ownerDocument.createTextNode(String(item)), firstChild);
  1468. }
  1469. });
  1470. }
  1471. cloneNode(deep) {
  1472. throw new Error(`invalid node type to clone: ${this.nodeType}, deep: ${deep}`);
  1473. }
  1474. compareDocumentPosition(_other) {
  1475. // unimplemented
  1476. // https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
  1477. return -1;
  1478. }
  1479. get firstChild() {
  1480. return this.childNodes[0] || null;
  1481. }
  1482. insertBefore(newNode, referenceNode) {
  1483. if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
  1484. for (let i = 0, ii = newNode.childNodes.length; i < ii; i++) {
  1485. insertBefore(this, newNode.childNodes[i], referenceNode);
  1486. }
  1487. }
  1488. else {
  1489. insertBefore(this, newNode, referenceNode);
  1490. }
  1491. return newNode;
  1492. }
  1493. get isConnected() {
  1494. let node = this;
  1495. while (node != null) {
  1496. if (node.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */) {
  1497. return true;
  1498. }
  1499. node = node.parentNode;
  1500. if (node != null && node.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
  1501. node = node.host;
  1502. }
  1503. }
  1504. return false;
  1505. }
  1506. isSameNode(node) {
  1507. return this === node;
  1508. }
  1509. get lastChild() {
  1510. return this.childNodes[this.childNodes.length - 1] || null;
  1511. }
  1512. get nextSibling() {
  1513. if (this.parentNode != null) {
  1514. const index = this.parentNode.childNodes.indexOf(this) + 1;
  1515. return this.parentNode.childNodes[index] || null;
  1516. }
  1517. return null;
  1518. }
  1519. get nodeValue() {
  1520. var _a;
  1521. return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
  1522. }
  1523. set nodeValue(value) {
  1524. this._nodeValue = value;
  1525. }
  1526. get parentElement() {
  1527. return this.parentNode || null;
  1528. }
  1529. set parentElement(value) {
  1530. this.parentNode = value;
  1531. }
  1532. get previousSibling() {
  1533. if (this.parentNode != null) {
  1534. const index = this.parentNode.childNodes.indexOf(this) - 1;
  1535. return this.parentNode.childNodes[index] || null;
  1536. }
  1537. return null;
  1538. }
  1539. contains(otherNode) {
  1540. if (otherNode === this) {
  1541. return true;
  1542. }
  1543. const childNodes = Array.from(this.childNodes);
  1544. if (childNodes.includes(otherNode)) {
  1545. return true;
  1546. }
  1547. return childNodes.some((node) => this.contains.bind(node)(otherNode));
  1548. }
  1549. removeChild(childNode) {
  1550. const index = this.childNodes.indexOf(childNode);
  1551. if (index > -1) {
  1552. this.childNodes.splice(index, 1);
  1553. if (this.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
  1554. const wasConnected = this.isConnected;
  1555. childNode.parentNode = null;
  1556. if (wasConnected === true) {
  1557. disconnectNode(childNode);
  1558. }
  1559. }
  1560. else {
  1561. childNode.parentNode = null;
  1562. }
  1563. }
  1564. else {
  1565. throw new Error(`node not found within childNodes during removeChild`);
  1566. }
  1567. return childNode;
  1568. }
  1569. remove() {
  1570. if (this.parentNode != null) {
  1571. this.parentNode.removeChild(this);
  1572. }
  1573. }
  1574. replaceChild(newChild, oldChild) {
  1575. if (oldChild.parentNode === this) {
  1576. this.insertBefore(newChild, oldChild);
  1577. oldChild.remove();
  1578. return newChild;
  1579. }
  1580. return null;
  1581. }
  1582. get textContent() {
  1583. var _a;
  1584. return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
  1585. }
  1586. set textContent(value) {
  1587. this._nodeValue = String(value);
  1588. }
  1589. }
  1590. MockNode.ELEMENT_NODE = 1;
  1591. MockNode.TEXT_NODE = 3;
  1592. MockNode.PROCESSING_INSTRUCTION_NODE = 7;
  1593. MockNode.COMMENT_NODE = 8;
  1594. MockNode.DOCUMENT_NODE = 9;
  1595. MockNode.DOCUMENT_TYPE_NODE = 10;
  1596. MockNode.DOCUMENT_FRAGMENT_NODE = 11;
  1597. class MockNodeList {
  1598. constructor(ownerDocument, childNodes, length) {
  1599. this.ownerDocument = ownerDocument;
  1600. this.childNodes = childNodes;
  1601. this.length = length;
  1602. }
  1603. }
  1604. class MockElement extends MockNode {
  1605. constructor(ownerDocument, nodeName) {
  1606. super(ownerDocument, 1 /* NODE_TYPES.ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
  1607. this.namespaceURI = null;
  1608. this.__shadowRoot = null;
  1609. this.__attributeMap = null;
  1610. }
  1611. addEventListener(type, handler) {
  1612. addEventListener(this, type, handler);
  1613. }
  1614. attachShadow(_opts) {
  1615. const shadowRoot = this.ownerDocument.createDocumentFragment();
  1616. this.shadowRoot = shadowRoot;
  1617. return shadowRoot;
  1618. }
  1619. blur() {
  1620. dispatchEvent(this, new MockFocusEvent('blur', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }));
  1621. }
  1622. get shadowRoot() {
  1623. return this.__shadowRoot || null;
  1624. }
  1625. set shadowRoot(shadowRoot) {
  1626. if (shadowRoot != null) {
  1627. shadowRoot.host = this;
  1628. this.__shadowRoot = shadowRoot;
  1629. }
  1630. else {
  1631. delete this.__shadowRoot;
  1632. }
  1633. }
  1634. get attributes() {
  1635. if (this.__attributeMap == null) {
  1636. const attrMap = createAttributeProxy(false);
  1637. this.__attributeMap = attrMap;
  1638. return attrMap;
  1639. }
  1640. return this.__attributeMap;
  1641. }
  1642. set attributes(attrs) {
  1643. this.__attributeMap = attrs;
  1644. }
  1645. get children() {
  1646. return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */);
  1647. }
  1648. get childElementCount() {
  1649. return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */).length;
  1650. }
  1651. get className() {
  1652. return this.getAttributeNS(null, 'class') || '';
  1653. }
  1654. set className(value) {
  1655. this.setAttributeNS(null, 'class', value);
  1656. }
  1657. get classList() {
  1658. return new MockClassList(this);
  1659. }
  1660. click() {
  1661. dispatchEvent(this, new MockEvent('click', { bubbles: true, cancelable: true, composed: true }));
  1662. }
  1663. cloneNode(_deep) {
  1664. // implemented on MockElement.prototype from within element.ts
  1665. // @ts-ignore - implemented on MockElement.prototype from within element.ts
  1666. return null;
  1667. }
  1668. closest(selector) {
  1669. let elm = this;
  1670. while (elm != null) {
  1671. if (elm.matches(selector)) {
  1672. return elm;
  1673. }
  1674. elm = elm.parentNode;
  1675. }
  1676. return null;
  1677. }
  1678. get dataset() {
  1679. return dataset(this);
  1680. }
  1681. get dir() {
  1682. return this.getAttributeNS(null, 'dir') || '';
  1683. }
  1684. set dir(value) {
  1685. this.setAttributeNS(null, 'dir', value);
  1686. }
  1687. dispatchEvent(ev) {
  1688. return dispatchEvent(this, ev);
  1689. }
  1690. get firstElementChild() {
  1691. return this.children[0] || null;
  1692. }
  1693. focus(_options) {
  1694. dispatchEvent(this, new MockFocusEvent('focus', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }));
  1695. }
  1696. getAttribute(attrName) {
  1697. if (attrName === 'style') {
  1698. if (this.__style != null && this.__style.length > 0) {
  1699. return this.style.cssText;
  1700. }
  1701. return null;
  1702. }
  1703. const attr = this.attributes.getNamedItem(attrName);
  1704. if (attr != null) {
  1705. return attr.value;
  1706. }
  1707. return null;
  1708. }
  1709. getAttributeNS(namespaceURI, attrName) {
  1710. const attr = this.attributes.getNamedItemNS(namespaceURI, attrName);
  1711. if (attr != null) {
  1712. return attr.value;
  1713. }
  1714. return null;
  1715. }
  1716. getBoundingClientRect() {
  1717. return { bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 };
  1718. }
  1719. getRootNode(opts) {
  1720. const isComposed = opts != null && opts.composed === true;
  1721. let node = this;
  1722. while (node.parentNode != null) {
  1723. node = node.parentNode;
  1724. if (isComposed === true && node.parentNode == null && node.host != null) {
  1725. node = node.host;
  1726. }
  1727. }
  1728. return node;
  1729. }
  1730. get draggable() {
  1731. return this.getAttributeNS(null, 'draggable') === 'true';
  1732. }
  1733. set draggable(value) {
  1734. this.setAttributeNS(null, 'draggable', value);
  1735. }
  1736. hasChildNodes() {
  1737. return this.childNodes.length > 0;
  1738. }
  1739. get id() {
  1740. return this.getAttributeNS(null, 'id') || '';
  1741. }
  1742. set id(value) {
  1743. this.setAttributeNS(null, 'id', value);
  1744. }
  1745. get innerHTML() {
  1746. if (this.childNodes.length === 0) {
  1747. return '';
  1748. }
  1749. return serializeNodeToHtml(this, {
  1750. newLines: false,
  1751. indentSpaces: 0,
  1752. });
  1753. }
  1754. set innerHTML(html) {
  1755. var _a;
  1756. if (NON_ESCAPABLE_CONTENT.has((_a = this.nodeName) !== null && _a !== void 0 ? _a : '') === true) {
  1757. setTextContent(this, html);
  1758. }
  1759. else {
  1760. for (let i = this.childNodes.length - 1; i >= 0; i--) {
  1761. this.removeChild(this.childNodes[i]);
  1762. }
  1763. if (typeof html === 'string') {
  1764. const frag = parseFragmentUtil(this.ownerDocument, html);
  1765. while (frag.childNodes.length > 0) {
  1766. this.appendChild(frag.childNodes[0]);
  1767. }
  1768. }
  1769. }
  1770. }
  1771. get innerText() {
  1772. const text = [];
  1773. getTextContent(this.childNodes, text);
  1774. return text.join('');
  1775. }
  1776. set innerText(value) {
  1777. setTextContent(this, value);
  1778. }
  1779. insertAdjacentElement(position, elm) {
  1780. if (position === 'beforebegin') {
  1781. insertBefore(this.parentNode, elm, this);
  1782. }
  1783. else if (position === 'afterbegin') {
  1784. this.prepend(elm);
  1785. }
  1786. else if (position === 'beforeend') {
  1787. this.appendChild(elm);
  1788. }
  1789. else if (position === 'afterend') {
  1790. insertBefore(this.parentNode, elm, this.nextSibling);
  1791. }
  1792. return elm;
  1793. }
  1794. insertAdjacentHTML(position, html) {
  1795. const frag = parseFragmentUtil(this.ownerDocument, html);
  1796. if (position === 'beforebegin') {
  1797. while (frag.childNodes.length > 0) {
  1798. insertBefore(this.parentNode, frag.childNodes[0], this);
  1799. }
  1800. }
  1801. else if (position === 'afterbegin') {
  1802. while (frag.childNodes.length > 0) {
  1803. this.prepend(frag.childNodes[frag.childNodes.length - 1]);
  1804. }
  1805. }
  1806. else if (position === 'beforeend') {
  1807. while (frag.childNodes.length > 0) {
  1808. this.appendChild(frag.childNodes[0]);
  1809. }
  1810. }
  1811. else if (position === 'afterend') {
  1812. while (frag.childNodes.length > 0) {
  1813. insertBefore(this.parentNode, frag.childNodes[frag.childNodes.length - 1], this.nextSibling);
  1814. }
  1815. }
  1816. }
  1817. insertAdjacentText(position, text) {
  1818. const elm = this.ownerDocument.createTextNode(text);
  1819. if (position === 'beforebegin') {
  1820. insertBefore(this.parentNode, elm, this);
  1821. }
  1822. else if (position === 'afterbegin') {
  1823. this.prepend(elm);
  1824. }
  1825. else if (position === 'beforeend') {
  1826. this.appendChild(elm);
  1827. }
  1828. else if (position === 'afterend') {
  1829. insertBefore(this.parentNode, elm, this.nextSibling);
  1830. }
  1831. }
  1832. hasAttribute(attrName) {
  1833. if (attrName === 'style') {
  1834. return this.__style != null && this.__style.length > 0;
  1835. }
  1836. return this.getAttribute(attrName) !== null;
  1837. }
  1838. hasAttributeNS(namespaceURI, name) {
  1839. return this.getAttributeNS(namespaceURI, name) !== null;
  1840. }
  1841. get hidden() {
  1842. return this.hasAttributeNS(null, 'hidden');
  1843. }
  1844. set hidden(isHidden) {
  1845. if (isHidden === true) {
  1846. this.setAttributeNS(null, 'hidden', '');
  1847. }
  1848. else {
  1849. this.removeAttributeNS(null, 'hidden');
  1850. }
  1851. }
  1852. get lang() {
  1853. return this.getAttributeNS(null, 'lang') || '';
  1854. }
  1855. set lang(value) {
  1856. this.setAttributeNS(null, 'lang', value);
  1857. }
  1858. get lastElementChild() {
  1859. const children = this.children;
  1860. return children[children.length - 1] || null;
  1861. }
  1862. matches(selector) {
  1863. return matches(selector, this);
  1864. }
  1865. get nextElementSibling() {
  1866. const parentElement = this.parentElement;
  1867. if (parentElement != null &&
  1868. (parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
  1869. parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
  1870. parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
  1871. const children = parentElement.children;
  1872. const index = children.indexOf(this) + 1;
  1873. return parentElement.children[index] || null;
  1874. }
  1875. return null;
  1876. }
  1877. get outerHTML() {
  1878. return serializeNodeToHtml(this, {
  1879. newLines: false,
  1880. outerHtml: true,
  1881. indentSpaces: 0,
  1882. });
  1883. }
  1884. get previousElementSibling() {
  1885. const parentElement = this.parentElement;
  1886. if (parentElement != null &&
  1887. (parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
  1888. parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
  1889. parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
  1890. const children = parentElement.children;
  1891. const index = children.indexOf(this) - 1;
  1892. return parentElement.children[index] || null;
  1893. }
  1894. return null;
  1895. }
  1896. getElementsByClassName(classNames) {
  1897. const classes = classNames
  1898. .trim()
  1899. .split(' ')
  1900. .filter((c) => c.length > 0);
  1901. const results = [];
  1902. getElementsByClassName(this, classes, results);
  1903. return results;
  1904. }
  1905. getElementsByTagName(tagName) {
  1906. const results = [];
  1907. getElementsByTagName(this, tagName.toLowerCase(), results);
  1908. return results;
  1909. }
  1910. querySelector(selector) {
  1911. return selectOne(selector, this);
  1912. }
  1913. querySelectorAll(selector) {
  1914. return selectAll(selector, this);
  1915. }
  1916. removeAttribute(attrName) {
  1917. if (attrName === 'style') {
  1918. delete this.__style;
  1919. }
  1920. else {
  1921. const attr = this.attributes.getNamedItem(attrName);
  1922. if (attr != null) {
  1923. this.attributes.removeNamedItemNS(attr);
  1924. if (checkAttributeChanged(this) === true) {
  1925. attributeChanged(this, attrName, attr.value, null);
  1926. }
  1927. }
  1928. }
  1929. }
  1930. removeAttributeNS(namespaceURI, attrName) {
  1931. const attr = this.attributes.getNamedItemNS(namespaceURI, attrName);
  1932. if (attr != null) {
  1933. this.attributes.removeNamedItemNS(attr);
  1934. if (checkAttributeChanged(this) === true) {
  1935. attributeChanged(this, attrName, attr.value, null);
  1936. }
  1937. }
  1938. }
  1939. removeEventListener(type, handler) {
  1940. removeEventListener(this, type, handler);
  1941. }
  1942. setAttribute(attrName, value) {
  1943. if (attrName === 'style') {
  1944. this.style = value;
  1945. }
  1946. else {
  1947. const attributes = this.attributes;
  1948. let attr = attributes.getNamedItem(attrName);
  1949. const checkAttrChanged = checkAttributeChanged(this);
  1950. if (attr != null) {
  1951. if (checkAttrChanged === true) {
  1952. const oldValue = attr.value;
  1953. attr.value = value;
  1954. if (oldValue !== attr.value) {
  1955. attributeChanged(this, attr.name, oldValue, attr.value);
  1956. }
  1957. }
  1958. else {
  1959. attr.value = value;
  1960. }
  1961. }
  1962. else {
  1963. if (attributes.caseInsensitive) {
  1964. attrName = attrName.toLowerCase();
  1965. }
  1966. attr = new MockAttr(attrName, value);
  1967. attributes.__items.push(attr);
  1968. if (checkAttrChanged === true) {
  1969. attributeChanged(this, attrName, null, attr.value);
  1970. }
  1971. }
  1972. }
  1973. }
  1974. setAttributeNS(namespaceURI, attrName, value) {
  1975. const attributes = this.attributes;
  1976. let attr = attributes.getNamedItemNS(namespaceURI, attrName);
  1977. const checkAttrChanged = checkAttributeChanged(this);
  1978. if (attr != null) {
  1979. if (checkAttrChanged === true) {
  1980. const oldValue = attr.value;
  1981. attr.value = value;
  1982. if (oldValue !== attr.value) {
  1983. attributeChanged(this, attr.name, oldValue, attr.value);
  1984. }
  1985. }
  1986. else {
  1987. attr.value = value;
  1988. }
  1989. }
  1990. else {
  1991. attr = new MockAttr(attrName, value, namespaceURI);
  1992. attributes.__items.push(attr);
  1993. if (checkAttrChanged === true) {
  1994. attributeChanged(this, attrName, null, attr.value);
  1995. }
  1996. }
  1997. }
  1998. get style() {
  1999. if (this.__style == null) {
  2000. this.__style = createCSSStyleDeclaration();
  2001. }
  2002. return this.__style;
  2003. }
  2004. set style(val) {
  2005. if (typeof val === 'string') {
  2006. if (this.__style == null) {
  2007. this.__style = createCSSStyleDeclaration();
  2008. }
  2009. this.__style.cssText = val;
  2010. }
  2011. else {
  2012. this.__style = val;
  2013. }
  2014. }
  2015. get tabIndex() {
  2016. return parseInt(this.getAttributeNS(null, 'tabindex') || '-1', 10);
  2017. }
  2018. set tabIndex(value) {
  2019. this.setAttributeNS(null, 'tabindex', value);
  2020. }
  2021. get tagName() {
  2022. var _a;
  2023. return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
  2024. }
  2025. set tagName(value) {
  2026. this.nodeName = value;
  2027. }
  2028. get textContent() {
  2029. const text = [];
  2030. getTextContent(this.childNodes, text);
  2031. return text.join('');
  2032. }
  2033. set textContent(value) {
  2034. setTextContent(this, value);
  2035. }
  2036. get title() {
  2037. return this.getAttributeNS(null, 'title') || '';
  2038. }
  2039. set title(value) {
  2040. this.setAttributeNS(null, 'title', value);
  2041. }
  2042. animate() {
  2043. /**/
  2044. }
  2045. onanimationstart() {
  2046. /**/
  2047. }
  2048. onanimationend() {
  2049. /**/
  2050. }
  2051. onanimationiteration() {
  2052. /**/
  2053. }
  2054. onabort() {
  2055. /**/
  2056. }
  2057. onauxclick() {
  2058. /**/
  2059. }
  2060. onbeforecopy() {
  2061. /**/
  2062. }
  2063. onbeforecut() {
  2064. /**/
  2065. }
  2066. onbeforepaste() {
  2067. /**/
  2068. }
  2069. onblur() {
  2070. /**/
  2071. }
  2072. oncancel() {
  2073. /**/
  2074. }
  2075. oncanplay() {
  2076. /**/
  2077. }
  2078. oncanplaythrough() {
  2079. /**/
  2080. }
  2081. onchange() {
  2082. /**/
  2083. }
  2084. onclick() {
  2085. /**/
  2086. }
  2087. onclose() {
  2088. /**/
  2089. }
  2090. oncontextmenu() {
  2091. /**/
  2092. }
  2093. oncopy() {
  2094. /**/
  2095. }
  2096. oncuechange() {
  2097. /**/
  2098. }
  2099. oncut() {
  2100. /**/
  2101. }
  2102. ondblclick() {
  2103. /**/
  2104. }
  2105. ondrag() {
  2106. /**/
  2107. }
  2108. ondragend() {
  2109. /**/
  2110. }
  2111. ondragenter() {
  2112. /**/
  2113. }
  2114. ondragleave() {
  2115. /**/
  2116. }
  2117. ondragover() {
  2118. /**/
  2119. }
  2120. ondragstart() {
  2121. /**/
  2122. }
  2123. ondrop() {
  2124. /**/
  2125. }
  2126. ondurationchange() {
  2127. /**/
  2128. }
  2129. onemptied() {
  2130. /**/
  2131. }
  2132. onended() {
  2133. /**/
  2134. }
  2135. onerror() {
  2136. /**/
  2137. }
  2138. onfocus() {
  2139. /**/
  2140. }
  2141. onfocusin() {
  2142. /**/
  2143. }
  2144. onfocusout() {
  2145. /**/
  2146. }
  2147. onformdata() {
  2148. /**/
  2149. }
  2150. onfullscreenchange() {
  2151. /**/
  2152. }
  2153. onfullscreenerror() {
  2154. /**/
  2155. }
  2156. ongotpointercapture() {
  2157. /**/
  2158. }
  2159. oninput() {
  2160. /**/
  2161. }
  2162. oninvalid() {
  2163. /**/
  2164. }
  2165. onkeydown() {
  2166. /**/
  2167. }
  2168. onkeypress() {
  2169. /**/
  2170. }
  2171. onkeyup() {
  2172. /**/
  2173. }
  2174. onload() {
  2175. /**/
  2176. }
  2177. onloadeddata() {
  2178. /**/
  2179. }
  2180. onloadedmetadata() {
  2181. /**/
  2182. }
  2183. onloadstart() {
  2184. /**/
  2185. }
  2186. onlostpointercapture() {
  2187. /**/
  2188. }
  2189. onmousedown() {
  2190. /**/
  2191. }
  2192. onmouseenter() {
  2193. /**/
  2194. }
  2195. onmouseleave() {
  2196. /**/
  2197. }
  2198. onmousemove() {
  2199. /**/
  2200. }
  2201. onmouseout() {
  2202. /**/
  2203. }
  2204. onmouseover() {
  2205. /**/
  2206. }
  2207. onmouseup() {
  2208. /**/
  2209. }
  2210. onmousewheel() {
  2211. /**/
  2212. }
  2213. onpaste() {
  2214. /**/
  2215. }
  2216. onpause() {
  2217. /**/
  2218. }
  2219. onplay() {
  2220. /**/
  2221. }
  2222. onplaying() {
  2223. /**/
  2224. }
  2225. onpointercancel() {
  2226. /**/
  2227. }
  2228. onpointerdown() {
  2229. /**/
  2230. }
  2231. onpointerenter() {
  2232. /**/
  2233. }
  2234. onpointerleave() {
  2235. /**/
  2236. }
  2237. onpointermove() {
  2238. /**/
  2239. }
  2240. onpointerout() {
  2241. /**/
  2242. }
  2243. onpointerover() {
  2244. /**/
  2245. }
  2246. onpointerup() {
  2247. /**/
  2248. }
  2249. onprogress() {
  2250. /**/
  2251. }
  2252. onratechange() {
  2253. /**/
  2254. }
  2255. onreset() {
  2256. /**/
  2257. }
  2258. onresize() {
  2259. /**/
  2260. }
  2261. onscroll() {
  2262. /**/
  2263. }
  2264. onsearch() {
  2265. /**/
  2266. }
  2267. onseeked() {
  2268. /**/
  2269. }
  2270. onseeking() {
  2271. /**/
  2272. }
  2273. onselect() {
  2274. /**/
  2275. }
  2276. onselectstart() {
  2277. /**/
  2278. }
  2279. onstalled() {
  2280. /**/
  2281. }
  2282. onsubmit() {
  2283. /**/
  2284. }
  2285. onsuspend() {
  2286. /**/
  2287. }
  2288. ontimeupdate() {
  2289. /**/
  2290. }
  2291. ontoggle() {
  2292. /**/
  2293. }
  2294. onvolumechange() {
  2295. /**/
  2296. }
  2297. onwaiting() {
  2298. /**/
  2299. }
  2300. onwebkitfullscreenchange() {
  2301. /**/
  2302. }
  2303. onwebkitfullscreenerror() {
  2304. /**/
  2305. }
  2306. onwheel() {
  2307. /**/
  2308. }
  2309. requestFullscreen() {
  2310. /**/
  2311. }
  2312. scrollBy() {
  2313. /**/
  2314. }
  2315. scrollTo() {
  2316. /**/
  2317. }
  2318. scrollIntoView() {
  2319. /**/
  2320. }
  2321. toString(opts) {
  2322. return serializeNodeToHtml(this, opts);
  2323. }
  2324. }
  2325. function getElementsByClassName(elm, classNames, foundElms) {
  2326. const children = elm.children;
  2327. for (let i = 0, ii = children.length; i < ii; i++) {
  2328. const childElm = children[i];
  2329. for (let j = 0, jj = classNames.length; j < jj; j++) {
  2330. if (childElm.classList.contains(classNames[j])) {
  2331. foundElms.push(childElm);
  2332. }
  2333. }
  2334. getElementsByClassName(childElm, classNames, foundElms);
  2335. }
  2336. }
  2337. function getElementsByTagName(elm, tagName, foundElms) {
  2338. var _a;
  2339. const children = elm.children;
  2340. for (let i = 0, ii = children.length; i < ii; i++) {
  2341. const childElm = children[i];
  2342. if (tagName === '*' || ((_a = childElm.nodeName) !== null && _a !== void 0 ? _a : '').toLowerCase() === tagName) {
  2343. foundElms.push(childElm);
  2344. }
  2345. getElementsByTagName(childElm, tagName, foundElms);
  2346. }
  2347. }
  2348. function resetElement(elm) {
  2349. resetEventListeners(elm);
  2350. delete elm.__attributeMap;
  2351. delete elm.__shadowRoot;
  2352. delete elm.__style;
  2353. }
  2354. function insertBefore(parentNode, newNode, referenceNode) {
  2355. if (newNode !== referenceNode) {
  2356. newNode.remove();
  2357. newNode.parentNode = parentNode;
  2358. newNode.ownerDocument = parentNode.ownerDocument;
  2359. if (referenceNode != null) {
  2360. const index = parentNode.childNodes.indexOf(referenceNode);
  2361. if (index > -1) {
  2362. parentNode.childNodes.splice(index, 0, newNode);
  2363. }
  2364. else {
  2365. throw new Error(`referenceNode not found in parentNode.childNodes`);
  2366. }
  2367. }
  2368. else {
  2369. parentNode.childNodes.push(newNode);
  2370. }
  2371. connectNode(parentNode.ownerDocument, newNode);
  2372. }
  2373. return newNode;
  2374. }
  2375. class MockHTMLElement extends MockElement {
  2376. constructor(ownerDocument, nodeName) {
  2377. super(ownerDocument, typeof nodeName === 'string' ? nodeName.toUpperCase() : null);
  2378. this.namespaceURI = 'http://www.w3.org/1999/xhtml';
  2379. }
  2380. get tagName() {
  2381. var _a;
  2382. return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
  2383. }
  2384. set tagName(value) {
  2385. this.nodeName = value;
  2386. }
  2387. get attributes() {
  2388. if (this.__attributeMap == null) {
  2389. const attrMap = createAttributeProxy(true);
  2390. this.__attributeMap = attrMap;
  2391. return attrMap;
  2392. }
  2393. return this.__attributeMap;
  2394. }
  2395. set attributes(attrs) {
  2396. this.__attributeMap = attrs;
  2397. }
  2398. }
  2399. class MockTextNode extends MockNode {
  2400. constructor(ownerDocument, text) {
  2401. super(ownerDocument, 3 /* NODE_TYPES.TEXT_NODE */, "#text" /* NODE_NAMES.TEXT_NODE */, text);
  2402. }
  2403. cloneNode(_deep) {
  2404. return new MockTextNode(null, this.nodeValue);
  2405. }
  2406. get textContent() {
  2407. return this.nodeValue;
  2408. }
  2409. set textContent(text) {
  2410. this.nodeValue = text;
  2411. }
  2412. get data() {
  2413. return this.nodeValue;
  2414. }
  2415. set data(text) {
  2416. this.nodeValue = text;
  2417. }
  2418. get wholeText() {
  2419. if (this.parentNode != null) {
  2420. const text = [];
  2421. for (let i = 0, ii = this.parentNode.childNodes.length; i < ii; i++) {
  2422. const childNode = this.parentNode.childNodes[i];
  2423. if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
  2424. text.push(childNode.nodeValue);
  2425. }
  2426. }
  2427. return text.join('');
  2428. }
  2429. return this.nodeValue;
  2430. }
  2431. }
  2432. function getTextContent(childNodes, text) {
  2433. for (let i = 0, ii = childNodes.length; i < ii; i++) {
  2434. const childNode = childNodes[i];
  2435. if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
  2436. text.push(childNode.nodeValue);
  2437. }
  2438. else if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
  2439. getTextContent(childNode.childNodes, text);
  2440. }
  2441. }
  2442. }
  2443. function setTextContent(elm, text) {
  2444. for (let i = elm.childNodes.length - 1; i >= 0; i--) {
  2445. elm.removeChild(elm.childNodes[i]);
  2446. }
  2447. const textNode = new MockTextNode(elm.ownerDocument, text);
  2448. elm.appendChild(textNode);
  2449. }
  2450. class MockComment extends MockNode {
  2451. constructor(ownerDocument, data) {
  2452. super(ownerDocument, 8 /* NODE_TYPES.COMMENT_NODE */, "#comment" /* NODE_NAMES.COMMENT_NODE */, data);
  2453. }
  2454. cloneNode(_deep) {
  2455. return new MockComment(null, this.nodeValue);
  2456. }
  2457. get textContent() {
  2458. return this.nodeValue;
  2459. }
  2460. set textContent(text) {
  2461. this.nodeValue = text;
  2462. }
  2463. }
  2464. class MockDocumentFragment extends MockHTMLElement {
  2465. constructor(ownerDocument) {
  2466. super(ownerDocument, null);
  2467. this.nodeName = "#document-fragment" /* NODE_NAMES.DOCUMENT_FRAGMENT_NODE */;
  2468. this.nodeType = 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */;
  2469. }
  2470. getElementById(id) {
  2471. return getElementById(this, id);
  2472. }
  2473. cloneNode(deep) {
  2474. const cloned = new MockDocumentFragment(null);
  2475. if (deep) {
  2476. for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
  2477. const childNode = this.childNodes[i];
  2478. if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
  2479. childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */ ||
  2480. childNode.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
  2481. const clonedChildNode = this.childNodes[i].cloneNode(true);
  2482. cloned.appendChild(clonedChildNode);
  2483. }
  2484. }
  2485. }
  2486. return cloned;
  2487. }
  2488. }
  2489. class MockDocumentTypeNode extends MockHTMLElement {
  2490. constructor(ownerDocument) {
  2491. super(ownerDocument, '!DOCTYPE');
  2492. this.nodeType = 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
  2493. this.setAttribute('html', '');
  2494. }
  2495. }
  2496. class MockCSSRule {
  2497. constructor(parentStyleSheet) {
  2498. this.parentStyleSheet = parentStyleSheet;
  2499. this.cssText = '';
  2500. this.type = 0;
  2501. }
  2502. }
  2503. class MockCSSStyleSheet {
  2504. constructor(ownerNode) {
  2505. this.type = 'text/css';
  2506. this.parentStyleSheet = null;
  2507. this.cssRules = [];
  2508. this.ownerNode = ownerNode;
  2509. }
  2510. get rules() {
  2511. return this.cssRules;
  2512. }
  2513. set rules(rules) {
  2514. this.cssRules = rules;
  2515. }
  2516. deleteRule(index) {
  2517. if (index >= 0 && index < this.cssRules.length) {
  2518. this.cssRules.splice(index, 1);
  2519. updateStyleTextNode(this.ownerNode);
  2520. }
  2521. }
  2522. insertRule(rule, index = 0) {
  2523. if (typeof index !== 'number') {
  2524. index = 0;
  2525. }
  2526. if (index < 0) {
  2527. index = 0;
  2528. }
  2529. if (index > this.cssRules.length) {
  2530. index = this.cssRules.length;
  2531. }
  2532. const cssRule = new MockCSSRule(this);
  2533. cssRule.cssText = rule;
  2534. this.cssRules.splice(index, 0, cssRule);
  2535. updateStyleTextNode(this.ownerNode);
  2536. return index;
  2537. }
  2538. }
  2539. function getStyleElementText(styleElm) {
  2540. const output = [];
  2541. for (let i = 0; i < styleElm.childNodes.length; i++) {
  2542. output.push(styleElm.childNodes[i].nodeValue);
  2543. }
  2544. return output.join('');
  2545. }
  2546. function setStyleElementText(styleElm, text) {
  2547. // keeping the innerHTML and the sheet.cssRules connected
  2548. // is not technically correct, but since we're doing
  2549. // SSR we'll need to turn any assigned cssRules into
  2550. // real text, not just properties that aren't rendered
  2551. const sheet = styleElm.sheet;
  2552. sheet.cssRules.length = 0;
  2553. sheet.insertRule(text);
  2554. updateStyleTextNode(styleElm);
  2555. }
  2556. function updateStyleTextNode(styleElm) {
  2557. const childNodeLen = styleElm.childNodes.length;
  2558. if (childNodeLen > 1) {
  2559. for (let i = childNodeLen - 1; i >= 1; i--) {
  2560. styleElm.removeChild(styleElm.childNodes[i]);
  2561. }
  2562. }
  2563. else if (childNodeLen < 1) {
  2564. styleElm.appendChild(styleElm.ownerDocument.createTextNode(''));
  2565. }
  2566. const textNode = styleElm.childNodes[0];
  2567. textNode.nodeValue = styleElm.sheet.cssRules.map((r) => r.cssText).join('\n');
  2568. }
  2569. function createElement(ownerDocument, tagName) {
  2570. if (typeof tagName !== 'string' || tagName === '' || !/^[a-z0-9-_:]+$/i.test(tagName)) {
  2571. throw new Error(`The tag name provided (${tagName}) is not a valid name.`);
  2572. }
  2573. tagName = tagName.toLowerCase();
  2574. switch (tagName) {
  2575. case 'a':
  2576. return new MockAnchorElement(ownerDocument);
  2577. case 'base':
  2578. return new MockBaseElement(ownerDocument);
  2579. case 'button':
  2580. return new MockButtonElement(ownerDocument);
  2581. case 'canvas':
  2582. return new MockCanvasElement(ownerDocument);
  2583. case 'form':
  2584. return new MockFormElement(ownerDocument);
  2585. case 'img':
  2586. return new MockImageElement(ownerDocument);
  2587. case 'input':
  2588. return new MockInputElement(ownerDocument);
  2589. case 'link':
  2590. return new MockLinkElement(ownerDocument);
  2591. case 'meta':
  2592. return new MockMetaElement(ownerDocument);
  2593. case 'script':
  2594. return new MockScriptElement(ownerDocument);
  2595. case 'style':
  2596. return new MockStyleElement(ownerDocument);
  2597. case 'template':
  2598. return new MockTemplateElement(ownerDocument);
  2599. case 'title':
  2600. return new MockTitleElement(ownerDocument);
  2601. }
  2602. if (ownerDocument != null && tagName.includes('-')) {
  2603. const win = ownerDocument.defaultView;
  2604. if (win != null && win.customElements != null) {
  2605. return createCustomElement(win.customElements, ownerDocument, tagName);
  2606. }
  2607. }
  2608. return new MockHTMLElement(ownerDocument, tagName);
  2609. }
  2610. function createElementNS(ownerDocument, namespaceURI, tagName) {
  2611. if (namespaceURI === 'http://www.w3.org/1999/xhtml') {
  2612. return createElement(ownerDocument, tagName);
  2613. }
  2614. else if (namespaceURI === 'http://www.w3.org/2000/svg') {
  2615. switch (tagName.toLowerCase()) {
  2616. case 'text':
  2617. case 'tspan':
  2618. case 'tref':
  2619. case 'altglyph':
  2620. case 'textpath':
  2621. return new MockSVGTextContentElement(ownerDocument, tagName);
  2622. case 'circle':
  2623. case 'ellipse':
  2624. case 'image':
  2625. case 'line':
  2626. case 'path':
  2627. case 'polygon':
  2628. case 'polyline':
  2629. case 'rect':
  2630. case 'use':
  2631. return new MockSVGGraphicsElement(ownerDocument, tagName);
  2632. case 'svg':
  2633. return new MockSVGSVGElement(ownerDocument, tagName);
  2634. default:
  2635. return new MockSVGElement(ownerDocument, tagName);
  2636. }
  2637. }
  2638. else {
  2639. return new MockElement(ownerDocument, tagName);
  2640. }
  2641. }
  2642. class MockAnchorElement extends MockHTMLElement {
  2643. constructor(ownerDocument) {
  2644. super(ownerDocument, 'a');
  2645. }
  2646. get href() {
  2647. return fullUrl(this, 'href');
  2648. }
  2649. set href(value) {
  2650. this.setAttribute('href', value);
  2651. }
  2652. get pathname() {
  2653. return new URL(this.href).pathname;
  2654. }
  2655. }
  2656. class MockButtonElement extends MockHTMLElement {
  2657. constructor(ownerDocument) {
  2658. super(ownerDocument, 'button');
  2659. }
  2660. }
  2661. patchPropAttributes(MockButtonElement.prototype, {
  2662. type: String,
  2663. }, {
  2664. type: 'submit',
  2665. });
  2666. class MockImageElement extends MockHTMLElement {
  2667. constructor(ownerDocument) {
  2668. super(ownerDocument, 'img');
  2669. }
  2670. get draggable() {
  2671. return this.getAttributeNS(null, 'draggable') !== 'false';
  2672. }
  2673. set draggable(value) {
  2674. this.setAttributeNS(null, 'draggable', value);
  2675. }
  2676. get src() {
  2677. return fullUrl(this, 'src');
  2678. }
  2679. set src(value) {
  2680. this.setAttribute('src', value);
  2681. }
  2682. }
  2683. patchPropAttributes(MockImageElement.prototype, {
  2684. height: Number,
  2685. width: Number,
  2686. });
  2687. class MockInputElement extends MockHTMLElement {
  2688. constructor(ownerDocument) {
  2689. super(ownerDocument, 'input');
  2690. }
  2691. get list() {
  2692. const listId = this.getAttribute('list');
  2693. if (listId) {
  2694. return this.ownerDocument.getElementById(listId);
  2695. }
  2696. return null;
  2697. }
  2698. }
  2699. patchPropAttributes(MockInputElement.prototype, {
  2700. accept: String,
  2701. autocomplete: String,
  2702. autofocus: Boolean,
  2703. capture: String,
  2704. checked: Boolean,
  2705. disabled: Boolean,
  2706. form: String,
  2707. formaction: String,
  2708. formenctype: String,
  2709. formmethod: String,
  2710. formnovalidate: String,
  2711. formtarget: String,
  2712. height: Number,
  2713. inputmode: String,
  2714. max: String,
  2715. maxLength: Number,
  2716. min: String,
  2717. minLength: Number,
  2718. multiple: Boolean,
  2719. name: String,
  2720. pattern: String,
  2721. placeholder: String,
  2722. required: Boolean,
  2723. readOnly: Boolean,
  2724. size: Number,
  2725. spellCheck: Boolean,
  2726. src: String,
  2727. step: String,
  2728. type: String,
  2729. value: String,
  2730. width: Number,
  2731. }, {
  2732. type: 'text',
  2733. });
  2734. class MockFormElement extends MockHTMLElement {
  2735. constructor(ownerDocument) {
  2736. super(ownerDocument, 'form');
  2737. }
  2738. }
  2739. patchPropAttributes(MockFormElement.prototype, {
  2740. name: String,
  2741. });
  2742. class MockLinkElement extends MockHTMLElement {
  2743. constructor(ownerDocument) {
  2744. super(ownerDocument, 'link');
  2745. }
  2746. get href() {
  2747. return fullUrl(this, 'href');
  2748. }
  2749. set href(value) {
  2750. this.setAttribute('href', value);
  2751. }
  2752. }
  2753. patchPropAttributes(MockLinkElement.prototype, {
  2754. crossorigin: String,
  2755. media: String,
  2756. rel: String,
  2757. type: String,
  2758. });
  2759. class MockMetaElement extends MockHTMLElement {
  2760. constructor(ownerDocument) {
  2761. super(ownerDocument, 'meta');
  2762. }
  2763. }
  2764. patchPropAttributes(MockMetaElement.prototype, {
  2765. charset: String,
  2766. content: String,
  2767. name: String,
  2768. });
  2769. class MockScriptElement extends MockHTMLElement {
  2770. constructor(ownerDocument) {
  2771. super(ownerDocument, 'script');
  2772. }
  2773. get src() {
  2774. return fullUrl(this, 'src');
  2775. }
  2776. set src(value) {
  2777. this.setAttribute('src', value);
  2778. }
  2779. }
  2780. patchPropAttributes(MockScriptElement.prototype, {
  2781. type: String,
  2782. });
  2783. class MockDOMMatrix {
  2784. constructor() {
  2785. this.a = 1;
  2786. this.b = 0;
  2787. this.c = 0;
  2788. this.d = 1;
  2789. this.e = 0;
  2790. this.f = 0;
  2791. this.m11 = 1;
  2792. this.m12 = 0;
  2793. this.m13 = 0;
  2794. this.m14 = 0;
  2795. this.m21 = 0;
  2796. this.m22 = 1;
  2797. this.m23 = 0;
  2798. this.m24 = 0;
  2799. this.m31 = 0;
  2800. this.m32 = 0;
  2801. this.m33 = 1;
  2802. this.m34 = 0;
  2803. this.m41 = 0;
  2804. this.m42 = 0;
  2805. this.m43 = 0;
  2806. this.m44 = 1;
  2807. this.is2D = true;
  2808. this.isIdentity = true;
  2809. }
  2810. static fromMatrix() {
  2811. return new MockDOMMatrix();
  2812. }
  2813. inverse() {
  2814. return new MockDOMMatrix();
  2815. }
  2816. flipX() {
  2817. return new MockDOMMatrix();
  2818. }
  2819. flipY() {
  2820. return new MockDOMMatrix();
  2821. }
  2822. multiply() {
  2823. return new MockDOMMatrix();
  2824. }
  2825. rotate() {
  2826. return new MockDOMMatrix();
  2827. }
  2828. rotateAxisAngle() {
  2829. return new MockDOMMatrix();
  2830. }
  2831. rotateFromVector() {
  2832. return new MockDOMMatrix();
  2833. }
  2834. scale() {
  2835. return new MockDOMMatrix();
  2836. }
  2837. scaleNonUniform() {
  2838. return new MockDOMMatrix();
  2839. }
  2840. skewX() {
  2841. return new MockDOMMatrix();
  2842. }
  2843. skewY() {
  2844. return new MockDOMMatrix();
  2845. }
  2846. toJSON() { }
  2847. toString() { }
  2848. transformPoint() {
  2849. return new MockDOMPoint();
  2850. }
  2851. translate() {
  2852. return new MockDOMMatrix();
  2853. }
  2854. }
  2855. class MockDOMPoint {
  2856. constructor() {
  2857. this.w = 1;
  2858. this.x = 0;
  2859. this.y = 0;
  2860. this.z = 0;
  2861. }
  2862. toJSON() { }
  2863. matrixTransform() {
  2864. return new MockDOMMatrix();
  2865. }
  2866. }
  2867. class MockSVGRect {
  2868. constructor() {
  2869. this.height = 10;
  2870. this.width = 10;
  2871. this.x = 0;
  2872. this.y = 0;
  2873. }
  2874. }
  2875. class MockStyleElement extends MockHTMLElement {
  2876. constructor(ownerDocument) {
  2877. super(ownerDocument, 'style');
  2878. this.sheet = new MockCSSStyleSheet(this);
  2879. }
  2880. get innerHTML() {
  2881. return getStyleElementText(this);
  2882. }
  2883. set innerHTML(value) {
  2884. setStyleElementText(this, value);
  2885. }
  2886. get innerText() {
  2887. return getStyleElementText(this);
  2888. }
  2889. set innerText(value) {
  2890. setStyleElementText(this, value);
  2891. }
  2892. get textContent() {
  2893. return getStyleElementText(this);
  2894. }
  2895. set textContent(value) {
  2896. setStyleElementText(this, value);
  2897. }
  2898. }
  2899. class MockSVGElement extends MockElement {
  2900. // SVGElement properties and methods
  2901. get ownerSVGElement() {
  2902. return null;
  2903. }
  2904. get viewportElement() {
  2905. return null;
  2906. }
  2907. onunload() {
  2908. /**/
  2909. }
  2910. // SVGGeometryElement properties and methods
  2911. get pathLength() {
  2912. return 0;
  2913. }
  2914. isPointInFill(_pt) {
  2915. return false;
  2916. }
  2917. isPointInStroke(_pt) {
  2918. return false;
  2919. }
  2920. getTotalLength() {
  2921. return 0;
  2922. }
  2923. }
  2924. class MockSVGGraphicsElement extends MockSVGElement {
  2925. getBBox(_options) {
  2926. return new MockSVGRect();
  2927. }
  2928. getCTM() {
  2929. return new MockDOMMatrix();
  2930. }
  2931. getScreenCTM() {
  2932. return new MockDOMMatrix();
  2933. }
  2934. }
  2935. class MockSVGSVGElement extends MockSVGGraphicsElement {
  2936. createSVGPoint() {
  2937. return new MockDOMPoint();
  2938. }
  2939. }
  2940. class MockSVGTextContentElement extends MockSVGGraphicsElement {
  2941. getComputedTextLength() {
  2942. return 0;
  2943. }
  2944. }
  2945. class MockBaseElement extends MockHTMLElement {
  2946. constructor(ownerDocument) {
  2947. super(ownerDocument, 'base');
  2948. }
  2949. get href() {
  2950. return fullUrl(this, 'href');
  2951. }
  2952. set href(value) {
  2953. this.setAttribute('href', value);
  2954. }
  2955. }
  2956. class MockTemplateElement extends MockHTMLElement {
  2957. constructor(ownerDocument) {
  2958. super(ownerDocument, 'template');
  2959. this.content = new MockDocumentFragment(ownerDocument);
  2960. }
  2961. get innerHTML() {
  2962. return this.content.innerHTML;
  2963. }
  2964. set innerHTML(html) {
  2965. this.content.innerHTML = html;
  2966. }
  2967. cloneNode(deep) {
  2968. const cloned = new MockTemplateElement(null);
  2969. cloned.attributes = cloneAttributes(this.attributes);
  2970. const styleCssText = this.getAttribute('style');
  2971. if (styleCssText != null && styleCssText.length > 0) {
  2972. cloned.setAttribute('style', styleCssText);
  2973. }
  2974. cloned.content = this.content.cloneNode(deep);
  2975. if (deep) {
  2976. for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
  2977. const clonedChildNode = this.childNodes[i].cloneNode(true);
  2978. cloned.appendChild(clonedChildNode);
  2979. }
  2980. }
  2981. return cloned;
  2982. }
  2983. }
  2984. class MockTitleElement extends MockHTMLElement {
  2985. constructor(ownerDocument) {
  2986. super(ownerDocument, 'title');
  2987. }
  2988. get text() {
  2989. return this.textContent;
  2990. }
  2991. set text(value) {
  2992. this.textContent = value;
  2993. }
  2994. }
  2995. class MockCanvasElement extends MockHTMLElement {
  2996. constructor(ownerDocument) {
  2997. super(ownerDocument, 'canvas');
  2998. }
  2999. getContext() {
  3000. return {
  3001. fillRect() {
  3002. return;
  3003. },
  3004. clearRect() { },
  3005. getImageData: function (_, __, w, h) {
  3006. return {
  3007. data: new Array(w * h * 4),
  3008. };
  3009. },
  3010. putImageData() { },
  3011. createImageData: function () {
  3012. return [];
  3013. },
  3014. setTransform() { },
  3015. drawImage() { },
  3016. save() { },
  3017. fillText() { },
  3018. restore() { },
  3019. beginPath() { },
  3020. moveTo() { },
  3021. lineTo() { },
  3022. closePath() { },
  3023. stroke() { },
  3024. translate() { },
  3025. scale() { },
  3026. rotate() { },
  3027. arc() { },
  3028. fill() { },
  3029. measureText() {
  3030. return { width: 0 };
  3031. },
  3032. transform() { },
  3033. rect() { },
  3034. clip() { },
  3035. };
  3036. }
  3037. }
  3038. function fullUrl(elm, attrName) {
  3039. const val = elm.getAttribute(attrName) || '';
  3040. if (elm.ownerDocument != null) {
  3041. const win = elm.ownerDocument.defaultView;
  3042. if (win != null) {
  3043. const loc = win.location;
  3044. if (loc != null) {
  3045. try {
  3046. const url = new URL(val, loc.href);
  3047. return url.href;
  3048. }
  3049. catch (e) { }
  3050. }
  3051. }
  3052. }
  3053. return val.replace(/\'|\"/g, '').trim();
  3054. }
  3055. function patchPropAttributes(prototype, attrs, defaults = {}) {
  3056. Object.keys(attrs).forEach((propName) => {
  3057. const attr = attrs[propName];
  3058. const defaultValue = defaults[propName];
  3059. if (attr === Boolean) {
  3060. Object.defineProperty(prototype, propName, {
  3061. get() {
  3062. return this.hasAttribute(propName);
  3063. },
  3064. set(value) {
  3065. if (value) {
  3066. this.setAttribute(propName, '');
  3067. }
  3068. else {
  3069. this.removeAttribute(propName);
  3070. }
  3071. },
  3072. });
  3073. }
  3074. else if (attr === Number) {
  3075. Object.defineProperty(prototype, propName, {
  3076. get() {
  3077. const value = this.getAttribute(propName);
  3078. return value ? parseInt(value, 10) : defaultValue === undefined ? 0 : defaultValue;
  3079. },
  3080. set(value) {
  3081. this.setAttribute(propName, value);
  3082. },
  3083. });
  3084. }
  3085. else {
  3086. Object.defineProperty(prototype, propName, {
  3087. get() {
  3088. return this.hasAttribute(propName) ? this.getAttribute(propName) : defaultValue || '';
  3089. },
  3090. set(value) {
  3091. this.setAttribute(propName, value);
  3092. },
  3093. });
  3094. }
  3095. });
  3096. }
  3097. MockElement.prototype.cloneNode = function (deep) {
  3098. // because we're creating elements, which extending specific HTML base classes there
  3099. // is a MockElement circular reference that bundling has trouble dealing with so
  3100. // the fix is to add cloneNode() to MockElement's prototype after the HTML classes
  3101. const cloned = createElement(this.ownerDocument, this.nodeName);
  3102. cloned.attributes = cloneAttributes(this.attributes);
  3103. const styleCssText = this.getAttribute('style');
  3104. if (styleCssText != null && styleCssText.length > 0) {
  3105. cloned.setAttribute('style', styleCssText);
  3106. }
  3107. if (deep) {
  3108. for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
  3109. const clonedChildNode = this.childNodes[i].cloneNode(true);
  3110. cloned.appendChild(clonedChildNode);
  3111. }
  3112. }
  3113. return cloned;
  3114. };
  3115. let sharedDocument;
  3116. function parseHtmlToDocument(html, ownerDocument = null) {
  3117. if (ownerDocument == null) {
  3118. if (sharedDocument == null) {
  3119. sharedDocument = new MockDocument();
  3120. }
  3121. ownerDocument = sharedDocument;
  3122. }
  3123. return parseDocumentUtil(ownerDocument, html);
  3124. }
  3125. function parseHtmlToFragment(html, ownerDocument = null) {
  3126. if (ownerDocument == null) {
  3127. if (sharedDocument == null) {
  3128. sharedDocument = new MockDocument();
  3129. }
  3130. ownerDocument = sharedDocument;
  3131. }
  3132. return parseFragmentUtil(ownerDocument, html);
  3133. }
  3134. const consoleNoop = () => {
  3135. /**/
  3136. };
  3137. function createConsole() {
  3138. return {
  3139. debug: consoleNoop,
  3140. error: consoleNoop,
  3141. info: consoleNoop,
  3142. log: consoleNoop,
  3143. warn: consoleNoop,
  3144. dir: consoleNoop,
  3145. dirxml: consoleNoop,
  3146. table: consoleNoop,
  3147. trace: consoleNoop,
  3148. group: consoleNoop,
  3149. groupCollapsed: consoleNoop,
  3150. groupEnd: consoleNoop,
  3151. clear: consoleNoop,
  3152. count: consoleNoop,
  3153. countReset: consoleNoop,
  3154. assert: consoleNoop,
  3155. profile: consoleNoop,
  3156. profileEnd: consoleNoop,
  3157. time: consoleNoop,
  3158. timeLog: consoleNoop,
  3159. timeEnd: consoleNoop,
  3160. timeStamp: consoleNoop,
  3161. context: consoleNoop,
  3162. memory: consoleNoop,
  3163. };
  3164. }
  3165. class MockHeaders {
  3166. constructor(init) {
  3167. this._values = [];
  3168. if (typeof init === 'object') {
  3169. if (typeof init[Symbol.iterator] === 'function') {
  3170. const kvs = [];
  3171. for (const kv of init) {
  3172. if (typeof kv[Symbol.iterator] === 'function') {
  3173. kvs.push([...kv]);
  3174. }
  3175. }
  3176. for (const kv of kvs) {
  3177. this.append(kv[0], kv[1]);
  3178. }
  3179. }
  3180. else {
  3181. for (const key in init) {
  3182. this.append(key, init[key]);
  3183. }
  3184. }
  3185. }
  3186. }
  3187. append(key, value) {
  3188. this._values.push([key, value + '']);
  3189. }
  3190. delete(key) {
  3191. key = key.toLowerCase();
  3192. for (let i = this._values.length - 1; i >= 0; i--) {
  3193. if (this._values[i][0].toLowerCase() === key) {
  3194. this._values.splice(i, 1);
  3195. }
  3196. }
  3197. }
  3198. entries() {
  3199. const entries = [];
  3200. for (const kv of this.keys()) {
  3201. entries.push([kv, this.get(kv)]);
  3202. }
  3203. let index = -1;
  3204. return {
  3205. next() {
  3206. index++;
  3207. return {
  3208. value: entries[index],
  3209. done: !entries[index],
  3210. };
  3211. },
  3212. [Symbol.iterator]() {
  3213. return this;
  3214. },
  3215. };
  3216. }
  3217. forEach(cb) {
  3218. for (const kv of this.entries()) {
  3219. cb(kv[1], kv[0]);
  3220. }
  3221. }
  3222. get(key) {
  3223. const rtn = [];
  3224. key = key.toLowerCase();
  3225. for (const kv of this._values) {
  3226. if (kv[0].toLowerCase() === key) {
  3227. rtn.push(kv[1]);
  3228. }
  3229. }
  3230. return rtn.length > 0 ? rtn.join(', ') : null;
  3231. }
  3232. has(key) {
  3233. key = key.toLowerCase();
  3234. for (const kv of this._values) {
  3235. if (kv[0].toLowerCase() === key) {
  3236. return true;
  3237. }
  3238. }
  3239. return false;
  3240. }
  3241. keys() {
  3242. const keys = [];
  3243. for (const kv of this._values) {
  3244. const key = kv[0].toLowerCase();
  3245. if (!keys.includes(key)) {
  3246. keys.push(key);
  3247. }
  3248. }
  3249. let index = -1;
  3250. return {
  3251. next() {
  3252. index++;
  3253. return {
  3254. value: keys[index],
  3255. done: !keys[index],
  3256. };
  3257. },
  3258. [Symbol.iterator]() {
  3259. return this;
  3260. },
  3261. };
  3262. }
  3263. set(key, value) {
  3264. for (const kv of this._values) {
  3265. if (kv[0].toLowerCase() === key.toLowerCase()) {
  3266. kv[1] = value + '';
  3267. return;
  3268. }
  3269. }
  3270. this.append(key, value);
  3271. }
  3272. values() {
  3273. const values = this._values;
  3274. let index = -1;
  3275. return {
  3276. next() {
  3277. index++;
  3278. const done = !values[index];
  3279. return {
  3280. value: done ? undefined : values[index][1],
  3281. done,
  3282. };
  3283. },
  3284. [Symbol.iterator]() {
  3285. return this;
  3286. },
  3287. };
  3288. }
  3289. [Symbol.iterator]() {
  3290. return this.entries();
  3291. }
  3292. }
  3293. class MockDOMParser {
  3294. parseFromString(htmlToParse, mimeType) {
  3295. if (mimeType !== 'text/html') {
  3296. console.error('XML parsing not implemented yet, continuing as html');
  3297. }
  3298. return parseHtmlToDocument(htmlToParse);
  3299. }
  3300. }
  3301. class MockRequest {
  3302. constructor(input, init = {}) {
  3303. this._method = 'GET';
  3304. this._url = '/';
  3305. this.bodyUsed = false;
  3306. this.cache = 'default';
  3307. this.credentials = 'same-origin';
  3308. this.integrity = '';
  3309. this.keepalive = false;
  3310. this.mode = 'cors';
  3311. this.redirect = 'follow';
  3312. this.referrer = 'about:client';
  3313. this.referrerPolicy = '';
  3314. if (typeof input === 'string') {
  3315. this.url = input;
  3316. }
  3317. else if (input) {
  3318. Object.assign(this, input);
  3319. this.headers = new MockHeaders(input.headers);
  3320. }
  3321. Object.assign(this, init);
  3322. if (init.headers) {
  3323. this.headers = new MockHeaders(init.headers);
  3324. }
  3325. if (!this.headers) {
  3326. this.headers = new MockHeaders();
  3327. }
  3328. }
  3329. get url() {
  3330. if (typeof this._url === 'string') {
  3331. return new URL(this._url, location.href).href;
  3332. }
  3333. return new URL('/', location.href).href;
  3334. }
  3335. set url(value) {
  3336. this._url = value;
  3337. }
  3338. get method() {
  3339. if (typeof this._method === 'string') {
  3340. return this._method.toUpperCase();
  3341. }
  3342. return 'GET';
  3343. }
  3344. set method(value) {
  3345. this._method = value;
  3346. }
  3347. clone() {
  3348. const clone = { ...this };
  3349. clone.headers = new MockHeaders(this.headers);
  3350. return new MockRequest(clone);
  3351. }
  3352. }
  3353. class MockResponse {
  3354. constructor(body, init = {}) {
  3355. this.ok = true;
  3356. this.status = 200;
  3357. this.statusText = '';
  3358. this.type = 'default';
  3359. this.url = '';
  3360. this._body = body;
  3361. if (init) {
  3362. Object.assign(this, init);
  3363. }
  3364. this.headers = new MockHeaders(init.headers);
  3365. }
  3366. async json() {
  3367. return JSON.parse(this._body);
  3368. }
  3369. async text() {
  3370. return this._body;
  3371. }
  3372. clone() {
  3373. const initClone = { ...this };
  3374. initClone.headers = new MockHeaders(this.headers);
  3375. return new MockResponse(this._body, initClone);
  3376. }
  3377. }
  3378. function setupGlobal(gbl) {
  3379. if (gbl.window == null) {
  3380. const win = (gbl.window = new MockWindow());
  3381. WINDOW_FUNCTIONS.forEach((fnName) => {
  3382. if (!(fnName in gbl)) {
  3383. gbl[fnName] = win[fnName].bind(win);
  3384. }
  3385. });
  3386. WINDOW_PROPS.forEach((propName) => {
  3387. if (!(propName in gbl)) {
  3388. Object.defineProperty(gbl, propName, {
  3389. get() {
  3390. return win[propName];
  3391. },
  3392. set(val) {
  3393. win[propName] = val;
  3394. },
  3395. configurable: true,
  3396. enumerable: true,
  3397. });
  3398. }
  3399. });
  3400. GLOBAL_CONSTRUCTORS.forEach(([cstrName]) => {
  3401. gbl[cstrName] = win[cstrName];
  3402. });
  3403. }
  3404. return gbl.window;
  3405. }
  3406. function teardownGlobal(gbl) {
  3407. const win = gbl.window;
  3408. if (win && typeof win.close === 'function') {
  3409. win.close();
  3410. }
  3411. }
  3412. function patchWindow(winToBePatched) {
  3413. const mockWin = new MockWindow(false);
  3414. WINDOW_FUNCTIONS.forEach((fnName) => {
  3415. if (typeof winToBePatched[fnName] !== 'function') {
  3416. winToBePatched[fnName] = mockWin[fnName].bind(mockWin);
  3417. }
  3418. });
  3419. WINDOW_PROPS.forEach((propName) => {
  3420. if (winToBePatched === undefined) {
  3421. Object.defineProperty(winToBePatched, propName, {
  3422. get() {
  3423. return mockWin[propName];
  3424. },
  3425. set(val) {
  3426. mockWin[propName] = val;
  3427. },
  3428. configurable: true,
  3429. enumerable: true,
  3430. });
  3431. }
  3432. });
  3433. }
  3434. function addGlobalsToWindowPrototype(mockWinPrototype) {
  3435. GLOBAL_CONSTRUCTORS.forEach(([cstrName, Cstr]) => {
  3436. Object.defineProperty(mockWinPrototype, cstrName, {
  3437. get() {
  3438. return this['__' + cstrName] || Cstr;
  3439. },
  3440. set(cstr) {
  3441. this['__' + cstrName] = cstr;
  3442. },
  3443. configurable: true,
  3444. enumerable: true,
  3445. });
  3446. });
  3447. }
  3448. const WINDOW_FUNCTIONS = [
  3449. 'addEventListener',
  3450. 'alert',
  3451. 'blur',
  3452. 'cancelAnimationFrame',
  3453. 'cancelIdleCallback',
  3454. 'clearInterval',
  3455. 'clearTimeout',
  3456. 'close',
  3457. 'confirm',
  3458. 'dispatchEvent',
  3459. 'focus',
  3460. 'getComputedStyle',
  3461. 'matchMedia',
  3462. 'open',
  3463. 'prompt',
  3464. 'removeEventListener',
  3465. 'requestAnimationFrame',
  3466. 'requestIdleCallback',
  3467. 'URL',
  3468. ];
  3469. const WINDOW_PROPS = [
  3470. 'customElements',
  3471. 'devicePixelRatio',
  3472. 'document',
  3473. 'history',
  3474. 'innerHeight',
  3475. 'innerWidth',
  3476. 'localStorage',
  3477. 'location',
  3478. 'navigator',
  3479. 'pageXOffset',
  3480. 'pageYOffset',
  3481. 'performance',
  3482. 'screenLeft',
  3483. 'screenTop',
  3484. 'screenX',
  3485. 'screenY',
  3486. 'scrollX',
  3487. 'scrollY',
  3488. 'sessionStorage',
  3489. 'CSS',
  3490. 'CustomEvent',
  3491. 'Event',
  3492. 'Element',
  3493. 'HTMLElement',
  3494. 'Node',
  3495. 'NodeList',
  3496. 'FocusEvent',
  3497. 'KeyboardEvent',
  3498. 'MouseEvent',
  3499. ];
  3500. const GLOBAL_CONSTRUCTORS = [
  3501. ['CustomEvent', MockCustomEvent],
  3502. ['Event', MockEvent],
  3503. ['Headers', MockHeaders],
  3504. ['FocusEvent', MockFocusEvent],
  3505. ['KeyboardEvent', MockKeyboardEvent],
  3506. ['MouseEvent', MockMouseEvent],
  3507. ['Request', MockRequest],
  3508. ['Response', MockResponse],
  3509. ['DOMParser', MockDOMParser],
  3510. ['HTMLAnchorElement', MockAnchorElement],
  3511. ['HTMLBaseElement', MockBaseElement],
  3512. ['HTMLButtonElement', MockButtonElement],
  3513. ['HTMLCanvasElement', MockCanvasElement],
  3514. ['HTMLFormElement', MockFormElement],
  3515. ['HTMLImageElement', MockImageElement],
  3516. ['HTMLInputElement', MockInputElement],
  3517. ['HTMLLinkElement', MockLinkElement],
  3518. ['HTMLMetaElement', MockMetaElement],
  3519. ['HTMLScriptElement', MockScriptElement],
  3520. ['HTMLStyleElement', MockStyleElement],
  3521. ['HTMLTemplateElement', MockTemplateElement],
  3522. ['HTMLTitleElement', MockTitleElement],
  3523. ];
  3524. class MockHistory {
  3525. constructor() {
  3526. this.items = [];
  3527. }
  3528. get length() {
  3529. return this.items.length;
  3530. }
  3531. back() {
  3532. this.go(-1);
  3533. }
  3534. forward() {
  3535. this.go(1);
  3536. }
  3537. go(_value) {
  3538. //
  3539. }
  3540. pushState(_state, _title, _url) {
  3541. //
  3542. }
  3543. replaceState(_state, _title, _url) {
  3544. //
  3545. }
  3546. }
  3547. class MockIntersectionObserver {
  3548. constructor() {
  3549. /**/
  3550. }
  3551. disconnect() {
  3552. /**/
  3553. }
  3554. observe() {
  3555. /**/
  3556. }
  3557. takeRecords() {
  3558. return [];
  3559. }
  3560. unobserve() {
  3561. /**/
  3562. }
  3563. }
  3564. class MockLocation {
  3565. constructor() {
  3566. this.ancestorOrigins = null;
  3567. this.protocol = '';
  3568. this.host = '';
  3569. this.hostname = '';
  3570. this.port = '';
  3571. this.pathname = '';
  3572. this.search = '';
  3573. this.hash = '';
  3574. this.username = '';
  3575. this.password = '';
  3576. this.origin = '';
  3577. this._href = '';
  3578. }
  3579. get href() {
  3580. return this._href;
  3581. }
  3582. set href(value) {
  3583. const url = new URL(value, 'http://mockdoc.stenciljs.com');
  3584. this._href = url.href;
  3585. this.protocol = url.protocol;
  3586. this.host = url.host;
  3587. this.hostname = url.hostname;
  3588. this.port = url.port;
  3589. this.pathname = url.pathname;
  3590. this.search = url.search;
  3591. this.hash = url.hash;
  3592. this.username = url.username;
  3593. this.password = url.password;
  3594. this.origin = url.origin;
  3595. }
  3596. assign(_url) {
  3597. //
  3598. }
  3599. reload(_forcedReload) {
  3600. //
  3601. }
  3602. replace(_url) {
  3603. //
  3604. }
  3605. toString() {
  3606. return this.href;
  3607. }
  3608. }
  3609. class MockNavigator {
  3610. constructor() {
  3611. this.appCodeName = 'MockNavigator';
  3612. this.appName = 'MockNavigator';
  3613. this.appVersion = 'MockNavigator';
  3614. this.platform = 'MockNavigator';
  3615. this.userAgent = 'MockNavigator';
  3616. }
  3617. }
  3618. /**
  3619. * https://developer.mozilla.org/en-US/docs/Web/API/Performance
  3620. */
  3621. class MockPerformance {
  3622. constructor() {
  3623. this.timeOrigin = Date.now();
  3624. this.eventCounts = new Map();
  3625. }
  3626. addEventListener() {
  3627. //
  3628. }
  3629. clearMarks() {
  3630. //
  3631. }
  3632. clearMeasures() {
  3633. //
  3634. }
  3635. clearResourceTimings() {
  3636. //
  3637. }
  3638. dispatchEvent() {
  3639. return true;
  3640. }
  3641. getEntries() {
  3642. return [];
  3643. }
  3644. getEntriesByName() {
  3645. return [];
  3646. }
  3647. getEntriesByType() {
  3648. return [];
  3649. }
  3650. // Stencil's implementation of `mark` is non-compliant with the `Performance` interface. Because Stencil will
  3651. // instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
  3652. // type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
  3653. // associated errors returned by the type checker)
  3654. // @ts-ignore
  3655. mark() {
  3656. //
  3657. }
  3658. // Stencil's implementation of `measure` is non-compliant with the `Performance` interface. Because Stencil will
  3659. // instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
  3660. // type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
  3661. // associated errors returned by the type checker)
  3662. // @ts-ignore
  3663. measure() {
  3664. //
  3665. }
  3666. get navigation() {
  3667. return {};
  3668. }
  3669. now() {
  3670. return Date.now() - this.timeOrigin;
  3671. }
  3672. get onresourcetimingbufferfull() {
  3673. return null;
  3674. }
  3675. removeEventListener() {
  3676. //
  3677. }
  3678. setResourceTimingBufferSize() {
  3679. //
  3680. }
  3681. get timing() {
  3682. return {};
  3683. }
  3684. toJSON() {
  3685. //
  3686. }
  3687. }
  3688. function resetPerformance(perf) {
  3689. if (perf != null) {
  3690. try {
  3691. perf.timeOrigin = Date.now();
  3692. }
  3693. catch (e) { }
  3694. }
  3695. }
  3696. class MockStorage {
  3697. constructor() {
  3698. this.items = new Map();
  3699. }
  3700. key(_value) {
  3701. //
  3702. }
  3703. getItem(key) {
  3704. key = String(key);
  3705. if (this.items.has(key)) {
  3706. return this.items.get(key);
  3707. }
  3708. return null;
  3709. }
  3710. setItem(key, value) {
  3711. if (value == null) {
  3712. value = 'null';
  3713. }
  3714. this.items.set(String(key), String(value));
  3715. }
  3716. removeItem(key) {
  3717. this.items.delete(String(key));
  3718. }
  3719. clear() {
  3720. this.items.clear();
  3721. }
  3722. }
  3723. const nativeClearInterval = clearInterval;
  3724. const nativeClearTimeout = clearTimeout;
  3725. const nativeSetInterval = setInterval;
  3726. const nativeSetTimeout = setTimeout;
  3727. const nativeURL = URL;
  3728. class MockWindow {
  3729. constructor(html = null) {
  3730. if (html !== false) {
  3731. this.document = new MockDocument(html, this);
  3732. }
  3733. else {
  3734. this.document = null;
  3735. }
  3736. this.performance = new MockPerformance();
  3737. this.customElements = new MockCustomElementRegistry(this);
  3738. this.console = createConsole();
  3739. resetWindowDefaults(this);
  3740. resetWindowDimensions(this);
  3741. }
  3742. addEventListener(type, handler) {
  3743. addEventListener(this, type, handler);
  3744. }
  3745. alert(msg) {
  3746. if (this.console) {
  3747. this.console.debug(msg);
  3748. }
  3749. else {
  3750. console.debug(msg);
  3751. }
  3752. }
  3753. blur() {
  3754. /**/
  3755. }
  3756. cancelAnimationFrame(id) {
  3757. this.__clearTimeout(id);
  3758. }
  3759. cancelIdleCallback(id) {
  3760. this.__clearTimeout(id);
  3761. }
  3762. get CharacterData() {
  3763. if (this.__charDataCstr == null) {
  3764. const ownerDocument = this.document;
  3765. this.__charDataCstr = class extends MockNode {
  3766. constructor() {
  3767. super(ownerDocument, 0, 'test', '');
  3768. throw new Error('Illegal constructor: cannot construct CharacterData');
  3769. }
  3770. };
  3771. }
  3772. return this.__charDataCstr;
  3773. }
  3774. set CharacterData(charDataCstr) {
  3775. this.__charDataCstr = charDataCstr;
  3776. }
  3777. clearInterval(id) {
  3778. this.__clearInterval(id);
  3779. }
  3780. clearTimeout(id) {
  3781. this.__clearTimeout(id);
  3782. }
  3783. close() {
  3784. resetWindow(this);
  3785. }
  3786. confirm() {
  3787. return false;
  3788. }
  3789. get CSS() {
  3790. return {
  3791. supports: () => true,
  3792. };
  3793. }
  3794. get Document() {
  3795. if (this.__docCstr == null) {
  3796. const win = this;
  3797. this.__docCstr = class extends MockDocument {
  3798. constructor() {
  3799. super(false, win);
  3800. throw new Error('Illegal constructor: cannot construct Document');
  3801. }
  3802. };
  3803. }
  3804. return this.__docCstr;
  3805. }
  3806. set Document(docCstr) {
  3807. this.__docCstr = docCstr;
  3808. }
  3809. get DocumentFragment() {
  3810. if (this.__docFragCstr == null) {
  3811. const ownerDocument = this.document;
  3812. this.__docFragCstr = class extends MockDocumentFragment {
  3813. constructor() {
  3814. super(ownerDocument);
  3815. throw new Error('Illegal constructor: cannot construct DocumentFragment');
  3816. }
  3817. };
  3818. }
  3819. return this.__docFragCstr;
  3820. }
  3821. set DocumentFragment(docFragCstr) {
  3822. this.__docFragCstr = docFragCstr;
  3823. }
  3824. get DocumentType() {
  3825. if (this.__docTypeCstr == null) {
  3826. const ownerDocument = this.document;
  3827. this.__docTypeCstr = class extends MockNode {
  3828. constructor() {
  3829. super(ownerDocument, 0, 'test', '');
  3830. throw new Error('Illegal constructor: cannot construct DocumentType');
  3831. }
  3832. };
  3833. }
  3834. return this.__docTypeCstr;
  3835. }
  3836. set DocumentType(docTypeCstr) {
  3837. this.__docTypeCstr = docTypeCstr;
  3838. }
  3839. get DOMTokenList() {
  3840. if (this.__domTokenListCstr == null) {
  3841. this.__domTokenListCstr = class MockDOMTokenList {
  3842. };
  3843. }
  3844. return this.__domTokenListCstr;
  3845. }
  3846. set DOMTokenList(domTokenListCstr) {
  3847. this.__domTokenListCstr = domTokenListCstr;
  3848. }
  3849. dispatchEvent(ev) {
  3850. return dispatchEvent(this, ev);
  3851. }
  3852. get Element() {
  3853. if (this.__elementCstr == null) {
  3854. const ownerDocument = this.document;
  3855. this.__elementCstr = class extends MockElement {
  3856. constructor() {
  3857. super(ownerDocument, '');
  3858. throw new Error('Illegal constructor: cannot construct Element');
  3859. }
  3860. };
  3861. }
  3862. return this.__elementCstr;
  3863. }
  3864. fetch(input, init) {
  3865. if (typeof fetch === 'function') {
  3866. return fetch(input, init);
  3867. }
  3868. throw new Error(`fetch() not implemented`);
  3869. }
  3870. focus() {
  3871. /**/
  3872. }
  3873. getComputedStyle(_) {
  3874. return {
  3875. cssText: '',
  3876. length: 0,
  3877. parentRule: null,
  3878. getPropertyPriority() {
  3879. return null;
  3880. },
  3881. getPropertyValue() {
  3882. return '';
  3883. },
  3884. item() {
  3885. return null;
  3886. },
  3887. removeProperty() {
  3888. return null;
  3889. },
  3890. setProperty() {
  3891. return null;
  3892. },
  3893. };
  3894. }
  3895. get globalThis() {
  3896. return this;
  3897. }
  3898. get history() {
  3899. if (this.__history == null) {
  3900. this.__history = new MockHistory();
  3901. }
  3902. return this.__history;
  3903. }
  3904. set history(hsty) {
  3905. this.__history = hsty;
  3906. }
  3907. get JSON() {
  3908. return JSON;
  3909. }
  3910. get HTMLElement() {
  3911. if (this.__htmlElementCstr == null) {
  3912. const ownerDocument = this.document;
  3913. this.__htmlElementCstr = class extends MockHTMLElement {
  3914. constructor() {
  3915. super(ownerDocument, '');
  3916. const observedAttributes = this.constructor.observedAttributes;
  3917. if (Array.isArray(observedAttributes) && typeof this.attributeChangedCallback === 'function') {
  3918. observedAttributes.forEach((attrName) => {
  3919. const attrValue = this.getAttribute(attrName);
  3920. if (attrValue != null) {
  3921. this.attributeChangedCallback(attrName, null, attrValue);
  3922. }
  3923. });
  3924. }
  3925. }
  3926. };
  3927. }
  3928. return this.__htmlElementCstr;
  3929. }
  3930. set HTMLElement(htmlElementCstr) {
  3931. this.__htmlElementCstr = htmlElementCstr;
  3932. }
  3933. get IntersectionObserver() {
  3934. return MockIntersectionObserver;
  3935. }
  3936. get localStorage() {
  3937. if (this.__localStorage == null) {
  3938. this.__localStorage = new MockStorage();
  3939. }
  3940. return this.__localStorage;
  3941. }
  3942. set localStorage(locStorage) {
  3943. this.__localStorage = locStorage;
  3944. }
  3945. get location() {
  3946. if (this.__location == null) {
  3947. this.__location = new MockLocation();
  3948. }
  3949. return this.__location;
  3950. }
  3951. set location(val) {
  3952. if (typeof val === 'string') {
  3953. if (this.__location == null) {
  3954. this.__location = new MockLocation();
  3955. }
  3956. this.__location.href = val;
  3957. }
  3958. else {
  3959. this.__location = val;
  3960. }
  3961. }
  3962. matchMedia() {
  3963. return {
  3964. matches: false,
  3965. };
  3966. }
  3967. get Node() {
  3968. if (this.__nodeCstr == null) {
  3969. const ownerDocument = this.document;
  3970. this.__nodeCstr = class extends MockNode {
  3971. constructor() {
  3972. super(ownerDocument, 0, 'test', '');
  3973. throw new Error('Illegal constructor: cannot construct Node');
  3974. }
  3975. };
  3976. }
  3977. return this.__nodeCstr;
  3978. }
  3979. get NodeList() {
  3980. if (this.__nodeListCstr == null) {
  3981. const ownerDocument = this.document;
  3982. this.__nodeListCstr = class extends MockNodeList {
  3983. constructor() {
  3984. super(ownerDocument, [], 0);
  3985. throw new Error('Illegal constructor: cannot construct NodeList');
  3986. }
  3987. };
  3988. }
  3989. return this.__nodeListCstr;
  3990. }
  3991. get navigator() {
  3992. if (this.__navigator == null) {
  3993. this.__navigator = new MockNavigator();
  3994. }
  3995. return this.__navigator;
  3996. }
  3997. set navigator(nav) {
  3998. this.__navigator = nav;
  3999. }
  4000. get parent() {
  4001. return null;
  4002. }
  4003. prompt() {
  4004. return '';
  4005. }
  4006. open() {
  4007. return null;
  4008. }
  4009. get origin() {
  4010. return this.location.origin;
  4011. }
  4012. removeEventListener(type, handler) {
  4013. removeEventListener(this, type, handler);
  4014. }
  4015. requestAnimationFrame(callback) {
  4016. return this.setTimeout(() => {
  4017. callback(Date.now());
  4018. }, 0);
  4019. }
  4020. requestIdleCallback(callback) {
  4021. return this.setTimeout(() => {
  4022. callback({
  4023. didTimeout: false,
  4024. timeRemaining: () => 0,
  4025. });
  4026. }, 0);
  4027. }
  4028. scroll(_x, _y) {
  4029. /**/
  4030. }
  4031. scrollBy(_x, _y) {
  4032. /**/
  4033. }
  4034. scrollTo(_x, _y) {
  4035. /**/
  4036. }
  4037. get self() {
  4038. return this;
  4039. }
  4040. get sessionStorage() {
  4041. if (this.__sessionStorage == null) {
  4042. this.__sessionStorage = new MockStorage();
  4043. }
  4044. return this.__sessionStorage;
  4045. }
  4046. set sessionStorage(locStorage) {
  4047. this.__sessionStorage = locStorage;
  4048. }
  4049. setInterval(callback, ms, ...args) {
  4050. if (this.__timeouts == null) {
  4051. this.__timeouts = new Set();
  4052. }
  4053. ms = Math.min(ms, this.__maxTimeout);
  4054. if (this.__allowInterval) {
  4055. const intervalId = this.__setInterval(() => {
  4056. if (this.__timeouts) {
  4057. this.__timeouts.delete(intervalId);
  4058. try {
  4059. callback(...args);
  4060. }
  4061. catch (e) {
  4062. if (this.console) {
  4063. this.console.error(e);
  4064. }
  4065. else {
  4066. console.error(e);
  4067. }
  4068. }
  4069. }
  4070. }, ms);
  4071. if (this.__timeouts) {
  4072. this.__timeouts.add(intervalId);
  4073. }
  4074. return intervalId;
  4075. }
  4076. const timeoutId = this.__setTimeout(() => {
  4077. if (this.__timeouts) {
  4078. this.__timeouts.delete(timeoutId);
  4079. try {
  4080. callback(...args);
  4081. }
  4082. catch (e) {
  4083. if (this.console) {
  4084. this.console.error(e);
  4085. }
  4086. else {
  4087. console.error(e);
  4088. }
  4089. }
  4090. }
  4091. }, ms);
  4092. if (this.__timeouts) {
  4093. this.__timeouts.add(timeoutId);
  4094. }
  4095. return timeoutId;
  4096. }
  4097. setTimeout(callback, ms, ...args) {
  4098. if (this.__timeouts == null) {
  4099. this.__timeouts = new Set();
  4100. }
  4101. ms = Math.min(ms, this.__maxTimeout);
  4102. const timeoutId = this.__setTimeout(() => {
  4103. if (this.__timeouts) {
  4104. this.__timeouts.delete(timeoutId);
  4105. try {
  4106. callback(...args);
  4107. }
  4108. catch (e) {
  4109. if (this.console) {
  4110. this.console.error(e);
  4111. }
  4112. else {
  4113. console.error(e);
  4114. }
  4115. }
  4116. }
  4117. }, ms);
  4118. if (this.__timeouts) {
  4119. this.__timeouts.add(timeoutId);
  4120. }
  4121. return timeoutId;
  4122. }
  4123. get top() {
  4124. return this;
  4125. }
  4126. get window() {
  4127. return this;
  4128. }
  4129. onanimationstart() {
  4130. /**/
  4131. }
  4132. onanimationend() {
  4133. /**/
  4134. }
  4135. onanimationiteration() {
  4136. /**/
  4137. }
  4138. onabort() {
  4139. /**/
  4140. }
  4141. onauxclick() {
  4142. /**/
  4143. }
  4144. onbeforecopy() {
  4145. /**/
  4146. }
  4147. onbeforecut() {
  4148. /**/
  4149. }
  4150. onbeforepaste() {
  4151. /**/
  4152. }
  4153. onblur() {
  4154. /**/
  4155. }
  4156. oncancel() {
  4157. /**/
  4158. }
  4159. oncanplay() {
  4160. /**/
  4161. }
  4162. oncanplaythrough() {
  4163. /**/
  4164. }
  4165. onchange() {
  4166. /**/
  4167. }
  4168. onclick() {
  4169. /**/
  4170. }
  4171. onclose() {
  4172. /**/
  4173. }
  4174. oncontextmenu() {
  4175. /**/
  4176. }
  4177. oncopy() {
  4178. /**/
  4179. }
  4180. oncuechange() {
  4181. /**/
  4182. }
  4183. oncut() {
  4184. /**/
  4185. }
  4186. ondblclick() {
  4187. /**/
  4188. }
  4189. ondrag() {
  4190. /**/
  4191. }
  4192. ondragend() {
  4193. /**/
  4194. }
  4195. ondragenter() {
  4196. /**/
  4197. }
  4198. ondragleave() {
  4199. /**/
  4200. }
  4201. ondragover() {
  4202. /**/
  4203. }
  4204. ondragstart() {
  4205. /**/
  4206. }
  4207. ondrop() {
  4208. /**/
  4209. }
  4210. ondurationchange() {
  4211. /**/
  4212. }
  4213. onemptied() {
  4214. /**/
  4215. }
  4216. onended() {
  4217. /**/
  4218. }
  4219. onerror() {
  4220. /**/
  4221. }
  4222. onfocus() {
  4223. /**/
  4224. }
  4225. onfocusin() {
  4226. /**/
  4227. }
  4228. onfocusout() {
  4229. /**/
  4230. }
  4231. onformdata() {
  4232. /**/
  4233. }
  4234. onfullscreenchange() {
  4235. /**/
  4236. }
  4237. onfullscreenerror() {
  4238. /**/
  4239. }
  4240. ongotpointercapture() {
  4241. /**/
  4242. }
  4243. oninput() {
  4244. /**/
  4245. }
  4246. oninvalid() {
  4247. /**/
  4248. }
  4249. onkeydown() {
  4250. /**/
  4251. }
  4252. onkeypress() {
  4253. /**/
  4254. }
  4255. onkeyup() {
  4256. /**/
  4257. }
  4258. onload() {
  4259. /**/
  4260. }
  4261. onloadeddata() {
  4262. /**/
  4263. }
  4264. onloadedmetadata() {
  4265. /**/
  4266. }
  4267. onloadstart() {
  4268. /**/
  4269. }
  4270. onlostpointercapture() {
  4271. /**/
  4272. }
  4273. onmousedown() {
  4274. /**/
  4275. }
  4276. onmouseenter() {
  4277. /**/
  4278. }
  4279. onmouseleave() {
  4280. /**/
  4281. }
  4282. onmousemove() {
  4283. /**/
  4284. }
  4285. onmouseout() {
  4286. /**/
  4287. }
  4288. onmouseover() {
  4289. /**/
  4290. }
  4291. onmouseup() {
  4292. /**/
  4293. }
  4294. onmousewheel() {
  4295. /**/
  4296. }
  4297. onpaste() {
  4298. /**/
  4299. }
  4300. onpause() {
  4301. /**/
  4302. }
  4303. onplay() {
  4304. /**/
  4305. }
  4306. onplaying() {
  4307. /**/
  4308. }
  4309. onpointercancel() {
  4310. /**/
  4311. }
  4312. onpointerdown() {
  4313. /**/
  4314. }
  4315. onpointerenter() {
  4316. /**/
  4317. }
  4318. onpointerleave() {
  4319. /**/
  4320. }
  4321. onpointermove() {
  4322. /**/
  4323. }
  4324. onpointerout() {
  4325. /**/
  4326. }
  4327. onpointerover() {
  4328. /**/
  4329. }
  4330. onpointerup() {
  4331. /**/
  4332. }
  4333. onprogress() {
  4334. /**/
  4335. }
  4336. onratechange() {
  4337. /**/
  4338. }
  4339. onreset() {
  4340. /**/
  4341. }
  4342. onresize() {
  4343. /**/
  4344. }
  4345. onscroll() {
  4346. /**/
  4347. }
  4348. onsearch() {
  4349. /**/
  4350. }
  4351. onseeked() {
  4352. /**/
  4353. }
  4354. onseeking() {
  4355. /**/
  4356. }
  4357. onselect() {
  4358. /**/
  4359. }
  4360. onselectstart() {
  4361. /**/
  4362. }
  4363. onstalled() {
  4364. /**/
  4365. }
  4366. onsubmit() {
  4367. /**/
  4368. }
  4369. onsuspend() {
  4370. /**/
  4371. }
  4372. ontimeupdate() {
  4373. /**/
  4374. }
  4375. ontoggle() {
  4376. /**/
  4377. }
  4378. onvolumechange() {
  4379. /**/
  4380. }
  4381. onwaiting() {
  4382. /**/
  4383. }
  4384. onwebkitfullscreenchange() {
  4385. /**/
  4386. }
  4387. onwebkitfullscreenerror() {
  4388. /**/
  4389. }
  4390. onwheel() {
  4391. /**/
  4392. }
  4393. }
  4394. addGlobalsToWindowPrototype(MockWindow.prototype);
  4395. function resetWindowDefaults(win) {
  4396. win.__clearInterval = nativeClearInterval;
  4397. win.__clearTimeout = nativeClearTimeout;
  4398. win.__setInterval = nativeSetInterval;
  4399. win.__setTimeout = nativeSetTimeout;
  4400. win.__maxTimeout = 30000;
  4401. win.__allowInterval = true;
  4402. win.URL = nativeURL;
  4403. }
  4404. function cloneWindow(srcWin, opts = {}) {
  4405. if (srcWin == null) {
  4406. return null;
  4407. }
  4408. const clonedWin = new MockWindow(false);
  4409. if (!opts.customElementProxy) {
  4410. // TODO(STENCIL-345) - Evaluate reconciling MockWindow, Window differences
  4411. // @ts-ignore
  4412. srcWin.customElements = null;
  4413. }
  4414. if (srcWin.document != null) {
  4415. const clonedDoc = new MockDocument(false, clonedWin);
  4416. clonedWin.document = clonedDoc;
  4417. clonedDoc.documentElement = srcWin.document.documentElement.cloneNode(true);
  4418. }
  4419. else {
  4420. clonedWin.document = new MockDocument(null, clonedWin);
  4421. }
  4422. return clonedWin;
  4423. }
  4424. function cloneDocument(srcDoc) {
  4425. if (srcDoc == null) {
  4426. return null;
  4427. }
  4428. const dstWin = cloneWindow(srcDoc.defaultView);
  4429. return dstWin.document;
  4430. }
  4431. // TODO(STENCIL-345) - Evaluate reconciling MockWindow, Window differences
  4432. /**
  4433. * Constrain setTimeout() to 1ms, but still async. Also
  4434. * only allow setInterval() to fire once, also constrained to 1ms.
  4435. * @param win the mock window instance to update
  4436. */
  4437. function constrainTimeouts(win) {
  4438. win.__allowInterval = false;
  4439. win.__maxTimeout = 0;
  4440. }
  4441. function resetWindow(win) {
  4442. if (win != null) {
  4443. if (win.__timeouts) {
  4444. win.__timeouts.forEach((timeoutId) => {
  4445. nativeClearInterval(timeoutId);
  4446. nativeClearTimeout(timeoutId);
  4447. });
  4448. win.__timeouts.clear();
  4449. }
  4450. if (win.customElements && win.customElements.clear) {
  4451. win.customElements.clear();
  4452. }
  4453. resetDocument(win.document);
  4454. resetPerformance(win.performance);
  4455. for (const key in win) {
  4456. if (win.hasOwnProperty(key) && key !== 'document' && key !== 'performance' && key !== 'customElements') {
  4457. delete win[key];
  4458. }
  4459. }
  4460. resetWindowDefaults(win);
  4461. resetWindowDimensions(win);
  4462. resetEventListeners(win);
  4463. if (win.document != null) {
  4464. try {
  4465. win.document.defaultView = win;
  4466. }
  4467. catch (e) { }
  4468. }
  4469. // ensure we don't hold onto nodeFetch values
  4470. win.fetch = null;
  4471. win.Headers = null;
  4472. win.Request = null;
  4473. win.Response = null;
  4474. win.FetchError = null;
  4475. }
  4476. }
  4477. function resetWindowDimensions(win) {
  4478. try {
  4479. win.devicePixelRatio = 1;
  4480. win.innerHeight = 768;
  4481. win.innerWidth = 1366;
  4482. win.pageXOffset = 0;
  4483. win.pageYOffset = 0;
  4484. win.screenLeft = 0;
  4485. win.screenTop = 0;
  4486. win.screenX = 0;
  4487. win.screenY = 0;
  4488. win.scrollX = 0;
  4489. win.scrollY = 0;
  4490. win.screen = {
  4491. availHeight: win.innerHeight,
  4492. availLeft: 0,
  4493. availTop: 0,
  4494. availWidth: win.innerWidth,
  4495. colorDepth: 24,
  4496. height: win.innerHeight,
  4497. keepAwake: false,
  4498. orientation: {
  4499. angle: 0,
  4500. type: 'portrait-primary',
  4501. },
  4502. pixelDepth: 24,
  4503. width: win.innerWidth,
  4504. };
  4505. }
  4506. catch (e) { }
  4507. }
  4508. class MockDocument extends MockHTMLElement {
  4509. constructor(html = null, win = null) {
  4510. super(null, null);
  4511. this.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
  4512. this.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
  4513. this.defaultView = win;
  4514. this.cookie = '';
  4515. this.referrer = '';
  4516. this.appendChild(this.createDocumentTypeNode());
  4517. if (typeof html === 'string') {
  4518. const parsedDoc = parseDocumentUtil(this, html);
  4519. const documentElement = parsedDoc.children.find((elm) => elm.nodeName === 'HTML');
  4520. if (documentElement != null) {
  4521. this.appendChild(documentElement);
  4522. setOwnerDocument(documentElement, this);
  4523. }
  4524. }
  4525. else if (html !== false) {
  4526. const documentElement = new MockHTMLElement(this, 'html');
  4527. this.appendChild(documentElement);
  4528. documentElement.appendChild(new MockHTMLElement(this, 'head'));
  4529. documentElement.appendChild(new MockHTMLElement(this, 'body'));
  4530. }
  4531. }
  4532. get dir() {
  4533. return this.documentElement.dir;
  4534. }
  4535. set dir(value) {
  4536. this.documentElement.dir = value;
  4537. }
  4538. get location() {
  4539. if (this.defaultView != null) {
  4540. return this.defaultView.location;
  4541. }
  4542. return null;
  4543. }
  4544. set location(val) {
  4545. if (this.defaultView != null) {
  4546. this.defaultView.location = val;
  4547. }
  4548. }
  4549. get baseURI() {
  4550. const baseNode = this.head.childNodes.find((node) => node.nodeName === 'BASE');
  4551. if (baseNode) {
  4552. return baseNode.href;
  4553. }
  4554. return this.URL;
  4555. }
  4556. get URL() {
  4557. return this.location.href;
  4558. }
  4559. get styleSheets() {
  4560. return this.querySelectorAll('style');
  4561. }
  4562. get scripts() {
  4563. return this.querySelectorAll('script');
  4564. }
  4565. get forms() {
  4566. return this.querySelectorAll('form');
  4567. }
  4568. get images() {
  4569. return this.querySelectorAll('img');
  4570. }
  4571. get scrollingElement() {
  4572. return this.documentElement;
  4573. }
  4574. get documentElement() {
  4575. for (let i = this.childNodes.length - 1; i >= 0; i--) {
  4576. if (this.childNodes[i].nodeName === 'HTML') {
  4577. return this.childNodes[i];
  4578. }
  4579. }
  4580. const documentElement = new MockHTMLElement(this, 'html');
  4581. this.appendChild(documentElement);
  4582. return documentElement;
  4583. }
  4584. set documentElement(documentElement) {
  4585. for (let i = this.childNodes.length - 1; i >= 0; i--) {
  4586. if (this.childNodes[i].nodeType !== 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
  4587. this.childNodes[i].remove();
  4588. }
  4589. }
  4590. if (documentElement != null) {
  4591. this.appendChild(documentElement);
  4592. setOwnerDocument(documentElement, this);
  4593. }
  4594. }
  4595. get head() {
  4596. const documentElement = this.documentElement;
  4597. for (let i = 0; i < documentElement.childNodes.length; i++) {
  4598. if (documentElement.childNodes[i].nodeName === 'HEAD') {
  4599. return documentElement.childNodes[i];
  4600. }
  4601. }
  4602. const head = new MockHTMLElement(this, 'head');
  4603. documentElement.insertBefore(head, documentElement.firstChild);
  4604. return head;
  4605. }
  4606. set head(head) {
  4607. const documentElement = this.documentElement;
  4608. for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
  4609. if (documentElement.childNodes[i].nodeName === 'HEAD') {
  4610. documentElement.childNodes[i].remove();
  4611. }
  4612. }
  4613. if (head != null) {
  4614. documentElement.insertBefore(head, documentElement.firstChild);
  4615. setOwnerDocument(head, this);
  4616. }
  4617. }
  4618. get body() {
  4619. const documentElement = this.documentElement;
  4620. for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
  4621. if (documentElement.childNodes[i].nodeName === 'BODY') {
  4622. return documentElement.childNodes[i];
  4623. }
  4624. }
  4625. const body = new MockHTMLElement(this, 'body');
  4626. documentElement.appendChild(body);
  4627. return body;
  4628. }
  4629. set body(body) {
  4630. const documentElement = this.documentElement;
  4631. for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
  4632. if (documentElement.childNodes[i].nodeName === 'BODY') {
  4633. documentElement.childNodes[i].remove();
  4634. }
  4635. }
  4636. if (body != null) {
  4637. documentElement.appendChild(body);
  4638. setOwnerDocument(body, this);
  4639. }
  4640. }
  4641. appendChild(newNode) {
  4642. newNode.remove();
  4643. newNode.parentNode = this;
  4644. this.childNodes.push(newNode);
  4645. return newNode;
  4646. }
  4647. createComment(data) {
  4648. return new MockComment(this, data);
  4649. }
  4650. createAttribute(attrName) {
  4651. return new MockAttr(attrName.toLowerCase(), '');
  4652. }
  4653. createAttributeNS(namespaceURI, attrName) {
  4654. return new MockAttr(attrName, '', namespaceURI);
  4655. }
  4656. createElement(tagName) {
  4657. if (tagName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
  4658. const doc = new MockDocument(false);
  4659. doc.nodeName = tagName;
  4660. doc.parentNode = null;
  4661. return doc;
  4662. }
  4663. return createElement(this, tagName);
  4664. }
  4665. createElementNS(namespaceURI, tagName) {
  4666. const elmNs = createElementNS(this, namespaceURI, tagName);
  4667. elmNs.namespaceURI = namespaceURI;
  4668. return elmNs;
  4669. }
  4670. createTextNode(text) {
  4671. return new MockTextNode(this, text);
  4672. }
  4673. createDocumentFragment() {
  4674. return new MockDocumentFragment(this);
  4675. }
  4676. createDocumentTypeNode() {
  4677. return new MockDocumentTypeNode(this);
  4678. }
  4679. getElementById(id) {
  4680. return getElementById(this, id);
  4681. }
  4682. getElementsByName(elmName) {
  4683. return getElementsByName(this, elmName.toLowerCase());
  4684. }
  4685. get title() {
  4686. const title = this.head.childNodes.find((elm) => elm.nodeName === 'TITLE');
  4687. if (title != null && typeof title.textContent === 'string') {
  4688. return title.textContent.trim();
  4689. }
  4690. return '';
  4691. }
  4692. set title(value) {
  4693. const head = this.head;
  4694. let title = head.childNodes.find((elm) => elm.nodeName === 'TITLE');
  4695. if (title == null) {
  4696. title = this.createElement('title');
  4697. head.appendChild(title);
  4698. }
  4699. title.textContent = value;
  4700. }
  4701. }
  4702. function createDocument(html = null) {
  4703. return new MockWindow(html).document;
  4704. }
  4705. function createFragment(html) {
  4706. return parseHtmlToFragment(html, null);
  4707. }
  4708. function resetDocument(doc) {
  4709. if (doc != null) {
  4710. resetEventListeners(doc);
  4711. const documentElement = doc.documentElement;
  4712. if (documentElement != null) {
  4713. resetElement(documentElement);
  4714. for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
  4715. const childNode = documentElement.childNodes[i];
  4716. resetElement(childNode);
  4717. childNode.childNodes.length = 0;
  4718. }
  4719. }
  4720. for (const key in doc) {
  4721. if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
  4722. delete doc[key];
  4723. }
  4724. }
  4725. try {
  4726. doc.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
  4727. }
  4728. catch (e) { }
  4729. try {
  4730. doc.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
  4731. }
  4732. catch (e) { }
  4733. try {
  4734. doc.cookie = '';
  4735. }
  4736. catch (e) { }
  4737. try {
  4738. doc.referrer = '';
  4739. }
  4740. catch (e) { }
  4741. }
  4742. }
  4743. const DOC_KEY_KEEPERS = new Set([
  4744. 'nodeName',
  4745. 'nodeType',
  4746. 'nodeValue',
  4747. 'ownerDocument',
  4748. 'parentNode',
  4749. 'childNodes',
  4750. '_shadowRoot',
  4751. ]);
  4752. function getElementById(elm, id) {
  4753. const children = elm.children;
  4754. for (let i = 0, ii = children.length; i < ii; i++) {
  4755. const childElm = children[i];
  4756. if (childElm.id === id) {
  4757. return childElm;
  4758. }
  4759. const childElmFound = getElementById(childElm, id);
  4760. if (childElmFound != null) {
  4761. return childElmFound;
  4762. }
  4763. }
  4764. return null;
  4765. }
  4766. function getElementsByName(elm, elmName, foundElms = []) {
  4767. const children = elm.children;
  4768. for (let i = 0, ii = children.length; i < ii; i++) {
  4769. const childElm = children[i];
  4770. if (childElm.name && childElm.name.toLowerCase() === elmName) {
  4771. foundElms.push(childElm);
  4772. }
  4773. getElementsByName(childElm, elmName, foundElms);
  4774. }
  4775. return foundElms;
  4776. }
  4777. function setOwnerDocument(elm, ownerDocument) {
  4778. for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
  4779. elm.childNodes[i].ownerDocument = ownerDocument;
  4780. if (elm.childNodes[i].nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
  4781. setOwnerDocument(elm.childNodes[i], ownerDocument);
  4782. }
  4783. }
  4784. }
  4785. function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve) {
  4786. var globalThis = $stencilWindow;
  4787. var self = $stencilWindow;
  4788. var top = $stencilWindow;
  4789. var parent = $stencilWindow;
  4790. var addEventListener = $stencilWindow.addEventListener.bind($stencilWindow);
  4791. var alert = $stencilWindow.alert.bind($stencilWindow);
  4792. var blur = $stencilWindow.blur.bind($stencilWindow);
  4793. var cancelAnimationFrame = $stencilWindow.cancelAnimationFrame.bind($stencilWindow);
  4794. var cancelIdleCallback = $stencilWindow.cancelIdleCallback.bind($stencilWindow);
  4795. var clearInterval = $stencilWindow.clearInterval.bind($stencilWindow);
  4796. var clearTimeout = $stencilWindow.clearTimeout.bind($stencilWindow);
  4797. var close = () => {};
  4798. var confirm = $stencilWindow.confirm.bind($stencilWindow);
  4799. var dispatchEvent = $stencilWindow.dispatchEvent.bind($stencilWindow);
  4800. var focus = $stencilWindow.focus.bind($stencilWindow);
  4801. var getComputedStyle = $stencilWindow.getComputedStyle.bind($stencilWindow);
  4802. var matchMedia = $stencilWindow.matchMedia.bind($stencilWindow);
  4803. var open = $stencilWindow.open.bind($stencilWindow);
  4804. var prompt = $stencilWindow.prompt.bind($stencilWindow);
  4805. var removeEventListener = $stencilWindow.removeEventListener.bind($stencilWindow);
  4806. var requestAnimationFrame = $stencilWindow.requestAnimationFrame.bind($stencilWindow);
  4807. var requestIdleCallback = $stencilWindow.requestIdleCallback.bind($stencilWindow);
  4808. var setInterval = $stencilWindow.setInterval.bind($stencilWindow);
  4809. var setTimeout = $stencilWindow.setTimeout.bind($stencilWindow);
  4810. var CharacterData = $stencilWindow.CharacterData;
  4811. var CSS = $stencilWindow.CSS;
  4812. var CustomEvent = $stencilWindow.CustomEvent;
  4813. var Document = $stencilWindow.Document;
  4814. var DocumentFragment = $stencilWindow.DocumentFragment;
  4815. var DocumentType = $stencilWindow.DocumentType;
  4816. var DOMTokenList = $stencilWindow.DOMTokenList;
  4817. var Element = $stencilWindow.Element;
  4818. var Event = $stencilWindow.Event;
  4819. var HTMLAnchorElement = $stencilWindow.HTMLAnchorElement;
  4820. var HTMLBaseElement = $stencilWindow.HTMLBaseElement;
  4821. var HTMLButtonElement = $stencilWindow.HTMLButtonElement;
  4822. var HTMLCanvasElement = $stencilWindow.HTMLCanvasElement;
  4823. var HTMLElement = $stencilWindow.HTMLElement;
  4824. var HTMLFormElement = $stencilWindow.HTMLFormElement;
  4825. var HTMLImageElement = $stencilWindow.HTMLImageElement;
  4826. var HTMLInputElement = $stencilWindow.HTMLInputElement;
  4827. var HTMLLinkElement = $stencilWindow.HTMLLinkElement;
  4828. var HTMLMetaElement = $stencilWindow.HTMLMetaElement;
  4829. var HTMLScriptElement = $stencilWindow.HTMLScriptElement;
  4830. var HTMLStyleElement = $stencilWindow.HTMLStyleElement;
  4831. var HTMLTemplateElement = $stencilWindow.HTMLTemplateElement;
  4832. var HTMLTitleElement = $stencilWindow.HTMLTitleElement;
  4833. var IntersectionObserver = $stencilWindow.IntersectionObserver;
  4834. var KeyboardEvent = $stencilWindow.KeyboardEvent;
  4835. var MouseEvent = $stencilWindow.MouseEvent;
  4836. var Node = $stencilWindow.Node;
  4837. var NodeList = $stencilWindow.NodeList;
  4838. var URL = $stencilWindow.URL;
  4839. var console = $stencilWindow.console;
  4840. var customElements = $stencilWindow.customElements;
  4841. var history = $stencilWindow.history;
  4842. var localStorage = $stencilWindow.localStorage;
  4843. var location = $stencilWindow.location;
  4844. var navigator = $stencilWindow.navigator;
  4845. var performance = $stencilWindow.performance;
  4846. var sessionStorage = $stencilWindow.sessionStorage;
  4847. var devicePixelRatio = $stencilWindow.devicePixelRatio;
  4848. var innerHeight = $stencilWindow.innerHeight;
  4849. var innerWidth = $stencilWindow.innerWidth;
  4850. var origin = $stencilWindow.origin;
  4851. var pageXOffset = $stencilWindow.pageXOffset;
  4852. var pageYOffset = $stencilWindow.pageYOffset;
  4853. var screen = $stencilWindow.screen;
  4854. var screenLeft = $stencilWindow.screenLeft;
  4855. var screenTop = $stencilWindow.screenTop;
  4856. var screenX = $stencilWindow.screenX;
  4857. var screenY = $stencilWindow.screenY;
  4858. var scrollX = $stencilWindow.scrollX;
  4859. var scrollY = $stencilWindow.scrollY;
  4860. var exports = {};
  4861. var fetch, FetchError, Headers, Request, Response;
  4862. if (typeof $stencilWindow.fetch === 'function') {
  4863. fetch = $stencilWindow.fetch;
  4864. } else {
  4865. fetch = $stencilWindow.fetch = function() { throw new Error('fetch() is not implemented'); };
  4866. }
  4867. if (typeof $stencilWindow.FetchError === 'function') {
  4868. FetchError = $stencilWindow.FetchError;
  4869. } else {
  4870. FetchError = $stencilWindow.FetchError = class FetchError { constructor() { throw new Error('FetchError is not implemented'); } };
  4871. }
  4872. if (typeof $stencilWindow.Headers === 'function') {
  4873. Headers = $stencilWindow.Headers;
  4874. } else {
  4875. Headers = $stencilWindow.Headers = class Headers { constructor() { throw new Error('Headers is not implemented'); } };
  4876. }
  4877. if (typeof $stencilWindow.Request === 'function') {
  4878. Request = $stencilWindow.Request;
  4879. } else {
  4880. Request = $stencilWindow.Request = class Request { constructor() { throw new Error('Request is not implemented'); } };
  4881. }
  4882. if (typeof $stencilWindow.Response === 'function') {
  4883. Response = $stencilWindow.Response;
  4884. } else {
  4885. Response = $stencilWindow.Response = class Response { constructor() { throw new Error('Response is not implemented'); } };
  4886. }
  4887. function hydrateAppClosure($stencilWindow) {
  4888. const window = $stencilWindow;
  4889. const document = $stencilWindow.document;
  4890. /*hydrateAppClosure start*/
  4891. const NAMESPACE = 'calcite';
  4892. const BUILD = /* calcite */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: true, cmpWillLoad: true, cmpWillRender: true, cmpWillUpdate: false, connectedCallback: true, constructableCSS: false, cssAnnotations: true, cssVarShim: false, devTools: false, disconnectedCallback: true, dynamicImportShim: false, element: false, event: true, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: true, hostListenerTargetDocument: true, hostListenerTargetParent: false, hostListenerTargetWindow: true, hotModuleReplacement: false, hydrateClientSide: true, hydrateServerSide: true, hydratedAttribute: false, hydratedClass: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, safari10: false, scoped: false, scriptDataOpts: false, shadowDelegatesFocus: false, 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 };
  4893. const autoTheme = "calcite-theme-auto";
  4894. const darkTheme = "calcite-theme-dark";
  4895. const lightTheme = "calcite-theme-light";
  4896. const CSS_UTILITY = {
  4897. autoTheme,
  4898. darkTheme,
  4899. lightTheme,
  4900. rtl: "calcite--rtl"
  4901. };
  4902. const TEXT$v = {
  4903. loading: "Loading"
  4904. };
  4905. /**
  4906. * Emits when the theme is dynamically toggled between light and dark on <body> or in OS preferences.
  4907. */
  4908. function initThemeChangeEvent() {
  4909. const { classList } = document.body;
  4910. const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
  4911. const getTheme = () => classList.contains(darkTheme) || (classList.contains(autoTheme) && prefersDark) ? "dark" : "light";
  4912. const emitThemeChange = (theme) => document.body.dispatchEvent(new CustomEvent("calciteThemeChange", { bubbles: true, detail: { theme } }));
  4913. const themeChangeHandler = (newTheme) => {
  4914. currentTheme !== newTheme && emitThemeChange(newTheme);
  4915. currentTheme = newTheme;
  4916. };
  4917. let currentTheme = getTheme();
  4918. // emits event on page load
  4919. emitThemeChange(currentTheme);
  4920. // emits event when changing OS theme preferences
  4921. window
  4922. .matchMedia("(prefers-color-scheme: dark)")
  4923. .addEventListener("change", (event) => themeChangeHandler(event.matches ? "dark" : "light"));
  4924. // emits event when toggling between theme classes on <body>
  4925. new MutationObserver(() => themeChangeHandler(getTheme())).observe(document.body, {
  4926. attributes: true,
  4927. attributeFilter: ["class"]
  4928. });
  4929. }
  4930. /**
  4931. * This file is imported in Stencil's `globalScript` config option.
  4932. *
  4933. * @see {@link https://stenciljs.com/docs/config#globalscript}
  4934. */
  4935. function appGlobalScript () {
  4936. const isBrowser = typeof window !== "undefined" &&
  4937. typeof location !== "undefined" &&
  4938. typeof document !== "undefined" &&
  4939. window.location === location &&
  4940. window.document === document;
  4941. if (isBrowser) {
  4942. if (document.readyState === "interactive") {
  4943. initThemeChangeEvent();
  4944. }
  4945. else {
  4946. document.addEventListener("DOMContentLoaded", () => initThemeChangeEvent(), { once: true });
  4947. }
  4948. }
  4949. }
  4950. const globalScripts = appGlobalScript;
  4951. function componentOnReady() {
  4952. return getHostRef(this).$onReadyPromise$;
  4953. }
  4954. function forceUpdate() {}
  4955. function hydrateApp(e, t, o, n, s) {
  4956. function l() {
  4957. if (global.clearTimeout(p), i.clear(), r.clear(), !h) {
  4958. h = !0;
  4959. try {
  4960. t.clientHydrateAnnotations && insertVdomAnnotations(e.document, t.staticComponents),
  4961. e.dispatchEvent(new e.Event("DOMContentLoaded")), e.document.createElement = c,
  4962. e.document.createElementNS = $;
  4963. } catch (e) {
  4964. renderCatchError(t, o, e);
  4965. }
  4966. }
  4967. n(e, t, o, s);
  4968. }
  4969. function a(e) {
  4970. renderCatchError(t, o, e), l();
  4971. }
  4972. const r = new Set, i = new Set, d = new Set, c = e.document.createElement, $ = e.document.createElementNS, m = Promise.resolve();
  4973. let p, h = !1;
  4974. try {
  4975. function u() {
  4976. return g(this);
  4977. }
  4978. function f(e) {
  4979. if (isValidComponent(e, t) && !getHostRef(e)) {
  4980. const t = loadModule({
  4981. $tagName$: e.nodeName.toLowerCase(),
  4982. $flags$: null
  4983. });
  4984. null != t && null != t.cmpMeta && (i.add(e), e.connectedCallback = u, registerHost(e, t.cmpMeta),
  4985. function o(e, t) {
  4986. if ("function" != typeof e.componentOnReady && (e.componentOnReady = componentOnReady),
  4987. "function" != typeof e.forceUpdate && (e.forceUpdate = forceUpdate), 1 & t.$flags$ && (e.shadowRoot = e),
  4988. null != t.$members$) {
  4989. const o = getHostRef(e);
  4990. Object.entries(t.$members$).forEach((([n, s]) => {
  4991. const l = s[0];
  4992. if (31 & l) {
  4993. const a = s[1] || n, r = e.getAttribute(a);
  4994. if (null != r) {
  4995. const e = parsePropertyValue(r, l);
  4996. o.$instanceValues$.set(n, e);
  4997. }
  4998. const i = e[n];
  4999. void 0 !== i && (o.$instanceValues$.set(n, i), delete e[n]), Object.defineProperty(e, n, {
  5000. get() {
  5001. return getValue(this, n);
  5002. },
  5003. set(e) {
  5004. setValue(this, n, e, t);
  5005. },
  5006. configurable: !0,
  5007. enumerable: !0
  5008. });
  5009. } else 64 & l && Object.defineProperty(e, n, {
  5010. value(...e) {
  5011. const t = getHostRef(this);
  5012. return t.$onInstancePromise$.then((() => t.$lazyInstance$[n](...e))).catch(consoleError);
  5013. }
  5014. });
  5015. }));
  5016. }
  5017. }(e, t.cmpMeta));
  5018. }
  5019. }
  5020. function g(n) {
  5021. return i.delete(n), isValidComponent(n, t) && o.hydratedCount < t.maxHydrateCount && !r.has(n) && shouldHydrate(n) ? (r.add(n),
  5022. async function s(e, t, o, n, l) {
  5023. o = o.toLowerCase();
  5024. const a = loadModule({
  5025. $tagName$: o,
  5026. $flags$: null
  5027. });
  5028. if (null != a && null != a.cmpMeta) {
  5029. l.add(n);
  5030. try {
  5031. connectedCallback(n), await n.componentOnReady(), t.hydratedCount++;
  5032. const e = getHostRef(n), s = e.$modeName$ ? e.$modeName$ : "$";
  5033. t.components.some((e => e.tag === o && e.mode === s)) || t.components.push({
  5034. tag: o,
  5035. mode: s,
  5036. count: 0,
  5037. depth: -1
  5038. });
  5039. } catch (t) {
  5040. e.console.error(t);
  5041. }
  5042. l.delete(n);
  5043. }
  5044. }(e, o, n.nodeName, n, d)) : m;
  5045. }
  5046. e.document.createElement = function t(o) {
  5047. const n = c.call(e.document, o);
  5048. return f(n), n;
  5049. }, e.document.createElementNS = function t(o, n) {
  5050. const s = $.call(e.document, o, n);
  5051. return f(s), s;
  5052. }, p = global.setTimeout((function L() {
  5053. a(`Hydrate exceeded timeout${function e(t) {
  5054. return Array.from(t).map(waitingOnElementMsg);
  5055. }(d)}`);
  5056. }), t.timeout), plt.$resourcesUrl$ = new URL(t.resourcesUrl || "./", doc.baseURI).href,
  5057. globalScripts(), function e(t) {
  5058. if (null != t && 1 === t.nodeType) {
  5059. f(t);
  5060. const o = t.children;
  5061. for (let t = 0, n = o.length; t < n; t++) e(o[t]);
  5062. }
  5063. }(e.document.body), function e() {
  5064. const t = Array.from(i).filter((e => e.parentElement));
  5065. return t.length > 0 ? Promise.all(t.map(g)).then(e) : m;
  5066. }().then(l).catch(a);
  5067. } catch (e) {
  5068. a(e);
  5069. }
  5070. }
  5071. function isValidComponent(e, t) {
  5072. if (null != e && 1 === e.nodeType) {
  5073. const o = e.nodeName;
  5074. if ("string" == typeof o && o.includes("-")) return !t.excludeComponents.includes(o.toLowerCase());
  5075. }
  5076. return !1;
  5077. }
  5078. function shouldHydrate(e) {
  5079. if (9 === e.nodeType) return !0;
  5080. if (NO_HYDRATE_TAGS.has(e.nodeName)) return !1;
  5081. if (e.hasAttribute("no-prerender")) return !1;
  5082. const t = e.parentNode;
  5083. return null == t || shouldHydrate(t);
  5084. }
  5085. function renderCatchError(e, t, o) {
  5086. const n = {
  5087. level: "error",
  5088. type: "build",
  5089. header: "Hydrate Error",
  5090. messageText: "",
  5091. relFilePath: null,
  5092. absFilePath: null,
  5093. lines: []
  5094. };
  5095. if (e.url) try {
  5096. const t = new URL(e.url);
  5097. "/" !== t.pathname && (n.header += ": " + t.pathname);
  5098. } catch (e) {}
  5099. null != o && (null != o.stack ? n.messageText = o.stack.toString() : null != o.message ? n.messageText = o.message.toString() : n.messageText = o.toString()),
  5100. t.diagnostics.push(n);
  5101. }
  5102. function printTag(e) {
  5103. let t = `<${e.nodeName.toLowerCase()}`;
  5104. if (Array.isArray(e.attributes)) for (let o = 0; o < e.attributes.length; o++) {
  5105. const n = e.attributes[o];
  5106. t += ` ${n.name}`, "" !== n.value && (t += `="${n.value}"`);
  5107. }
  5108. return t += ">", t;
  5109. }
  5110. function waitingOnElementMsg(e) {
  5111. let t = "";
  5112. if (e) {
  5113. const o = [];
  5114. t = " - waiting on:";
  5115. let n = e;
  5116. for (;n && 9 !== n.nodeType && "BODY" !== n.nodeName; ) o.unshift(printTag(n)),
  5117. n = n.parentElement;
  5118. let s = "";
  5119. for (const e of o) s += " ", t += `\n${s}${e}`;
  5120. }
  5121. return t;
  5122. }
  5123. const createTime = (e, t = "") => {
  5124. return () => {};
  5125. }, XLINK_NS = "http://www.w3.org/1999/xlink", EMPTY_OBJ = {}, isComplexType = e => "object" == (e = typeof e) || "function" === e, isPromise = e => !!e && ("object" == typeof e || "function" == typeof e) && "function" == typeof e.then, h = (e, t, ...o) => {
  5126. let n = null, s = null, l = null, a = !1, r = !1;
  5127. const i = [], d = t => {
  5128. for (let o = 0; o < t.length; o++) n = t[o], Array.isArray(n) ? d(n) : null != n && "boolean" != typeof n && ((a = "function" != typeof e && !isComplexType(n)) ? n = String(n) : BUILD.isDev ,
  5129. a && r ? i[i.length - 1].$text$ += n : i.push(a ? newVNode(null, n) : n), r = a);
  5130. };
  5131. if (d(o), t && (t.key && (s = t.key),
  5132. t.name && (l = t.name), BUILD.vdomClass)) {
  5133. const e = t.className || t.class;
  5134. e && (t.class = "object" != typeof e ? e : Object.keys(e).filter((t => e[t])).join(" "));
  5135. }
  5136. if ("function" == typeof e) return e(null === t ? {} : t, i, vdomFnUtils);
  5137. const c = newVNode(e, null);
  5138. return c.$attrs$ = t, i.length > 0 && (c.$children$ = i), (c.$key$ = s),
  5139. (c.$name$ = l), c;
  5140. }, newVNode = (e, t) => {
  5141. const o = {
  5142. $flags$: 0,
  5143. $tag$: e,
  5144. $text$: t,
  5145. $elm$: null,
  5146. $children$: null
  5147. };
  5148. return (o.$attrs$ = null), (o.$key$ = null),
  5149. (o.$name$ = null), o;
  5150. }, Host = {}, isHost = e => e && e.$tag$ === Host, vdomFnUtils = {
  5151. forEach: (e, t) => e.map(convertToPublic).forEach(t),
  5152. map: (e, t) => e.map(convertToPublic).map(t).map(convertToPrivate)
  5153. }, convertToPublic = e => ({
  5154. vattrs: e.$attrs$,
  5155. vchildren: e.$children$,
  5156. vkey: e.$key$,
  5157. vname: e.$name$,
  5158. vtag: e.$tag$,
  5159. vtext: e.$text$
  5160. }), convertToPrivate = e => {
  5161. if ("function" == typeof e.vtag) {
  5162. const t = {
  5163. ...e.vattrs
  5164. };
  5165. return e.vkey && (t.key = e.vkey), e.vname && (t.name = e.vname), h(e.vtag, t, ...e.vchildren || []);
  5166. }
  5167. const t = newVNode(e.vtag, e.vtext);
  5168. return t.$attrs$ = e.vattrs, t.$children$ = e.vchildren, t.$key$ = e.vkey, t.$name$ = e.vname,
  5169. t;
  5170. }, clientHydrate = (e, t, o, n, s, l, a) => {
  5171. let r, i, d, c;
  5172. if (1 === l.nodeType) {
  5173. for (r = l.getAttribute("c-id"), r && (i = r.split("."), i[0] !== a && "0" !== i[0] || (d = {
  5174. $flags$: 0,
  5175. $hostId$: i[0],
  5176. $nodeId$: i[1],
  5177. $depth$: i[2],
  5178. $index$: i[3],
  5179. $tag$: l.tagName.toLowerCase(),
  5180. $elm$: l,
  5181. $attrs$: null,
  5182. $children$: null,
  5183. $key$: null,
  5184. $name$: null,
  5185. $text$: null
  5186. }, t.push(d), l.removeAttribute("c-id"), e.$children$ || (e.$children$ = []), e.$children$[d.$index$] = d,
  5187. e = d, n && "0" === d.$depth$ && (n[d.$index$] = d.$elm$))), c = l.childNodes.length - 1; c >= 0; c--) clientHydrate(e, t, o, n, s, l.childNodes[c], a);
  5188. if (l.shadowRoot) for (c = l.shadowRoot.childNodes.length - 1; c >= 0; c--) clientHydrate(e, t, o, n, s, l.shadowRoot.childNodes[c], a);
  5189. } else if (8 === l.nodeType) i = l.nodeValue.split("."), i[1] !== a && "0" !== i[1] || (r = i[0],
  5190. d = {
  5191. $flags$: 0,
  5192. $hostId$: i[1],
  5193. $nodeId$: i[2],
  5194. $depth$: i[3],
  5195. $index$: i[4],
  5196. $elm$: l,
  5197. $attrs$: null,
  5198. $children$: null,
  5199. $key$: null,
  5200. $name$: null,
  5201. $tag$: null,
  5202. $text$: null
  5203. }, "t" === r ? (d.$elm$ = l.nextSibling, d.$elm$ && 3 === d.$elm$.nodeType && (d.$text$ = d.$elm$.textContent,
  5204. t.push(d), l.remove(), e.$children$ || (e.$children$ = []), e.$children$[d.$index$] = d,
  5205. n && "0" === d.$depth$ && (n[d.$index$] = d.$elm$))) : d.$hostId$ === a && ("s" === r ? (d.$tag$ = "slot",
  5206. i[5] ? l["s-sn"] = d.$name$ = i[5] : l["s-sn"] = "", l["s-sr"] = !0, n && (d.$elm$ = doc.createElement(d.$tag$),
  5207. d.$name$ && d.$elm$.setAttribute("name", d.$name$), l.parentNode.insertBefore(d.$elm$, l),
  5208. l.remove(), "0" === d.$depth$ && (n[d.$index$] = d.$elm$)), o.push(d), e.$children$ || (e.$children$ = []),
  5209. e.$children$[d.$index$] = d) : "r" === r && (n ? l.remove() : (s["s-cr"] = l,
  5210. l["s-cn"] = !0)))); else if (e && "style" === e.$tag$) {
  5211. const t = newVNode(null, l.textContent);
  5212. t.$elm$ = l, t.$index$ = "0", e.$children$ = [ t ];
  5213. }
  5214. }, initializeDocumentHydrate = (e, t) => {
  5215. if (1 === e.nodeType) {
  5216. let o = 0;
  5217. for (;o < e.childNodes.length; o++) initializeDocumentHydrate(e.childNodes[o], t);
  5218. if (e.shadowRoot) for (o = 0; o < e.shadowRoot.childNodes.length; o++) initializeDocumentHydrate(e.shadowRoot.childNodes[o], t);
  5219. } else if (8 === e.nodeType) {
  5220. const o = e.nodeValue.split(".");
  5221. "o" === o[0] && (t.set(o[1] + "." + o[2], e), e.nodeValue = "", e["s-en"] = o[3]);
  5222. }
  5223. }, parsePropertyValue = (e, t) => null == e || isComplexType(e) ? e : 4 & t ? "false" !== e && ("" === e || !!e) : 2 & t ? parseFloat(e) : 1 & t ? String(e) : e, getElement = e => getHostRef(e).$hostElement$ , createEvent = (e, t, o) => {
  5224. const n = getElement(e);
  5225. return {
  5226. emit: e => (emitEvent(n, t, {
  5227. bubbles: !!(4 & o),
  5228. composed: !!(2 & o),
  5229. cancelable: !!(1 & o),
  5230. detail: e
  5231. }))
  5232. };
  5233. }, emitEvent = (e, t, o) => {
  5234. const n = plt.ce(t, o);
  5235. return e.dispatchEvent(n), n;
  5236. }, rootAppliedStyles = new WeakMap, registerStyle = (e, t, o) => {
  5237. let n = styles.get(e);
  5238. n = t, styles.set(e, n);
  5239. }, addStyle = (e, t, o, n) => {
  5240. let s = getScopeId(t);
  5241. const l = styles.get(s);
  5242. if (e = 11 === e.nodeType ? e : doc, l) if ("string" == typeof l) {
  5243. e = e.head || e;
  5244. let o, a = rootAppliedStyles.get(e);
  5245. if (a || rootAppliedStyles.set(e, a = new Set), !a.has(s)) {
  5246. if (e.host && (o = e.querySelector(`[sty-id="${s}"]`))) o.innerHTML = l; else {
  5247. o = doc.createElement("style"), o.innerHTML = l;
  5248. o.setAttribute("sty-id", s),
  5249. e.insertBefore(o, e.querySelector("link"));
  5250. }
  5251. a && a.add(s);
  5252. }
  5253. }
  5254. return s;
  5255. }, attachStyles = e => {
  5256. const t = e.$cmpMeta$, o = e.$hostElement$, n = t.$flags$, s = createTime("attachStyles", t.$tagName$), l = addStyle(o.getRootNode(), t);
  5257. 10 & n && (o["s-sc"] = l,
  5258. o.classList.add(l + "-h"), BUILD.scoped ),
  5259. s();
  5260. }, getScopeId = (e, t) => "sc-" + (e.$tagName$), setAccessor = (e, t, o, n, s, l) => {
  5261. if (o !== n) {
  5262. let a = isMemberInElement(e, t), r = t.toLowerCase();
  5263. if ("class" === t) {
  5264. const t = e.classList, s = parseClassList(o), l = parseClassList(n);
  5265. t.remove(...s.filter((e => e && !l.includes(e)))), t.add(...l.filter((e => e && !s.includes(e))));
  5266. } else if ("style" === t) {
  5267. for (const t in o) n && null != n[t] || (e.style[t] = "");
  5268. for (const t in n) o && n[t] === o[t] || (e.style[t] = n[t]);
  5269. } else if ("key" === t) ; else if ("ref" === t) n && n(e); else if ((a ) || "o" !== t[0] || "n" !== t[1]) {
  5270. {
  5271. const i = isComplexType(n);
  5272. if ((a || i && null !== n) && !s) try {
  5273. if (e.tagName.includes("-")) e[t] = n; else {
  5274. const s = null == n ? "" : n;
  5275. "list" === t ? a = !1 : null != o && e[t] == s || (e[t] = s);
  5276. }
  5277. } catch (e) {}
  5278. let d = !1;
  5279. r !== (r = r.replace(/^xlink\:?/, "")) && (t = r, d = !0), null == n || !1 === n ? !1 === n && "" !== e.getAttribute(t) || (d ? e.removeAttributeNS(XLINK_NS, t) : e.removeAttribute(t)) : (!a || 4 & l || s) && !i && (n = !0 === n ? "" : n,
  5280. d ? e.setAttributeNS(XLINK_NS, t, n) : e.setAttribute(t, n));
  5281. }
  5282. } else t = "-" === t[2] ? t.slice(3) : isMemberInElement(win, r) ? r.slice(2) : r[2] + t.slice(3),
  5283. o && plt.rel(e, t, o, !1), n && plt.ael(e, t, n, !1);
  5284. }
  5285. }, parseClassListRegex = /\s/, parseClassList = e => e ? e.split(parseClassListRegex) : [], updateElement = (e, t, o, n) => {
  5286. const s = 11 === t.$elm$.nodeType && t.$elm$.host ? t.$elm$.host : t.$elm$, l = e && e.$attrs$ || EMPTY_OBJ, a = t.$attrs$ || EMPTY_OBJ;
  5287. for (n in l) n in a || setAccessor(s, n, l[n], void 0, o, t.$flags$);
  5288. for (n in a) setAccessor(s, n, l[n], a[n], o, t.$flags$);
  5289. };
  5290. let scopeId, contentRef, hostTagName, useNativeShadowDom = !1, checkSlotFallbackVisibility = !1, checkSlotRelocate = !1, isSvgMode = !1;
  5291. const createElm = (e, t, o, n) => {
  5292. const s = t.$children$[o];
  5293. let l, a, r, i = 0;
  5294. if (!useNativeShadowDom && (checkSlotRelocate = !0, "slot" === s.$tag$ && (scopeId && n.classList.add(scopeId + "-s"),
  5295. s.$flags$ |= s.$children$ ? 2 : 1)), null !== s.$text$) l = s.$elm$ = doc.createTextNode(s.$text$); else if (1 & s.$flags$) l = s.$elm$ = slotReferenceDebugNode(s) ; else {
  5296. if (!isSvgMode && (isSvgMode = "svg" === s.$tag$), l = s.$elm$ = doc.createElementNS(isSvgMode ? "http://www.w3.org/2000/svg" : "http://www.w3.org/1999/xhtml", 2 & s.$flags$ ? "slot-fb" : s.$tag$) ,
  5297. isSvgMode && "foreignObject" === s.$tag$ && (isSvgMode = !1), updateElement(null, s, isSvgMode),
  5298. null != scopeId && l["s-si"] !== scopeId && l.classList.add(l["s-si"] = scopeId),
  5299. s.$children$) for (i = 0; i < s.$children$.length; ++i) a = createElm(e, s, i, l),
  5300. a && l.appendChild(a);
  5301. ("svg" === s.$tag$ ? isSvgMode = !1 : "foreignObject" === l.tagName && (isSvgMode = !0));
  5302. }
  5303. return (l["s-hn"] = hostTagName, 3 & s.$flags$ && (l["s-sr"] = !0,
  5304. l["s-cr"] = contentRef, l["s-sn"] = s.$name$ || "", r = e && e.$children$ && e.$children$[o],
  5305. r && r.$tag$ === s.$tag$ && e.$elm$ && putBackInOriginalLocation(e.$elm$, !1))),
  5306. l;
  5307. }, putBackInOriginalLocation = (e, t) => {
  5308. plt.$flags$ |= 1;
  5309. const o = e.childNodes;
  5310. for (let e = o.length - 1; e >= 0; e--) {
  5311. const n = o[e];
  5312. n["s-hn"] !== hostTagName && n["s-ol"] && (parentReferenceNode(n).insertBefore(n, referenceNode(n)),
  5313. n["s-ol"].remove(), n["s-ol"] = void 0, checkSlotRelocate = !0), t && putBackInOriginalLocation(n, t);
  5314. }
  5315. plt.$flags$ &= -2;
  5316. }, addVnodes = (e, t, o, n, s, l) => {
  5317. let a, r = e["s-cr"] && e["s-cr"].parentNode || e;
  5318. for (r.shadowRoot && r.tagName === hostTagName && (r = r.shadowRoot); s <= l; ++s) n[s] && (a = createElm(null, o, s, e),
  5319. a && (n[s].$elm$ = a, r.insertBefore(a, referenceNode(t) )));
  5320. }, removeVnodes = (e, t, o, n, s) => {
  5321. for (;t <= o; ++t) (n = e[t]) && (s = n.$elm$, callNodeRefs(n), (checkSlotFallbackVisibility = !0,
  5322. s["s-ol"] ? s["s-ol"].remove() : putBackInOriginalLocation(s, !0)), s.remove());
  5323. }, isSameVnode = (e, t) => e.$tag$ === t.$tag$ && ("slot" === e.$tag$ ? e.$name$ === t.$name$ : e.$key$ === t.$key$), referenceNode = e => e && e["s-ol"] || e, parentReferenceNode = e => (e["s-ol"] ? e["s-ol"] : e).parentNode, patch = (e, t) => {
  5324. const o = t.$elm$ = e.$elm$, n = e.$children$, s = t.$children$, l = t.$tag$, a = t.$text$;
  5325. let r;
  5326. null !== a ? (r = o["s-cr"]) ? r.parentNode.textContent = a : e.$text$ !== a && (o.data = a) : ((isSvgMode = "svg" === l || "foreignObject" !== l && isSvgMode),
  5327. ("slot" === l || updateElement(e, t, isSvgMode)),
  5328. null !== n && null !== s ? ((e, t, o, n) => {
  5329. let s, l, a = 0, r = 0, i = 0, d = 0, c = t.length - 1, $ = t[0], m = t[c], p = n.length - 1, h = n[0], u = n[p];
  5330. for (;a <= c && r <= p; ) if (null == $) $ = t[++a]; else if (null == m) m = t[--c]; else if (null == h) h = n[++r]; else if (null == u) u = n[--p]; else if (isSameVnode($, h)) patch($, h),
  5331. $ = t[++a], h = n[++r]; else if (isSameVnode(m, u)) patch(m, u), m = t[--c], u = n[--p]; else if (isSameVnode($, u)) "slot" !== $.$tag$ && "slot" !== u.$tag$ || putBackInOriginalLocation($.$elm$.parentNode, !1),
  5332. patch($, u), e.insertBefore($.$elm$, m.$elm$.nextSibling), $ = t[++a], u = n[--p]; else if (isSameVnode(m, h)) "slot" !== $.$tag$ && "slot" !== u.$tag$ || putBackInOriginalLocation(m.$elm$.parentNode, !1),
  5333. patch(m, h), e.insertBefore(m.$elm$, $.$elm$), m = t[--c], h = n[++r]; else {
  5334. if (i = -1, BUILD.vdomKey) for (d = a; d <= c; ++d) if (t[d] && null !== t[d].$key$ && t[d].$key$ === h.$key$) {
  5335. i = d;
  5336. break;
  5337. }
  5338. i >= 0 ? (l = t[i], l.$tag$ !== h.$tag$ ? s = createElm(t && t[r], o, i, e) : (patch(l, h),
  5339. t[i] = void 0, s = l.$elm$), h = n[++r]) : (s = createElm(t && t[r], o, r, e), h = n[++r]),
  5340. s && (parentReferenceNode($.$elm$).insertBefore(s, referenceNode($.$elm$)) );
  5341. }
  5342. a > c ? addVnodes(e, null == n[p + 1] ? null : n[p + 1].$elm$, o, n, r, p) : r > p && removeVnodes(t, a, c);
  5343. })(o, n, t, s) : null !== s ? (null !== e.$text$ && (o.textContent = ""),
  5344. addVnodes(o, null, t, s, 0, s.length - 1)) : null !== n && removeVnodes(n, 0, n.length - 1),
  5345. isSvgMode && "svg" === l && (isSvgMode = !1));
  5346. }, updateFallbackSlotVisibility = e => {
  5347. const t = e.childNodes;
  5348. let o, n, s, l, a, r;
  5349. for (n = 0, s = t.length; n < s; n++) if (o = t[n], 1 === o.nodeType) {
  5350. if (o["s-sr"]) for (a = o["s-sn"], o.hidden = !1, l = 0; l < s; l++) if (r = t[l].nodeType,
  5351. t[l]["s-hn"] !== o["s-hn"] || "" !== a) {
  5352. if (1 === r && a === t[l].getAttribute("slot")) {
  5353. o.hidden = !0;
  5354. break;
  5355. }
  5356. } else if (1 === r || 3 === r && "" !== t[l].textContent.trim()) {
  5357. o.hidden = !0;
  5358. break;
  5359. }
  5360. updateFallbackSlotVisibility(o);
  5361. }
  5362. }, relocateNodes = [], relocateSlotContent = e => {
  5363. let t, o, n, s, l, a, r = 0;
  5364. const i = e.childNodes, d = i.length;
  5365. for (;r < d; r++) {
  5366. if (t = i[r], t["s-sr"] && (o = t["s-cr"]) && o.parentNode) for (n = o.parentNode.childNodes,
  5367. s = t["s-sn"], a = n.length - 1; a >= 0; a--) o = n[a], o["s-cn"] || o["s-nr"] || o["s-hn"] === t["s-hn"] || (isNodeLocatedInSlot(o, s) ? (l = relocateNodes.find((e => e.$nodeToRelocate$ === o)),
  5368. checkSlotFallbackVisibility = !0, o["s-sn"] = o["s-sn"] || s, l ? l.$slotRefNode$ = t : relocateNodes.push({
  5369. $slotRefNode$: t,
  5370. $nodeToRelocate$: o
  5371. }), o["s-sr"] && relocateNodes.map((e => {
  5372. isNodeLocatedInSlot(e.$nodeToRelocate$, o["s-sn"]) && (l = relocateNodes.find((e => e.$nodeToRelocate$ === o)),
  5373. l && !e.$slotRefNode$ && (e.$slotRefNode$ = l.$slotRefNode$));
  5374. }))) : relocateNodes.some((e => e.$nodeToRelocate$ === o)) || relocateNodes.push({
  5375. $nodeToRelocate$: o
  5376. }));
  5377. 1 === t.nodeType && relocateSlotContent(t);
  5378. }
  5379. }, isNodeLocatedInSlot = (e, t) => 1 === e.nodeType ? null === e.getAttribute("slot") && "" === t || e.getAttribute("slot") === t : e["s-sn"] === t || "" === t, callNodeRefs = e => {
  5380. (e.$attrs$ && e.$attrs$.ref && e.$attrs$.ref(null), e.$children$ && e.$children$.map(callNodeRefs));
  5381. }, renderVdom = (e, t) => {
  5382. const o = e.$hostElement$, n = e.$cmpMeta$, s = e.$vnode$ || newVNode(null, null), l = isHost(t) ? t : h(null, null, t);
  5383. if (hostTagName = o.tagName, BUILD.isDev ) ;
  5384. if (n.$attrsToReflect$ && (l.$attrs$ = l.$attrs$ || {}, n.$attrsToReflect$.map((([e, t]) => l.$attrs$[t] = o[e]))),
  5385. l.$tag$ = null, l.$flags$ |= 4, e.$vnode$ = l, l.$elm$ = s.$elm$ = o.shadowRoot || o,
  5386. (scopeId = o["s-sc"]), (contentRef = o["s-cr"],
  5387. useNativeShadowDom = supportsShadow, checkSlotFallbackVisibility = !1), patch(s, l),
  5388. BUILD.slotRelocation) {
  5389. if (plt.$flags$ |= 1, checkSlotRelocate) {
  5390. let e, t, o, n, s, a;
  5391. relocateSlotContent(l.$elm$);
  5392. let r = 0;
  5393. for (;r < relocateNodes.length; r++) e = relocateNodes[r], t = e.$nodeToRelocate$,
  5394. t["s-ol"] || (o = originalLocationDebugNode(t) ,
  5395. o["s-nr"] = t, t.parentNode.insertBefore(t["s-ol"] = o, t));
  5396. for (r = 0; r < relocateNodes.length; r++) if (e = relocateNodes[r], t = e.$nodeToRelocate$,
  5397. e.$slotRefNode$) {
  5398. for (n = e.$slotRefNode$.parentNode, s = e.$slotRefNode$.nextSibling, o = t["s-ol"]; o = o.previousSibling; ) if (a = o["s-nr"],
  5399. a && a["s-sn"] === t["s-sn"] && n === a.parentNode && (a = a.nextSibling, !a || !a["s-nr"])) {
  5400. s = a;
  5401. break;
  5402. }
  5403. (!s && n !== t.parentNode || t.nextSibling !== s) && t !== s && (!t["s-hn"] && t["s-ol"] && (t["s-hn"] = t["s-ol"].parentNode.nodeName),
  5404. n.insertBefore(t, s));
  5405. } else 1 === t.nodeType && (t.hidden = !0);
  5406. }
  5407. checkSlotFallbackVisibility && updateFallbackSlotVisibility(l.$elm$), plt.$flags$ &= -2,
  5408. relocateNodes.length = 0;
  5409. }
  5410. }, slotReferenceDebugNode = e => doc.createComment(`<slot${e.$name$ ? ' name="' + e.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`), originalLocationDebugNode = e => doc.createComment("org-location for " + (e.localName ? `<${e.localName}> (host=${e["s-hn"]})` : `[${e.textContent}]`)), attachToAncestor = (e, t) => {
  5411. t && !e.$onRenderResolve$ && t["s-p"] && t["s-p"].push(new Promise((t => e.$onRenderResolve$ = t)));
  5412. }, scheduleUpdate = (e, t) => {
  5413. if ((e.$flags$ |= 16), 4 & e.$flags$) return void (e.$flags$ |= 512);
  5414. attachToAncestor(e, e.$ancestorComponent$);
  5415. const o = () => dispatchHooks(e, t);
  5416. return writeTask(o) ;
  5417. }, dispatchHooks = (e, t) => {
  5418. const n = createTime("scheduleUpdate", e.$cmpMeta$.$tagName$), s = e.$lazyInstance$ ;
  5419. let l;
  5420. return t ? ((e.$flags$ |= 256, e.$queuedListeners$ && (e.$queuedListeners$.map((([e, t]) => safeCall(s, e, t))),
  5421. e.$queuedListeners$ = null)), (l = safeCall(s, "componentWillLoad"))) : (BUILD.cmpWillUpdate ), (l = then(l, (() => safeCall(s, "componentWillRender")))),
  5422. n(), then(l, (() => updateComponent(e, s, t)));
  5423. }, updateComponent = async (e, t, o) => {
  5424. const n = e.$hostElement$, s = createTime("update", e.$cmpMeta$.$tagName$), l = n["s-rc"];
  5425. o && attachStyles(e);
  5426. const a = createTime("render", e.$cmpMeta$.$tagName$);
  5427. if (await callRender(e, t) ,
  5428. BUILD.hydrateServerSide) try {
  5429. serverSideConnected(n), o && (1 & e.$cmpMeta$.$flags$ ? n["s-en"] = "" : 2 & e.$cmpMeta$.$flags$ && (n["s-en"] = "c"));
  5430. } catch (e) {
  5431. consoleError(e, n);
  5432. }
  5433. if (l && (l.map((e => e())), n["s-rc"] = void 0), a(), s(),
  5434. BUILD.asyncLoading) {
  5435. const t = n["s-p"], o = () => postUpdateComponent(e);
  5436. 0 === t.length ? o() : (Promise.all(t).then(o), e.$flags$ |= 4, t.length = 0);
  5437. }
  5438. };
  5439. const callRender = (e, t, o) => {
  5440. try {
  5441. if (t = t.render(), (e.$flags$ &= -17),
  5442. (e.$flags$ |= 2), BUILD.hasRenderFn ) {
  5443. return Promise.resolve(t).then((t => renderVdom(e, t)));
  5444. }
  5445. } catch (t) {
  5446. consoleError(t, e.$hostElement$);
  5447. }
  5448. return null;
  5449. }, postUpdateComponent = e => {
  5450. const t = e.$cmpMeta$.$tagName$, o = e.$hostElement$, n = createTime("postUpdate", t), s = e.$lazyInstance$ , l = e.$ancestorComponent$;
  5451. (safeCall(s, "componentDidRender"),
  5452. BUILD.isDev ), 64 & e.$flags$ ? (n()) : (e.$flags$ |= 64, addHydratedFlag(o),
  5453. (safeCall(s, "componentDidLoad"),
  5454. BUILD.isDev ), n(), (e.$onReadyResolve$(o), l || appDidLoad())), e.$onInstanceResolve$(o), (e.$onRenderResolve$ && (e.$onRenderResolve$(),
  5455. e.$onRenderResolve$ = void 0), 512 & e.$flags$ && nextTick((() => scheduleUpdate(e, !1))),
  5456. e.$flags$ &= -517);
  5457. }, forceUpdate$1 = e => {
  5458. {
  5459. const t = getHostRef(e), o = t.$hostElement$.isConnected;
  5460. return o && 2 == (18 & t.$flags$) && scheduleUpdate(t, !1), o;
  5461. }
  5462. }, appDidLoad = e => {
  5463. addHydratedFlag(doc.documentElement), nextTick((() => emitEvent(win, "appload", {
  5464. detail: {
  5465. namespace: NAMESPACE
  5466. }
  5467. }))), BUILD.profile ;
  5468. }, safeCall = (e, t, o) => {
  5469. if (e && e[t]) try {
  5470. return e[t](o);
  5471. } catch (e) {
  5472. consoleError(e);
  5473. }
  5474. }, then = (e, t) => e && e.then ? e.then(t) : t(), addHydratedFlag = e => e.classList.add("calcite-hydrated") , serverSideConnected = e => {
  5475. const t = e.children;
  5476. if (null != t) for (let e = 0, o = t.length; e < o; e++) {
  5477. const o = t[e];
  5478. "function" == typeof o.connectedCallback && o.connectedCallback(), serverSideConnected(o);
  5479. }
  5480. }, getValue = (e, t) => getHostRef(e).$instanceValues$.get(t), setValue = (e, t, o, n) => {
  5481. const s = getHostRef(e), l = s.$hostElement$ , a = s.$instanceValues$.get(t), r = s.$flags$, i = s.$lazyInstance$ ;
  5482. o = parsePropertyValue(o, n.$members$[t][0]);
  5483. const d = Number.isNaN(a) && Number.isNaN(o), c = o !== a && !d;
  5484. if ((!(8 & r) || void 0 === a) && c && (s.$instanceValues$.set(t, o),
  5485. i)) {
  5486. if (n.$watchers$ && 128 & r) {
  5487. const e = n.$watchers$[t];
  5488. e && e.map((e => {
  5489. try {
  5490. i[e](o, a, t);
  5491. } catch (e) {
  5492. consoleError(e, l);
  5493. }
  5494. }));
  5495. }
  5496. if (2 == (18 & r)) {
  5497. if (i.componentShouldUpdate && !1 === i.componentShouldUpdate(o, a, t)) return;
  5498. scheduleUpdate(s, !1);
  5499. }
  5500. }
  5501. }, proxyComponent = (e, t, o) => {
  5502. if (t.$members$) {
  5503. e.watchers && (t.$watchers$ = e.watchers);
  5504. const n = Object.entries(t.$members$), s = e.prototype;
  5505. if (n.map((([e, [n]]) => {
  5506. (31 & n || (2 & o) && 32 & n) ? Object.defineProperty(s, e, {
  5507. get() {
  5508. return getValue(this, e);
  5509. },
  5510. set(s) {
  5511. setValue(this, e, s, t);
  5512. },
  5513. configurable: !0,
  5514. enumerable: !0
  5515. }) : 1 & o && 64 & n && Object.defineProperty(s, e, {
  5516. value(...t) {
  5517. const o = getHostRef(this);
  5518. return o.$onInstancePromise$.then((() => o.$lazyInstance$[e](...t)));
  5519. }
  5520. });
  5521. })), (1 & o)) {
  5522. const o = new Map;
  5523. s.attributeChangedCallback = function(e, t, n) {
  5524. plt.jmp((() => {
  5525. const t = o.get(e);
  5526. if (this.hasOwnProperty(t)) n = this[t], delete this[t]; else if (s.hasOwnProperty(t) && "number" == typeof this[t] && this[t] == n) return;
  5527. this[t] = (null !== n || "boolean" != typeof this[t]) && n;
  5528. }));
  5529. }, e.observedAttributes = n.filter((([e, t]) => 15 & t[0])).map((([e, n]) => {
  5530. const s = n[1] || e;
  5531. return o.set(s, e), 512 & n[0] && t.$attrsToReflect$.push([ e, s ]),
  5532. s;
  5533. }));
  5534. }
  5535. }
  5536. return e;
  5537. }, initializeComponent = async (e, t, o, n, s) => {
  5538. if (0 == (32 & t.$flags$)) {
  5539. {
  5540. if (t.$flags$ |= 32, (s = loadModule(o)).then) {
  5541. const e = (() => {});
  5542. s = await s, e();
  5543. }
  5544. !s.isProxied && ((o.$watchers$ = s.watchers),
  5545. proxyComponent(s, o, 2), s.isProxied = !0);
  5546. const e = createTime("createInstance", o.$tagName$);
  5547. (t.$flags$ |= 8);
  5548. try {
  5549. new s(t);
  5550. } catch (e) {
  5551. consoleError(e);
  5552. }
  5553. (t.$flags$ &= -9), (t.$flags$ |= 128), e(),
  5554. fireConnectedCallback(t.$lazyInstance$);
  5555. }
  5556. if (s.style) {
  5557. let n = s.style;
  5558. const l = getScopeId(o);
  5559. if (!styles.has(l)) {
  5560. const e = createTime("registerStyles", o.$tagName$);
  5561. registerStyle(l, n), e();
  5562. }
  5563. }
  5564. }
  5565. const r = t.$ancestorComponent$, i = () => scheduleUpdate(t, !0);
  5566. r && r["s-rc"] ? r["s-rc"].push(i) : i();
  5567. }, fireConnectedCallback = e => {
  5568. safeCall(e, "connectedCallback");
  5569. }, connectedCallback = e => {
  5570. if (0 == (1 & plt.$flags$)) {
  5571. const t = getHostRef(e), o = t.$cmpMeta$, n = createTime("connectedCallback", o.$tagName$);
  5572. if (1 & t.$flags$) addHostEventListeners(e, t, o.$listeners$), fireConnectedCallback(t.$lazyInstance$); else {
  5573. let n;
  5574. if (t.$flags$ |= 1, (n = e.getAttribute("s-id"), n)) {
  5575. ((e, t, o, n) => {
  5576. const s = createTime("hydrateClient", t), l = e.shadowRoot, a = [], r = l ? [] : null, i = n.$vnode$ = newVNode(t, null);
  5577. plt.$orgLocNodes$ || initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = new Map),
  5578. e["s-id"] = o, e.removeAttribute("s-id"), clientHydrate(i, a, [], r, e, e, o), a.map((e => {
  5579. const o = e.$hostId$ + "." + e.$nodeId$, n = plt.$orgLocNodes$.get(o), s = e.$elm$;
  5580. n && supportsShadow && "" === n["s-en"] && n.parentNode.insertBefore(s, n.nextSibling),
  5581. l || (s["s-hn"] = t, n && (s["s-ol"] = n, s["s-ol"]["s-nr"] = s)), plt.$orgLocNodes$.delete(o);
  5582. })), l && r.map((e => {
  5583. e && l.appendChild(e);
  5584. })), s();
  5585. })(e, o.$tagName$, n, t);
  5586. }
  5587. if (!n && (BUILD.hydrateServerSide ) && setContentReference(e),
  5588. BUILD.asyncLoading) {
  5589. let o = e;
  5590. for (;o = o.parentNode || o.host; ) if (1 === o.nodeType && o.hasAttribute("s-id") && o["s-p"] || o["s-p"]) {
  5591. attachToAncestor(t, t.$ancestorComponent$ = o);
  5592. break;
  5593. }
  5594. }
  5595. initializeComponent(e, t, o);
  5596. }
  5597. n();
  5598. }
  5599. }, setContentReference = e => {
  5600. const t = e["s-cr"] = doc.createComment("");
  5601. t["s-cn"] = !0, e.insertBefore(t, e.firstChild);
  5602. }, Fragment = (e, t) => t, addHostEventListeners = (e, t, o, n) => {
  5603. o && (o.map((([o, n, s]) => {
  5604. const l = getHostListenerTarget(e, o) , a = hostListenerProxy(t, s), r = hostListenerOpts(o);
  5605. plt.ael(l, n, a, r), (t.$rmListeners$ = t.$rmListeners$ || []).push((() => plt.rel(l, n, a, r)));
  5606. })));
  5607. }, hostListenerProxy = (e, t) => o => {
  5608. try {
  5609. 256 & e.$flags$ ? e.$lazyInstance$[t](o) : (e.$queuedListeners$ = e.$queuedListeners$ || []).push([ t, o ]) ;
  5610. } catch (e) {
  5611. consoleError(e);
  5612. }
  5613. }, getHostListenerTarget = (e, t) => 4 & t ? doc : 8 & t ? win : 16 & t ? doc.body : e, hostListenerOpts = e => 0 != (2 & e), insertVdomAnnotations = (e, t) => {
  5614. if (null != e) {
  5615. const o = {
  5616. hostIds: 0,
  5617. rootLevelIds: 0,
  5618. staticComponents: new Set(t)
  5619. }, n = [];
  5620. parseVNodeAnnotations(e, e.body, o, n), n.forEach((t => {
  5621. if (null != t) {
  5622. const n = t["s-nr"];
  5623. let s = n["s-host-id"], l = n["s-node-id"], a = `${s}.${l}`;
  5624. if (null == s) if (s = 0, o.rootLevelIds++, l = o.rootLevelIds, a = `${s}.${l}`,
  5625. 1 === n.nodeType) n.setAttribute("c-id", a); else if (3 === n.nodeType) {
  5626. if (0 === s && "" === n.nodeValue.trim()) return void t.remove();
  5627. const o = e.createComment(a);
  5628. o.nodeValue = `t.${a}`, n.parentNode.insertBefore(o, n);
  5629. }
  5630. let r = `o.${a}`;
  5631. const i = t.parentElement;
  5632. i && ("" === i["s-en"] ? r += "." : "c" === i["s-en"] && (r += ".c")), t.nodeValue = r;
  5633. }
  5634. }));
  5635. }
  5636. }, parseVNodeAnnotations = (e, t, o, n) => {
  5637. null != t && (null != t["s-nr"] && n.push(t), 1 === t.nodeType && t.childNodes.forEach((t => {
  5638. const s = getHostRef(t);
  5639. if (null != s && !o.staticComponents.has(t.nodeName.toLowerCase())) {
  5640. const n = {
  5641. nodeIds: 0
  5642. };
  5643. insertVNodeAnnotations(e, t, s.$vnode$, o, n);
  5644. }
  5645. parseVNodeAnnotations(e, t, o, n);
  5646. })));
  5647. }, insertVNodeAnnotations = (e, t, o, n, s) => {
  5648. if (null != o) {
  5649. const l = ++n.hostIds;
  5650. if (t.setAttribute("s-id", l), null != t["s-cr"] && (t["s-cr"].nodeValue = `r.${l}`),
  5651. null != o.$children$) {
  5652. const t = 0;
  5653. o.$children$.forEach(((o, n) => {
  5654. insertChildVNodeAnnotations(e, o, s, l, t, n);
  5655. }));
  5656. }
  5657. if (t && o && o.$elm$ && !t.hasAttribute("c-id")) {
  5658. const e = t.parentElement;
  5659. if (e && e.childNodes) {
  5660. const n = Array.from(e.childNodes), s = n.find((e => 8 === e.nodeType && e["s-sr"]));
  5661. if (s) {
  5662. const e = n.indexOf(t) - 1;
  5663. o.$elm$.setAttribute("c-id", `${s["s-host-id"]}.${s["s-node-id"]}.0.${e}`);
  5664. }
  5665. }
  5666. }
  5667. }
  5668. }, insertChildVNodeAnnotations = (e, t, o, n, s, l) => {
  5669. const a = t.$elm$;
  5670. if (null == a) return;
  5671. const r = o.nodeIds++, i = `${n}.${r}.${s}.${l}`;
  5672. if (a["s-host-id"] = n, a["s-node-id"] = r, 1 === a.nodeType) a.setAttribute("c-id", i); else if (3 === a.nodeType) {
  5673. const t = a.parentNode, o = t.nodeName;
  5674. if ("STYLE" !== o && "SCRIPT" !== o) {
  5675. const o = `t.${i}`, n = e.createComment(o);
  5676. t.insertBefore(n, a);
  5677. }
  5678. } else if (8 === a.nodeType && a["s-sr"]) {
  5679. const e = `s.${i}.${a["s-sn"] || ""}`;
  5680. a.nodeValue = e;
  5681. }
  5682. if (null != t.$children$) {
  5683. const l = s + 1;
  5684. t.$children$.forEach(((t, s) => {
  5685. insertChildVNodeAnnotations(e, t, o, n, l, s);
  5686. }));
  5687. }
  5688. }, hAsync = (e, t, ...o) => {
  5689. if (Array.isArray(o) && o.length > 0) {
  5690. const n = o.flat(1 / 0);
  5691. return n.some(isPromise) ? Promise.all(n).then((o => h(e, t, ...o))).catch((o => h(e, t))) : h(e, t, ...o);
  5692. }
  5693. return h(e, t);
  5694. }, NO_HYDRATE_TAGS = new Set([ "CODE", "HEAD", "IFRAME", "INPUT", "OBJECT", "OUTPUT", "NOSCRIPT", "PRE", "SCRIPT", "SELECT", "STYLE", "TEMPLATE", "TEXTAREA" ]);
  5695. const cmpModules = new Map, getModule = e => {
  5696. if ("string" == typeof e) {
  5697. e = e.toLowerCase();
  5698. const t = cmpModules.get(e);
  5699. if (null != t) return t[e];
  5700. }
  5701. return null;
  5702. }, loadModule = (e, t, o) => getModule(e.$tagName$), isMemberInElement = (e, t) => {
  5703. if (null != e) {
  5704. if (t in e) return !0;
  5705. const o = getModule(e.nodeName);
  5706. if (null != o) {
  5707. const e = o;
  5708. if (null != e && null != e.cmpMeta && null != e.cmpMeta.$members$) return t in e.cmpMeta.$members$;
  5709. }
  5710. }
  5711. return !1;
  5712. }, registerComponents = e => {
  5713. for (const t of e) {
  5714. const e = t.cmpMeta.$tagName$;
  5715. cmpModules.set(e, {
  5716. [e]: t
  5717. });
  5718. }
  5719. }, win = window, doc = win.document, writeTask = e => {
  5720. process.nextTick((() => {
  5721. try {
  5722. e();
  5723. } catch (e) {
  5724. consoleError(e);
  5725. }
  5726. }));
  5727. }, resolved = Promise.resolve(), nextTick = e => resolved.then(e), defaultConsoleError = e => {
  5728. null != e && console.error(e.stack || e.message || e);
  5729. }, consoleError = (e, t) => (defaultConsoleError)(e, t), plt = {
  5730. $flags$: 0,
  5731. $resourcesUrl$: "",
  5732. jmp: e => e(),
  5733. raf: e => requestAnimationFrame(e),
  5734. ael: (e, t, o, n) => e.addEventListener(t, o, n),
  5735. rel: (e, t, o, n) => e.removeEventListener(t, o, n),
  5736. ce: (e, t) => new win.CustomEvent(e, t)
  5737. }, supportsShadow = !1, hostRefs = new WeakMap, getHostRef = e => hostRefs.get(e), registerInstance = (e, t) => hostRefs.set(t.$lazyInstance$ = e, t), registerHost = (e, t) => {
  5738. const o = {
  5739. $flags$: 0,
  5740. $cmpMeta$: t,
  5741. $hostElement$: e,
  5742. $instanceValues$: new Map,
  5743. $renderCount$: 0
  5744. };
  5745. return o.$onInstancePromise$ = new Promise((e => o.$onInstanceResolve$ = e)), o.$onReadyPromise$ = new Promise((e => o.$onReadyResolve$ = e)),
  5746. e["s-p"] = [], e["s-rc"] = [], addHostEventListeners(e, o, t.$listeners$), hostRefs.set(e, o);
  5747. }, styles = new Map;
  5748. const accordionCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-accordion:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-accordion{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-accordion{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-accordion{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-accordion{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-accordion{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-accordion:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-accordion:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-accordion-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-accordion-h{--calcite-accordion-item-spacing-unit:0.25rem;--calcite-accordion-icon-margin:0.5rem;--calcite-accordion-item-padding:var(--calcite-accordion-item-spacing-unit) 0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-accordion-h{--calcite-accordion-item-spacing-unit:0.5rem;--calcite-accordion-icon-margin:0.75rem;--calcite-accordion-item-padding:var(--calcite-accordion-item-spacing-unit) 0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-accordion-h{--calcite-accordion-item-spacing-unit:0.75rem;--calcite-accordion-icon-margin:1rem;--calcite-accordion-item-padding:var(--calcite-accordion-item-spacing-unit) 1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host*/.sc-calcite-accordion-h{position:relative;display:block;max-inline-size:100%;line-height:1.5rem;--calcite-accordion-item-border:var(--calcite-ui-border-2);--calcite-accordion-item-background:var(--calcite-ui-foreground-1)}/*!@.accordion--transparent*/.accordion--transparent.sc-calcite-accordion{--calcite-accordion-item-border:transparent;--calcite-accordion-item-background:transparent}/*!@.accordion--minimal*/.accordion--minimal.sc-calcite-accordion{--calcite-accordion-item-padding:var(--calcite-accordion-item-spacing-unit) 0}/*!@.accordion*/.accordion.sc-calcite-accordion{border-width:1px;border-block-end-width:0px;border-style:solid;border-color:var(--calcite-ui-border-2)}";
  5749. /**
  5750. * @slot - A slot for adding `calcite-accordion-item`s. `calcite-accordion` cannot be nested, however `calcite-accordion-item`s can.
  5751. */
  5752. class Accordion {
  5753. constructor(hostRef) {
  5754. registerInstance(this, hostRef);
  5755. this.calciteInternalAccordionChange = createEvent(this, "calciteInternalAccordionChange", 6);
  5756. //--------------------------------------------------------------------------
  5757. //
  5758. // Public Properties
  5759. //
  5760. //--------------------------------------------------------------------------
  5761. /** Specifies the appearance of the component. */
  5762. this.appearance = "solid";
  5763. /** Specifies the placement of the icon in the header. */
  5764. this.iconPosition = "end";
  5765. /** Specifies the type of the icon in the header. */
  5766. this.iconType = "chevron";
  5767. /** Specifies the size of the component. */
  5768. this.scale = "m";
  5769. /**
  5770. * Specifies the selection mode - `"multi"` (allow any number of open items), `"single"` (allow one open item),
  5771. * or `"single-persist"` (allow and require one open item).
  5772. */
  5773. this.selectionMode = "multi";
  5774. //--------------------------------------------------------------------------
  5775. //
  5776. // Private State/Props
  5777. //
  5778. //--------------------------------------------------------------------------
  5779. /** created list of Accordion items */
  5780. this.items = [];
  5781. /** keep track of whether the items have been sorted so we don't re-sort */
  5782. this.sorted = false;
  5783. this.sortItems = (items) => items.sort((a, b) => a.position - b.position).map((a) => a.item);
  5784. }
  5785. //--------------------------------------------------------------------------
  5786. //
  5787. // Lifecycle
  5788. //
  5789. //--------------------------------------------------------------------------
  5790. componentDidLoad() {
  5791. if (!this.sorted) {
  5792. this.items = this.sortItems(this.items);
  5793. this.sorted = true;
  5794. }
  5795. }
  5796. render() {
  5797. const transparent = this.appearance === "transparent";
  5798. const minimal = this.appearance === "minimal";
  5799. return (hAsync("div", { class: {
  5800. "accordion--transparent": transparent,
  5801. "accordion--minimal": minimal,
  5802. accordion: !transparent && !minimal
  5803. } }, hAsync("slot", null)));
  5804. }
  5805. //--------------------------------------------------------------------------
  5806. //
  5807. // Event Listeners
  5808. //
  5809. //--------------------------------------------------------------------------
  5810. calciteInternalAccordionItemKeyEvent(event) {
  5811. const item = event.detail.item;
  5812. const parent = event.detail.parent;
  5813. if (this.el === parent) {
  5814. const { key } = item;
  5815. const itemToFocus = event.target;
  5816. const isFirstItem = this.itemIndex(itemToFocus) === 0;
  5817. const isLastItem = this.itemIndex(itemToFocus) === this.items.length - 1;
  5818. switch (key) {
  5819. case "ArrowDown":
  5820. if (isLastItem) {
  5821. this.focusFirstItem();
  5822. }
  5823. else {
  5824. this.focusNextItem(itemToFocus);
  5825. }
  5826. break;
  5827. case "ArrowUp":
  5828. if (isFirstItem) {
  5829. this.focusLastItem();
  5830. }
  5831. else {
  5832. this.focusPrevItem(itemToFocus);
  5833. }
  5834. break;
  5835. case "Home":
  5836. this.focusFirstItem();
  5837. break;
  5838. case "End":
  5839. this.focusLastItem();
  5840. break;
  5841. }
  5842. }
  5843. event.stopPropagation();
  5844. }
  5845. registerCalciteAccordionItem(event) {
  5846. const item = {
  5847. item: event.target,
  5848. parent: event.detail.parent,
  5849. position: event.detail.position
  5850. };
  5851. if (this.el === item.parent) {
  5852. this.items.push(item);
  5853. }
  5854. event.stopPropagation();
  5855. }
  5856. updateActiveItemOnChange(event) {
  5857. this.requestedAccordionItem = event.detail.requestedAccordionItem;
  5858. this.calciteInternalAccordionChange.emit({
  5859. requestedAccordionItem: this.requestedAccordionItem
  5860. });
  5861. event.stopPropagation();
  5862. }
  5863. //--------------------------------------------------------------------------
  5864. //
  5865. // Private Methods
  5866. //
  5867. //--------------------------------------------------------------------------
  5868. focusFirstItem() {
  5869. const firstItem = this.items[0];
  5870. this.focusElement(firstItem);
  5871. }
  5872. focusLastItem() {
  5873. const lastItem = this.items[this.items.length - 1];
  5874. this.focusElement(lastItem);
  5875. }
  5876. focusNextItem(el) {
  5877. const index = this.itemIndex(el);
  5878. const nextItem = this.items[index + 1] || this.items[0];
  5879. this.focusElement(nextItem);
  5880. }
  5881. focusPrevItem(el) {
  5882. const index = this.itemIndex(el);
  5883. const prevItem = this.items[index - 1] || this.items[this.items.length - 1];
  5884. this.focusElement(prevItem);
  5885. }
  5886. itemIndex(el) {
  5887. return this.items.indexOf(el);
  5888. }
  5889. focusElement(item) {
  5890. const target = item;
  5891. target === null || target === void 0 ? void 0 : target.focus();
  5892. }
  5893. get el() { return getElement(this); }
  5894. static get style() { return accordionCss; }
  5895. static get cmpMeta() { return {
  5896. "$flags$": 9,
  5897. "$tagName$": "calcite-accordion",
  5898. "$members$": {
  5899. "appearance": [513],
  5900. "iconPosition": [513, "icon-position"],
  5901. "iconType": [513, "icon-type"],
  5902. "scale": [513],
  5903. "selectionMode": [513, "selection-mode"]
  5904. },
  5905. "$listeners$": [[0, "calciteInternalAccordionItemKeyEvent", "calciteInternalAccordionItemKeyEvent"], [0, "calciteInternalAccordionItemRegister", "registerCalciteAccordionItem"], [0, "calciteInternalAccordionItemSelect", "updateActiveItemOnChange"]],
  5906. "$lazyBundleId$": "-",
  5907. "$attrsToReflect$": [["appearance", "appearance"], ["iconPosition", "icon-position"], ["iconType", "icon-type"], ["scale", "scale"], ["selectionMode", "selection-mode"]]
  5908. }; }
  5909. }
  5910. function gen(counts) {
  5911. return counts
  5912. .map((count) => {
  5913. let out = "";
  5914. for (let i = 0; i < count; i++) {
  5915. out += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
  5916. }
  5917. return out;
  5918. })
  5919. .join("-");
  5920. }
  5921. const guid = () => gen([2, 1, 1, 1, 3]);
  5922. /**
  5923. * This helper will guarantee an ID on the provided element.
  5924. *
  5925. * If it already has an ID, it will be preserved, otherwise a unique one will be generated and assigned.
  5926. *
  5927. * @param el
  5928. * @returns {string} The element's ID.
  5929. */
  5930. function ensureId(el) {
  5931. if (!el) {
  5932. return "";
  5933. }
  5934. return (el.id = el.id || `${el.tagName.toLowerCase()}-${guid()}`);
  5935. }
  5936. function nodeListToArray(nodeList) {
  5937. return Array.isArray(nodeList) ? nodeList : Array.from(nodeList);
  5938. }
  5939. function getThemeName(el) {
  5940. const closestElWithTheme = closestElementCrossShadowBoundary(el, `.${CSS_UTILITY.darkTheme}, .${CSS_UTILITY.lightTheme}`);
  5941. return (closestElWithTheme === null || closestElWithTheme === void 0 ? void 0 : closestElWithTheme.classList.contains("calcite-theme-dark")) ? "dark" : "light";
  5942. }
  5943. function getElementDir(el) {
  5944. const prop = "dir";
  5945. const selector = `[${prop}]`;
  5946. const closest = closestElementCrossShadowBoundary(el, selector);
  5947. return closest ? closest.getAttribute(prop) : "ltr";
  5948. }
  5949. function getElementProp(el, prop, fallbackValue) {
  5950. const selector = `[${prop}]`;
  5951. const closest = el.closest(selector);
  5952. return closest ? closest.getAttribute(prop) : fallbackValue;
  5953. }
  5954. function getRootNode(el) {
  5955. return el.getRootNode();
  5956. }
  5957. function getHost(root) {
  5958. return root.host || null;
  5959. }
  5960. /**
  5961. * This helper queries an element's rootNode and any ancestor rootNodes.
  5962. *
  5963. * If both an 'id' and 'selector' are supplied, 'id' will take precedence over 'selector'.
  5964. *
  5965. * @param element
  5966. * @param root0
  5967. * @param root0.selector
  5968. * @param root0.id
  5969. * @returns {Element} The element.
  5970. */
  5971. function queryElementRoots(element, { selector, id }) {
  5972. // Gets the rootNode and any ancestor rootNodes (shadowRoot or document) of an element and queries them for a selector.
  5973. // Based on: https://stackoverflow.com/q/54520554/194216
  5974. function queryFrom(el) {
  5975. if (!el) {
  5976. return null;
  5977. }
  5978. if (el.assignedSlot) {
  5979. el = el.assignedSlot;
  5980. }
  5981. const rootNode = getRootNode(el);
  5982. const found = id
  5983. ? "getElementById" in rootNode
  5984. ? /*
  5985. Check to make sure 'getElementById' exists in cases where element is no longer connected to the DOM and getRootNode() returns the element.
  5986. https://github.com/Esri/calcite-components/pull/4280
  5987. */
  5988. rootNode.getElementById(id)
  5989. : null
  5990. : selector
  5991. ? rootNode.querySelector(selector)
  5992. : null;
  5993. const host = getHost(rootNode);
  5994. return found ? found : host ? queryFrom(host) : null;
  5995. }
  5996. return queryFrom(element);
  5997. }
  5998. function closestElementCrossShadowBoundary(element, selector) {
  5999. // based on https://stackoverflow.com/q/54520554/194216
  6000. function closestFrom(el) {
  6001. return el ? el.closest(selector) || closestFrom(getHost(getRootNode(el))) : null;
  6002. }
  6003. return closestFrom(element);
  6004. }
  6005. function isCalciteFocusable(el) {
  6006. return typeof (el === null || el === void 0 ? void 0 : el.setFocus) === "function";
  6007. }
  6008. async function focusElement(el) {
  6009. if (!el) {
  6010. return;
  6011. }
  6012. return isCalciteFocusable(el) ? el.setFocus() : el.focus();
  6013. }
  6014. const defaultSlotSelector = ":not([slot])";
  6015. function getSlotted(element, slotName, options) {
  6016. if (slotName && !Array.isArray(slotName) && typeof slotName !== "string") {
  6017. options = slotName;
  6018. slotName = null;
  6019. }
  6020. const slotSelector = slotName
  6021. ? Array.isArray(slotName)
  6022. ? slotName.map((name) => `[slot="${name}"]`).join(",")
  6023. : `[slot="${slotName}"]`
  6024. : defaultSlotSelector;
  6025. if (options === null || options === void 0 ? void 0 : options.all) {
  6026. return queryMultiple(element, slotSelector, options);
  6027. }
  6028. return querySingle(element, slotSelector, options);
  6029. }
  6030. function getDirectChildren(el, selector) {
  6031. return el ? Array.from(el.children || []).filter((child) => child === null || child === void 0 ? void 0 : child.matches(selector)) : [];
  6032. }
  6033. function queryMultiple(element, slotSelector, options) {
  6034. let matches = slotSelector === defaultSlotSelector
  6035. ? getDirectChildren(element, defaultSlotSelector)
  6036. : Array.from(element.querySelectorAll(slotSelector));
  6037. matches = options && options.direct === false ? matches : matches.filter((el) => el.parentElement === element);
  6038. matches = (options === null || options === void 0 ? void 0 : options.matches) ? matches.filter((el) => el === null || el === void 0 ? void 0 : el.matches(options.matches)) : matches;
  6039. const selector = options === null || options === void 0 ? void 0 : options.selector;
  6040. return selector
  6041. ? matches
  6042. .map((item) => Array.from(item.querySelectorAll(selector)))
  6043. .reduce((previousValue, currentValue) => [...previousValue, ...currentValue], [])
  6044. .filter((match) => !!match)
  6045. : matches;
  6046. }
  6047. function querySingle(element, slotSelector, options) {
  6048. let match = slotSelector === defaultSlotSelector
  6049. ? getDirectChildren(element, defaultSlotSelector)[0] || null
  6050. : element.querySelector(slotSelector);
  6051. match = options && options.direct === false ? match : (match === null || match === void 0 ? void 0 : match.parentElement) === element ? match : null;
  6052. match = (options === null || options === void 0 ? void 0 : options.matches) ? ((match === null || match === void 0 ? void 0 : match.matches(options.matches)) ? match : null) : match;
  6053. const selector = options === null || options === void 0 ? void 0 : options.selector;
  6054. return selector ? match === null || match === void 0 ? void 0 : match.querySelector(selector) : match;
  6055. }
  6056. function filterDirectChildren(el, selector) {
  6057. return Array.from(el.children).filter((child) => child.matches(selector));
  6058. }
  6059. // set a default icon from a defined set or allow an override with an icon name string
  6060. function setRequestedIcon(iconObject, iconValue, matchedValue) {
  6061. if (typeof iconValue === "string" && iconValue !== "") {
  6062. return iconValue;
  6063. }
  6064. else if (iconValue === "") {
  6065. return iconObject[matchedValue];
  6066. }
  6067. }
  6068. function intersects(rect1, rect2) {
  6069. return !(rect2.left > rect1.right ||
  6070. rect2.right < rect1.left ||
  6071. rect2.top > rect1.bottom ||
  6072. rect2.bottom < rect1.top);
  6073. }
  6074. /**
  6075. * This helper makes sure that boolean aria attributes are properly converted to a string.
  6076. *
  6077. * It should only be used for aria attributes that require a string value of "true" or "false".
  6078. *
  6079. * @param value
  6080. * @returns {string} The string conversion of a boolean value ("true" | "false").
  6081. */
  6082. function toAriaBoolean(value) {
  6083. return Boolean(value).toString();
  6084. }
  6085. /**
  6086. * This helper returns true if the pointer event fired from the primary button of the device.
  6087. *
  6088. * See https://www.w3.org/TR/pointerevents/#the-button-property.
  6089. *
  6090. * @param event
  6091. * @returns {boolean}
  6092. */
  6093. function isPrimaryPointerButton(event) {
  6094. return !!(event.isPrimary && event.button === 0);
  6095. }
  6096. /**
  6097. * This utility ensures observers are created only for browser contexts.
  6098. *
  6099. * @param type - the type of observer to create
  6100. * @param callback - the observer callback
  6101. * @param options - the observer options
  6102. */
  6103. function createObserver(type, callback, options) {
  6104. {
  6105. return undefined;
  6106. }
  6107. }
  6108. const observed = new Set();
  6109. let mutationObserver$1;
  6110. const observerOptions = { childList: true };
  6111. /**
  6112. * Helper to set up a conditional slot component on connectedCallback.
  6113. *
  6114. * @param component
  6115. */
  6116. function connectConditionalSlotComponent(component) {
  6117. if (!mutationObserver$1) {
  6118. mutationObserver$1 = createObserver();
  6119. }
  6120. mutationObserver$1.observe(component.el, observerOptions);
  6121. }
  6122. /**
  6123. * Helper to tear down a conditional slot component on disconnectedCallback.
  6124. *
  6125. * @param component
  6126. */
  6127. function disconnectConditionalSlotComponent(component) {
  6128. observed.delete(component.el);
  6129. // we explicitly process queued mutations and disconnect and reconnect
  6130. // the observer until MutationObserver gets an `unobserve` method
  6131. // see https://github.com/whatwg/dom/issues/126
  6132. processMutations(mutationObserver$1.takeRecords());
  6133. mutationObserver$1.disconnect();
  6134. for (const [element] of observed.entries()) {
  6135. mutationObserver$1.observe(element, observerOptions);
  6136. }
  6137. }
  6138. function processMutations(mutations) {
  6139. mutations.forEach(({ target }) => {
  6140. forceUpdate$1(target);
  6141. });
  6142. }
  6143. const SLOTS$u = {
  6144. actionsStart: "actions-start",
  6145. actionsEnd: "actions-end"
  6146. };
  6147. const CSS$U = {
  6148. icon: "icon",
  6149. header: "header",
  6150. headerContent: "header-content",
  6151. actionsStart: "actions-start",
  6152. actionsEnd: "actions-end",
  6153. headerText: "header-text",
  6154. heading: "heading",
  6155. description: "description",
  6156. expandIcon: "expand-icon",
  6157. content: "content",
  6158. iconStart: "icon--start",
  6159. iconEnd: "icon--end",
  6160. headerContainer: "header-container"
  6161. };
  6162. const accordionItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-accordion-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-accordion-item{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-accordion-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-accordion-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-accordion-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-accordion-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-accordion-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-accordion-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-accordion-item-h{display:none}/*!@.icon-position--end, .icon-position--start*/.icon-position--end.sc-calcite-accordion-item,.icon-position--start.sc-calcite-accordion-item{--calcite-accordion-item-icon-rotation:calc(90deg * -1);--calcite-accordion-item-active-icon-rotation:0deg;--calcite-accordion-item-icon-rotation-rtl:90deg;--calcite-accordion-item-active-icon-rotation-rtl:0deg}/*!@.icon-position--start*/.icon-position--start.sc-calcite-accordion-item{--calcite-accordion-item-flex-direction:row-reverse;--calcite-accordion-item-icon-spacing-start:0;--calcite-accordion-item-icon-spacing-end:var(--calcite-accordion-icon-margin)}/*!@.icon-position--end*/.icon-position--end.sc-calcite-accordion-item{--calcite-accordion-item-flex-direction:row;--calcite-accordion-item-icon-spacing-start:var(--calcite-accordion-icon-margin);--calcite-accordion-item-icon-spacing-end:0}/*!@.icon-position--end:not(.icon-type--plus-minus)*/.icon-position--end.sc-calcite-accordion-item:not(.icon-type--plus-minus){--calcite-accordion-item-icon-rotation:0deg;--calcite-accordion-item-active-icon-rotation:180deg;--calcite-accordion-item-icon-rotation-rtl:0deg;--calcite-accordion-item-active-icon-rotation-rtl:calc(180deg * -1)}/*!@:host*/.sc-calcite-accordion-item-h{position:relative;display:flex;flex-direction:column;color:var(--calcite-ui-text-3);text-decoration-line:none;background-color:var(--calcite-accordion-item-background, var(--calcite-ui-foreground-1))}/*!@:host .header-content*/.sc-calcite-accordion-item-h .header-content.sc-calcite-accordion-item{outline-color:transparent}/*!@:host(:focus) .header-content*/.sc-calcite-accordion-item-h:focus .header-content.sc-calcite-accordion-item{outline:2px solid transparent;outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host([expanded])*/[expanded].sc-calcite-accordion-item-h{color:var(--calcite-ui-text-1)}/*!@:host([expanded]) .content*/[expanded].sc-calcite-accordion-item-h .content.sc-calcite-accordion-item{display:block;color:var(--calcite-ui-text-1)}/*!@:host([expanded]) .header*/[expanded].sc-calcite-accordion-item-h .header.sc-calcite-accordion-item{border-block-end-color:transparent}/*!@:host .header*/.sc-calcite-accordion-item-h .header.sc-calcite-accordion-item{display:flex;align-items:stretch}/*!@:host .icon*/.sc-calcite-accordion-item-h .icon.sc-calcite-accordion-item{position:relative;margin:0px;display:inline-flex;color:var(--calcite-ui-text-3);transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);margin-inline-end:var(--calcite-accordion-item-icon-spacing-start);margin-inline-start:var(--calcite-accordion-item-icon-spacing-end)}/*!@.icon--start*/.icon--start.sc-calcite-accordion-item{display:flex;align-items:center;margin-inline-end:var(--calcite-accordion-icon-margin)}/*!@.icon--end*/.icon--end.sc-calcite-accordion-item{display:flex;align-items:center;margin-inline-end:var(--calcite-accordion-icon-margin);margin-inline-start:var(--calcite-accordion-icon-margin)}/*!@.header-container*/.header-container.sc-calcite-accordion-item{inline-size:100%}/*!@.content*/.content.sc-calcite-accordion-item{padding:var(--calcite-accordion-item-padding)}/*!@:host .content,\n:host .header*/.sc-calcite-accordion-item-h .content.sc-calcite-accordion-item,.sc-calcite-accordion-item-h .header.sc-calcite-accordion-item{border-block-end:1px solid var(--calcite-accordion-item-border, var(--calcite-ui-border-2))}/*!@:host .header **/.sc-calcite-accordion-item-h .header.sc-calcite-accordion-item *.sc-calcite-accordion-item{display:inline-flex;align-items:center;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host .content*/.sc-calcite-accordion-item-h .content.sc-calcite-accordion-item{display:none;padding-block-start:0px;color:var(--calcite-ui-text-3);text-align:initial}/*!@:host .expand-icon*/.sc-calcite-accordion-item-h .expand-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-3);margin-inline-start:var(--calcite-accordion-item-icon-spacing-start);margin-inline-end:var(--calcite-accordion-item-icon-spacing-end);transform:rotate(var(--calcite-accordion-item-icon-rotation))}/*!@.calcite--rtl .expand-icon*/.calcite--rtl.sc-calcite-accordion-item .expand-icon.sc-calcite-accordion-item{transform:rotate(var(--calcite-accordion-item-icon-rotation-rtl))}/*!@:host([expanded]) .expand-icon*/[expanded].sc-calcite-accordion-item-h .expand-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1);transform:rotate(var(--calcite-accordion-item-active-icon-rotation))}/*!@:host([expanded]) .calcite--rtl .expand-icon*/[expanded].sc-calcite-accordion-item-h .calcite--rtl.sc-calcite-accordion-item .expand-icon.sc-calcite-accordion-item{transform:rotate(var(--calcite-accordion-item-active-icon-rotation-rtl))}/*!@:host .header-text*/.sc-calcite-accordion-item-h .header-text.sc-calcite-accordion-item{margin-block:0px;flex-grow:1;flex-direction:column;padding-block:0px;text-align:initial;margin-inline-end:auto}/*!@:host .heading, \n:host .description*/.sc-calcite-accordion-item-h .heading.sc-calcite-accordion-item,.sc-calcite-accordion-item-h .description.sc-calcite-accordion-item{display:flex;inline-size:100%}/*!@:host .heading*/.sc-calcite-accordion-item-h .heading.sc-calcite-accordion-item{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}/*!@:host .description*/.sc-calcite-accordion-item-h .description.sc-calcite-accordion-item{margin-block-start:0.25rem;color:var(--calcite-ui-text-3)}/*!@:host(:focus) .heading, \n:host(:hover) .heading*/.sc-calcite-accordion-item-h:focus .heading.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:hover .heading.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .icon, \n:host(:hover) .icon*/.sc-calcite-accordion-item-h:focus .icon.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:hover .icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .expand-icon, \n:host(:hover) .expand-icon*/.sc-calcite-accordion-item-h:focus .expand-icon.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:hover .expand-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .description, \n:host(:hover) .description*/.sc-calcite-accordion-item-h:focus .description.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:hover .description.sc-calcite-accordion-item{color:var(--calcite-ui-text-2)}/*!@:host(:focus) .heading, \n:host(:active) .heading, \n:host([expanded]) .heading*/.sc-calcite-accordion-item-h:focus .heading.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:active .heading.sc-calcite-accordion-item,[expanded].sc-calcite-accordion-item-h .heading.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .icon, \n:host(:active) .icon, \n:host([expanded]) .icon*/.sc-calcite-accordion-item-h:focus .icon.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:active .icon.sc-calcite-accordion-item,[expanded].sc-calcite-accordion-item-h .icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .expand-icon, \n:host(:active) .expand-icon, \n:host([expanded]) .expand-icon*/.sc-calcite-accordion-item-h:focus .expand-icon.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:active .expand-icon.sc-calcite-accordion-item,[expanded].sc-calcite-accordion-item-h .expand-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .description, \n:host(:active) .description, \n:host([expanded]) .description*/.sc-calcite-accordion-item-h:focus .description.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:active .description.sc-calcite-accordion-item,[expanded].sc-calcite-accordion-item-h .description.sc-calcite-accordion-item{color:var(--calcite-ui-text-2)}/*!@.header-content*/.header-content.sc-calcite-accordion-item{flex-grow:1;cursor:pointer;padding:var(--calcite-accordion-item-padding);flex-direction:var(--calcite-accordion-item-flex-direction)}/*!@.actions-start, \n.actions-end*/.actions-start.sc-calcite-accordion-item,.actions-end.sc-calcite-accordion-item{display:flex;align-items:center}@media (forced-colors: active){/*!@:host([expanded]) .header*/[expanded].sc-calcite-accordion-item-h .header.sc-calcite-accordion-item{border-block-end:none}/*!@:host([expanded]) .heading*/[expanded].sc-calcite-accordion-item-h .heading.sc-calcite-accordion-item{font-weight:bolder}/*!@:host(:hover) .heading,\n:host(:focus) .heading*/.sc-calcite-accordion-item-h:hover .heading.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:focus .heading.sc-calcite-accordion-item{text-decoration:underline}}";
  6163. /**
  6164. * @slot - A slot for adding custom content, including nested `calcite-accordion-item`s.
  6165. */
  6166. class AccordionItem {
  6167. constructor(hostRef) {
  6168. registerInstance(this, hostRef);
  6169. this.calciteInternalAccordionItemKeyEvent = createEvent(this, "calciteInternalAccordionItemKeyEvent", 6);
  6170. this.calciteInternalAccordionItemSelect = createEvent(this, "calciteInternalAccordionItemSelect", 6);
  6171. this.calciteInternalAccordionItemClose = createEvent(this, "calciteInternalAccordionItemClose", 6);
  6172. this.calciteInternalAccordionItemRegister = createEvent(this, "calciteInternalAccordionItemRegister", 6);
  6173. //--------------------------------------------------------------------------
  6174. //
  6175. // Public Properties
  6176. //
  6177. //--------------------------------------------------------------------------
  6178. /**
  6179. * When `true`, the component is active.
  6180. *
  6181. * @deprecated use `expanded` instead.
  6182. */
  6183. this.active = false;
  6184. /** When `true`, the component is expanded. */
  6185. this.expanded = false;
  6186. /** what icon position does the parent accordion specify */
  6187. this.iconPosition = "end";
  6188. /** handle clicks on item header */
  6189. this.itemHeaderClickHandler = () => this.emitRequestedItem();
  6190. }
  6191. activeHandler(value) {
  6192. this.expanded = value;
  6193. }
  6194. expandedHandler(value) {
  6195. this.active = value;
  6196. }
  6197. iconHandler(value) {
  6198. this.iconStart = value;
  6199. }
  6200. iconStartHandler(value) {
  6201. this.icon = value;
  6202. }
  6203. //--------------------------------------------------------------------------
  6204. //
  6205. // Lifecycle
  6206. //
  6207. //--------------------------------------------------------------------------
  6208. connectedCallback() {
  6209. this.parent = this.el.parentElement;
  6210. this.selectionMode = getElementProp(this.el, "selection-mode", "multi");
  6211. this.iconType = getElementProp(this.el, "icon-type", "chevron");
  6212. this.iconPosition = getElementProp(this.el, "icon-position", this.iconPosition);
  6213. const isExpanded = this.active || this.expanded;
  6214. if (isExpanded) {
  6215. this.activeHandler(isExpanded);
  6216. this.expandedHandler(isExpanded);
  6217. }
  6218. if (this.iconStart) {
  6219. this.icon = this.iconStart;
  6220. }
  6221. else if (this.icon) {
  6222. this.iconStart = this.icon;
  6223. }
  6224. connectConditionalSlotComponent(this);
  6225. }
  6226. componentDidLoad() {
  6227. this.itemPosition = this.getItemPosition();
  6228. this.calciteInternalAccordionItemRegister.emit({
  6229. parent: this.parent,
  6230. position: this.itemPosition
  6231. });
  6232. }
  6233. disconnectedCallback() {
  6234. disconnectConditionalSlotComponent(this);
  6235. }
  6236. // --------------------------------------------------------------------------
  6237. //
  6238. // Render Methods
  6239. //
  6240. // --------------------------------------------------------------------------
  6241. renderActionsStart() {
  6242. const { el } = this;
  6243. return getSlotted(el, SLOTS$u.actionsStart) ? (hAsync("div", { class: CSS$U.actionsStart }, hAsync("slot", { name: SLOTS$u.actionsStart }))) : null;
  6244. }
  6245. renderActionsEnd() {
  6246. const { el } = this;
  6247. return getSlotted(el, SLOTS$u.actionsEnd) ? (hAsync("div", { class: CSS$U.actionsEnd }, hAsync("slot", { name: SLOTS$u.actionsEnd }))) : null;
  6248. }
  6249. render() {
  6250. const dir = getElementDir(this.el);
  6251. const iconStartEl = this.iconStart ? (hAsync("calcite-icon", { class: CSS$U.iconStart, icon: this.iconStart, key: "icon-start", scale: "s" })) : null;
  6252. const iconEndEl = this.iconEnd ? (hAsync("calcite-icon", { class: CSS$U.iconEnd, icon: this.iconEnd, key: "icon-end", scale: "s" })) : null;
  6253. const description = this.description || this.itemSubtitle;
  6254. return (hAsync(Host, null, hAsync("div", { class: {
  6255. [`icon-position--${this.iconPosition}`]: true,
  6256. [`icon-type--${this.iconType}`]: true
  6257. } }, hAsync("div", { class: { [CSS$U.header]: true, [CSS_UTILITY.rtl]: dir === "rtl" } }, this.renderActionsStart(), hAsync("div", { "aria-expanded": toAriaBoolean(this.active || this.expanded), class: CSS$U.headerContent, onClick: this.itemHeaderClickHandler, role: "button", tabindex: "0" }, hAsync("div", { class: CSS$U.headerContainer }, iconStartEl, hAsync("div", { class: CSS$U.headerText }, hAsync("span", { class: CSS$U.heading }, this.heading || this.itemTitle), description ? hAsync("span", { class: CSS$U.description }, description) : null), iconEndEl), hAsync("calcite-icon", { class: CSS$U.expandIcon, icon: this.iconType === "chevron"
  6258. ? "chevronDown"
  6259. : this.iconType === "caret"
  6260. ? "caretDown"
  6261. : this.expanded || this.active
  6262. ? "minus"
  6263. : "plus", scale: "s" })), this.renderActionsEnd()), hAsync("div", { class: CSS$U.content }, hAsync("slot", null)))));
  6264. }
  6265. //--------------------------------------------------------------------------
  6266. //
  6267. // Event Listeners
  6268. //
  6269. //--------------------------------------------------------------------------
  6270. keyDownHandler(event) {
  6271. if (event.target === this.el) {
  6272. switch (event.key) {
  6273. case " ":
  6274. case "Enter":
  6275. this.emitRequestedItem();
  6276. event.preventDefault();
  6277. break;
  6278. case "ArrowUp":
  6279. case "ArrowDown":
  6280. case "Home":
  6281. case "End":
  6282. this.calciteInternalAccordionItemKeyEvent.emit({
  6283. parent: this.parent,
  6284. item: event
  6285. });
  6286. event.preventDefault();
  6287. break;
  6288. }
  6289. }
  6290. }
  6291. updateActiveItemOnChange(event) {
  6292. this.requestedAccordionItem = event.detail
  6293. .requestedAccordionItem;
  6294. if (this.el.parentNode !== this.requestedAccordionItem.parentNode) {
  6295. return;
  6296. }
  6297. this.determineActiveItem();
  6298. event.stopPropagation();
  6299. }
  6300. //--------------------------------------------------------------------------
  6301. //
  6302. // Private Methods
  6303. //
  6304. //--------------------------------------------------------------------------
  6305. determineActiveItem() {
  6306. switch (this.selectionMode) {
  6307. case "multi":
  6308. if (this.el === this.requestedAccordionItem) {
  6309. this.expanded = !this.expanded;
  6310. }
  6311. break;
  6312. case "single":
  6313. this.expanded = this.el === this.requestedAccordionItem ? !this.expanded : false;
  6314. break;
  6315. case "single-persist":
  6316. this.expanded = this.el === this.requestedAccordionItem;
  6317. break;
  6318. }
  6319. }
  6320. emitRequestedItem() {
  6321. this.calciteInternalAccordionItemSelect.emit({
  6322. requestedAccordionItem: this.el
  6323. });
  6324. }
  6325. getItemPosition() {
  6326. return Array.prototype.indexOf.call(this.parent.querySelectorAll("calcite-accordion-item"), this.el);
  6327. }
  6328. get el() { return getElement(this); }
  6329. static get watchers() { return {
  6330. "active": ["activeHandler"],
  6331. "expanded": ["expandedHandler"],
  6332. "icon": ["iconHandler"],
  6333. "iconStart": ["iconStartHandler"]
  6334. }; }
  6335. static get style() { return accordionItemCss; }
  6336. static get cmpMeta() { return {
  6337. "$flags$": 9,
  6338. "$tagName$": "calcite-accordion-item",
  6339. "$members$": {
  6340. "active": [1540],
  6341. "expanded": [1540],
  6342. "itemTitle": [1, "item-title"],
  6343. "itemSubtitle": [1, "item-subtitle"],
  6344. "heading": [1],
  6345. "description": [1],
  6346. "icon": [1537],
  6347. "iconStart": [513, "icon-start"],
  6348. "iconEnd": [513, "icon-end"]
  6349. },
  6350. "$listeners$": [[0, "keydown", "keyDownHandler"], [16, "calciteInternalAccordionChange", "updateActiveItemOnChange"]],
  6351. "$lazyBundleId$": "-",
  6352. "$attrsToReflect$": [["active", "active"], ["expanded", "expanded"], ["icon", "icon"], ["iconStart", "icon-start"], ["iconEnd", "icon-end"]]
  6353. }; }
  6354. }
  6355. const CSS$T = {
  6356. button: "button",
  6357. buttonTextVisible: "button--text-visible",
  6358. buttonCompact: "button--compact",
  6359. iconContainer: "icon-container",
  6360. slotContainer: "slot-container",
  6361. slotContainerHidden: "slot-container--hidden",
  6362. textContainer: "text-container",
  6363. textContainerVisible: "text-container--visible"
  6364. };
  6365. const TEXT$u = {
  6366. loading: "Loading"
  6367. };
  6368. const SLOTS$t = {
  6369. tooltip: "tooltip"
  6370. };
  6371. function noopClick() {
  6372. /** noop */
  6373. }
  6374. /**
  6375. * This helper updates the host element to prevent keyboard interaction on its subtree and sets the appropriate aria attribute for accessibility.
  6376. *
  6377. * This should be used in the `componentDidRender` lifecycle hook.
  6378. *
  6379. * **Notes**
  6380. *
  6381. * this util is not needed for simple components whose root element or elements are an interactive component (custom element or native control). For those cases, set the `disabled` props on the root components instead.
  6382. * technically, users can override `tabindex` and restore keyboard navigation, but this will be considered user error
  6383. *
  6384. * @param component
  6385. * @param hostIsTabbable
  6386. */
  6387. function updateHostInteraction(component, hostIsTabbable = false) {
  6388. if (component.disabled) {
  6389. component.el.setAttribute("tabindex", "-1");
  6390. component.el.setAttribute("aria-disabled", "true");
  6391. if (component.el.contains(document.activeElement)) {
  6392. document.activeElement.blur();
  6393. }
  6394. component.el.click = noopClick;
  6395. return;
  6396. }
  6397. component.el.click = HTMLElement.prototype.click;
  6398. if (typeof hostIsTabbable === "function") {
  6399. component.el.setAttribute("tabindex", hostIsTabbable.call(component) ? "0" : "-1");
  6400. }
  6401. else if (hostIsTabbable === true) {
  6402. component.el.setAttribute("tabindex", "0");
  6403. }
  6404. else if (hostIsTabbable === false) {
  6405. component.el.removeAttribute("tabindex");
  6406. }
  6407. else ;
  6408. component.el.removeAttribute("aria-disabled");
  6409. }
  6410. const actionCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-action:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-action{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-action:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-action-h{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-action-h *.sc-calcite-action{box-sizing:border-box}/*!@:root*/.sc-calcite-action:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-action-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-action-h{display:flex;background-color:transparent;--calcite-action-indicator-color:var(--calcite-ui-brand)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-action-h[disabled] .sc-calcite-action-s>[calcite-hydrated][disabled],[disabled].sc-calcite-action-h [calcite-hydrated][disabled].sc-calcite-action{opacity:1}/*!@.button*/.button.sc-calcite-action{position:relative;margin:0px;display:flex;inline-size:auto;cursor:pointer;align-items:center;justify-content:flex-start;border-style:none;background-color:var(--calcite-ui-foreground-1);fill:var(--calcite-ui-text-3);font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-3);outline-color:transparent;text-align:unset;flex:1 0 auto}/*!@.button:hover*/.button.sc-calcite-action:hover{background-color:var(--calcite-ui-foreground-2);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}/*!@.button:focus*/.button.sc-calcite-action:focus{background-color:var(--calcite-ui-foreground-2);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1);outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.button:active*/.button.sc-calcite-action:active{background-color:var(--calcite-ui-foreground-3)}/*!@.button .icon-container*/.button.sc-calcite-action .icon-container.sc-calcite-action{pointer-events:none;margin:0px;display:flex;align-items:center;justify-content:center;min-inline-size:1rem;min-block-size:1rem}/*!@.button .text-container*/.button.sc-calcite-action .text-container.sc-calcite-action{margin:0px;inline-size:0px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.5rem;opacity:0;transition-property:opacity;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-property:margin;transition-property:inline-size}/*!@.button .text-container--visible*/.button.sc-calcite-action .text-container--visible.sc-calcite-action{inline-size:auto;flex:1 1 auto;opacity:1}/*!@:host([scale=s]) .button*/[scale=s].sc-calcite-action-h .button.sc-calcite-action{padding-inline:0.5rem;padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-normal)}/*!@:host([scale=s]) .button--text-visible .icon-container*/[scale=s].sc-calcite-action-h .button--text-visible.sc-calcite-action .icon-container.sc-calcite-action{margin-inline-end:0.5rem}/*!@:host([scale=m]) .button*/[scale=m].sc-calcite-action-h .button.sc-calcite-action{padding-inline:1rem;padding-block:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem;font-weight:var(--calcite-font-weight-normal)}/*!@:host([scale=m]) .button--text-visible .icon-container*/[scale=m].sc-calcite-action-h .button--text-visible.sc-calcite-action .icon-container.sc-calcite-action{margin-inline-end:0.75rem}/*!@:host([scale=l]) .button*/[scale=l].sc-calcite-action-h .button.sc-calcite-action{padding:1.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;font-weight:var(--calcite-font-weight-normal)}/*!@:host([scale=l]) .button--text-visible .icon-container*/[scale=l].sc-calcite-action-h .button--text-visible.sc-calcite-action .icon-container.sc-calcite-action{margin-inline-end:1rem}/*!@:host([alignment=center]) .button*/[alignment=center].sc-calcite-action-h .button.sc-calcite-action{justify-content:center}/*!@:host([alignment=end]) .button*/[alignment=end].sc-calcite-action-h .button.sc-calcite-action{justify-content:flex-end}/*!@:host([alignment=center]) .button .text-container--visible, \n:host([alignment=end]) .button .text-container--visible*/[alignment=center].sc-calcite-action-h .button.sc-calcite-action .text-container--visible.sc-calcite-action,[alignment=end].sc-calcite-action-h .button.sc-calcite-action .text-container--visible.sc-calcite-action{flex:0 1 auto}/*!@:host([scale=s][compact]) .button, \n:host([scale=m][compact]) .button, \n:host([scale=l][compact]) .button*/[scale=s][compact].sc-calcite-action-h .button.sc-calcite-action,[scale=m][compact].sc-calcite-action-h .button.sc-calcite-action,[scale=l][compact].sc-calcite-action-h .button.sc-calcite-action{padding-inline:0px}/*!@.slot-container*/.slot-container.sc-calcite-action{display:flex}/*!@.slot-container--hidden*/.slot-container--hidden.sc-calcite-action{display:none}/*!@.button--text-visible*/.button--text-visible.sc-calcite-action{inline-size:100%}/*!@:host([active]) .button, \n:host([active]) .button:hover, \n:host([active]) .button:focus, \n:host([active][loading]) .button*/[active].sc-calcite-action-h .button.sc-calcite-action,[active].sc-calcite-action-h .button.sc-calcite-action:hover,[active].sc-calcite-action-h .button.sc-calcite-action:focus,[active][loading].sc-calcite-action-h .button.sc-calcite-action{background-color:var(--calcite-ui-foreground-3);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}/*!@:host([active]) .button:active*/[active].sc-calcite-action-h .button.sc-calcite-action:active{background-color:var(--calcite-ui-foreground-1)}/*!@:host([appearance=clear]) .button, \n:host([appearance=transparent]) .button*/[appearance=clear].sc-calcite-action-h .button.sc-calcite-action,[appearance=transparent].sc-calcite-action-h .button.sc-calcite-action{background-color:transparent;transition-property:box-shadow;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host([appearance=clear]) .button:hover, \n:host([appearance=clear]) .button:focus, \n:host([appearance=transparent]) .button:hover, \n:host([appearance=transparent]) .button:focus*/[appearance=clear].sc-calcite-action-h .button.sc-calcite-action:hover,[appearance=clear].sc-calcite-action-h .button.sc-calcite-action:focus,[appearance=transparent].sc-calcite-action-h .button.sc-calcite-action:hover,[appearance=transparent].sc-calcite-action-h .button.sc-calcite-action:focus{background-color:transparent;box-shadow:0 0 0 2px var(--calcite-ui-border-1) inset}/*!@:host([active][appearance=clear]) .button, \n:host([active][appearance=clear]) .button:hover, \n:host([active][appearance=clear]) .button:focus, \n:host([active][appearance=transparent]) .button, \n:host([active][appearance=transparent]) .button:hover, \n:host([active][appearance=transparent]) .button:focus*/[active][appearance=clear].sc-calcite-action-h .button.sc-calcite-action,[active][appearance=clear].sc-calcite-action-h .button.sc-calcite-action:hover,[active][appearance=clear].sc-calcite-action-h .button.sc-calcite-action:focus,[active][appearance=transparent].sc-calcite-action-h .button.sc-calcite-action,[active][appearance=transparent].sc-calcite-action-h .button.sc-calcite-action:hover,[active][appearance=transparent].sc-calcite-action-h .button.sc-calcite-action:focus{background-color:var(--calcite-ui-foreground-3);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}/*!@:host([appearance=clear][loading]) .button, \n:host([appearance=clear][disabled]) .button, \n:host([appearance=transparent][loading]) .button, \n:host([appearance=transparent][disabled]) .button*/[appearance=clear][loading].sc-calcite-action-h .button.sc-calcite-action,[appearance=clear][disabled].sc-calcite-action-h .button.sc-calcite-action,[appearance=transparent][loading].sc-calcite-action-h .button.sc-calcite-action,[appearance=transparent][disabled].sc-calcite-action-h .button.sc-calcite-action{background-color:transparent}/*!@:host([loading]) .button, \n:host([loading]) .button:hover, \n:host([loading]) .button:focus*/[loading].sc-calcite-action-h .button.sc-calcite-action,[loading].sc-calcite-action-h .button.sc-calcite-action:hover,[loading].sc-calcite-action-h .button.sc-calcite-action:focus{background-color:var(--calcite-ui-foreground-1)}/*!@:host([loading]) .button .text-container, \n:host([loading]) .button:hover .text-container, \n:host([loading]) .button:focus .text-container*/[loading].sc-calcite-action-h .button.sc-calcite-action .text-container.sc-calcite-action,[loading].sc-calcite-action-h .button.sc-calcite-action:hover .text-container.sc-calcite-action,[loading].sc-calcite-action-h .button.sc-calcite-action:focus .text-container.sc-calcite-action{opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([loading]) calcite-loader[inline]*/[loading].sc-calcite-action-h calcite-loader[inline].sc-calcite-action{color:var(--calcite-ui-text-3);margin-inline-end:0px}/*!@:host([disabled]) .button, \n:host([disabled]) .button:hover, \n:host([disabled]) .button:focus*/[disabled].sc-calcite-action-h .button.sc-calcite-action,[disabled].sc-calcite-action-h .button.sc-calcite-action:hover,[disabled].sc-calcite-action-h .button.sc-calcite-action:focus{cursor:default;background-color:var(--calcite-ui-foreground-1);opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled][active]) .button, \n:host([disabled][active]) .button:hover, \n:host([disabled][active]) .button:focus*/[disabled][active].sc-calcite-action-h .button.sc-calcite-action,[disabled][active].sc-calcite-action-h .button.sc-calcite-action:hover,[disabled][active].sc-calcite-action-h .button.sc-calcite-action:focus{background-color:var(--calcite-ui-foreground-3);opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([indicator]) .button::after*/[indicator].sc-calcite-action-h .button.sc-calcite-action::after{content:\"\";position:absolute;block-size:0.5rem;inline-size:0.5rem;border-radius:9999px;border-width:2px;background-color:var(--calcite-action-indicator-color);border-color:var(--calcite-ui-foreground-1);inset-block-end:0.75rem;inset-inline-end:0.75rem}/*!@:host([indicator]) .button--text-visible::after*/[indicator].sc-calcite-action-h .button--text-visible.sc-calcite-action::after{inset-block-end:auto}/*!@:host([indicator]) .button--text-visible .text-container--visible*/[indicator].sc-calcite-action-h .button--text-visible.sc-calcite-action .text-container--visible.sc-calcite-action{margin-inline-end:1rem}/*!@:host([indicator]) .button:hover::after,\n:host([indicator]) .button:focus::after*/[indicator].sc-calcite-action-h .button.sc-calcite-action:hover::after,[indicator].sc-calcite-action-h .button.sc-calcite-action:focus::after{border-color:var(--calcite-ui-foreground-1)}/*!@:host([indicator][scale=s]) .button::after*/[indicator][scale=s].sc-calcite-action-h .button.sc-calcite-action::after{inset-block-end:0.25rem;inset-inline-end:0.25rem}/*!@:host([indicator][scale=s]) .button--text-visible::after*/[indicator][scale=s].sc-calcite-action-h .button--text-visible.sc-calcite-action::after{inset-block-end:auto;inset-inline-end:0.5rem}/*!@:host([indicator][active]) .button::after*/[indicator][active].sc-calcite-action-h .button.sc-calcite-action::after{border-color:var(--calcite-ui-foreground-3)}";
  6411. /**
  6412. * @slot - A slot for adding a `calcite-icon`.
  6413. */
  6414. class Action {
  6415. constructor(hostRef) {
  6416. registerInstance(this, hostRef);
  6417. this.calciteActionClick = createEvent(this, "calciteActionClick", 6);
  6418. // --------------------------------------------------------------------------
  6419. //
  6420. // Properties
  6421. //
  6422. // --------------------------------------------------------------------------
  6423. /**
  6424. * When `true`, the component is highlighted.
  6425. */
  6426. this.active = false;
  6427. /** Specifies the appearance of the component. */
  6428. this.appearance = "solid";
  6429. /**
  6430. * When `true`, the side padding of the component is reduced. Compact mode is used internally by components, e.g. `calcite-block-section`.
  6431. */
  6432. this.compact = false;
  6433. /**
  6434. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  6435. */
  6436. this.disabled = false;
  6437. /**
  6438. * When `true`, indicates unread changes.
  6439. */
  6440. this.indicator = false;
  6441. /**
  6442. * Specifies the text label to display while loading.
  6443. *
  6444. * @default "Loading"
  6445. */
  6446. this.intlLoading = TEXT$u.loading;
  6447. /**
  6448. * When `true`, a busy indicator is displayed.
  6449. */
  6450. this.loading = false;
  6451. /**
  6452. * Specifies the size of the component.
  6453. */
  6454. this.scale = "m";
  6455. /**
  6456. * Indicates whether the text is displayed.
  6457. */
  6458. this.textEnabled = false;
  6459. this.mutationObserver = createObserver();
  6460. // --------------------------------------------------------------------------
  6461. //
  6462. // Private Methods
  6463. //
  6464. // --------------------------------------------------------------------------
  6465. this.handleTooltipSlotChange = (event) => {
  6466. const tooltips = event.target
  6467. .assignedElements({
  6468. flatten: true
  6469. })
  6470. .filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-tooltip"));
  6471. const tooltip = tooltips[0];
  6472. if (tooltip) {
  6473. tooltip.referenceElement = this.buttonEl;
  6474. }
  6475. };
  6476. this.calciteActionClickHandler = () => {
  6477. if (!this.disabled) {
  6478. this.calciteActionClick.emit();
  6479. }
  6480. };
  6481. }
  6482. // --------------------------------------------------------------------------
  6483. //
  6484. // Lifecycle
  6485. //
  6486. // --------------------------------------------------------------------------
  6487. connectedCallback() {
  6488. var _a;
  6489. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  6490. }
  6491. disconnectedCallback() {
  6492. var _a;
  6493. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  6494. }
  6495. componentDidRender() {
  6496. updateHostInteraction(this);
  6497. }
  6498. // --------------------------------------------------------------------------
  6499. //
  6500. // Methods
  6501. //
  6502. // --------------------------------------------------------------------------
  6503. /** Sets focus on the component. */
  6504. async setFocus() {
  6505. var _a;
  6506. (_a = this.buttonEl) === null || _a === void 0 ? void 0 : _a.focus();
  6507. }
  6508. // --------------------------------------------------------------------------
  6509. //
  6510. // Render Methods
  6511. //
  6512. // --------------------------------------------------------------------------
  6513. renderTextContainer() {
  6514. const { text, textEnabled } = this;
  6515. const textContainerClasses = {
  6516. [CSS$T.textContainer]: true,
  6517. [CSS$T.textContainerVisible]: textEnabled
  6518. };
  6519. return text ? (hAsync("div", { class: textContainerClasses, key: "text-container" }, text)) : null;
  6520. }
  6521. renderIconContainer() {
  6522. var _a;
  6523. const { loading, icon, scale, el, intlLoading } = this;
  6524. const iconScale = scale === "l" ? "m" : "s";
  6525. const loaderScale = scale === "l" ? "l" : "m";
  6526. const calciteLoaderNode = loading ? (hAsync("calcite-loader", { active: true, inline: true, label: intlLoading, scale: loaderScale })) : null;
  6527. const calciteIconNode = icon ? hAsync("calcite-icon", { icon: icon, scale: iconScale }) : null;
  6528. const iconNode = calciteLoaderNode || calciteIconNode;
  6529. const hasIconToDisplay = iconNode || ((_a = el.children) === null || _a === void 0 ? void 0 : _a.length);
  6530. const slotContainerNode = (hAsync("div", { class: {
  6531. [CSS$T.slotContainer]: true,
  6532. [CSS$T.slotContainerHidden]: loading
  6533. } }, hAsync("slot", null)));
  6534. return hasIconToDisplay ? (hAsync("div", { "aria-hidden": "true", class: CSS$T.iconContainer, key: "icon-container" }, iconNode, slotContainerNode)) : null;
  6535. }
  6536. render() {
  6537. const { compact, disabled, loading, textEnabled, label, text } = this;
  6538. const ariaLabel = label || text;
  6539. const buttonClasses = {
  6540. [CSS$T.button]: true,
  6541. [CSS$T.buttonTextVisible]: textEnabled,
  6542. [CSS$T.buttonCompact]: compact
  6543. };
  6544. return (hAsync(Host, { onClick: this.calciteActionClickHandler }, hAsync("button", { "aria-busy": toAriaBoolean(loading), "aria-disabled": toAriaBoolean(disabled), "aria-label": ariaLabel, class: buttonClasses, disabled: disabled, ref: (buttonEl) => (this.buttonEl = buttonEl) }, this.renderIconContainer(), this.renderTextContainer()), hAsync("slot", { name: SLOTS$t.tooltip, onSlotchange: this.handleTooltipSlotChange })));
  6545. }
  6546. get el() { return getElement(this); }
  6547. static get style() { return actionCss; }
  6548. static get cmpMeta() { return {
  6549. "$flags$": 9,
  6550. "$tagName$": "calcite-action",
  6551. "$members$": {
  6552. "active": [516],
  6553. "alignment": [513],
  6554. "appearance": [513],
  6555. "compact": [516],
  6556. "disabled": [516],
  6557. "icon": [1],
  6558. "indicator": [516],
  6559. "intlLoading": [1, "intl-loading"],
  6560. "label": [1],
  6561. "loading": [516],
  6562. "scale": [513],
  6563. "text": [1],
  6564. "textEnabled": [516, "text-enabled"],
  6565. "setFocus": [64]
  6566. },
  6567. "$listeners$": undefined,
  6568. "$lazyBundleId$": "-",
  6569. "$attrsToReflect$": [["active", "active"], ["alignment", "alignment"], ["appearance", "appearance"], ["compact", "compact"], ["disabled", "disabled"], ["indicator", "indicator"], ["loading", "loading"], ["scale", "scale"], ["textEnabled", "text-enabled"]]
  6570. }; }
  6571. }
  6572. const CSS$S = {
  6573. menu: "menu",
  6574. defaultTrigger: "default-trigger"
  6575. };
  6576. const SLOTS$s = {
  6577. tooltip: "tooltip",
  6578. trigger: "trigger"
  6579. };
  6580. const ICONS$g = {
  6581. menu: "ellipsis"
  6582. };
  6583. const SLOTS$r = {
  6584. menuActions: "menu-actions",
  6585. menuTooltip: "menu-tooltip"
  6586. };
  6587. const TEXT$t = {
  6588. more: "More"
  6589. };
  6590. const ICONS$f = {
  6591. menu: "ellipsis"
  6592. };
  6593. const overflowActionsDebounceInMs = 150;
  6594. const groupBufferPx = 2;
  6595. const getAverage = (arr) => arr.reduce((p, c) => p + c, 0) / arr.length;
  6596. const geActionDimensions = (actions) => {
  6597. const actionLen = actions === null || actions === void 0 ? void 0 : actions.length;
  6598. return {
  6599. actionWidth: actionLen ? getAverage(actions.map((action) => action.clientWidth || 0)) : 0,
  6600. actionHeight: actionLen ? getAverage(actions.map((action) => action.clientHeight || 0)) : 0
  6601. };
  6602. };
  6603. const getMaxActionCount = ({ width, actionWidth, layout, height, actionHeight, groupCount }) => {
  6604. const maxContainerPx = layout === "horizontal" ? width : height;
  6605. const avgItemPx = layout === "horizontal" ? actionWidth : actionHeight;
  6606. return Math.floor((maxContainerPx - groupCount * groupBufferPx) / avgItemPx);
  6607. };
  6608. const getOverflowCount = ({ layout, actionCount, actionWidth, width, actionHeight, height, groupCount }) => {
  6609. return Math.max(actionCount - getMaxActionCount({ width, actionWidth, layout, height, actionHeight, groupCount }), 0);
  6610. };
  6611. const queryActions = (el) => {
  6612. return Array.from(el.querySelectorAll("calcite-action")).filter((action) => action.closest("calcite-action-menu") ? action.slot === SLOTS$s.trigger : true);
  6613. };
  6614. const overflowActions = ({ actionGroups, expanded, overflowCount }) => {
  6615. let needToSlotCount = overflowCount;
  6616. actionGroups.reverse().forEach((group) => {
  6617. let slottedWithinGroupCount = 0;
  6618. const groupActions = queryActions(group).reverse();
  6619. groupActions.forEach((groupAction) => {
  6620. if (groupAction.slot === SLOTS$r.menuActions) {
  6621. groupAction.removeAttribute("slot");
  6622. groupAction.textEnabled = expanded;
  6623. }
  6624. });
  6625. if (needToSlotCount > 0) {
  6626. groupActions.some((groupAction) => {
  6627. const unslottedActions = groupActions.filter((action) => !action.slot);
  6628. if (unslottedActions.length > 1 && groupActions.length > 2 && !groupAction.closest("calcite-action-menu")) {
  6629. groupAction.textEnabled = true;
  6630. groupAction.setAttribute("slot", SLOTS$r.menuActions);
  6631. slottedWithinGroupCount++;
  6632. if (slottedWithinGroupCount > 1) {
  6633. needToSlotCount--;
  6634. }
  6635. }
  6636. return needToSlotCount < 1;
  6637. });
  6638. }
  6639. forceUpdate$1(group);
  6640. });
  6641. };
  6642. const ICONS$e = {
  6643. chevronsLeft: "chevrons-left",
  6644. chevronsRight: "chevrons-right"
  6645. };
  6646. function getCalcitePosition(position, el) {
  6647. var _a;
  6648. return position || ((_a = el.closest("calcite-shell-panel")) === null || _a === void 0 ? void 0 : _a.position) || "start";
  6649. }
  6650. function toggleChildActionText({ parent, expanded }) {
  6651. queryActions(parent)
  6652. .filter((el) => el.slot !== SLOTS$r.menuActions)
  6653. .forEach((action) => (action.textEnabled = expanded));
  6654. parent
  6655. .querySelectorAll("calcite-action-group, calcite-action-menu")
  6656. .forEach((el) => (el.expanded = expanded));
  6657. }
  6658. const setTooltipReference = ({ tooltip, referenceElement, expanded, ref }) => {
  6659. if (tooltip) {
  6660. tooltip.referenceElement = !expanded && referenceElement ? referenceElement : null;
  6661. }
  6662. if (ref) {
  6663. ref(referenceElement);
  6664. }
  6665. return referenceElement;
  6666. };
  6667. const ExpandToggle = ({ expanded, intlExpand, intlCollapse, toggle, el, position, tooltip, ref, scale }) => {
  6668. const rtl = getElementDir(el) === "rtl";
  6669. const expandText = expanded ? intlCollapse : intlExpand;
  6670. const icons = [ICONS$e.chevronsLeft, ICONS$e.chevronsRight];
  6671. if (rtl) {
  6672. icons.reverse();
  6673. }
  6674. const end = getCalcitePosition(position, el) === "end";
  6675. const expandIcon = end ? icons[1] : icons[0];
  6676. const collapseIcon = end ? icons[0] : icons[1];
  6677. const actionNode = (hAsync("calcite-action", { icon: expanded ? expandIcon : collapseIcon, onClick: toggle, ref: (referenceElement) => setTooltipReference({ tooltip, referenceElement, expanded, ref }), scale: scale, text: expandText, textEnabled: expanded }));
  6678. return actionNode;
  6679. };
  6680. const CSS$R = {
  6681. actionGroupBottom: "action-group--bottom"
  6682. };
  6683. const SLOTS$q = {
  6684. bottomActions: "bottom-actions",
  6685. expandTooltip: "expand-tooltip"
  6686. };
  6687. const TEXT$s = {
  6688. expand: "Expand",
  6689. collapse: "Collapse"
  6690. };
  6691. /** Detect free variable `global` from Node.js. */
  6692. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  6693. /** Detect free variable `self`. */
  6694. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  6695. /** Used as a reference to the global object. */
  6696. var root = freeGlobal || freeSelf || Function('return this')();
  6697. /** Built-in value references. */
  6698. var Symbol$1 = root.Symbol;
  6699. /** Used for built-in method references. */
  6700. var objectProto$5 = Object.prototype;
  6701. /** Used to check objects for own properties. */
  6702. var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
  6703. /**
  6704. * Used to resolve the
  6705. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  6706. * of values.
  6707. */
  6708. var nativeObjectToString$1 = objectProto$5.toString;
  6709. /** Built-in value references. */
  6710. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
  6711. /**
  6712. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  6713. *
  6714. * @private
  6715. * @param {*} value The value to query.
  6716. * @returns {string} Returns the raw `toStringTag`.
  6717. */
  6718. function getRawTag(value) {
  6719. var isOwn = hasOwnProperty$3.call(value, symToStringTag$1),
  6720. tag = value[symToStringTag$1];
  6721. try {
  6722. value[symToStringTag$1] = undefined;
  6723. var unmasked = true;
  6724. } catch (e) {}
  6725. var result = nativeObjectToString$1.call(value);
  6726. if (unmasked) {
  6727. if (isOwn) {
  6728. value[symToStringTag$1] = tag;
  6729. } else {
  6730. delete value[symToStringTag$1];
  6731. }
  6732. }
  6733. return result;
  6734. }
  6735. /** Used for built-in method references. */
  6736. var objectProto$4 = Object.prototype;
  6737. /**
  6738. * Used to resolve the
  6739. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  6740. * of values.
  6741. */
  6742. var nativeObjectToString = objectProto$4.toString;
  6743. /**
  6744. * Converts `value` to a string using `Object.prototype.toString`.
  6745. *
  6746. * @private
  6747. * @param {*} value The value to convert.
  6748. * @returns {string} Returns the converted string.
  6749. */
  6750. function objectToString(value) {
  6751. return nativeObjectToString.call(value);
  6752. }
  6753. /** `Object#toString` result references. */
  6754. var nullTag = '[object Null]',
  6755. undefinedTag = '[object Undefined]';
  6756. /** Built-in value references. */
  6757. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
  6758. /**
  6759. * The base implementation of `getTag` without fallbacks for buggy environments.
  6760. *
  6761. * @private
  6762. * @param {*} value The value to query.
  6763. * @returns {string} Returns the `toStringTag`.
  6764. */
  6765. function baseGetTag(value) {
  6766. if (value == null) {
  6767. return value === undefined ? undefinedTag : nullTag;
  6768. }
  6769. return (symToStringTag && symToStringTag in Object(value))
  6770. ? getRawTag(value)
  6771. : objectToString(value);
  6772. }
  6773. /**
  6774. * Checks if `value` is object-like. A value is object-like if it's not `null`
  6775. * and has a `typeof` result of "object".
  6776. *
  6777. * @static
  6778. * @memberOf _
  6779. * @since 4.0.0
  6780. * @category Lang
  6781. * @param {*} value The value to check.
  6782. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  6783. * @example
  6784. *
  6785. * _.isObjectLike({});
  6786. * // => true
  6787. *
  6788. * _.isObjectLike([1, 2, 3]);
  6789. * // => true
  6790. *
  6791. * _.isObjectLike(_.noop);
  6792. * // => false
  6793. *
  6794. * _.isObjectLike(null);
  6795. * // => false
  6796. */
  6797. function isObjectLike(value) {
  6798. return value != null && typeof value == 'object';
  6799. }
  6800. /** `Object#toString` result references. */
  6801. var symbolTag = '[object Symbol]';
  6802. /**
  6803. * Checks if `value` is classified as a `Symbol` primitive or object.
  6804. *
  6805. * @static
  6806. * @memberOf _
  6807. * @since 4.0.0
  6808. * @category Lang
  6809. * @param {*} value The value to check.
  6810. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  6811. * @example
  6812. *
  6813. * _.isSymbol(Symbol.iterator);
  6814. * // => true
  6815. *
  6816. * _.isSymbol('abc');
  6817. * // => false
  6818. */
  6819. function isSymbol(value) {
  6820. return typeof value == 'symbol' ||
  6821. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  6822. }
  6823. /**
  6824. * A specialized version of `_.map` for arrays without support for iteratee
  6825. * shorthands.
  6826. *
  6827. * @private
  6828. * @param {Array} [array] The array to iterate over.
  6829. * @param {Function} iteratee The function invoked per iteration.
  6830. * @returns {Array} Returns the new mapped array.
  6831. */
  6832. function arrayMap(array, iteratee) {
  6833. var index = -1,
  6834. length = array == null ? 0 : array.length,
  6835. result = Array(length);
  6836. while (++index < length) {
  6837. result[index] = iteratee(array[index], index, array);
  6838. }
  6839. return result;
  6840. }
  6841. /**
  6842. * Checks if `value` is classified as an `Array` object.
  6843. *
  6844. * @static
  6845. * @memberOf _
  6846. * @since 0.1.0
  6847. * @category Lang
  6848. * @param {*} value The value to check.
  6849. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  6850. * @example
  6851. *
  6852. * _.isArray([1, 2, 3]);
  6853. * // => true
  6854. *
  6855. * _.isArray(document.body.children);
  6856. * // => false
  6857. *
  6858. * _.isArray('abc');
  6859. * // => false
  6860. *
  6861. * _.isArray(_.noop);
  6862. * // => false
  6863. */
  6864. var isArray = Array.isArray;
  6865. /** Used as references for various `Number` constants. */
  6866. var INFINITY = 1 / 0;
  6867. /** Used to convert symbols to primitives and strings. */
  6868. var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
  6869. symbolToString = symbolProto ? symbolProto.toString : undefined;
  6870. /**
  6871. * The base implementation of `_.toString` which doesn't convert nullish
  6872. * values to empty strings.
  6873. *
  6874. * @private
  6875. * @param {*} value The value to process.
  6876. * @returns {string} Returns the string.
  6877. */
  6878. function baseToString(value) {
  6879. // Exit early for strings to avoid a performance hit in some environments.
  6880. if (typeof value == 'string') {
  6881. return value;
  6882. }
  6883. if (isArray(value)) {
  6884. // Recursively convert values (susceptible to call stack limits).
  6885. return arrayMap(value, baseToString) + '';
  6886. }
  6887. if (isSymbol(value)) {
  6888. return symbolToString ? symbolToString.call(value) : '';
  6889. }
  6890. var result = (value + '');
  6891. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  6892. }
  6893. /** Used to match a single whitespace character. */
  6894. var reWhitespace = /\s/;
  6895. /**
  6896. * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
  6897. * character of `string`.
  6898. *
  6899. * @private
  6900. * @param {string} string The string to inspect.
  6901. * @returns {number} Returns the index of the last non-whitespace character.
  6902. */
  6903. function trimmedEndIndex(string) {
  6904. var index = string.length;
  6905. while (index-- && reWhitespace.test(string.charAt(index))) {}
  6906. return index;
  6907. }
  6908. /** Used to match leading whitespace. */
  6909. var reTrimStart = /^\s+/;
  6910. /**
  6911. * The base implementation of `_.trim`.
  6912. *
  6913. * @private
  6914. * @param {string} string The string to trim.
  6915. * @returns {string} Returns the trimmed string.
  6916. */
  6917. function baseTrim(string) {
  6918. return string
  6919. ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
  6920. : string;
  6921. }
  6922. /**
  6923. * Checks if `value` is the
  6924. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  6925. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  6926. *
  6927. * @static
  6928. * @memberOf _
  6929. * @since 0.1.0
  6930. * @category Lang
  6931. * @param {*} value The value to check.
  6932. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  6933. * @example
  6934. *
  6935. * _.isObject({});
  6936. * // => true
  6937. *
  6938. * _.isObject([1, 2, 3]);
  6939. * // => true
  6940. *
  6941. * _.isObject(_.noop);
  6942. * // => true
  6943. *
  6944. * _.isObject(null);
  6945. * // => false
  6946. */
  6947. function isObject(value) {
  6948. var type = typeof value;
  6949. return value != null && (type == 'object' || type == 'function');
  6950. }
  6951. /** Used as references for various `Number` constants. */
  6952. var NAN = 0 / 0;
  6953. /** Used to detect bad signed hexadecimal string values. */
  6954. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  6955. /** Used to detect binary string values. */
  6956. var reIsBinary = /^0b[01]+$/i;
  6957. /** Used to detect octal string values. */
  6958. var reIsOctal = /^0o[0-7]+$/i;
  6959. /** Built-in method references without a dependency on `root`. */
  6960. var freeParseInt = parseInt;
  6961. /**
  6962. * Converts `value` to a number.
  6963. *
  6964. * @static
  6965. * @memberOf _
  6966. * @since 4.0.0
  6967. * @category Lang
  6968. * @param {*} value The value to process.
  6969. * @returns {number} Returns the number.
  6970. * @example
  6971. *
  6972. * _.toNumber(3.2);
  6973. * // => 3.2
  6974. *
  6975. * _.toNumber(Number.MIN_VALUE);
  6976. * // => 5e-324
  6977. *
  6978. * _.toNumber(Infinity);
  6979. * // => Infinity
  6980. *
  6981. * _.toNumber('3.2');
  6982. * // => 3.2
  6983. */
  6984. function toNumber(value) {
  6985. if (typeof value == 'number') {
  6986. return value;
  6987. }
  6988. if (isSymbol(value)) {
  6989. return NAN;
  6990. }
  6991. if (isObject(value)) {
  6992. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  6993. value = isObject(other) ? (other + '') : other;
  6994. }
  6995. if (typeof value != 'string') {
  6996. return value === 0 ? value : +value;
  6997. }
  6998. value = baseTrim(value);
  6999. var isBinary = reIsBinary.test(value);
  7000. return (isBinary || reIsOctal.test(value))
  7001. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  7002. : (reIsBadHex.test(value) ? NAN : +value);
  7003. }
  7004. /**
  7005. * This method returns the first argument it receives.
  7006. *
  7007. * @static
  7008. * @since 0.1.0
  7009. * @memberOf _
  7010. * @category Util
  7011. * @param {*} value Any value.
  7012. * @returns {*} Returns `value`.
  7013. * @example
  7014. *
  7015. * var object = { 'a': 1 };
  7016. *
  7017. * console.log(_.identity(object) === object);
  7018. * // => true
  7019. */
  7020. function identity(value) {
  7021. return value;
  7022. }
  7023. /** `Object#toString` result references. */
  7024. var asyncTag = '[object AsyncFunction]',
  7025. funcTag$1 = '[object Function]',
  7026. genTag = '[object GeneratorFunction]',
  7027. proxyTag = '[object Proxy]';
  7028. /**
  7029. * Checks if `value` is classified as a `Function` object.
  7030. *
  7031. * @static
  7032. * @memberOf _
  7033. * @since 0.1.0
  7034. * @category Lang
  7035. * @param {*} value The value to check.
  7036. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  7037. * @example
  7038. *
  7039. * _.isFunction(_);
  7040. * // => true
  7041. *
  7042. * _.isFunction(/abc/);
  7043. * // => false
  7044. */
  7045. function isFunction(value) {
  7046. if (!isObject(value)) {
  7047. return false;
  7048. }
  7049. // The use of `Object#toString` avoids issues with the `typeof` operator
  7050. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  7051. var tag = baseGetTag(value);
  7052. return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
  7053. }
  7054. /** Used as references for various `Number` constants. */
  7055. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  7056. /** Used to detect unsigned integer values. */
  7057. var reIsUint = /^(?:0|[1-9]\d*)$/;
  7058. /**
  7059. * Checks if `value` is a valid array-like index.
  7060. *
  7061. * @private
  7062. * @param {*} value The value to check.
  7063. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  7064. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  7065. */
  7066. function isIndex(value, length) {
  7067. var type = typeof value;
  7068. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  7069. return !!length &&
  7070. (type == 'number' ||
  7071. (type != 'symbol' && reIsUint.test(value))) &&
  7072. (value > -1 && value % 1 == 0 && value < length);
  7073. }
  7074. /** Used as references for various `Number` constants. */
  7075. var MAX_SAFE_INTEGER = 9007199254740991;
  7076. /**
  7077. * Checks if `value` is a valid array-like length.
  7078. *
  7079. * **Note:** This method is loosely based on
  7080. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  7081. *
  7082. * @static
  7083. * @memberOf _
  7084. * @since 4.0.0
  7085. * @category Lang
  7086. * @param {*} value The value to check.
  7087. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  7088. * @example
  7089. *
  7090. * _.isLength(3);
  7091. * // => true
  7092. *
  7093. * _.isLength(Number.MIN_VALUE);
  7094. * // => false
  7095. *
  7096. * _.isLength(Infinity);
  7097. * // => false
  7098. *
  7099. * _.isLength('3');
  7100. * // => false
  7101. */
  7102. function isLength(value) {
  7103. return typeof value == 'number' &&
  7104. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  7105. }
  7106. /**
  7107. * Checks if `value` is array-like. A value is considered array-like if it's
  7108. * not a function and has a `value.length` that's an integer greater than or
  7109. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  7110. *
  7111. * @static
  7112. * @memberOf _
  7113. * @since 4.0.0
  7114. * @category Lang
  7115. * @param {*} value The value to check.
  7116. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  7117. * @example
  7118. *
  7119. * _.isArrayLike([1, 2, 3]);
  7120. * // => true
  7121. *
  7122. * _.isArrayLike(document.body.children);
  7123. * // => true
  7124. *
  7125. * _.isArrayLike('abc');
  7126. * // => true
  7127. *
  7128. * _.isArrayLike(_.noop);
  7129. * // => false
  7130. */
  7131. function isArrayLike(value) {
  7132. return value != null && isLength(value.length) && !isFunction(value);
  7133. }
  7134. /** Used for built-in method references. */
  7135. var objectProto$3 = Object.prototype;
  7136. /**
  7137. * Checks if `value` is likely a prototype object.
  7138. *
  7139. * @private
  7140. * @param {*} value The value to check.
  7141. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  7142. */
  7143. function isPrototype(value) {
  7144. var Ctor = value && value.constructor,
  7145. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
  7146. return value === proto;
  7147. }
  7148. /**
  7149. * The base implementation of `_.times` without support for iteratee shorthands
  7150. * or max array length checks.
  7151. *
  7152. * @private
  7153. * @param {number} n The number of times to invoke `iteratee`.
  7154. * @param {Function} iteratee The function invoked per iteration.
  7155. * @returns {Array} Returns the array of results.
  7156. */
  7157. function baseTimes(n, iteratee) {
  7158. var index = -1,
  7159. result = Array(n);
  7160. while (++index < n) {
  7161. result[index] = iteratee(index);
  7162. }
  7163. return result;
  7164. }
  7165. /** `Object#toString` result references. */
  7166. var argsTag$1 = '[object Arguments]';
  7167. /**
  7168. * The base implementation of `_.isArguments`.
  7169. *
  7170. * @private
  7171. * @param {*} value The value to check.
  7172. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  7173. */
  7174. function baseIsArguments(value) {
  7175. return isObjectLike(value) && baseGetTag(value) == argsTag$1;
  7176. }
  7177. /** Used for built-in method references. */
  7178. var objectProto$2 = Object.prototype;
  7179. /** Used to check objects for own properties. */
  7180. var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
  7181. /** Built-in value references. */
  7182. var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
  7183. /**
  7184. * Checks if `value` is likely an `arguments` object.
  7185. *
  7186. * @static
  7187. * @memberOf _
  7188. * @since 0.1.0
  7189. * @category Lang
  7190. * @param {*} value The value to check.
  7191. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  7192. * else `false`.
  7193. * @example
  7194. *
  7195. * _.isArguments(function() { return arguments; }());
  7196. * // => true
  7197. *
  7198. * _.isArguments([1, 2, 3]);
  7199. * // => false
  7200. */
  7201. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  7202. return isObjectLike(value) && hasOwnProperty$2.call(value, 'callee') &&
  7203. !propertyIsEnumerable.call(value, 'callee');
  7204. };
  7205. /**
  7206. * This method returns `false`.
  7207. *
  7208. * @static
  7209. * @memberOf _
  7210. * @since 4.13.0
  7211. * @category Util
  7212. * @returns {boolean} Returns `false`.
  7213. * @example
  7214. *
  7215. * _.times(2, _.stubFalse);
  7216. * // => [false, false]
  7217. */
  7218. function stubFalse() {
  7219. return false;
  7220. }
  7221. /** Detect free variable `exports`. */
  7222. var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
  7223. /** Detect free variable `module`. */
  7224. var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
  7225. /** Detect the popular CommonJS extension `module.exports`. */
  7226. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  7227. /** Built-in value references. */
  7228. var Buffer = moduleExports$1 ? root.Buffer : undefined;
  7229. /* Built-in method references for those with the same name as other `lodash` methods. */
  7230. var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
  7231. /**
  7232. * Checks if `value` is a buffer.
  7233. *
  7234. * @static
  7235. * @memberOf _
  7236. * @since 4.3.0
  7237. * @category Lang
  7238. * @param {*} value The value to check.
  7239. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  7240. * @example
  7241. *
  7242. * _.isBuffer(new Buffer(2));
  7243. * // => true
  7244. *
  7245. * _.isBuffer(new Uint8Array(2));
  7246. * // => false
  7247. */
  7248. var isBuffer = nativeIsBuffer || stubFalse;
  7249. /** `Object#toString` result references. */
  7250. var argsTag = '[object Arguments]',
  7251. arrayTag = '[object Array]',
  7252. boolTag = '[object Boolean]',
  7253. dateTag = '[object Date]',
  7254. errorTag = '[object Error]',
  7255. funcTag = '[object Function]',
  7256. mapTag = '[object Map]',
  7257. numberTag = '[object Number]',
  7258. objectTag = '[object Object]',
  7259. regexpTag = '[object RegExp]',
  7260. setTag = '[object Set]',
  7261. stringTag = '[object String]',
  7262. weakMapTag = '[object WeakMap]';
  7263. var arrayBufferTag = '[object ArrayBuffer]',
  7264. dataViewTag = '[object DataView]',
  7265. float32Tag = '[object Float32Array]',
  7266. float64Tag = '[object Float64Array]',
  7267. int8Tag = '[object Int8Array]',
  7268. int16Tag = '[object Int16Array]',
  7269. int32Tag = '[object Int32Array]',
  7270. uint8Tag = '[object Uint8Array]',
  7271. uint8ClampedTag = '[object Uint8ClampedArray]',
  7272. uint16Tag = '[object Uint16Array]',
  7273. uint32Tag = '[object Uint32Array]';
  7274. /** Used to identify `toStringTag` values of typed arrays. */
  7275. var typedArrayTags = {};
  7276. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  7277. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  7278. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  7279. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  7280. typedArrayTags[uint32Tag] = true;
  7281. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  7282. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  7283. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  7284. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  7285. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  7286. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  7287. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  7288. typedArrayTags[weakMapTag] = false;
  7289. /**
  7290. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  7291. *
  7292. * @private
  7293. * @param {*} value The value to check.
  7294. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  7295. */
  7296. function baseIsTypedArray(value) {
  7297. return isObjectLike(value) &&
  7298. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  7299. }
  7300. /**
  7301. * The base implementation of `_.unary` without support for storing metadata.
  7302. *
  7303. * @private
  7304. * @param {Function} func The function to cap arguments for.
  7305. * @returns {Function} Returns the new capped function.
  7306. */
  7307. function baseUnary(func) {
  7308. return function(value) {
  7309. return func(value);
  7310. };
  7311. }
  7312. /** Detect free variable `exports`. */
  7313. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  7314. /** Detect free variable `module`. */
  7315. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  7316. /** Detect the popular CommonJS extension `module.exports`. */
  7317. var moduleExports = freeModule && freeModule.exports === freeExports;
  7318. /** Detect free variable `process` from Node.js. */
  7319. var freeProcess = moduleExports && freeGlobal.process;
  7320. /** Used to access faster Node.js helpers. */
  7321. var nodeUtil = (function() {
  7322. try {
  7323. // Use `util.types` for Node.js 10+.
  7324. var types = freeModule && freeModule.require && freeModule.require('util').types;
  7325. if (types) {
  7326. return types;
  7327. }
  7328. // Legacy `process.binding('util')` for Node.js < 10.
  7329. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  7330. } catch (e) {}
  7331. }());
  7332. /* Node.js helper references. */
  7333. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  7334. /**
  7335. * Checks if `value` is classified as a typed array.
  7336. *
  7337. * @static
  7338. * @memberOf _
  7339. * @since 3.0.0
  7340. * @category Lang
  7341. * @param {*} value The value to check.
  7342. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  7343. * @example
  7344. *
  7345. * _.isTypedArray(new Uint8Array);
  7346. * // => true
  7347. *
  7348. * _.isTypedArray([]);
  7349. * // => false
  7350. */
  7351. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  7352. /** Used for built-in method references. */
  7353. var objectProto$1 = Object.prototype;
  7354. /** Used to check objects for own properties. */
  7355. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  7356. /**
  7357. * Creates an array of the enumerable property names of the array-like `value`.
  7358. *
  7359. * @private
  7360. * @param {*} value The value to query.
  7361. * @param {boolean} inherited Specify returning inherited property names.
  7362. * @returns {Array} Returns the array of property names.
  7363. */
  7364. function arrayLikeKeys(value, inherited) {
  7365. var isArr = isArray(value),
  7366. isArg = !isArr && isArguments(value),
  7367. isBuff = !isArr && !isArg && isBuffer(value),
  7368. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  7369. skipIndexes = isArr || isArg || isBuff || isType,
  7370. result = skipIndexes ? baseTimes(value.length, String) : [],
  7371. length = result.length;
  7372. for (var key in value) {
  7373. if ((inherited || hasOwnProperty$1.call(value, key)) &&
  7374. !(skipIndexes && (
  7375. // Safari 9 has enumerable `arguments.length` in strict mode.
  7376. key == 'length' ||
  7377. // Node.js 0.10 has enumerable non-index properties on buffers.
  7378. (isBuff && (key == 'offset' || key == 'parent')) ||
  7379. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  7380. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  7381. // Skip index properties.
  7382. isIndex(key, length)
  7383. ))) {
  7384. result.push(key);
  7385. }
  7386. }
  7387. return result;
  7388. }
  7389. /**
  7390. * This function is like
  7391. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  7392. * except that it includes inherited enumerable properties.
  7393. *
  7394. * @private
  7395. * @param {Object} object The object to query.
  7396. * @returns {Array} Returns the array of property names.
  7397. */
  7398. function nativeKeysIn(object) {
  7399. var result = [];
  7400. if (object != null) {
  7401. for (var key in Object(object)) {
  7402. result.push(key);
  7403. }
  7404. }
  7405. return result;
  7406. }
  7407. /** Used for built-in method references. */
  7408. var objectProto = Object.prototype;
  7409. /** Used to check objects for own properties. */
  7410. var hasOwnProperty = objectProto.hasOwnProperty;
  7411. /**
  7412. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  7413. *
  7414. * @private
  7415. * @param {Object} object The object to query.
  7416. * @returns {Array} Returns the array of property names.
  7417. */
  7418. function baseKeysIn(object) {
  7419. if (!isObject(object)) {
  7420. return nativeKeysIn(object);
  7421. }
  7422. var isProto = isPrototype(object),
  7423. result = [];
  7424. for (var key in object) {
  7425. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  7426. result.push(key);
  7427. }
  7428. }
  7429. return result;
  7430. }
  7431. /**
  7432. * Creates an array of the own and inherited enumerable property names of `object`.
  7433. *
  7434. * **Note:** Non-object values are coerced to objects.
  7435. *
  7436. * @static
  7437. * @memberOf _
  7438. * @since 3.0.0
  7439. * @category Object
  7440. * @param {Object} object The object to query.
  7441. * @returns {Array} Returns the array of property names.
  7442. * @example
  7443. *
  7444. * function Foo() {
  7445. * this.a = 1;
  7446. * this.b = 2;
  7447. * }
  7448. *
  7449. * Foo.prototype.c = 3;
  7450. *
  7451. * _.keysIn(new Foo);
  7452. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  7453. */
  7454. function keysIn(object) {
  7455. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  7456. }
  7457. /**
  7458. * Converts `value` to a string. An empty string is returned for `null`
  7459. * and `undefined` values. The sign of `-0` is preserved.
  7460. *
  7461. * @static
  7462. * @memberOf _
  7463. * @since 4.0.0
  7464. * @category Lang
  7465. * @param {*} value The value to convert.
  7466. * @returns {string} Returns the converted string.
  7467. * @example
  7468. *
  7469. * _.toString(null);
  7470. * // => ''
  7471. *
  7472. * _.toString(-0);
  7473. * // => '-0'
  7474. *
  7475. * _.toString([1, 2, 3]);
  7476. * // => '1,2,3'
  7477. */
  7478. function toString(value) {
  7479. return value == null ? '' : baseToString(value);
  7480. }
  7481. /**
  7482. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  7483. *
  7484. * @private
  7485. * @param {boolean} [fromRight] Specify iterating from right to left.
  7486. * @returns {Function} Returns the new base function.
  7487. */
  7488. function createBaseFor(fromRight) {
  7489. return function(object, iteratee, keysFunc) {
  7490. var index = -1,
  7491. iterable = Object(object),
  7492. props = keysFunc(object),
  7493. length = props.length;
  7494. while (length--) {
  7495. var key = props[fromRight ? length : ++index];
  7496. if (iteratee(iterable[key], key, iterable) === false) {
  7497. break;
  7498. }
  7499. }
  7500. return object;
  7501. };
  7502. }
  7503. /**
  7504. * The base implementation of `baseForOwn` which iterates over `object`
  7505. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  7506. * Iteratee functions may exit iteration early by explicitly returning `false`.
  7507. *
  7508. * @private
  7509. * @param {Object} object The object to iterate over.
  7510. * @param {Function} iteratee The function invoked per iteration.
  7511. * @param {Function} keysFunc The function to get the keys of `object`.
  7512. * @returns {Object} Returns `object`.
  7513. */
  7514. var baseFor = createBaseFor();
  7515. /**
  7516. * Gets the timestamp of the number of milliseconds that have elapsed since
  7517. * the Unix epoch (1 January 1970 00:00:00 UTC).
  7518. *
  7519. * @static
  7520. * @memberOf _
  7521. * @since 2.4.0
  7522. * @category Date
  7523. * @returns {number} Returns the timestamp.
  7524. * @example
  7525. *
  7526. * _.defer(function(stamp) {
  7527. * console.log(_.now() - stamp);
  7528. * }, _.now());
  7529. * // => Logs the number of milliseconds it took for the deferred invocation.
  7530. */
  7531. var now = function() {
  7532. return root.Date.now();
  7533. };
  7534. /** Error message constants. */
  7535. var FUNC_ERROR_TEXT$1 = 'Expected a function';
  7536. /* Built-in method references for those with the same name as other `lodash` methods. */
  7537. var nativeMax = Math.max,
  7538. nativeMin = Math.min;
  7539. /**
  7540. * Creates a debounced function that delays invoking `func` until after `wait`
  7541. * milliseconds have elapsed since the last time the debounced function was
  7542. * invoked. The debounced function comes with a `cancel` method to cancel
  7543. * delayed `func` invocations and a `flush` method to immediately invoke them.
  7544. * Provide `options` to indicate whether `func` should be invoked on the
  7545. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  7546. * with the last arguments provided to the debounced function. Subsequent
  7547. * calls to the debounced function return the result of the last `func`
  7548. * invocation.
  7549. *
  7550. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  7551. * invoked on the trailing edge of the timeout only if the debounced function
  7552. * is invoked more than once during the `wait` timeout.
  7553. *
  7554. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  7555. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  7556. *
  7557. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  7558. * for details over the differences between `_.debounce` and `_.throttle`.
  7559. *
  7560. * @static
  7561. * @memberOf _
  7562. * @since 0.1.0
  7563. * @category Function
  7564. * @param {Function} func The function to debounce.
  7565. * @param {number} [wait=0] The number of milliseconds to delay.
  7566. * @param {Object} [options={}] The options object.
  7567. * @param {boolean} [options.leading=false]
  7568. * Specify invoking on the leading edge of the timeout.
  7569. * @param {number} [options.maxWait]
  7570. * The maximum time `func` is allowed to be delayed before it's invoked.
  7571. * @param {boolean} [options.trailing=true]
  7572. * Specify invoking on the trailing edge of the timeout.
  7573. * @returns {Function} Returns the new debounced function.
  7574. * @example
  7575. *
  7576. * // Avoid costly calculations while the window size is in flux.
  7577. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  7578. *
  7579. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  7580. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  7581. * 'leading': true,
  7582. * 'trailing': false
  7583. * }));
  7584. *
  7585. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  7586. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  7587. * var source = new EventSource('/stream');
  7588. * jQuery(source).on('message', debounced);
  7589. *
  7590. * // Cancel the trailing debounced invocation.
  7591. * jQuery(window).on('popstate', debounced.cancel);
  7592. */
  7593. function debounce(func, wait, options) {
  7594. var lastArgs,
  7595. lastThis,
  7596. maxWait,
  7597. result,
  7598. timerId,
  7599. lastCallTime,
  7600. lastInvokeTime = 0,
  7601. leading = false,
  7602. maxing = false,
  7603. trailing = true;
  7604. if (typeof func != 'function') {
  7605. throw new TypeError(FUNC_ERROR_TEXT$1);
  7606. }
  7607. wait = toNumber(wait) || 0;
  7608. if (isObject(options)) {
  7609. leading = !!options.leading;
  7610. maxing = 'maxWait' in options;
  7611. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  7612. trailing = 'trailing' in options ? !!options.trailing : trailing;
  7613. }
  7614. function invokeFunc(time) {
  7615. var args = lastArgs,
  7616. thisArg = lastThis;
  7617. lastArgs = lastThis = undefined;
  7618. lastInvokeTime = time;
  7619. result = func.apply(thisArg, args);
  7620. return result;
  7621. }
  7622. function leadingEdge(time) {
  7623. // Reset any `maxWait` timer.
  7624. lastInvokeTime = time;
  7625. // Start the timer for the trailing edge.
  7626. timerId = setTimeout(timerExpired, wait);
  7627. // Invoke the leading edge.
  7628. return leading ? invokeFunc(time) : result;
  7629. }
  7630. function remainingWait(time) {
  7631. var timeSinceLastCall = time - lastCallTime,
  7632. timeSinceLastInvoke = time - lastInvokeTime,
  7633. timeWaiting = wait - timeSinceLastCall;
  7634. return maxing
  7635. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  7636. : timeWaiting;
  7637. }
  7638. function shouldInvoke(time) {
  7639. var timeSinceLastCall = time - lastCallTime,
  7640. timeSinceLastInvoke = time - lastInvokeTime;
  7641. // Either this is the first call, activity has stopped and we're at the
  7642. // trailing edge, the system time has gone backwards and we're treating
  7643. // it as the trailing edge, or we've hit the `maxWait` limit.
  7644. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  7645. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  7646. }
  7647. function timerExpired() {
  7648. var time = now();
  7649. if (shouldInvoke(time)) {
  7650. return trailingEdge(time);
  7651. }
  7652. // Restart the timer.
  7653. timerId = setTimeout(timerExpired, remainingWait(time));
  7654. }
  7655. function trailingEdge(time) {
  7656. timerId = undefined;
  7657. // Only invoke if we have `lastArgs` which means `func` has been
  7658. // debounced at least once.
  7659. if (trailing && lastArgs) {
  7660. return invokeFunc(time);
  7661. }
  7662. lastArgs = lastThis = undefined;
  7663. return result;
  7664. }
  7665. function cancel() {
  7666. if (timerId !== undefined) {
  7667. clearTimeout(timerId);
  7668. }
  7669. lastInvokeTime = 0;
  7670. lastArgs = lastCallTime = lastThis = timerId = undefined;
  7671. }
  7672. function flush() {
  7673. return timerId === undefined ? result : trailingEdge(now());
  7674. }
  7675. function debounced() {
  7676. var time = now(),
  7677. isInvoking = shouldInvoke(time);
  7678. lastArgs = arguments;
  7679. lastThis = this;
  7680. lastCallTime = time;
  7681. if (isInvoking) {
  7682. if (timerId === undefined) {
  7683. return leadingEdge(lastCallTime);
  7684. }
  7685. if (maxing) {
  7686. // Handle invocations in a tight loop.
  7687. clearTimeout(timerId);
  7688. timerId = setTimeout(timerExpired, wait);
  7689. return invokeFunc(lastCallTime);
  7690. }
  7691. }
  7692. if (timerId === undefined) {
  7693. timerId = setTimeout(timerExpired, wait);
  7694. }
  7695. return result;
  7696. }
  7697. debounced.cancel = cancel;
  7698. debounced.flush = flush;
  7699. return debounced;
  7700. }
  7701. /**
  7702. * Casts `value` to `identity` if it's not a function.
  7703. *
  7704. * @private
  7705. * @param {*} value The value to inspect.
  7706. * @returns {Function} Returns cast function.
  7707. */
  7708. function castFunction(value) {
  7709. return typeof value == 'function' ? value : identity;
  7710. }
  7711. /**
  7712. * Used to match `RegExp`
  7713. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  7714. */
  7715. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  7716. reHasRegExpChar = RegExp(reRegExpChar.source);
  7717. /**
  7718. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  7719. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  7720. *
  7721. * @static
  7722. * @memberOf _
  7723. * @since 3.0.0
  7724. * @category String
  7725. * @param {string} [string=''] The string to escape.
  7726. * @returns {string} Returns the escaped string.
  7727. * @example
  7728. *
  7729. * _.escapeRegExp('[lodash](https://lodash.com/)');
  7730. * // => '\[lodash\]\(https://lodash\.com/\)'
  7731. */
  7732. function escapeRegExp(string) {
  7733. string = toString(string);
  7734. return (string && reHasRegExpChar.test(string))
  7735. ? string.replace(reRegExpChar, '\\$&')
  7736. : string;
  7737. }
  7738. /**
  7739. * Iterates over own and inherited enumerable string keyed properties of an
  7740. * object and invokes `iteratee` for each property. The iteratee is invoked
  7741. * with three arguments: (value, key, object). Iteratee functions may exit
  7742. * iteration early by explicitly returning `false`.
  7743. *
  7744. * @static
  7745. * @memberOf _
  7746. * @since 0.3.0
  7747. * @category Object
  7748. * @param {Object} object The object to iterate over.
  7749. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  7750. * @returns {Object} Returns `object`.
  7751. * @see _.forInRight
  7752. * @example
  7753. *
  7754. * function Foo() {
  7755. * this.a = 1;
  7756. * this.b = 2;
  7757. * }
  7758. *
  7759. * Foo.prototype.c = 3;
  7760. *
  7761. * _.forIn(new Foo, function(value, key) {
  7762. * console.log(key);
  7763. * });
  7764. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  7765. */
  7766. function forIn(object, iteratee) {
  7767. return object == null
  7768. ? object
  7769. : baseFor(object, castFunction(iteratee), keysIn);
  7770. }
  7771. /** Error message constants. */
  7772. var FUNC_ERROR_TEXT = 'Expected a function';
  7773. /**
  7774. * Creates a throttled function that only invokes `func` at most once per
  7775. * every `wait` milliseconds. The throttled function comes with a `cancel`
  7776. * method to cancel delayed `func` invocations and a `flush` method to
  7777. * immediately invoke them. Provide `options` to indicate whether `func`
  7778. * should be invoked on the leading and/or trailing edge of the `wait`
  7779. * timeout. The `func` is invoked with the last arguments provided to the
  7780. * throttled function. Subsequent calls to the throttled function return the
  7781. * result of the last `func` invocation.
  7782. *
  7783. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  7784. * invoked on the trailing edge of the timeout only if the throttled function
  7785. * is invoked more than once during the `wait` timeout.
  7786. *
  7787. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  7788. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  7789. *
  7790. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  7791. * for details over the differences between `_.throttle` and `_.debounce`.
  7792. *
  7793. * @static
  7794. * @memberOf _
  7795. * @since 0.1.0
  7796. * @category Function
  7797. * @param {Function} func The function to throttle.
  7798. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  7799. * @param {Object} [options={}] The options object.
  7800. * @param {boolean} [options.leading=true]
  7801. * Specify invoking on the leading edge of the timeout.
  7802. * @param {boolean} [options.trailing=true]
  7803. * Specify invoking on the trailing edge of the timeout.
  7804. * @returns {Function} Returns the new throttled function.
  7805. * @example
  7806. *
  7807. * // Avoid excessively updating the position while scrolling.
  7808. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  7809. *
  7810. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  7811. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  7812. * jQuery(element).on('click', throttled);
  7813. *
  7814. * // Cancel the trailing throttled invocation.
  7815. * jQuery(window).on('popstate', throttled.cancel);
  7816. */
  7817. function throttle$1(func, wait, options) {
  7818. var leading = true,
  7819. trailing = true;
  7820. if (typeof func != 'function') {
  7821. throw new TypeError(FUNC_ERROR_TEXT);
  7822. }
  7823. if (isObject(options)) {
  7824. leading = 'leading' in options ? !!options.leading : leading;
  7825. trailing = 'trailing' in options ? !!options.trailing : trailing;
  7826. }
  7827. return debounce(func, wait, {
  7828. 'leading': leading,
  7829. 'maxWait': wait,
  7830. 'trailing': trailing
  7831. });
  7832. }
  7833. const actionBarCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-action-bar:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-action-bar{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action-bar{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action-bar{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action-bar{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action-bar{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-action-bar:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-action-bar-h{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-action-bar-h *.sc-calcite-action-bar{box-sizing:border-box}/*!@:root*/.sc-calcite-action-bar:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-bar-h{display:none}/*!@:host*/.sc-calcite-action-bar-h{pointer-events:auto;display:inline-flex;align-self:stretch;background:transparent;--calcite-action-bar-expanded-max-width:auto}/*!@:host([layout=vertical])*/[layout=vertical].sc-calcite-action-bar-h{flex-direction:column}/*!@:host([layout=horizontal])*/[layout=horizontal].sc-calcite-action-bar-h{flex-direction:row}/*!@:host([layout=vertical][overflow-actions-disabled])*/[layout=vertical][overflow-actions-disabled].sc-calcite-action-bar-h{overflow-y:auto}/*!@:host([layout=horizontal][overflow-actions-disabled])*/[layout=horizontal][overflow-actions-disabled].sc-calcite-action-bar-h{overflow-x:auto}/*!@:host([layout=vertical][expanded])*/[layout=vertical][expanded].sc-calcite-action-bar-h{max-inline-size:var(--calcite-action-bar-expanded-max-width)}/*!@::slotted(calcite-action-group)*/.sc-calcite-action-bar-s>calcite-action-group{border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}/*!@:host([layout=horizontal]) ::slotted(calcite-action-group)*/.sc-calcite-action-bar-h[layout=horizontal] .sc-calcite-action-bar-s>calcite-action-group{border-width:0px;border-inline-end-width:1px;border-style:solid}/*!@::slotted(calcite-action-group:last-child)*/.sc-calcite-action-bar-s>calcite-action-group:last-child{border-block-end-width:0px;border-inline-end-width:0px}/*!@.action-group--bottom*/.action-group--bottom.sc-calcite-action-bar{flex-grow:1;justify-content:flex-end;padding-block-end:0px;padding-inline-end:0px}";
  7834. /**
  7835. * @slot - A slot for adding `calcite-action`s that will appear at the top of the action bar.
  7836. * @slot bottom-actions - A slot for adding `calcite-action`s that will appear at the bottom of the action bar, above the collapse/expand button.
  7837. * @slot expand-tooltip - Used to set the tooltip for the expand toggle.
  7838. */
  7839. class ActionBar {
  7840. constructor(hostRef) {
  7841. registerInstance(this, hostRef);
  7842. this.calciteActionBarToggle = createEvent(this, "calciteActionBarToggle", 6);
  7843. // --------------------------------------------------------------------------
  7844. //
  7845. // Properties
  7846. //
  7847. // --------------------------------------------------------------------------
  7848. /**
  7849. * When `true`, the expand-toggling behavior is disabled.
  7850. */
  7851. this.expandDisabled = false;
  7852. /**
  7853. * When `true`, the component is expanded.
  7854. */
  7855. this.expanded = false;
  7856. /**
  7857. * The layout direction of the actions.
  7858. */
  7859. this.layout = "vertical";
  7860. /**
  7861. * Disables automatically overflowing `calcite-action`s that won't fit into menus.
  7862. */
  7863. this.overflowActionsDisabled = false;
  7864. this.mutationObserver = createObserver();
  7865. this.resizeObserver = createObserver();
  7866. // --------------------------------------------------------------------------
  7867. //
  7868. // Private Methods
  7869. //
  7870. // --------------------------------------------------------------------------
  7871. this.actionMenuOpenChangeHandler = (event) => {
  7872. if (event.detail) {
  7873. const composedPath = event.composedPath();
  7874. Array.from(this.el.querySelectorAll("calcite-action-group")).forEach((group) => {
  7875. if (!composedPath.includes(group)) {
  7876. group.menuOpen = false;
  7877. }
  7878. });
  7879. }
  7880. };
  7881. this.resizeHandlerEntries = (entries) => {
  7882. entries.forEach(this.resizeHandler);
  7883. };
  7884. this.resizeHandler = (entry) => {
  7885. const { width, height } = entry.contentRect;
  7886. this.resize({ width, height });
  7887. };
  7888. this.resize = debounce(({ width, height }) => {
  7889. const { el, expanded, expandDisabled, layout } = this;
  7890. if ((layout === "vertical" && !height) || (layout === "horizontal" && !width)) {
  7891. return;
  7892. }
  7893. const actions = queryActions(el);
  7894. const actionCount = expandDisabled ? actions.length : actions.length + 1;
  7895. const actionGroups = Array.from(el.querySelectorAll("calcite-action-group"));
  7896. const groupCount = getSlotted(el, SLOTS$q.bottomActions) || !expandDisabled
  7897. ? actionGroups.length + 1
  7898. : actionGroups.length;
  7899. const { actionHeight, actionWidth } = geActionDimensions(actions);
  7900. const overflowCount = getOverflowCount({
  7901. layout,
  7902. actionCount,
  7903. actionHeight,
  7904. actionWidth,
  7905. height,
  7906. width,
  7907. groupCount
  7908. });
  7909. overflowActions({
  7910. actionGroups,
  7911. expanded,
  7912. overflowCount
  7913. });
  7914. }, overflowActionsDebounceInMs);
  7915. this.conditionallyOverflowActions = () => {
  7916. if (!this.overflowActionsDisabled) {
  7917. this.overflowActions();
  7918. }
  7919. };
  7920. this.toggleExpand = () => {
  7921. this.expanded = !this.expanded;
  7922. this.calciteActionBarToggle.emit();
  7923. };
  7924. this.setExpandToggleRef = (el) => {
  7925. this.expandToggleEl = el;
  7926. };
  7927. }
  7928. expandHandler() {
  7929. this.conditionallyOverflowActions();
  7930. }
  7931. expandedHandler(expanded) {
  7932. toggleChildActionText({ parent: this.el, expanded });
  7933. this.conditionallyOverflowActions();
  7934. }
  7935. overflowDisabledHandler(overflowActionsDisabled) {
  7936. overflowActionsDisabled
  7937. ? this.resizeObserver.disconnect()
  7938. : this.resizeObserver.observe(this.el);
  7939. }
  7940. // --------------------------------------------------------------------------
  7941. //
  7942. // Lifecycle
  7943. //
  7944. // --------------------------------------------------------------------------
  7945. componentDidLoad() {
  7946. this.conditionallyOverflowActions();
  7947. }
  7948. connectedCallback() {
  7949. var _a, _b;
  7950. const { el, expanded } = this;
  7951. toggleChildActionText({ parent: el, expanded });
  7952. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(el, { childList: true, subtree: true });
  7953. if (!this.overflowActionsDisabled) {
  7954. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.observe(el);
  7955. }
  7956. this.conditionallyOverflowActions();
  7957. connectConditionalSlotComponent(this);
  7958. }
  7959. disconnectedCallback() {
  7960. var _a, _b;
  7961. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  7962. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
  7963. disconnectConditionalSlotComponent(this);
  7964. }
  7965. // --------------------------------------------------------------------------
  7966. //
  7967. // Methods
  7968. //
  7969. // --------------------------------------------------------------------------
  7970. /**
  7971. * Overflows actions that won't fit into menus.
  7972. *
  7973. * @internal
  7974. */
  7975. async overflowActions() {
  7976. this.resize({ width: this.el.clientWidth, height: this.el.clientHeight });
  7977. }
  7978. /**
  7979. * Sets focus on the component.
  7980. *
  7981. * @param focusId
  7982. */
  7983. async setFocus(focusId) {
  7984. var _a;
  7985. if (focusId === "expand-toggle") {
  7986. await focusElement(this.expandToggleEl);
  7987. return;
  7988. }
  7989. (_a = this.el) === null || _a === void 0 ? void 0 : _a.focus();
  7990. }
  7991. // --------------------------------------------------------------------------
  7992. //
  7993. // Render Methods
  7994. //
  7995. // --------------------------------------------------------------------------
  7996. renderBottomActionGroup() {
  7997. const { expanded, expandDisabled, intlExpand, intlCollapse, el, position, toggleExpand, scale, layout } = this;
  7998. const tooltip = getSlotted(el, SLOTS$q.expandTooltip);
  7999. const expandLabel = intlExpand || TEXT$s.expand;
  8000. const collapseLabel = intlCollapse || TEXT$s.collapse;
  8001. const expandToggleNode = !expandDisabled ? (hAsync(ExpandToggle, { el: el, expanded: expanded, intlCollapse: collapseLabel, intlExpand: expandLabel, position: position, ref: this.setExpandToggleRef, scale: scale, toggle: toggleExpand, tooltip: tooltip })) : null;
  8002. return getSlotted(el, SLOTS$q.bottomActions) || expandToggleNode ? (hAsync("calcite-action-group", { class: CSS$R.actionGroupBottom, layout: layout, scale: scale }, hAsync("slot", { name: SLOTS$q.bottomActions }), hAsync("slot", { name: SLOTS$q.expandTooltip }), expandToggleNode)) : null;
  8003. }
  8004. render() {
  8005. return (hAsync(Host, { onCalciteActionMenuOpenChange: this.actionMenuOpenChangeHandler }, hAsync("slot", null), this.renderBottomActionGroup()));
  8006. }
  8007. get el() { return getElement(this); }
  8008. static get watchers() { return {
  8009. "expandDisabled": ["expandHandler"],
  8010. "expanded": ["expandedHandler"],
  8011. "overflowActionsDisabled": ["overflowDisabledHandler"]
  8012. }; }
  8013. static get style() { return actionBarCss; }
  8014. static get cmpMeta() { return {
  8015. "$flags$": 9,
  8016. "$tagName$": "calcite-action-bar",
  8017. "$members$": {
  8018. "expandDisabled": [516, "expand-disabled"],
  8019. "expanded": [1540],
  8020. "intlExpand": [1, "intl-expand"],
  8021. "intlCollapse": [1, "intl-collapse"],
  8022. "layout": [513],
  8023. "overflowActionsDisabled": [516, "overflow-actions-disabled"],
  8024. "position": [513],
  8025. "scale": [513],
  8026. "overflowActions": [64],
  8027. "setFocus": [64]
  8028. },
  8029. "$listeners$": undefined,
  8030. "$lazyBundleId$": "-",
  8031. "$attrsToReflect$": [["expandDisabled", "expand-disabled"], ["expanded", "expanded"], ["layout", "layout"], ["overflowActionsDisabled", "overflow-actions-disabled"], ["position", "position"], ["scale", "scale"]]
  8032. }; }
  8033. }
  8034. const actionGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-action-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-action-group{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-action-group:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-action-group-h{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-action-group-h *.sc-calcite-action-group{box-sizing:border-box}/*!@:root*/.sc-calcite-action-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-group-h{display:none}/*!@:host*/.sc-calcite-action-group-h{display:flex;flex-direction:column;padding:0px;--calcite-action-group-columns:3}/*!@:host([columns=\"1\"])*/[columns=\"1\"].sc-calcite-action-group-h{--calcite-action-group-columns:1}/*!@:host([columns=\"2\"])*/[columns=\"2\"].sc-calcite-action-group-h{--calcite-action-group-columns:2}/*!@:host([columns=\"3\"])*/[columns=\"3\"].sc-calcite-action-group-h{--calcite-action-group-columns:3}/*!@:host([columns=\"4\"])*/[columns=\"4\"].sc-calcite-action-group-h{--calcite-action-group-columns:4}/*!@:host([columns=\"5\"])*/[columns=\"5\"].sc-calcite-action-group-h{--calcite-action-group-columns:5}/*!@:host([columns=\"6\"])*/[columns=\"6\"].sc-calcite-action-group-h{--calcite-action-group-columns:6}/*!@:host(:first-child)*/.sc-calcite-action-group-h:first-child{padding-block-start:0px}/*!@:host([layout=horizontal])*/[layout=horizontal].sc-calcite-action-group-h{flex-direction:row}/*!@:host([layout=grid])*/[layout=grid].sc-calcite-action-group-h{display:grid;place-content:stretch;gap:1px;background-color:var(--calcite-ui-background);padding:1px;grid-template-columns:repeat(var(--calcite-action-group-columns), auto)}";
  8035. /**
  8036. * @slot - A slot for adding a group of `calcite-action`s.
  8037. * @slot menu-actions - A slot for adding an overflow menu with `calcite-action`s inside a `calcite-dropdown`.
  8038. * @slot menu-tooltip - A slot for adding a `calcite-tooltip` for the menu.
  8039. */
  8040. class ActionGroup {
  8041. constructor(hostRef) {
  8042. registerInstance(this, hostRef);
  8043. // --------------------------------------------------------------------------
  8044. //
  8045. // Properties
  8046. //
  8047. // --------------------------------------------------------------------------
  8048. /**
  8049. * When `true`, the component is expanded.
  8050. */
  8051. this.expanded = false;
  8052. /**
  8053. * Indicates the layout of the component.
  8054. */
  8055. this.layout = "vertical";
  8056. /**
  8057. * When `true`, the `calcite-action-menu` is open.
  8058. */
  8059. this.menuOpen = false;
  8060. // --------------------------------------------------------------------------
  8061. //
  8062. // Private Methods
  8063. //
  8064. // --------------------------------------------------------------------------
  8065. this.setMenuOpen = (event) => {
  8066. this.menuOpen = !!event.detail;
  8067. };
  8068. }
  8069. expandedHandler() {
  8070. this.menuOpen = false;
  8071. }
  8072. // --------------------------------------------------------------------------
  8073. //
  8074. // Lifecycle
  8075. //
  8076. // --------------------------------------------------------------------------
  8077. connectedCallback() {
  8078. connectConditionalSlotComponent(this);
  8079. }
  8080. disconnectedCallback() {
  8081. disconnectConditionalSlotComponent(this);
  8082. }
  8083. // --------------------------------------------------------------------------
  8084. //
  8085. // Component Methods
  8086. //
  8087. // --------------------------------------------------------------------------
  8088. renderTooltip() {
  8089. const { el } = this;
  8090. const hasTooltip = getSlotted(el, SLOTS$r.menuTooltip);
  8091. return hasTooltip ? hAsync("slot", { name: SLOTS$r.menuTooltip, slot: SLOTS$s.tooltip }) : null;
  8092. }
  8093. renderMenu() {
  8094. const { el, expanded, intlMore, menuOpen, scale, layout } = this;
  8095. const hasMenuItems = getSlotted(el, SLOTS$r.menuActions);
  8096. return hasMenuItems ? (hAsync("calcite-action-menu", { expanded: expanded, flipPlacements: ["left", "right"], label: intlMore || TEXT$t.more, onCalciteActionMenuOpenChange: this.setMenuOpen, open: menuOpen, placement: layout === "horizontal" ? "bottom-leading" : "leading-start", scale: scale }, hAsync("calcite-action", { icon: ICONS$f.menu, scale: scale, slot: SLOTS$s.trigger, text: intlMore || TEXT$t.more, textEnabled: expanded }), hAsync("slot", { name: SLOTS$r.menuActions }), this.renderTooltip())) : null;
  8097. }
  8098. render() {
  8099. return (hAsync(Fragment, null, hAsync("slot", null), this.renderMenu()));
  8100. }
  8101. get el() { return getElement(this); }
  8102. static get watchers() { return {
  8103. "expanded": ["expandedHandler"]
  8104. }; }
  8105. static get style() { return actionGroupCss; }
  8106. static get cmpMeta() { return {
  8107. "$flags$": 9,
  8108. "$tagName$": "calcite-action-group",
  8109. "$members$": {
  8110. "expanded": [516],
  8111. "layout": [513],
  8112. "columns": [514],
  8113. "intlMore": [1, "intl-more"],
  8114. "menuOpen": [1540, "menu-open"],
  8115. "scale": [513]
  8116. },
  8117. "$listeners$": undefined,
  8118. "$lazyBundleId$": "-",
  8119. "$attrsToReflect$": [["expanded", "expanded"], ["layout", "layout"], ["columns", "columns"], ["menuOpen", "menu-open"], ["scale", "scale"]]
  8120. }; }
  8121. }
  8122. function getRoundRobinIndex(index, total) {
  8123. return (index + total) % total;
  8124. }
  8125. function isActivationKey(key) {
  8126. return key === "Enter" || key === " ";
  8127. }
  8128. const numberKeys = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
  8129. const actionMenuCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-action-menu:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-action-menu{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action-menu{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action-menu{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action-menu{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action-menu{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-action-menu:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-action-menu:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-menu-h{display:none}/*!@:host*/.sc-calcite-action-menu-h{box-sizing:border-box;display:flex;flex-direction:column;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size-1);color:var(--calcite-ui-text-2)}/*!@.menu ::slotted(calcite-action)*/.menu .sc-calcite-action-menu-s>calcite-action{margin:0.125rem;display:flex;outline-color:transparent}/*!@.menu ::slotted(calcite-action[active])*/.menu .sc-calcite-action-menu-s>calcite-action[active]{outline:2px solid var(--calcite-ui-brand);outline-offset:0px}/*!@.default-trigger*/.default-trigger.sc-calcite-action-menu{position:relative;block-size:100%;flex:0 1 auto;align-self:stretch}/*!@slot[name=trigger]::slotted(calcite-action), \ncalcite-action::slotted([slot=trigger])*/slot[name=trigger].sc-calcite-action-menu-s>calcite-action,calcite-action.sc-calcite-action-menu-s>[slot=trigger]{position:relative;block-size:100%;flex:0 1 auto;align-self:stretch}/*!@.menu*/.menu.sc-calcite-action-menu{flex-direction:column;flex-wrap:nowrap;outline:2px solid transparent;outline-offset:2px}";
  8130. const SUPPORTED_MENU_NAV_KEYS = ["ArrowUp", "ArrowDown", "End", "Home"];
  8131. /**
  8132. * @slot - A slot for adding `calcite-action`s.
  8133. * @slot trigger - A slot for adding a `calcite-action` to trigger opening the menu.
  8134. * @slot tooltip - A slot for adding an tooltip for the menu.
  8135. */
  8136. class ActionMenu {
  8137. constructor(hostRef) {
  8138. registerInstance(this, hostRef);
  8139. this.calciteActionMenuOpenChange = createEvent(this, "calciteActionMenuOpenChange", 6);
  8140. // --------------------------------------------------------------------------
  8141. //
  8142. // Properties
  8143. //
  8144. // --------------------------------------------------------------------------
  8145. /**
  8146. * When `true`, the component is expanded.
  8147. */
  8148. this.expanded = false;
  8149. /**
  8150. * When `true`, the component is open.
  8151. */
  8152. this.open = false;
  8153. /**
  8154. * Determines the type of positioning to use for the overlaid content.
  8155. *
  8156. * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
  8157. * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
  8158. *
  8159. */
  8160. this.overlayPositioning = "absolute";
  8161. /**
  8162. * Determines where the component will be positioned relative to the `referenceElement`.
  8163. *
  8164. * @see [LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)
  8165. */
  8166. this.placement = "auto";
  8167. this.actionElements = [];
  8168. this.guid = `calcite-action-menu-${guid()}`;
  8169. this.menuId = `${this.guid}-menu`;
  8170. this.menuButtonId = `${this.guid}-menu-button`;
  8171. this.activeMenuItemIndex = -1;
  8172. // --------------------------------------------------------------------------
  8173. //
  8174. // Component Methods
  8175. //
  8176. // --------------------------------------------------------------------------
  8177. this.connectMenuButtonEl = () => {
  8178. const { menuButtonId, menuId, open, label } = this;
  8179. const menuButtonEl = this.slottedMenuButtonEl || this.defaultMenuButtonEl;
  8180. if (this.menuButtonEl === menuButtonEl) {
  8181. return;
  8182. }
  8183. this.disconnectMenuButtonEl();
  8184. this.menuButtonEl = menuButtonEl;
  8185. this.setTooltipReferenceElement();
  8186. if (!menuButtonEl) {
  8187. return;
  8188. }
  8189. menuButtonEl.active = open;
  8190. menuButtonEl.setAttribute("aria-controls", menuId);
  8191. menuButtonEl.setAttribute("aria-expanded", toAriaBoolean(open));
  8192. menuButtonEl.setAttribute("aria-haspopup", "true");
  8193. if (!menuButtonEl.id) {
  8194. menuButtonEl.id = menuButtonId;
  8195. }
  8196. if (!menuButtonEl.label) {
  8197. menuButtonEl.label = label;
  8198. }
  8199. if (!menuButtonEl.text) {
  8200. menuButtonEl.text = label;
  8201. }
  8202. menuButtonEl.addEventListener("pointerdown", this.menuButtonClick);
  8203. menuButtonEl.addEventListener("keydown", this.menuButtonKeyDown);
  8204. };
  8205. this.disconnectMenuButtonEl = () => {
  8206. const { menuButtonEl } = this;
  8207. if (!menuButtonEl) {
  8208. return;
  8209. }
  8210. menuButtonEl.removeEventListener("pointerdown", this.menuButtonClick);
  8211. menuButtonEl.removeEventListener("keydown", this.menuButtonKeyDown);
  8212. };
  8213. this.setMenuButtonEl = (event) => {
  8214. const actions = event.target
  8215. .assignedElements({
  8216. flatten: true
  8217. })
  8218. .filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-action"));
  8219. this.slottedMenuButtonEl = actions[0];
  8220. this.connectMenuButtonEl();
  8221. };
  8222. this.setDefaultMenuButtonEl = (el) => {
  8223. this.defaultMenuButtonEl = el;
  8224. this.connectMenuButtonEl();
  8225. };
  8226. // --------------------------------------------------------------------------
  8227. //
  8228. // Private Methods
  8229. //
  8230. // --------------------------------------------------------------------------
  8231. this.handleCalciteActionClick = () => {
  8232. this.open = false;
  8233. this.setFocus();
  8234. };
  8235. this.menuButtonClick = (event) => {
  8236. if (!isPrimaryPointerButton(event)) {
  8237. return;
  8238. }
  8239. this.toggleOpen();
  8240. };
  8241. this.updateTooltip = (event) => {
  8242. const tooltips = event.target
  8243. .assignedElements({
  8244. flatten: true
  8245. })
  8246. .filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-tooltip"));
  8247. this.tooltipEl = tooltips[0];
  8248. this.setTooltipReferenceElement();
  8249. };
  8250. this.setTooltipReferenceElement = () => {
  8251. const { tooltipEl, expanded, menuButtonEl, open } = this;
  8252. if (tooltipEl) {
  8253. tooltipEl.referenceElement = !expanded && !open ? menuButtonEl : null;
  8254. }
  8255. };
  8256. this.updateAction = (action, index) => {
  8257. const { guid, activeMenuItemIndex } = this;
  8258. const id = `${guid}-action-${index}`;
  8259. action.tabIndex = -1;
  8260. action.setAttribute("role", "menuitem");
  8261. if (!action.id) {
  8262. action.id = id;
  8263. }
  8264. action.active = index === activeMenuItemIndex;
  8265. };
  8266. this.updateActions = (actions) => {
  8267. actions === null || actions === void 0 ? void 0 : actions.forEach(this.updateAction);
  8268. };
  8269. this.handleDefaultSlotChange = (event) => {
  8270. const actions = event.target
  8271. .assignedElements({
  8272. flatten: true
  8273. })
  8274. .filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-action"));
  8275. this.actionElements = actions;
  8276. };
  8277. this.menuButtonKeyDown = (event) => {
  8278. const { key } = event;
  8279. const { actionElements, activeMenuItemIndex, open } = this;
  8280. if (!actionElements.length) {
  8281. return;
  8282. }
  8283. if (isActivationKey(key)) {
  8284. event.preventDefault();
  8285. if (!open) {
  8286. this.toggleOpen();
  8287. return;
  8288. }
  8289. const action = actionElements[activeMenuItemIndex];
  8290. action ? action.click() : this.toggleOpen(false);
  8291. }
  8292. if (key === "Tab") {
  8293. this.open = false;
  8294. return;
  8295. }
  8296. if (key === "Escape") {
  8297. this.toggleOpen(false);
  8298. event.preventDefault();
  8299. return;
  8300. }
  8301. this.handleActionNavigation(event, key, actionElements);
  8302. };
  8303. this.handleActionNavigation = (event, key, actions) => {
  8304. if (!this.isValidKey(key, SUPPORTED_MENU_NAV_KEYS)) {
  8305. return;
  8306. }
  8307. event.preventDefault();
  8308. if (!this.open) {
  8309. this.toggleOpen();
  8310. if (key === "Home" || key === "ArrowDown") {
  8311. this.activeMenuItemIndex = 0;
  8312. }
  8313. if (key === "End" || key === "ArrowUp") {
  8314. this.activeMenuItemIndex = actions.length - 1;
  8315. }
  8316. return;
  8317. }
  8318. if (key === "Home") {
  8319. this.activeMenuItemIndex = 0;
  8320. }
  8321. if (key === "End") {
  8322. this.activeMenuItemIndex = actions.length - 1;
  8323. }
  8324. const currentIndex = this.activeMenuItemIndex;
  8325. if (key === "ArrowUp") {
  8326. this.activeMenuItemIndex = getRoundRobinIndex(Math.max(currentIndex - 1, -1), actions.length);
  8327. }
  8328. if (key === "ArrowDown") {
  8329. this.activeMenuItemIndex = getRoundRobinIndex(currentIndex + 1, actions.length);
  8330. }
  8331. };
  8332. this.toggleOpenEnd = () => {
  8333. this.setFocus();
  8334. this.el.removeEventListener("calcitePopoverOpen", this.toggleOpenEnd);
  8335. };
  8336. this.toggleOpen = (value = !this.open) => {
  8337. this.el.addEventListener("calcitePopoverOpen", this.toggleOpenEnd);
  8338. this.open = value;
  8339. };
  8340. }
  8341. // --------------------------------------------------------------------------
  8342. //
  8343. // Lifecycle
  8344. //
  8345. // --------------------------------------------------------------------------
  8346. disconnectedCallback() {
  8347. this.disconnectMenuButtonEl();
  8348. }
  8349. expandedHandler() {
  8350. this.open = false;
  8351. this.setTooltipReferenceElement();
  8352. }
  8353. openHandler(open) {
  8354. this.activeMenuItemIndex = this.open ? 0 : -1;
  8355. if (this.menuButtonEl) {
  8356. this.menuButtonEl.active = open;
  8357. }
  8358. this.calciteActionMenuOpenChange.emit(open);
  8359. this.setTooltipReferenceElement();
  8360. }
  8361. closeCalciteActionMenuOnClick(event) {
  8362. if (!isPrimaryPointerButton(event)) {
  8363. return;
  8364. }
  8365. const composedPath = event.composedPath();
  8366. if (composedPath.includes(this.el)) {
  8367. return;
  8368. }
  8369. this.open = false;
  8370. }
  8371. activeMenuItemIndexHandler() {
  8372. this.updateActions(this.actionElements);
  8373. }
  8374. // --------------------------------------------------------------------------
  8375. //
  8376. // Methods
  8377. //
  8378. // --------------------------------------------------------------------------
  8379. /** Sets focus on the component. */
  8380. async setFocus() {
  8381. focusElement(this.menuButtonEl);
  8382. }
  8383. renderMenuButton() {
  8384. const { label, scale, expanded } = this;
  8385. const menuButtonSlot = (hAsync("slot", { name: SLOTS$s.trigger, onSlotchange: this.setMenuButtonEl }, hAsync("calcite-action", { class: CSS$S.defaultTrigger, icon: ICONS$g.menu, ref: this.setDefaultMenuButtonEl, scale: scale, text: label, textEnabled: expanded })));
  8386. return menuButtonSlot;
  8387. }
  8388. renderMenuItems() {
  8389. const { actionElements, activeMenuItemIndex, open, menuId, menuButtonEl, label, placement, overlayPositioning, flipPlacements } = this;
  8390. const activeAction = actionElements[activeMenuItemIndex];
  8391. const activeDescendantId = (activeAction === null || activeAction === void 0 ? void 0 : activeAction.id) || null;
  8392. return (hAsync("calcite-popover", { disablePointer: true, flipPlacements: flipPlacements, label: label, offsetDistance: 0, open: open, overlayPositioning: overlayPositioning, placement: placement, referenceElement: menuButtonEl }, hAsync("div", { "aria-activedescendant": activeDescendantId, "aria-labelledby": menuButtonEl === null || menuButtonEl === void 0 ? void 0 : menuButtonEl.id, class: CSS$S.menu, id: menuId, onClick: this.handleCalciteActionClick, role: "menu", tabIndex: -1 }, hAsync("slot", { onSlotchange: this.handleDefaultSlotChange }))));
  8393. }
  8394. render() {
  8395. return (hAsync(Fragment, null, this.renderMenuButton(), this.renderMenuItems(), hAsync("slot", { name: SLOTS$s.tooltip, onSlotchange: this.updateTooltip })));
  8396. }
  8397. isValidKey(key, supportedKeys) {
  8398. return !!supportedKeys.find((k) => k === key);
  8399. }
  8400. get el() { return getElement(this); }
  8401. static get watchers() { return {
  8402. "expanded": ["expandedHandler"],
  8403. "open": ["openHandler"],
  8404. "activeMenuItemIndex": ["activeMenuItemIndexHandler"]
  8405. }; }
  8406. static get style() { return actionMenuCss; }
  8407. static get cmpMeta() { return {
  8408. "$flags$": 9,
  8409. "$tagName$": "calcite-action-menu",
  8410. "$members$": {
  8411. "expanded": [516],
  8412. "flipPlacements": [16],
  8413. "label": [1],
  8414. "open": [1540],
  8415. "overlayPositioning": [513, "overlay-positioning"],
  8416. "placement": [513],
  8417. "scale": [513],
  8418. "menuButtonEl": [32],
  8419. "activeMenuItemIndex": [32],
  8420. "setFocus": [64]
  8421. },
  8422. "$listeners$": [[9, "pointerdown", "closeCalciteActionMenuOnClick"]],
  8423. "$lazyBundleId$": "-",
  8424. "$attrsToReflect$": [["expanded", "expanded"], ["open", "open"], ["overlayPositioning", "overlay-positioning"], ["placement", "placement"], ["scale", "scale"]]
  8425. }; }
  8426. }
  8427. const CSS$Q = {
  8428. actionGroupBottom: "action-group--bottom",
  8429. container: "container"
  8430. };
  8431. const TEXT$r = {
  8432. expand: "Expand",
  8433. collapse: "Collapse"
  8434. };
  8435. const SLOTS$p = {
  8436. expandTooltip: "expand-tooltip"
  8437. };
  8438. const actionPadCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-action-pad:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-action-pad{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action-pad{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action-pad{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action-pad{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action-pad{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-action-pad:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-action-pad-h{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-action-pad-h *.sc-calcite-action-pad{box-sizing:border-box}/*!@:root*/.sc-calcite-action-pad:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-pad-h{display:none}/*!@:host*/.sc-calcite-action-pad-h{display:block}@keyframes in{0%{opacity:0}100%{opacity:1}}/*!@:host*/.sc-calcite-action-pad-h{animation:in var(--calcite-internal-animation-timing-slow) ease-in-out;border-radius:0.125rem;--calcite-action-pad-expanded-max-width:auto;background:transparent}/*!@:host([expanded][layout=vertical]) .container*/[expanded][layout=vertical].sc-calcite-action-pad-h .container.sc-calcite-action-pad{max-inline-size:var(--calcite-action-pad-expanded-max-width)}/*!@::slotted(calcite-action-group)*/.sc-calcite-action-pad-s>calcite-action-group{border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-block:0px}/*!@.container*/.container.sc-calcite-action-pad{display:inline-flex;flex-direction:column;overflow-y:auto;border-radius:0.25rem;background-color:var(--calcite-ui-background);--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@.action-group--bottom*/.action-group--bottom.sc-calcite-action-pad{flex-grow:1;justify-content:flex-end;padding-block-end:0px}/*!@:host([layout=horizontal]) .container*/[layout=horizontal].sc-calcite-action-pad-h .container.sc-calcite-action-pad{flex-direction:row}/*!@:host([layout=horizontal]) .container .action-group--bottom*/[layout=horizontal].sc-calcite-action-pad-h .container.sc-calcite-action-pad .action-group--bottom.sc-calcite-action-pad{padding:0px}/*!@:host([layout=horizontal]) .container ::slotted(calcite-action-group)*/.sc-calcite-action-pad-h[layout=horizontal] .container .sc-calcite-action-pad-s>calcite-action-group{border-width:0px;padding:0px;border-inline-end-width:1px}/*!@::slotted(calcite-action-group:last-child)*/.sc-calcite-action-pad-s>calcite-action-group:last-child{border-block-end-width:0px}";
  8439. /**
  8440. * @slot - A slot for adding `calcite-action`s to the component.
  8441. * @slot expand-tooltip - Used to set the `calcite-tooltip` for the expand toggle.
  8442. */
  8443. class ActionPad {
  8444. constructor(hostRef) {
  8445. registerInstance(this, hostRef);
  8446. this.calciteActionPadToggle = createEvent(this, "calciteActionPadToggle", 6);
  8447. // --------------------------------------------------------------------------
  8448. //
  8449. // Properties
  8450. //
  8451. // --------------------------------------------------------------------------
  8452. /**
  8453. * When `true`, the expand-toggling behavior is disabled.
  8454. */
  8455. this.expandDisabled = false;
  8456. /**
  8457. * When `true`, the component is expanded.
  8458. */
  8459. this.expanded = false;
  8460. /**
  8461. * Indicates the layout of the component.
  8462. */
  8463. this.layout = "vertical";
  8464. // --------------------------------------------------------------------------
  8465. //
  8466. // Private Methods
  8467. //
  8468. // --------------------------------------------------------------------------
  8469. this.actionMenuOpenChangeHandler = (event) => {
  8470. if (event.detail) {
  8471. const composedPath = event.composedPath();
  8472. Array.from(this.el.querySelectorAll("calcite-action-group")).forEach((group) => {
  8473. if (!composedPath.includes(group)) {
  8474. group.menuOpen = false;
  8475. }
  8476. });
  8477. }
  8478. };
  8479. this.toggleExpand = () => {
  8480. this.expanded = !this.expanded;
  8481. this.calciteActionPadToggle.emit();
  8482. };
  8483. this.setExpandToggleRef = (el) => {
  8484. this.expandToggleEl = el;
  8485. };
  8486. }
  8487. expandedHandler(expanded) {
  8488. toggleChildActionText({ parent: this.el, expanded });
  8489. }
  8490. // --------------------------------------------------------------------------
  8491. //
  8492. // Lifecycle
  8493. //
  8494. // --------------------------------------------------------------------------
  8495. connectedCallback() {
  8496. connectConditionalSlotComponent(this);
  8497. }
  8498. disconnectedCallback() {
  8499. disconnectConditionalSlotComponent(this);
  8500. }
  8501. componentWillLoad() {
  8502. const { el, expanded } = this;
  8503. toggleChildActionText({ parent: el, expanded });
  8504. }
  8505. // --------------------------------------------------------------------------
  8506. //
  8507. // Methods
  8508. //
  8509. // --------------------------------------------------------------------------
  8510. /**
  8511. * Sets focus on the component.
  8512. *
  8513. * @param focusId
  8514. */
  8515. async setFocus(focusId) {
  8516. var _a;
  8517. if (focusId === "expand-toggle") {
  8518. await focusElement(this.expandToggleEl);
  8519. return;
  8520. }
  8521. (_a = this.el) === null || _a === void 0 ? void 0 : _a.focus();
  8522. }
  8523. // --------------------------------------------------------------------------
  8524. //
  8525. // Component Methods
  8526. //
  8527. // --------------------------------------------------------------------------
  8528. renderBottomActionGroup() {
  8529. const { expanded, expandDisabled, intlExpand, intlCollapse, el, position, toggleExpand, scale, layout } = this;
  8530. const tooltip = getSlotted(el, SLOTS$p.expandTooltip);
  8531. const expandLabel = intlExpand || TEXT$r.expand;
  8532. const collapseLabel = intlCollapse || TEXT$r.collapse;
  8533. const expandToggleNode = !expandDisabled ? (hAsync(ExpandToggle, { el: el, expanded: expanded, intlCollapse: collapseLabel, intlExpand: expandLabel, position: position, ref: this.setExpandToggleRef, scale: scale, toggle: toggleExpand, tooltip: tooltip })) : null;
  8534. return expandToggleNode ? (hAsync("calcite-action-group", { class: CSS$Q.actionGroupBottom, layout: layout, scale: scale }, hAsync("slot", { name: SLOTS$p.expandTooltip }), expandToggleNode)) : null;
  8535. }
  8536. render() {
  8537. return (hAsync(Host, { onCalciteActionMenuOpenChange: this.actionMenuOpenChangeHandler }, hAsync("div", { class: CSS$Q.container }, hAsync("slot", null), this.renderBottomActionGroup())));
  8538. }
  8539. get el() { return getElement(this); }
  8540. static get watchers() { return {
  8541. "expanded": ["expandedHandler"]
  8542. }; }
  8543. static get style() { return actionPadCss; }
  8544. static get cmpMeta() { return {
  8545. "$flags$": 9,
  8546. "$tagName$": "calcite-action-pad",
  8547. "$members$": {
  8548. "expandDisabled": [516, "expand-disabled"],
  8549. "expanded": [1540],
  8550. "layout": [513],
  8551. "intlExpand": [1, "intl-expand"],
  8552. "intlCollapse": [1, "intl-collapse"],
  8553. "position": [513],
  8554. "scale": [513],
  8555. "setFocus": [64]
  8556. },
  8557. "$listeners$": undefined,
  8558. "$lazyBundleId$": "-",
  8559. "$attrsToReflect$": [["expandDisabled", "expand-disabled"], ["expanded", "expanded"], ["layout", "layout"], ["position", "position"], ["scale", "scale"]]
  8560. }; }
  8561. }
  8562. const TEXT$q = {
  8563. intlClose: "Close"
  8564. };
  8565. const DURATIONS = {
  8566. slow: 14000,
  8567. medium: 10000,
  8568. fast: 6000
  8569. };
  8570. const SLOTS$o = {
  8571. title: "title",
  8572. message: "message",
  8573. link: "link"
  8574. };
  8575. var StatusIcons;
  8576. (function (StatusIcons) {
  8577. StatusIcons["green"] = "checkCircle";
  8578. StatusIcons["yellow"] = "exclamationMarkTriangle";
  8579. StatusIcons["red"] = "exclamationMarkTriangle";
  8580. StatusIcons["blue"] = "lightbulb";
  8581. })(StatusIcons || (StatusIcons = {}));
  8582. const componentToTransitionListeners = new WeakMap();
  8583. function transitionStart(event) {
  8584. if (event.propertyName === this.openTransitionProp && event.target === this.transitionEl) {
  8585. this.open ? this.onBeforeOpen() : this.onBeforeClose();
  8586. }
  8587. }
  8588. function transitionEnd(event) {
  8589. if (event.propertyName === this.openTransitionProp && event.target === this.transitionEl) {
  8590. this.open ? this.onOpen() : this.onClose();
  8591. }
  8592. }
  8593. /**
  8594. * Helper to keep track of transition listeners on setTransitionEl and connectedCallback on OpenCloseComponent components.
  8595. *
  8596. * @param component
  8597. */
  8598. function connectOpenCloseComponent(component) {
  8599. disconnectOpenCloseComponent(component);
  8600. if (component.transitionEl) {
  8601. const boundOnTransitionStart = transitionStart.bind(component);
  8602. const boundOnTransitionEnd = transitionEnd.bind(component);
  8603. componentToTransitionListeners.set(component, [
  8604. component.transitionEl,
  8605. boundOnTransitionStart,
  8606. boundOnTransitionEnd
  8607. ]);
  8608. component.transitionEl.addEventListener("transitionstart", boundOnTransitionStart);
  8609. component.transitionEl.addEventListener("transitionend", boundOnTransitionEnd);
  8610. }
  8611. }
  8612. /**
  8613. * Helper to tear down transition listeners on disconnectedCallback on OpenCloseComponent components.
  8614. *
  8615. * @param component
  8616. */
  8617. function disconnectOpenCloseComponent(component) {
  8618. if (!componentToTransitionListeners.has(component)) {
  8619. return;
  8620. }
  8621. const [transitionEl, start, end] = componentToTransitionListeners.get(component);
  8622. transitionEl.removeEventListener("transitionstart", start);
  8623. transitionEl.removeEventListener("transitionend", end);
  8624. componentToTransitionListeners.delete(component);
  8625. }
  8626. // adopted from https://stackoverflow.com/a/66939244
  8627. class BigDecimal {
  8628. constructor(input) {
  8629. if (input instanceof BigDecimal) {
  8630. return input;
  8631. }
  8632. const [integers, decimals] = String(input).split(".").concat("");
  8633. this.value =
  8634. BigInt(integers + decimals.padEnd(BigDecimal.DECIMALS, "0").slice(0, BigDecimal.DECIMALS)) +
  8635. BigInt(BigDecimal.ROUNDED && decimals[BigDecimal.DECIMALS] >= "5");
  8636. this.isNegative = input.charAt(0) === "-";
  8637. }
  8638. static _divRound(dividend, divisor) {
  8639. return BigDecimal.fromBigInt(dividend / divisor + (BigDecimal.ROUNDED ? ((dividend * BigInt(2)) / divisor) % BigInt(2) : BigInt(0)));
  8640. }
  8641. static fromBigInt(bigint) {
  8642. return Object.assign(Object.create(BigDecimal.prototype), { value: bigint });
  8643. }
  8644. toString() {
  8645. const s = this.value
  8646. .toString()
  8647. .replace(new RegExp("-", "g"), "")
  8648. .padStart(BigDecimal.DECIMALS + 1, "0");
  8649. const i = s.slice(0, -BigDecimal.DECIMALS);
  8650. const d = s.slice(-BigDecimal.DECIMALS).replace(/\.?0+$/, "");
  8651. const value = i.concat(d.length ? "." + d : "");
  8652. return `${this.isNegative ? "-" : ""}${value}`;
  8653. }
  8654. formatToParts(formatter) {
  8655. const s = this.value
  8656. .toString()
  8657. .replace(new RegExp("-", "g"), "")
  8658. .padStart(BigDecimal.DECIMALS + 1, "0");
  8659. const i = s.slice(0, -BigDecimal.DECIMALS);
  8660. const d = s.slice(-BigDecimal.DECIMALS).replace(/\.?0+$/, "");
  8661. const parts = formatter.formatToParts(BigInt(i));
  8662. this.isNegative && parts.unshift({ type: "minusSign", value: numberStringFormatter.minusSign });
  8663. if (d.length) {
  8664. parts.push({ type: "decimal", value: numberStringFormatter.decimal });
  8665. d.split("").forEach((char) => parts.push({ type: "fraction", value: char }));
  8666. }
  8667. return parts;
  8668. }
  8669. format(formatter) {
  8670. const s = this.value
  8671. .toString()
  8672. .replace(new RegExp("-", "g"), "")
  8673. .padStart(BigDecimal.DECIMALS + 1, "0");
  8674. const i = s.slice(0, -BigDecimal.DECIMALS);
  8675. const d = s.slice(-BigDecimal.DECIMALS).replace(/\.?0+$/, "");
  8676. const iFormatted = `${this.isNegative ? numberStringFormatter.minusSign : ""}${formatter.format(BigInt(i))}`;
  8677. const dFormatted = d.length ? `${numberStringFormatter.decimal}${formatter.format(BigInt(d))}` : "";
  8678. return `${iFormatted}${dFormatted}`;
  8679. }
  8680. add(num) {
  8681. return BigDecimal.fromBigInt(this.value + new BigDecimal(num).value);
  8682. }
  8683. subtract(num) {
  8684. return BigDecimal.fromBigInt(this.value - new BigDecimal(num).value);
  8685. }
  8686. multiply(num) {
  8687. return BigDecimal._divRound(this.value * new BigDecimal(num).value, BigDecimal.SHIFT);
  8688. }
  8689. divide(num) {
  8690. return BigDecimal._divRound(this.value * BigDecimal.SHIFT, new BigDecimal(num).value);
  8691. }
  8692. }
  8693. // Configuration: constants
  8694. BigDecimal.DECIMALS = 100; // number of decimals on all instances
  8695. BigDecimal.ROUNDED = true; // numbers are truncated (false) or rounded (true)
  8696. BigDecimal.SHIFT = BigInt("1" + "0".repeat(BigDecimal.DECIMALS)); // derived constant
  8697. function isValidNumber(numberString) {
  8698. return !(!numberString || isNaN(Number(numberString)));
  8699. }
  8700. function parseNumberString(numberString) {
  8701. if (!numberString || !stringContainsNumbers(numberString)) {
  8702. return "";
  8703. }
  8704. return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
  8705. let containsDecimal = false;
  8706. const result = nonExpoNumString
  8707. .split("")
  8708. .filter((value, i) => {
  8709. if (value.match(/\./g) && !containsDecimal) {
  8710. containsDecimal = true;
  8711. return true;
  8712. }
  8713. if (value.match(/\-/g) && i === 0) {
  8714. return true;
  8715. }
  8716. return numberKeys.includes(value);
  8717. })
  8718. .reduce((string, part) => string + part);
  8719. return isValidNumber(result) ? new BigDecimal(result).toString() : "";
  8720. });
  8721. }
  8722. // regex for number sanitization
  8723. const allLeadingZerosOptionallyNegative = /^([-0])0+(?=\d)/;
  8724. const decimalOnlyAtEndOfString = /(?!^\.)\.$/;
  8725. const allHyphensExceptTheStart = /(?!^-)-/g;
  8726. const isNegativeDecimalOnlyZeros = /^-\b0\b\.?0*$/;
  8727. const sanitizeNumberString = (numberString) => sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
  8728. const sanitizedValue = nonExpoNumString
  8729. .replace(allHyphensExceptTheStart, "")
  8730. .replace(decimalOnlyAtEndOfString, "")
  8731. .replace(allLeadingZerosOptionallyNegative, "$1");
  8732. return isValidNumber(sanitizedValue)
  8733. ? isNegativeDecimalOnlyZeros.test(sanitizedValue)
  8734. ? sanitizedValue
  8735. : new BigDecimal(sanitizedValue).toString()
  8736. : nonExpoNumString;
  8737. });
  8738. function sanitizeExponentialNumberString(numberString, func) {
  8739. if (!numberString) {
  8740. return numberString;
  8741. }
  8742. const firstE = numberString.toLowerCase().indexOf("e") + 1;
  8743. if (!firstE) {
  8744. return func(numberString);
  8745. }
  8746. return numberString
  8747. .replace(/[eE]*$/g, "")
  8748. .substring(0, firstE)
  8749. .concat(numberString.slice(firstE).replace(/[eE]/g, ""))
  8750. .split(/[eE]/)
  8751. .map((section, i) => (i === 1 ? func(section.replace(/\./g, "")) : func(section)))
  8752. .join("e")
  8753. .replace(/^e/, "1e");
  8754. }
  8755. function stringContainsNumbers(string) {
  8756. return numberKeys.some((number) => string.includes(number));
  8757. }
  8758. const defaultLocale = "en";
  8759. const locales = [
  8760. "ar",
  8761. "bg",
  8762. "bs",
  8763. "ca",
  8764. "cs",
  8765. "da",
  8766. "de",
  8767. "de-CH",
  8768. "el",
  8769. defaultLocale,
  8770. "en-AU",
  8771. "en-CA",
  8772. "en-GB",
  8773. "es",
  8774. "es-MX",
  8775. "et",
  8776. "fi",
  8777. "fr",
  8778. "fr-CH",
  8779. "he",
  8780. "hi",
  8781. "hr",
  8782. "hu",
  8783. "id",
  8784. "it",
  8785. "it-CH",
  8786. "ja",
  8787. "ko",
  8788. "lt",
  8789. "lv",
  8790. "mk",
  8791. "nb",
  8792. "nl",
  8793. "pl",
  8794. "pt",
  8795. "pt-PT",
  8796. "ro",
  8797. "ru",
  8798. "sk",
  8799. "sl",
  8800. "sr",
  8801. "sv",
  8802. "th",
  8803. "tr",
  8804. "uk",
  8805. "vi",
  8806. "zh-CN",
  8807. "zh-HK",
  8808. "zh-TW"
  8809. ];
  8810. const numberingSystems = [
  8811. "arab",
  8812. "arabext",
  8813. "bali",
  8814. "beng",
  8815. "deva",
  8816. "fullwide",
  8817. "gujr",
  8818. "guru",
  8819. "hanidec",
  8820. "khmr",
  8821. "knda",
  8822. "laoo",
  8823. "latn",
  8824. "limb",
  8825. "mlym",
  8826. "mong",
  8827. "mymr",
  8828. "orya",
  8829. "tamldec",
  8830. "telu",
  8831. "thai",
  8832. "tibt"
  8833. ];
  8834. const isNumberingSystemSupported = (numberingSystem) => numberingSystems.includes(numberingSystem);
  8835. const browserNumberingSystem = new Intl.NumberFormat().resolvedOptions().numberingSystem;
  8836. const defaultNumberingSystem = browserNumberingSystem === "arab" || !isNumberingSystemSupported(browserNumberingSystem)
  8837. ? "latn"
  8838. : browserNumberingSystem;
  8839. const getSupportedNumberingSystem = (numberingSystem) => isNumberingSystemSupported(numberingSystem) ? numberingSystem : defaultNumberingSystem;
  8840. function getSupportedLocale(locale) {
  8841. if (locales.indexOf(locale) > -1) {
  8842. return locale;
  8843. }
  8844. if (!locale) {
  8845. return defaultLocale;
  8846. }
  8847. locale = locale.toLowerCase();
  8848. // we support both 'nb' and 'no' (BCP 47) for Norwegian
  8849. if (locale === "nb") {
  8850. return "no";
  8851. }
  8852. if (locale.includes("-")) {
  8853. locale = locale.replace(/(\w+)-(\w+)/, (_match, language, region) => `${language}-${region.toUpperCase()}`);
  8854. if (!locales.includes(locale)) {
  8855. locale = locale.split("-")[0];
  8856. }
  8857. }
  8858. return locales.includes(locale) ? locale : defaultLocale;
  8859. }
  8860. const connectedComponents = new Set();
  8861. /**
  8862. * This utility sets up internals for messages support.
  8863. *
  8864. * It needs to be called in `connectedCallback` before any logic that depends on locale
  8865. *
  8866. * @param component
  8867. */
  8868. function connectLocalized(component) {
  8869. updateEffectiveLocale(component);
  8870. if (connectedComponents.size === 0) {
  8871. mutationObserver.observe(document.documentElement, {
  8872. attributes: true,
  8873. attributeFilter: ["lang"],
  8874. subtree: true
  8875. });
  8876. }
  8877. connectedComponents.add(component);
  8878. }
  8879. /**
  8880. * This is only exported for components that implemented the now deprecated `locale` prop.
  8881. *
  8882. * Do not use this utils for new components.
  8883. *
  8884. * @param component
  8885. */
  8886. function updateEffectiveLocale(component) {
  8887. component.effectiveLocale = getLocale(component);
  8888. }
  8889. /**
  8890. * This utility tears down internals for messages support.
  8891. *
  8892. * It needs to be called in `disconnectedCallback`
  8893. *
  8894. * @param component
  8895. */
  8896. function disconnectLocalized(component) {
  8897. connectedComponents.delete(component);
  8898. if (connectedComponents.size === 0) {
  8899. mutationObserver.disconnect();
  8900. }
  8901. }
  8902. const mutationObserver = createObserver();
  8903. /**
  8904. * This util helps resolve a component's locale.
  8905. * It will also fall back on the deprecated `locale` if a component implemented this previously.
  8906. *
  8907. * @param component
  8908. */
  8909. function getLocale(component) {
  8910. var _a;
  8911. return (component.el.lang ||
  8912. component.locale ||
  8913. ((_a = closestElementCrossShadowBoundary(component.el, "[lang]")) === null || _a === void 0 ? void 0 : _a.lang) ||
  8914. document.documentElement.lang ||
  8915. defaultLocale);
  8916. }
  8917. /**
  8918. * This util formats and parses numbers for localization
  8919. */
  8920. class NumberStringFormat {
  8921. constructor() {
  8922. this.delocalize = (numberString) =>
  8923. // For performance, (de)localization is skipped if the formatter isn't initialized.
  8924. // In order to localize/delocalize, e.g. when lang/numberingSystem props are not default values,
  8925. // `numberFormatOptions` must be set in a component to create and cache the formatter.
  8926. this._numberFormatOptions
  8927. ? sanitizeExponentialNumberString(numberString, (nonExpoNumString) => nonExpoNumString
  8928. .trim()
  8929. .replace(new RegExp(`[${this._minusSign}]`, "g"), "-")
  8930. .replace(new RegExp(`[${this._group}]`, "g"), "")
  8931. .replace(new RegExp(`[${this._decimal}]`, "g"), ".")
  8932. .replace(new RegExp(`[${this._digits.join("")}]`, "g"), this._getDigitIndex))
  8933. : numberString;
  8934. this.localize = (numberString) => this._numberFormatOptions
  8935. ? sanitizeExponentialNumberString(numberString, (nonExpoNumString) => isValidNumber(nonExpoNumString.trim())
  8936. ? new BigDecimal(nonExpoNumString.trim())
  8937. .format(this._numberFormatter)
  8938. .replace(new RegExp(`[${this._actualGroup}]`, "g"), this._group)
  8939. : nonExpoNumString)
  8940. : numberString;
  8941. }
  8942. get group() {
  8943. return this._group;
  8944. }
  8945. get decimal() {
  8946. return this._decimal;
  8947. }
  8948. get minusSign() {
  8949. return this._minusSign;
  8950. }
  8951. get digits() {
  8952. return this._digits;
  8953. }
  8954. get numberFormatter() {
  8955. return this._numberFormatter;
  8956. }
  8957. get numberFormatOptions() {
  8958. return this._numberFormatOptions;
  8959. }
  8960. /**
  8961. * numberFormatOptions needs to be set before localize/delocalize is called to ensure the options are up to date
  8962. */
  8963. set numberFormatOptions(options) {
  8964. options.locale = getSupportedLocale(options === null || options === void 0 ? void 0 : options.locale);
  8965. options.numberingSystem = getSupportedNumberingSystem(options === null || options === void 0 ? void 0 : options.numberingSystem);
  8966. if (
  8967. // No need to create the formatter if `locale` and `numberingSystem`
  8968. // are the default values and `numberFormatOptions` has not been set
  8969. (!this._numberFormatOptions &&
  8970. options.locale === defaultLocale &&
  8971. options.numberingSystem === defaultNumberingSystem &&
  8972. // don't skip initialization if any options besides locale/numberingSystem are set
  8973. Object.keys(options).length === 2) ||
  8974. // cache formatter by only recreating when options change
  8975. JSON.stringify(this._numberFormatOptions) === JSON.stringify(options)) {
  8976. return;
  8977. }
  8978. this._numberFormatOptions = options;
  8979. this._numberFormatter = new Intl.NumberFormat(this._numberFormatOptions.locale, this._numberFormatOptions);
  8980. this._digits = [
  8981. ...new Intl.NumberFormat(this._numberFormatOptions.locale, {
  8982. useGrouping: false,
  8983. numberingSystem: this._numberFormatOptions.numberingSystem
  8984. }).format(9876543210)
  8985. ].reverse();
  8986. const index = new Map(this._digits.map((d, i) => [d, i]));
  8987. const parts = new Intl.NumberFormat(this._numberFormatOptions.locale).formatToParts(-12345678.9);
  8988. this._actualGroup = parts.find((d) => d.type === "group").value;
  8989. // change whitespace group characters that don't render correctly
  8990. this._group = this._actualGroup.trim().length === 0 ? " " : this._actualGroup;
  8991. this._decimal = parts.find((d) => d.type === "decimal").value;
  8992. this._minusSign = parts.find((d) => d.type === "minusSign").value;
  8993. this._getDigitIndex = (d) => index.get(d);
  8994. }
  8995. }
  8996. const numberStringFormatter = new NumberStringFormat();
  8997. const alertCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-alert:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-alert{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-alert{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-alert{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-alert{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-alert{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-alert:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-alert:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-alert-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-alert-h{--calcite-alert-width:40em;--calcite-alert-spacing-token-small:0.5rem;--calcite-alert-spacing-token-large:0.75rem}/*!@:host([scale=s]) slot[name=title]::slotted(*), \n:host([scale=s]) *::slotted([slot=title])*/.sc-calcite-alert-h[scale=s] slot[name=title].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=s] *.sc-calcite-alert-s>[slot=title]{font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=s]) slot[name=message]::slotted(*), \n:host([scale=s]) *::slotted([slot=message])*/.sc-calcite-alert-h[scale=s] slot[name=message].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=s] *.sc-calcite-alert-s>[slot=message]{font-size:var(--calcite-font-size--2);line-height:1.375}/*!@:host([scale=s]) slot[name=link]::slotted(*), \n:host([scale=s]) *::slotted([slot=link])*/.sc-calcite-alert-h[scale=s] slot[name=link].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=s] *.sc-calcite-alert-s>[slot=link]{font-size:var(--calcite-font-size--2);line-height:1.375}/*!@:host([scale=s]) .alert-queue-count*/[scale=s].sc-calcite-alert-h .alert-queue-count.sc-calcite-alert{margin-inline:0.5rem}/*!@:host([scale=s]) .container*/[scale=s].sc-calcite-alert-h .container.sc-calcite-alert{--calcite-alert-min-height:3.5rem}/*!@:host([scale=s]) .alert-close*/[scale=s].sc-calcite-alert-h .alert-close.sc-calcite-alert{padding:0.5rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-alert-h{--calcite-alert-width:50em;--calcite-alert-spacing-token-small:0.75rem;--calcite-alert-spacing-token-large:1rem}/*!@:host([scale=m]) slot[name=title]::slotted(*), \n:host([scale=m]) *::slotted([slot=title])*/.sc-calcite-alert-h[scale=m] slot[name=title].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=m] *.sc-calcite-alert-s>[slot=title]{font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([scale=m]) slot[name=message]::slotted(*), \n:host([scale=m]) *::slotted([slot=message])*/.sc-calcite-alert-h[scale=m] slot[name=message].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=m] *.sc-calcite-alert-s>[slot=message]{font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=m]) slot[name=link]::slotted(*), \n:host([scale=m]) *::slotted([slot=link])*/.sc-calcite-alert-h[scale=m] slot[name=link].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=m] *.sc-calcite-alert-s>[slot=link]{font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=m]) .alert-queue-count*/[scale=m].sc-calcite-alert-h .alert-queue-count.sc-calcite-alert{margin-inline:0.75rem}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-alert-h .container.sc-calcite-alert{--calcite-alert-min-height:4.1875rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-alert-h{--calcite-alert-width:60em;--calcite-alert-spacing-token-small:1rem;--calcite-alert-spacing-token-large:1.25rem}/*!@:host([scale=l]) slot[name=title]::slotted(*), \n:host([scale=l]) *::slotted([slot=title])*/.sc-calcite-alert-h[scale=l] slot[name=title].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=l] *.sc-calcite-alert-s>[slot=title]{margin-block-end:0.25rem;font-size:var(--calcite-font-size-1);line-height:1.375}/*!@:host([scale=l]) slot[name=message]::slotted(*), \n:host([scale=l]) *::slotted([slot=message])*/.sc-calcite-alert-h[scale=l] slot[name=message].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=l] *.sc-calcite-alert-s>[slot=message]{font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([scale=l]) slot[name=link]::slotted(*), \n:host([scale=l]) *::slotted([slot=link])*/.sc-calcite-alert-h[scale=l] slot[name=link].sc-calcite-alert-s>*,.sc-calcite-alert-h[scale=l] *.sc-calcite-alert-s>[slot=link]{font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([scale=l]) .alert-queue-count*/[scale=l].sc-calcite-alert-h .alert-queue-count.sc-calcite-alert{margin-inline:1rem}/*!@:host([scale=l]) .container*/[scale=l].sc-calcite-alert-h .container.sc-calcite-alert{--calcite-alert-min-height:5.625rem}/*!@:host*/.sc-calcite-alert-h{--calcite-alert-edge-distance:2rem;display:block}/*!@:host .container*/.sc-calcite-alert-h .container.sc-calcite-alert{pointer-events:none;position:fixed;z-index:500;margin-block:0px;margin-inline:auto;display:flex;align-items:center;justify-content:center;background-color:var(--calcite-ui-foreground-1);opacity:0;--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-radius:var(--calcite-border-radius);border-block-start:0px solid transparent;border-inline:1px solid var(--calcite-ui-border-3);border-block-end:1px solid var(--calcite-ui-border-3);min-block-size:var(--calcite-alert-min-height);inline-size:var(--calcite-alert-width);max-inline-size:calc(100% - (var(--calcite-alert-edge-distance) * 2 + 2px));max-block-size:0;transition:var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out}/*!@:host .container.bottom, :host .container.top*/.sc-calcite-alert-h .container.bottom.sc-calcite-alert,.sc-calcite-alert-h .container.top.sc-calcite-alert{inset-inline-end:0;inset-inline-start:0}/*!@:host .container[class*=bottom]*/.sc-calcite-alert-h .container[class*=bottom].sc-calcite-alert{transform:translate3d(0, var(--calcite-alert-edge-distance), 0);inset-block-end:var(--calcite-alert-edge-distance)}/*!@:host .container[class*=top]*/.sc-calcite-alert-h .container[class*=top].sc-calcite-alert{transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), 0);inset-block-start:var(--calcite-alert-edge-distance)}/*!@:host .container[class*=-start]*/.sc-calcite-alert-h .container[class*=-start].sc-calcite-alert{inset-inline-start:var(--calcite-alert-edge-distance);inset-inline-end:auto}/*!@:host .container[class*=-end]*/.sc-calcite-alert-h .container[class*=-end].sc-calcite-alert{inset-inline-end:var(--calcite-alert-edge-distance);inset-inline-start:auto}/*!@:host([calcite-hydrated-hidden])*/[calcite-hydrated-hidden].sc-calcite-alert-h{visibility:hidden !important;pointer-events:none}/*!@.container*/.container.sc-calcite-alert{display:flex;inline-size:100%;align-items:center;justify-content:center}/*!@.alert-close*/.alert-close.sc-calcite-alert{outline-color:transparent}/*!@.alert-close:focus*/.alert-close.sc-calcite-alert:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host([open]) .container:not(.queued)*/[open].sc-calcite-alert-h .container.sc-calcite-alert:not(.queued){max-block-size:100%;border-block-start-width:2px;opacity:1;pointer-events:initial}/*!@:host([open]) .container:not(.queued)[class*=bottom]*/[open].sc-calcite-alert-h .container.sc-calcite-alert:not(.queued)[class*=bottom]{transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), inherit)}/*!@:host([open]) .container:not(.queued)[class*=top]*/[open].sc-calcite-alert-h .container.sc-calcite-alert:not(.queued)[class*=top]{transform:translate3d(0, var(--calcite-alert-edge-distance), inherit)}/*!@slot[name=title]::slotted(*), \n*::slotted([slot=title])*/slot[name=title].sc-calcite-alert-s>*,*.sc-calcite-alert-s>[slot=title]{font-size:var(--calcite-font-size-0);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@slot[name=message]::slotted(*), \n*::slotted([slot=message])*/slot[name=message].sc-calcite-alert-s>*,*.sc-calcite-alert-s>[slot=message]{margin:0px;display:inline;font-size:var(--calcite-font-size--1);line-height:1.375;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);margin-inline-end:0.5rem}/*!@slot[name=link]::slotted(*), \n*::slotted([slot=link])*/slot[name=link].sc-calcite-alert-s>*,*.sc-calcite-alert-s>[slot=link]{display:inline-flex;color:var(--calcite-ui-text-link)}/*!@.alert-content*/.alert-content.sc-calcite-alert{transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-inline:var(--calcite-alert-spacing-token-large);flex:0 0 auto;overflow-wrap:break-word;background-color:var(--calcite-ui-foreground-1);flex:1 1 auto;min-inline-size:0;padding-block:var(--calcite-alert-spacing-token-small);padding-inline:0 var(--calcite-alert-spacing-token-small);border-end-start-radius:var(--calcite-border-radius);border-end-end-radius:var(--calcite-border-radius)}/*!@.alert-content:first-of-type:not(:only-child)*/.alert-content.sc-calcite-alert:first-of-type:not(:only-child){padding-inline-start:var(--calcite-alert-spacing-token-large)}/*!@.alert-content:only-child*/.alert-content.sc-calcite-alert:only-child{padding:var(--calcite-alert-spacing-token-small)}/*!@.alert-icon*/.alert-icon.sc-calcite-alert{transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-alert-spacing-token-small);padding-inline:var(--calcite-alert-spacing-token-large);flex:0 0 auto;display:flex;align-items:center;align-self:stretch;background-color:var(--calcite-ui-foreground-1);padding-block:0px}/*!@.alert-close*/.alert-close.sc-calcite-alert{transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-alert-spacing-token-small);padding-inline:var(--calcite-alert-spacing-token-large);flex:0 0 auto;cursor:pointer;align-self:stretch;overflow:hidden;border-style:none;background-color:var(--calcite-ui-foreground-1);padding-block:0px;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;border-end-end-radius:var(--calcite-border-radius)}/*!@.alert-close:hover, .alert-close:focus*/.alert-close.sc-calcite-alert:hover,.alert-close.sc-calcite-alert:focus{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@.alert-close:open*/.alert-close.sc-calcite-alert:open{background-color:var(--calcite-ui-foreground-3)}/*!@.alert-queue-count*/.alert-queue-count.sc-calcite-alert{visibility:hidden;display:flex;cursor:default;align-items:center;justify-content:space-around;align-self:stretch;overflow:hidden;background-color:var(--calcite-ui-foreground-1);text-align:center;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2);opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-inline:0px solid transparent;border-start-end-radius:0}/*!@.alert-queue-count.active*/.alert-queue-count.active.sc-calcite-alert{visibility:visible;opacity:1}/*!@:host([auto-dismiss]) > .alert-queue-count*/[auto-dismiss].sc-calcite-alert-h>.alert-queue-count.sc-calcite-alert{border-inline-end:0px solid transparent}/*!@.alert-dismiss-progress*/.alert-dismiss-progress.sc-calcite-alert{position:absolute;display:block;inline-size:100%;overflow:hidden;inset-inline:0;inset-block-start:-2px;block-size:2px;border-radius:var(--calcite-border-radius) var(--calcite-border-radius) 0 0}/*!@.alert-dismiss-progress:after*/.alert-dismiss-progress.sc-calcite-alert:after{position:absolute;inset-block-start:0px;display:block;block-size:2px;content:\"\";background-color:var(--calcite-alert-dismiss-progress-background);inset-inline-end:0}/*!@:host([color=blue]) .container*/[color=blue].sc-calcite-alert-h .container.sc-calcite-alert{border-block-start-color:var(--calcite-ui-info)}/*!@:host([color=blue]) .container .alert-icon*/[color=blue].sc-calcite-alert-h .container.sc-calcite-alert .alert-icon.sc-calcite-alert{color:var(--calcite-ui-info)}/*!@:host([color=red]) .container*/[color=red].sc-calcite-alert-h .container.sc-calcite-alert{border-block-start-color:var(--calcite-ui-danger)}/*!@:host([color=red]) .container .alert-icon*/[color=red].sc-calcite-alert-h .container.sc-calcite-alert .alert-icon.sc-calcite-alert{color:var(--calcite-ui-danger)}/*!@:host([color=yellow]) .container*/[color=yellow].sc-calcite-alert-h .container.sc-calcite-alert{border-block-start-color:var(--calcite-ui-warning)}/*!@:host([color=yellow]) .container .alert-icon*/[color=yellow].sc-calcite-alert-h .container.sc-calcite-alert .alert-icon.sc-calcite-alert{color:var(--calcite-ui-warning)}/*!@:host([color=green]) .container*/[color=green].sc-calcite-alert-h .container.sc-calcite-alert{border-block-start-color:var(--calcite-ui-success)}/*!@:host([color=green]) .container .alert-icon*/[color=green].sc-calcite-alert-h .container.sc-calcite-alert .alert-icon.sc-calcite-alert{color:var(--calcite-ui-success)}/*!@:host([auto-dismiss-duration=fast]) .alert-dismiss-progress:after*/[auto-dismiss-duration=fast].sc-calcite-alert-h .alert-dismiss-progress.sc-calcite-alert:after{animation:dismissProgress 6000ms ease-out}/*!@:host([auto-dismiss-duration=medium]) .alert-dismiss-progress:after*/[auto-dismiss-duration=medium].sc-calcite-alert-h .alert-dismiss-progress.sc-calcite-alert:after{animation:dismissProgress 10000ms ease-out}/*!@:host([auto-dismiss-duration=slow]) .alert-dismiss-progress:after*/[auto-dismiss-duration=slow].sc-calcite-alert-h .alert-dismiss-progress.sc-calcite-alert:after{animation:dismissProgress 14000ms ease-out}@keyframes dismissProgress{0%{inline-size:0px;opacity:0.75}100%{inline-size:100%;opacity:1}}";
  8998. /**
  8999. * Alerts are meant to provide a way to communicate urgent or important information to users, frequently as a result of an action they took in your app. Alerts are positioned
  9000. * at the bottom of the page. Multiple opened alerts will be added to a queue, allowing users to dismiss them in the order they are provided.
  9001. */
  9002. /**
  9003. * @slot title - A slot for optionally adding a title to the component.
  9004. * @slot message - A slot for adding main text to the component.
  9005. * @slot link - A slot for optionally adding an action to take from the alert (undo, try again, link to page, etc.)
  9006. */
  9007. class Alert {
  9008. constructor(hostRef) {
  9009. registerInstance(this, hostRef);
  9010. this.calciteAlertBeforeClose = createEvent(this, "calciteAlertBeforeClose", 6);
  9011. this.calciteAlertClose = createEvent(this, "calciteAlertClose", 6);
  9012. this.calciteAlertBeforeOpen = createEvent(this, "calciteAlertBeforeOpen", 6);
  9013. this.calciteAlertOpen = createEvent(this, "calciteAlertOpen", 6);
  9014. this.calciteInternalAlertSync = createEvent(this, "calciteInternalAlertSync", 6);
  9015. this.calciteInternalAlertRegister = createEvent(this, "calciteInternalAlertRegister", 6);
  9016. //--------------------------------------------------------------------------
  9017. //
  9018. // Properties
  9019. //
  9020. //---------------------------------------------------------------------------
  9021. /**
  9022. * When `true`, displays and positions the component.
  9023. *
  9024. * @deprecated use `open` instead.
  9025. */
  9026. this.active = false;
  9027. /** When `true`, displays and positions the component. */
  9028. this.open = false;
  9029. /** When `true`, the component closes automatically (recommended for passive, non-blocking alerts). */
  9030. this.autoDismiss = false;
  9031. /** Specifies the duration before the component automatically closes (only use with `autoDismiss`). */
  9032. this.autoDismissDuration = this.autoDismiss ? "medium" : null;
  9033. /** Specifies the color for the component (will apply to top border and icon). */
  9034. this.color = "blue";
  9035. /**
  9036. * Specifies the text label for the close button.
  9037. *
  9038. * @default "Close"
  9039. */
  9040. this.intlClose = TEXT$q.intlClose;
  9041. /** Specifies the placement of the component */
  9042. this.placement = "bottom";
  9043. /** Specifies the size of the component. */
  9044. this.scale = "m";
  9045. //--------------------------------------------------------------------------
  9046. //
  9047. // Private State/Props
  9048. //
  9049. //--------------------------------------------------------------------------
  9050. this.effectiveLocale = "";
  9051. /** the list of queued alerts */
  9052. this.queue = [];
  9053. /** the count of queued alerts */
  9054. this.queueLength = 0;
  9055. /** is the alert queued */
  9056. this.queued = false;
  9057. this.autoDismissTimeoutId = null;
  9058. this.trackTimer = Date.now();
  9059. this.openTransitionProp = "opacity";
  9060. //--------------------------------------------------------------------------
  9061. //
  9062. // Private Methods
  9063. //
  9064. //--------------------------------------------------------------------------
  9065. this.setTransitionEl = (el) => {
  9066. this.transitionEl = el;
  9067. connectOpenCloseComponent(this);
  9068. };
  9069. /** close and emit calciteInternalAlertSync event with the updated queue payload */
  9070. this.closeAlert = () => {
  9071. this.autoDismissTimeoutId = null;
  9072. this.queued = false;
  9073. this.open = false;
  9074. this.queue = this.queue.filter((el) => el !== this.el);
  9075. this.determineActiveAlert();
  9076. this.calciteInternalAlertSync.emit({ queue: this.queue });
  9077. };
  9078. }
  9079. activeHandler(value) {
  9080. this.open = value;
  9081. }
  9082. openHandler(value) {
  9083. if (this.open && !this.queued) {
  9084. this.calciteInternalAlertRegister.emit();
  9085. this.active = value;
  9086. }
  9087. if (!this.open) {
  9088. this.queue = this.queue.filter((el) => el !== this.el);
  9089. this.calciteInternalAlertSync.emit({ queue: this.queue });
  9090. this.active = false;
  9091. }
  9092. }
  9093. updateRequestedIcon() {
  9094. this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
  9095. }
  9096. updateDuration() {
  9097. if (this.autoDismiss && this.autoDismissTimeoutId) {
  9098. window.clearTimeout(this.autoDismissTimeoutId);
  9099. this.autoDismissTimeoutId = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration] - (Date.now() - this.trackTimer));
  9100. }
  9101. }
  9102. //--------------------------------------------------------------------------
  9103. //
  9104. // Lifecycle
  9105. //
  9106. //--------------------------------------------------------------------------
  9107. connectedCallback() {
  9108. connectLocalized(this);
  9109. const open = this.open || this.active;
  9110. if (open && !this.queued) {
  9111. this.activeHandler(open);
  9112. this.openHandler(open);
  9113. this.calciteInternalAlertRegister.emit();
  9114. }
  9115. connectOpenCloseComponent(this);
  9116. }
  9117. componentWillLoad() {
  9118. this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
  9119. }
  9120. disconnectedCallback() {
  9121. window.clearTimeout(this.autoDismissTimeoutId);
  9122. disconnectOpenCloseComponent(this);
  9123. disconnectLocalized(this);
  9124. }
  9125. render() {
  9126. const closeButton = (hAsync("button", { "aria-label": this.intlClose, class: "alert-close", onClick: this.closeAlert, ref: (el) => (this.closeButton = el), type: "button" }, hAsync("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })));
  9127. numberStringFormatter.numberFormatOptions = {
  9128. locale: this.effectiveLocale,
  9129. numberingSystem: this.numberingSystem,
  9130. signDisplay: "always"
  9131. };
  9132. const queueNumber = this.queueLength > 2 ? this.queueLength - 1 : 1;
  9133. const queueText = numberStringFormatter.numberFormatter.format(queueNumber);
  9134. const queueCount = (hAsync("div", { class: `${this.queueLength > 1 ? "active " : ""}alert-queue-count` }, hAsync("calcite-chip", { scale: this.scale, value: queueText }, queueText)));
  9135. const { active, autoDismiss, label, placement, queued, requestedIcon } = this;
  9136. const role = autoDismiss ? "alert" : "alertdialog";
  9137. const hidden = !active;
  9138. return (hAsync(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "calcite-hydrated-hidden": hidden, role: role }, hAsync("div", { class: {
  9139. container: true,
  9140. queued,
  9141. [placement]: true
  9142. }, ref: this.setTransitionEl }, requestedIcon ? (hAsync("div", { class: "alert-icon" }, hAsync("calcite-icon", { icon: requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, hAsync("div", { class: "alert-content" }, hAsync("slot", { name: SLOTS$o.title }), hAsync("slot", { name: SLOTS$o.message }), hAsync("slot", { name: SLOTS$o.link })), queueCount, !autoDismiss ? closeButton : null, active && !queued && autoDismiss ? hAsync("div", { class: "alert-dismiss-progress" }) : null)));
  9143. }
  9144. // when an alert is opened or closed, update queue and determine active alert
  9145. alertSync(event) {
  9146. if (this.queue !== event.detail.queue) {
  9147. this.queue = event.detail.queue;
  9148. }
  9149. this.queueLength = this.queue.length;
  9150. this.determineActiveAlert();
  9151. event.stopPropagation();
  9152. }
  9153. // when an alert is first registered, trigger a queue sync
  9154. alertRegister() {
  9155. if (this.open && !this.queue.includes(this.el)) {
  9156. this.queued = true;
  9157. this.queue.push(this.el);
  9158. }
  9159. this.calciteInternalAlertSync.emit({ queue: this.queue });
  9160. this.determineActiveAlert();
  9161. }
  9162. //--------------------------------------------------------------------------
  9163. //
  9164. // Public Methods
  9165. //
  9166. //--------------------------------------------------------------------------
  9167. /** Sets focus on the component. */
  9168. async setFocus() {
  9169. const alertLinkEl = getSlotted(this.el, { selector: "calcite-link" });
  9170. if (!this.closeButton && !alertLinkEl) {
  9171. return;
  9172. }
  9173. else if (alertLinkEl) {
  9174. alertLinkEl.setFocus();
  9175. }
  9176. else if (this.closeButton) {
  9177. this.closeButton.focus();
  9178. }
  9179. }
  9180. /** determine which alert is active */
  9181. determineActiveAlert() {
  9182. var _a;
  9183. if (((_a = this.queue) === null || _a === void 0 ? void 0 : _a[0]) === this.el) {
  9184. this.openAlert();
  9185. if (this.autoDismiss && !this.autoDismissTimeoutId) {
  9186. this.trackTimer = Date.now();
  9187. this.autoDismissTimeoutId = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration]);
  9188. }
  9189. }
  9190. else {
  9191. return;
  9192. }
  9193. }
  9194. onBeforeOpen() {
  9195. this.calciteAlertBeforeOpen.emit();
  9196. }
  9197. onOpen() {
  9198. this.calciteAlertOpen.emit();
  9199. }
  9200. onBeforeClose() {
  9201. this.calciteAlertBeforeClose.emit();
  9202. }
  9203. onClose() {
  9204. this.calciteAlertClose.emit();
  9205. }
  9206. /** remove queued class after animation completes */
  9207. openAlert() {
  9208. window.clearTimeout(this.queueTimeout);
  9209. this.queueTimeout = window.setTimeout(() => (this.queued = false), 300);
  9210. }
  9211. get el() { return getElement(this); }
  9212. static get watchers() { return {
  9213. "active": ["activeHandler"],
  9214. "open": ["openHandler"],
  9215. "icon": ["updateRequestedIcon"],
  9216. "color": ["updateRequestedIcon"],
  9217. "autoDismissDuration": ["updateDuration"]
  9218. }; }
  9219. static get style() { return alertCss; }
  9220. static get cmpMeta() { return {
  9221. "$flags$": 9,
  9222. "$tagName$": "calcite-alert",
  9223. "$members$": {
  9224. "active": [1540],
  9225. "open": [1540],
  9226. "autoDismiss": [516, "auto-dismiss"],
  9227. "autoDismissDuration": [513, "auto-dismiss-duration"],
  9228. "color": [513],
  9229. "icon": [520],
  9230. "intlClose": [1, "intl-close"],
  9231. "label": [1],
  9232. "numberingSystem": [513, "numbering-system"],
  9233. "placement": [513],
  9234. "scale": [513],
  9235. "effectiveLocale": [32],
  9236. "queue": [32],
  9237. "queueLength": [32],
  9238. "queued": [32],
  9239. "requestedIcon": [32],
  9240. "setFocus": [64]
  9241. },
  9242. "$listeners$": [[8, "calciteInternalAlertSync", "alertSync"], [8, "calciteInternalAlertRegister", "alertRegister"]],
  9243. "$lazyBundleId$": "-",
  9244. "$attrsToReflect$": [["active", "active"], ["open", "open"], ["autoDismiss", "auto-dismiss"], ["autoDismissDuration", "auto-dismiss-duration"], ["color", "color"], ["icon", "icon"], ["numberingSystem", "numbering-system"], ["placement", "placement"], ["scale", "scale"]]
  9245. }; }
  9246. }
  9247. function rgbToHex(color) {
  9248. const { r, g, b } = color;
  9249. return `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b
  9250. .toString(16)
  9251. .padStart(2, "0")}`.toLowerCase();
  9252. }
  9253. const hexChar = /^[0-9A-F]$/i;
  9254. const shortHandHex = /^#[0-9A-F]{3}$/i;
  9255. const longhandHex = /^#[0-9A-F]{6}$/i;
  9256. function isValidHex(hex) {
  9257. return isShorthandHex(hex) || isLonghandHex(hex);
  9258. }
  9259. function isShorthandHex(hex) {
  9260. return hex && hex.length === 4 && shortHandHex.test(hex);
  9261. }
  9262. function isLonghandHex(hex) {
  9263. return hex && hex.length === 7 && longhandHex.test(hex);
  9264. }
  9265. function normalizeHex(hex) {
  9266. hex = hex.toLowerCase();
  9267. if (!hex.startsWith("#")) {
  9268. hex = `#${hex}`;
  9269. }
  9270. if (isShorthandHex(hex)) {
  9271. return rgbToHex(hexToRGB(hex));
  9272. }
  9273. return hex;
  9274. }
  9275. function hexToRGB(hex) {
  9276. if (!isValidHex(hex)) {
  9277. return null;
  9278. }
  9279. hex = hex.replace("#", "");
  9280. if (hex.length === 3) {
  9281. const [first, second, third] = hex.split("");
  9282. const r = parseInt(`${first}${first}`, 16);
  9283. const g = parseInt(`${second}${second}`, 16);
  9284. const b = parseInt(`${third}${third}`, 16);
  9285. return { r, g, b };
  9286. }
  9287. const r = parseInt(hex.slice(0, 2), 16);
  9288. const g = parseInt(hex.slice(2, 4), 16);
  9289. const b = parseInt(hex.slice(4, 6), 16);
  9290. return { r, g, b };
  9291. }
  9292. // these utils allow users to pass enum values as strings without having to access the enum
  9293. // based on the approach suggested by https://github.com/microsoft/TypeScript/issues/17690#issuecomment-321365759,
  9294. const enumify = (x) => x;
  9295. const CSSColorMode = enumify({
  9296. HEX: "hex",
  9297. HEXA: "hexa",
  9298. RGB_CSS: "rgb-css",
  9299. RGBA_CSS: "rgba-css",
  9300. HSL_CSS: "hsl-css",
  9301. HSLA_CSS: "hsla-css"
  9302. });
  9303. const ObjectColorMode = enumify({
  9304. RGB: "rgb",
  9305. RGBA: "rgba",
  9306. HSL: "hsl",
  9307. HSLA: "hsla",
  9308. HSV: "hsv",
  9309. HSVA: "hsva"
  9310. });
  9311. function parseMode(colorValue) {
  9312. if (typeof colorValue === "string") {
  9313. if (colorValue.startsWith("#")) {
  9314. const { length } = colorValue;
  9315. if (length === 4 || length === 7) {
  9316. return CSSColorMode.HEX;
  9317. }
  9318. if (length === 5 || length === 9) {
  9319. return CSSColorMode.HEXA;
  9320. }
  9321. }
  9322. if (colorValue.startsWith("rgba(")) {
  9323. return CSSColorMode.RGBA_CSS;
  9324. }
  9325. if (colorValue.startsWith("rgb(")) {
  9326. return CSSColorMode.RGB_CSS;
  9327. }
  9328. if (colorValue.startsWith("hsl(")) {
  9329. return CSSColorMode.HSL_CSS;
  9330. }
  9331. if (colorValue.startsWith("hsla(")) {
  9332. return CSSColorMode.HSLA_CSS;
  9333. }
  9334. }
  9335. if (typeof colorValue === "object") {
  9336. if (hasChannels(colorValue, "r", "g", "b")) {
  9337. return hasChannels(colorValue, "a") ? ObjectColorMode.RGBA : ObjectColorMode.RGB;
  9338. }
  9339. if (hasChannels(colorValue, "h", "s", "l")) {
  9340. return hasChannels(colorValue, "a") ? ObjectColorMode.HSLA : ObjectColorMode.HSL;
  9341. }
  9342. if (hasChannels(colorValue, "h", "s", "v")) {
  9343. return hasChannels(colorValue, "a") ? ObjectColorMode.HSVA : ObjectColorMode.HSV;
  9344. }
  9345. }
  9346. return null;
  9347. }
  9348. function hasChannels(colorObject, ...channels) {
  9349. return channels.every((channel) => channel && colorObject && `${channel}` in colorObject);
  9350. }
  9351. function colorEqual(value1, value2) {
  9352. return (value1 === null || value1 === void 0 ? void 0 : value1.rgbNumber()) === (value2 === null || value2 === void 0 ? void 0 : value2.rgbNumber());
  9353. }
  9354. /**
  9355. * Convert a string to a valid hex by hashing its contents
  9356. * and using the hash as a seed for three distinct color values
  9357. *
  9358. * @param str
  9359. */
  9360. function stringToHex(str) {
  9361. let hash = 0;
  9362. for (let i = 0; i < str.length; i++) {
  9363. hash = str.charCodeAt(i) + ((hash << 5) - hash);
  9364. }
  9365. let hex = "#";
  9366. for (let j = 0; j < 3; j++) {
  9367. const value = (hash >> (j * 8)) & 0xff;
  9368. hex += ("00" + value.toString(16)).substr(-2);
  9369. }
  9370. return hex;
  9371. }
  9372. /**
  9373. * Find the hue of a color given the separate RGB color channels
  9374. *
  9375. * @param rgb
  9376. */
  9377. function rgbToHue(rgb) {
  9378. let { r, g, b } = rgb;
  9379. r /= 255;
  9380. g /= 255;
  9381. b /= 255;
  9382. const max = Math.max(r, g, b);
  9383. const min = Math.min(r, g, b);
  9384. const delta = max - min;
  9385. if (max === min) {
  9386. return 0;
  9387. }
  9388. let hue = (max + min) / 2;
  9389. switch (max) {
  9390. case r:
  9391. hue = (g - b) / delta + (g < b ? 6 : 0);
  9392. break;
  9393. case g:
  9394. hue = (b - r) / delta + 2;
  9395. break;
  9396. case b:
  9397. hue = (r - g) / delta + 4;
  9398. break;
  9399. }
  9400. return Math.round(hue * 60);
  9401. }
  9402. /**
  9403. * For a hex color, find the hue
  9404. *
  9405. * @param hex {string} - form of "#------"
  9406. */
  9407. function hexToHue(hex) {
  9408. return rgbToHue(hexToRGB(hex));
  9409. }
  9410. const avatarCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-avatar:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-avatar{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-avatar{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-avatar{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-avatar{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-avatar{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-avatar:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-avatar:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-avatar-h{display:none}/*!@:host*/.sc-calcite-avatar-h{display:inline-block;overflow:hidden;border-radius:50%}/*!@:host([scale=s])*/[scale=s].sc-calcite-avatar-h{block-size:1.5rem;inline-size:1.5rem;font-size:var(--calcite-font-size--3)}/*!@:host([scale=m])*/[scale=m].sc-calcite-avatar-h{block-size:2rem;inline-size:2rem;font-size:var(--calcite-font-size--2)}/*!@:host([scale=l])*/[scale=l].sc-calcite-avatar-h{block-size:2.75rem;inline-size:2.75rem;font-size:var(--calcite-font-size-0)}/*!@.icon*/.icon.sc-calcite-avatar{display:flex}/*!@.background*/.background.sc-calcite-avatar{display:flex;block-size:100%;inline-size:100%;align-items:center;justify-content:center;border-radius:50%}/*!@.initials*/.initials.sc-calcite-avatar{font-weight:var(--calcite-font-weight-bold);text-transform:uppercase;color:var(--calcite-ui-text-3)}/*!@.thumbnail*/.thumbnail.sc-calcite-avatar{block-size:100%;inline-size:100%;border-radius:50%}";
  9411. class Avatar {
  9412. constructor(hostRef) {
  9413. registerInstance(this, hostRef);
  9414. //--------------------------------------------------------------------------
  9415. //
  9416. // Properties
  9417. //
  9418. //--------------------------------------------------------------------------
  9419. /** Specifies the size of the component. */
  9420. this.scale = "m";
  9421. //--------------------------------------------------------------------------
  9422. //
  9423. // Private State/Props
  9424. //
  9425. //--------------------------------------------------------------------------
  9426. this.thumbnailFailedToLoad = false;
  9427. }
  9428. //--------------------------------------------------------------------------
  9429. //
  9430. // Lifecycle
  9431. //
  9432. //--------------------------------------------------------------------------
  9433. render() {
  9434. return this.determineContent();
  9435. }
  9436. //--------------------------------------------------------------------------
  9437. //
  9438. // Private Methods
  9439. //
  9440. //--------------------------------------------------------------------------
  9441. determineContent() {
  9442. if (this.thumbnail && !this.thumbnailFailedToLoad) {
  9443. return (hAsync("img", { alt: "", class: "thumbnail", onError: () => (this.thumbnailFailedToLoad = true), src: this.thumbnail }));
  9444. }
  9445. const initials = this.generateInitials();
  9446. const backgroundColor = this.generateFillColor();
  9447. return (hAsync("span", { class: "background", style: { backgroundColor } }, initials ? (hAsync("span", { "aria-hidden": "true", class: "initials" }, initials)) : (hAsync("calcite-icon", { class: "icon", icon: "user", scale: this.scale }))));
  9448. }
  9449. /**
  9450. * Generate a valid background color that is consistent and unique to this user
  9451. */
  9452. generateFillColor() {
  9453. const { userId, username, fullName, el } = this;
  9454. const theme = getThemeName(el);
  9455. const id = userId && `#${userId.substr(userId.length - 6)}`;
  9456. const name = username || fullName || "";
  9457. const hex = id && isValidHex(id) ? id : stringToHex(name);
  9458. // if there is not unique information, or an invalid hex is produced, return a default
  9459. if ((!userId && !name) || !isValidHex(hex)) {
  9460. return `var(--calcite-ui-foreground-2)`;
  9461. }
  9462. const hue = hexToHue(hex);
  9463. const l = theme === "dark" ? 20 : 90;
  9464. return `hsl(${hue}, 60%, ${l}%)`;
  9465. }
  9466. /**
  9467. * Use fullname or username to generate initials
  9468. */
  9469. generateInitials() {
  9470. const { fullName, username } = this;
  9471. if (fullName) {
  9472. return fullName
  9473. .trim()
  9474. .split(" ")
  9475. .map((name) => name.substring(0, 1))
  9476. .join("");
  9477. }
  9478. else if (username) {
  9479. return username.substring(0, 2);
  9480. }
  9481. return false;
  9482. }
  9483. get el() { return getElement(this); }
  9484. static get style() { return avatarCss; }
  9485. static get cmpMeta() { return {
  9486. "$flags$": 9,
  9487. "$tagName$": "calcite-avatar",
  9488. "$members$": {
  9489. "scale": [513],
  9490. "thumbnail": [513],
  9491. "fullName": [513, "full-name"],
  9492. "username": [513],
  9493. "userId": [513, "user-id"],
  9494. "thumbnailFailedToLoad": [32]
  9495. },
  9496. "$listeners$": undefined,
  9497. "$lazyBundleId$": "-",
  9498. "$attrsToReflect$": [["scale", "scale"], ["thumbnail", "thumbnail"], ["fullName", "full-name"], ["username", "username"], ["userId", "user-id"]]
  9499. }; }
  9500. }
  9501. const CSS$P = {
  9502. container: "container",
  9503. content: "content",
  9504. contentSpaced: "content--spaced",
  9505. headerContainer: "header-container",
  9506. icon: "icon",
  9507. statusIcon: "status-icon",
  9508. toggle: "toggle",
  9509. toggleIcon: "toggle-icon",
  9510. title: "title",
  9511. heading: "heading",
  9512. header: "header",
  9513. button: "button",
  9514. summary: "summary",
  9515. description: "description",
  9516. controlContainer: "control-container",
  9517. valid: "valid",
  9518. invalid: "invalid",
  9519. loading: "loading"
  9520. };
  9521. const TEXT$p = {
  9522. collapse: "Collapse",
  9523. expand: "Expand",
  9524. loading: "Loading",
  9525. options: "Options"
  9526. };
  9527. const SLOTS$n = {
  9528. icon: "icon",
  9529. control: "control",
  9530. headerMenuActions: "header-menu-actions"
  9531. };
  9532. const ICONS$d = {
  9533. opened: "chevron-up",
  9534. closed: "chevron-down",
  9535. valid: "check-circle",
  9536. invalid: "exclamation-mark-triangle",
  9537. refresh: "refresh"
  9538. };
  9539. const HEADING_LEVEL$7 = 4;
  9540. function constrainHeadingLevel(level) {
  9541. return Math.min(Math.max(Math.ceil(level), 1), 6);
  9542. }
  9543. const Heading = (props, children) => {
  9544. const HeadingTag = `h${props.level}`;
  9545. delete props.level;
  9546. return hAsync(HeadingTag, { ...props }, children);
  9547. };
  9548. const blockCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-block:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-block{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-block{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-block{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-block{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-block{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-block:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-block-h{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-block-h *.sc-calcite-block{box-sizing:border-box}/*!@:host*/.sc-calcite-block-h{--calcite-icon-size:1rem;--calcite-spacing-eighth:0.125rem;--calcite-spacing-quarter:0.25rem;--calcite-spacing-half:0.5rem;--calcite-spacing-three-quarters:0.75rem;--calcite-spacing:1rem;--calcite-spacing-plus-quarter:1.25rem;--calcite-spacing-plus-half:1.5rem;--calcite-spacing-double:2rem;--calcite-menu-min-width:10rem;--calcite-header-min-height:3rem;--calcite-footer-min-height:3rem}/*!@:root*/.sc-calcite-block:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-block-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-block-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-block-h{display:flex;flex-shrink:0;flex-grow:0;flex-direction:column;border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding:0px;transition-property:margin;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;transition-timing-function:cubic-bezier(0.215, 0.440, 0.420, 0.880);flex-basis:auto}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-block-h[disabled] .sc-calcite-block-s>[calcite-hydrated][disabled],[disabled].sc-calcite-block-h [calcite-hydrated][disabled].sc-calcite-block{opacity:1}/*!@.header*/.header.sc-calcite-block{margin:0px;display:flex;align-content:space-between;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}/*!@.heading*/.heading.sc-calcite-block{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}/*!@.header .heading*/.header.sc-calcite-block .heading.sc-calcite-block{flex:1 1 auto;padding:0.5rem}/*!@.header*/.header.sc-calcite-block{justify-content:flex-start;padding:0px}/*!@.header,\n.toggle*/.header.sc-calcite-block,.toggle.sc-calcite-block{grid-area:header}/*!@.header-container*/.header-container.sc-calcite-block{display:grid;align-items:stretch;grid-template:auto/auto 1fr auto auto;grid-template-areas:\"handle header control menu\";grid-column:header-start/menu-end;grid-row:1/2}/*!@.toggle*/.toggle.sc-calcite-block{margin:0px;display:flex;cursor:pointer;flex-wrap:nowrap;align-items:center;justify-content:space-between;border-style:none;padding:0px;font-family:inherit;outline-color:transparent;text-align:initial;background-color:transparent}/*!@.toggle:hover*/.toggle.sc-calcite-block:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.toggle:focus*/.toggle.sc-calcite-block:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@calcite-loader[inline]*/calcite-loader[inline].sc-calcite-block{grid-area:control;align-self:center}/*!@calcite-handle*/calcite-handle.sc-calcite-block{grid-area:handle}/*!@.title*/.title.sc-calcite-block{margin:0px;padding:0.75rem}/*!@.header .title .heading*/.header.sc-calcite-block .title.sc-calcite-block .heading.sc-calcite-block{padding:0px;font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-medium);line-height:1.25;color:var(--calcite-ui-text-2);transition-property:color;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);word-wrap:break-word;word-break:break-word}/*!@.description*/.description.sc-calcite-block{margin-block-start:0.125rem;padding:0px;font-size:var(--calcite-font-size--2);color:var(--calcite-ui-text-3);word-wrap:break-word;word-break:break-word}/*!@.icon*/.icon.sc-calcite-block{margin-inline-start:0.75rem;margin-inline-end:0px;margin-block:0.75rem}/*!@.status-icon.valid*/.status-icon.valid.sc-calcite-block{color:var(--calcite-ui-success)}/*!@.status-icon.invalid*/.status-icon.invalid.sc-calcite-block{color:var(--calcite-ui-danger)}/*!@.status-icon.loading*/.status-icon.loading.sc-calcite-block{animation:spin var(--calcite-internal-animation-timing-medium) linear infinite}@keyframes spin{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}/*!@.toggle-icon*/.toggle-icon.sc-calcite-block{margin-block:0.75rem;align-self:center;justify-self:end;color:var(--calcite-ui-text-3);transition-property:color;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);margin-inline-end:1rem;margin-inline-start:auto}/*!@.toggle:hover .toggle-icon*/.toggle.sc-calcite-block:hover .toggle-icon.sc-calcite-block{color:var(--calcite-ui-text-1)}/*!@.container*/.container.sc-calcite-block{display:flex;block-size:100%;flex-direction:column}/*!@.content*/.content.sc-calcite-block{position:relative;flex:1 1 0%}@keyframes in{0%{opacity:0}100%{opacity:1}}/*!@.content*/.content.sc-calcite-block{animation:in var(--calcite-internal-animation-timing-slow) ease-in-out}/*!@.content--spaced*/.content--spaced.sc-calcite-block{padding-block:var(--calcite-block-padding, 0.5rem);padding-inline:var(--calcite-block-padding, 0.625rem)}/*!@.control-container*/.control-container.sc-calcite-block{margin:0px;display:flex;grid-area:control}/*!@calcite-action-menu*/calcite-action-menu.sc-calcite-block{grid-area:menu}/*!@:host([open])*/[open].sc-calcite-block-h{margin-block:0.5rem}/*!@:host([open]) .header .title .heading*/[open].sc-calcite-block-h .header.sc-calcite-block .title.sc-calcite-block .heading.sc-calcite-block{color:var(--calcite-ui-text-1)}";
  9549. /**
  9550. * @slot - A slot for adding content to the component.
  9551. * @slot icon - A slot for adding a leading header icon with `calcite-icon`.
  9552. * @slot control - A slot for adding a single HTML input element in a header.
  9553. * @slot header-menu-actions - A slot for adding an overflow menu with `calcite-action`s inside a dropdown.
  9554. */
  9555. class Block {
  9556. constructor(hostRef) {
  9557. registerInstance(this, hostRef);
  9558. this.calciteBlockToggle = createEvent(this, "calciteBlockToggle", 6);
  9559. // --------------------------------------------------------------------------
  9560. //
  9561. // Properties
  9562. //
  9563. // --------------------------------------------------------------------------
  9564. /**
  9565. * When `true`, the component is collapsible.
  9566. */
  9567. this.collapsible = false;
  9568. /**
  9569. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  9570. */
  9571. this.disabled = false;
  9572. /**
  9573. * When `true`, displays a drag handle in the header.
  9574. */
  9575. this.dragHandle = false;
  9576. /**
  9577. * Accessible name for the component's collapse button.
  9578. *
  9579. * @default "Collapse"
  9580. */
  9581. this.intlCollapse = TEXT$p.collapse;
  9582. /**
  9583. * Accessible name for the component's expand button.
  9584. *
  9585. * @default "Expand"
  9586. */
  9587. this.intlExpand = TEXT$p.expand;
  9588. /**
  9589. * Accessible name when the component is loading.
  9590. *
  9591. * @default "Loading"
  9592. */
  9593. this.intlLoading = TEXT$p.loading;
  9594. /**
  9595. * Accessible name for the component's options button.
  9596. *
  9597. * @default "Options"
  9598. */
  9599. this.intlOptions = TEXT$p.options;
  9600. /**
  9601. * When `true`, a busy indicator is displayed.
  9602. */
  9603. this.loading = false;
  9604. /**
  9605. * When `true`, expands the component and its contents.
  9606. */
  9607. this.open = false;
  9608. /**
  9609. * When `true`, removes padding for the slotted content.
  9610. *
  9611. * @deprecated Use `--calcite-block-padding` CSS variable instead.
  9612. */
  9613. this.disablePadding = false;
  9614. this.guid = guid();
  9615. // --------------------------------------------------------------------------
  9616. //
  9617. // Private Methods
  9618. //
  9619. // --------------------------------------------------------------------------
  9620. this.onHeaderClick = () => {
  9621. this.open = !this.open;
  9622. this.calciteBlockToggle.emit();
  9623. };
  9624. }
  9625. //--------------------------------------------------------------------------
  9626. //
  9627. // Lifecycle
  9628. //
  9629. //--------------------------------------------------------------------------
  9630. componentDidRender() {
  9631. updateHostInteraction(this);
  9632. }
  9633. // --------------------------------------------------------------------------
  9634. //
  9635. // Lifecycle
  9636. //
  9637. // --------------------------------------------------------------------------
  9638. connectedCallback() {
  9639. connectConditionalSlotComponent(this);
  9640. }
  9641. disconnectedCallback() {
  9642. disconnectConditionalSlotComponent(this);
  9643. }
  9644. // --------------------------------------------------------------------------
  9645. //
  9646. // Render Methods
  9647. //
  9648. // --------------------------------------------------------------------------
  9649. renderScrim() {
  9650. const { loading } = this;
  9651. const defaultSlot = hAsync("slot", null);
  9652. return [loading ? hAsync("calcite-scrim", { loading: loading }) : null, defaultSlot];
  9653. }
  9654. renderIcon() {
  9655. const { el, status } = this;
  9656. const showingLoadingStatus = this.loading && !this.open;
  9657. const statusIcon = showingLoadingStatus ? ICONS$d.refresh : ICONS$d[status];
  9658. const hasIcon = getSlotted(el, SLOTS$n.icon) || statusIcon;
  9659. const iconEl = !statusIcon ? (hAsync("slot", { key: "icon-slot", name: SLOTS$n.icon })) : (hAsync("calcite-icon", { class: {
  9660. [CSS$P.statusIcon]: true,
  9661. [CSS$P.valid]: status == "valid",
  9662. [CSS$P.invalid]: status == "invalid",
  9663. [CSS$P.loading]: showingLoadingStatus
  9664. }, icon: statusIcon, scale: "m" }));
  9665. return hasIcon ? hAsync("div", { class: CSS$P.icon }, iconEl) : null;
  9666. }
  9667. renderTitle() {
  9668. const { heading, headingLevel, summary, description } = this;
  9669. return heading || summary || description ? (hAsync("div", { class: CSS$P.title }, hAsync(Heading, { class: CSS$P.heading, level: headingLevel || HEADING_LEVEL$7 }, heading), summary || description ? (hAsync("div", { class: CSS$P.description }, summary || description)) : null)) : null;
  9670. }
  9671. render() {
  9672. const { collapsible, el, intlCollapse, intlExpand, loading, open, intlLoading } = this;
  9673. const toggleLabel = open ? intlCollapse || TEXT$p.collapse : intlExpand || TEXT$p.expand;
  9674. const headerContent = (hAsync("header", { class: CSS$P.header }, this.renderIcon(), this.renderTitle()));
  9675. const hasControl = !!getSlotted(el, SLOTS$n.control);
  9676. const hasMenuActions = !!getSlotted(el, SLOTS$n.headerMenuActions);
  9677. const collapseIcon = open ? ICONS$d.opened : ICONS$d.closed;
  9678. const { guid } = this;
  9679. const regionId = `${guid}-region`;
  9680. const buttonId = `${guid}-button`;
  9681. const headerNode = (hAsync("div", { class: CSS$P.headerContainer }, this.dragHandle ? hAsync("calcite-handle", null) : null, collapsible ? (hAsync("button", { "aria-controls": regionId, "aria-expanded": collapsible ? toAriaBoolean(open) : null, "aria-label": toggleLabel, class: CSS$P.toggle, id: buttonId, onClick: this.onHeaderClick, title: toggleLabel }, headerContent, !hasControl && !hasMenuActions ? (hAsync("calcite-icon", { "aria-hidden": "true", class: CSS$P.toggleIcon, icon: collapseIcon, scale: "s" })) : null)) : (headerContent), loading ? (hAsync("calcite-loader", { inline: true, "is-active": true, label: intlLoading })) : hasControl ? (hAsync("div", { class: CSS$P.controlContainer }, hAsync("slot", { name: SLOTS$n.control }))) : null, hasMenuActions ? (hAsync("calcite-action-menu", { label: this.intlOptions || TEXT$p.options }, hAsync("slot", { name: SLOTS$n.headerMenuActions }))) : null));
  9682. return (hAsync(Host, null, hAsync("article", { "aria-busy": toAriaBoolean(loading), class: {
  9683. [CSS$P.container]: true
  9684. } }, headerNode, hAsync("section", { "aria-expanded": toAriaBoolean(open), "aria-labelledby": buttonId, class: {
  9685. [CSS$P.content]: true,
  9686. [CSS$P.contentSpaced]: !this.disablePadding
  9687. }, hidden: !open, id: regionId }, this.renderScrim()))));
  9688. }
  9689. get el() { return getElement(this); }
  9690. static get style() { return blockCss; }
  9691. static get cmpMeta() { return {
  9692. "$flags$": 9,
  9693. "$tagName$": "calcite-block",
  9694. "$members$": {
  9695. "collapsible": [516],
  9696. "disabled": [516],
  9697. "dragHandle": [516, "drag-handle"],
  9698. "heading": [1],
  9699. "headingLevel": [514, "heading-level"],
  9700. "intlCollapse": [1, "intl-collapse"],
  9701. "intlExpand": [1, "intl-expand"],
  9702. "intlLoading": [1, "intl-loading"],
  9703. "intlOptions": [1, "intl-options"],
  9704. "loading": [516],
  9705. "open": [1540],
  9706. "status": [513],
  9707. "summary": [1],
  9708. "description": [1],
  9709. "disablePadding": [516, "disable-padding"]
  9710. },
  9711. "$listeners$": undefined,
  9712. "$lazyBundleId$": "-",
  9713. "$attrsToReflect$": [["collapsible", "collapsible"], ["disabled", "disabled"], ["dragHandle", "drag-handle"], ["headingLevel", "heading-level"], ["loading", "loading"], ["open", "open"], ["status", "status"], ["disablePadding", "disable-padding"]]
  9714. }; }
  9715. }
  9716. const CSS$O = {
  9717. content: "content",
  9718. invalid: "invalid",
  9719. toggle: "toggle",
  9720. toggleSwitch: "toggle--switch",
  9721. toggleSwitchContent: "toggle--switch__content",
  9722. toggleSwitchText: "toggle--switch__text",
  9723. sectionHeader: "section-header",
  9724. sectionHeaderText: "section-header__text",
  9725. statusIcon: "status-icon",
  9726. valid: "valid"
  9727. };
  9728. const TEXT$o = {
  9729. collapse: "Collapse",
  9730. expand: "Expand"
  9731. };
  9732. const ICONS$c = {
  9733. menuOpen: "chevron-down",
  9734. menuClosedLeft: "chevron-left",
  9735. menuClosedRight: "chevron-right",
  9736. valid: "check-circle",
  9737. invalid: "exclamation-mark-triangle"
  9738. };
  9739. const blockSectionCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-block-section:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-block-section{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-block-section{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-block-section{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-block-section{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-block-section{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-block-section:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-block-section:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-block-section-h{display:none}/*!@:host*/.sc-calcite-block-section-h{box-sizing:border-box;display:block;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size--1);color:var(--calcite-ui-text-2)}/*!@:host([open])*/[open].sc-calcite-block-section-h{border-width:0px;border-block-end-width:1px;border-style:solid;border-block-end-color:var(--calcite-ui-border-3)}/*!@:host(:last-child)*/.sc-calcite-block-section-h:last-child{border-block-end-width:0px}/*!@.toggle*/.toggle.sc-calcite-block-section{inline-size:100%;border-width:0px;background-color:transparent;font-family:var(--calcite-sans-family);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}/*!@.toggle--switch, \n.section-header*/.toggle--switch.sc-calcite-block-section,.section-header.sc-calcite-block-section{margin-inline:0px;margin-block:0.25rem;display:flex;cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;padding-inline:0px;padding-block:0.5rem;font-size:var(--calcite-font-size--1);outline-color:transparent}/*!@.toggle--switch:focus, \n.section-header:focus*/.toggle--switch.sc-calcite-block-section:focus,.section-header.sc-calcite-block-section:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.toggle--switch:hover, \n.section-header:hover*/.toggle--switch.sc-calcite-block-section:hover,.section-header.sc-calcite-block-section:hover{color:var(--calcite-ui-text-1)}/*!@.section-header .status-icon*/.section-header.sc-calcite-block-section .status-icon.sc-calcite-block-section{align-self:flex-end}/*!@.section-header__text*/.section-header__text.sc-calcite-block-section{margin-inline:0.75rem;margin-block:0px;flex:1 1 auto;text-align:initial;word-wrap:anywhere}/*!@.toggle--switch calcite-switch*/.toggle--switch.sc-calcite-block-section calcite-switch.sc-calcite-block-section{pointer-events:none;margin-inline-start:0.25rem}/*!@.toggle--switch .status-icon*/.toggle--switch.sc-calcite-block-section .status-icon.sc-calcite-block-section{margin-inline-start:0.5rem}/*!@.toggle--switch__content*/.toggle--switch__content.sc-calcite-block-section{display:flex;flex:1 1 auto;align-items:center}/*!@.status-icon.valid*/.status-icon.valid.sc-calcite-block-section{color:var(--calcite-ui-success)}/*!@.status-icon.invalid*/.status-icon.invalid.sc-calcite-block-section{color:var(--calcite-ui-danger)}";
  9740. /**
  9741. * @slot - A slot for adding content to the component.
  9742. */
  9743. class BlockSection {
  9744. constructor(hostRef) {
  9745. registerInstance(this, hostRef);
  9746. this.calciteBlockSectionToggle = createEvent(this, "calciteBlockSectionToggle", 6);
  9747. /**
  9748. * When `true`, expands the component and its contents.
  9749. */
  9750. this.open = false;
  9751. /**
  9752. * Specifies the component's toggle display -
  9753. *
  9754. * `"button"` (selectable header), or
  9755. *
  9756. * `"switch"` (toggle switch).
  9757. */
  9758. this.toggleDisplay = "button";
  9759. this.guid = guid();
  9760. // --------------------------------------------------------------------------
  9761. //
  9762. // Private Methods
  9763. //
  9764. // --------------------------------------------------------------------------
  9765. this.handleHeaderKeyDown = (event) => {
  9766. if (isActivationKey(event.key)) {
  9767. this.toggleSection();
  9768. event.preventDefault();
  9769. event.stopPropagation();
  9770. }
  9771. };
  9772. this.toggleSection = () => {
  9773. this.open = !this.open;
  9774. this.calciteBlockSectionToggle.emit();
  9775. };
  9776. }
  9777. // --------------------------------------------------------------------------
  9778. //
  9779. // Render Methods
  9780. //
  9781. // --------------------------------------------------------------------------
  9782. renderStatusIcon() {
  9783. var _a;
  9784. const { status } = this;
  9785. const statusIcon = (_a = ICONS$c[status]) !== null && _a !== void 0 ? _a : false;
  9786. const statusIconClasses = {
  9787. [CSS$O.statusIcon]: true,
  9788. [CSS$O.valid]: status == "valid",
  9789. [CSS$O.invalid]: status == "invalid"
  9790. };
  9791. return !!statusIcon ? (hAsync("calcite-icon", { class: statusIconClasses, icon: statusIcon, scale: "s" })) : null;
  9792. }
  9793. render() {
  9794. const { el, intlCollapse, intlExpand, open, text, toggleDisplay } = this;
  9795. const dir = getElementDir(el);
  9796. const arrowIcon = open
  9797. ? ICONS$c.menuOpen
  9798. : dir === "rtl"
  9799. ? ICONS$c.menuClosedLeft
  9800. : ICONS$c.menuClosedRight;
  9801. const toggleLabel = open ? intlCollapse || TEXT$o.collapse : intlExpand || TEXT$o.expand;
  9802. const { guid } = this;
  9803. const regionId = `${guid}-region`;
  9804. const buttonId = `${guid}-button`;
  9805. const headerNode = toggleDisplay === "switch" ? (hAsync("div", { "aria-controls": regionId, "aria-label": toggleLabel, class: {
  9806. [CSS$O.toggle]: true,
  9807. [CSS$O.toggleSwitch]: true
  9808. }, id: buttonId, onClick: this.toggleSection, onKeyDown: this.handleHeaderKeyDown, tabIndex: 0, title: toggleLabel }, hAsync("div", { class: CSS$O.toggleSwitchContent }, hAsync("span", { class: CSS$O.toggleSwitchText }, text)), hAsync("calcite-switch", { checked: open, label: toggleLabel, scale: "s", tabIndex: -1 }), this.renderStatusIcon())) : (hAsync("button", { "aria-controls": regionId, "aria-label": toggleLabel, class: {
  9809. [CSS$O.sectionHeader]: true,
  9810. [CSS$O.toggle]: true
  9811. }, id: buttonId, name: toggleLabel, onClick: this.toggleSection }, hAsync("calcite-icon", { icon: arrowIcon, scale: "s" }), hAsync("span", { class: CSS$O.sectionHeaderText }, text), this.renderStatusIcon()));
  9812. return (hAsync(Host, null, headerNode, hAsync("section", { "aria-expanded": toAriaBoolean(open), "aria-labelledby": buttonId, class: CSS$O.content, hidden: !open, id: regionId }, hAsync("slot", null))));
  9813. }
  9814. get el() { return getElement(this); }
  9815. static get style() { return blockSectionCss; }
  9816. static get cmpMeta() { return {
  9817. "$flags$": 9,
  9818. "$tagName$": "calcite-block-section",
  9819. "$members$": {
  9820. "intlCollapse": [1, "intl-collapse"],
  9821. "intlExpand": [1, "intl-expand"],
  9822. "open": [1540],
  9823. "status": [513],
  9824. "text": [1],
  9825. "toggleDisplay": [513, "toggle-display"]
  9826. },
  9827. "$listeners$": undefined,
  9828. "$lazyBundleId$": "-",
  9829. "$attrsToReflect$": [["open", "open"], ["status", "status"], ["toggleDisplay", "toggle-display"]]
  9830. }; }
  9831. }
  9832. (function(prototype) {
  9833. if (typeof prototype.requestSubmit == "function") return
  9834. prototype.requestSubmit = function(submitter) {
  9835. if (submitter) {
  9836. validateSubmitter(submitter, this);
  9837. submitter.click();
  9838. } else {
  9839. submitter = document.createElement("input");
  9840. submitter.type = "submit";
  9841. submitter.hidden = true;
  9842. this.appendChild(submitter);
  9843. submitter.click();
  9844. this.removeChild(submitter);
  9845. }
  9846. };
  9847. function validateSubmitter(submitter, form) {
  9848. submitter instanceof HTMLElement || raise(TypeError, "parameter 1 is not of type 'HTMLElement'");
  9849. submitter.type == "submit" || raise(TypeError, "The specified element is not a submit button");
  9850. submitter.form == form || raise(DOMException, "The specified element is not owned by this form element", "NotFoundError");
  9851. }
  9852. function raise(errorConstructor, message, name) {
  9853. throw new errorConstructor("Failed to execute 'requestSubmit' on 'HTMLFormElement': " + message + ".", name)
  9854. }
  9855. })(HTMLFormElement.prototype);
  9856. const CSS$N = {
  9857. buttonLoader: "calcite-button--loader",
  9858. content: "content",
  9859. contentSlotted: "content--slotted",
  9860. icon: "icon",
  9861. iconStart: "icon--start",
  9862. iconEnd: "icon--end",
  9863. loadingIn: "loading-in",
  9864. loadingOut: "loading-out",
  9865. iconStartEmpty: "icon-start-empty",
  9866. iconEndEmpty: "icon-end-empty"
  9867. };
  9868. const TEXT$n = {
  9869. loading: "Loading"
  9870. };
  9871. /**
  9872. * Exported for testing purposes only
  9873. *
  9874. * @internal
  9875. */
  9876. const labelClickEvent = "calciteInternalLabelClick";
  9877. const labelConnectedEvent = "calciteInternalLabelConnected";
  9878. const labelDisconnectedEvent = "calciteInternaLabelDisconnected";
  9879. const labelTagName = "calcite-label";
  9880. const onLabelClickMap = new WeakMap();
  9881. const onLabelConnectedMap = new WeakMap();
  9882. const onLabelDisconnectedMap = new WeakMap();
  9883. const unlabeledComponents = new Set();
  9884. const findLabelForComponent = (componentEl) => {
  9885. const { id } = componentEl;
  9886. const forLabel = id && queryElementRoots(componentEl, { selector: `${labelTagName}[for="${id}"]` });
  9887. if (forLabel) {
  9888. return forLabel;
  9889. }
  9890. const parentLabel = closestElementCrossShadowBoundary(componentEl, labelTagName);
  9891. if (!parentLabel ||
  9892. // labelable components within other custom elements are not considered labelable
  9893. hasAncestorCustomElements(parentLabel, componentEl)) {
  9894. return null;
  9895. }
  9896. return parentLabel;
  9897. };
  9898. function hasAncestorCustomElements(label, componentEl) {
  9899. let traversedElements;
  9900. const customElementAncestorCheckEventType = "custom-element-ancestor-check";
  9901. const listener = (event) => {
  9902. event.stopImmediatePropagation();
  9903. const composedPath = event.composedPath();
  9904. traversedElements = composedPath.slice(composedPath.indexOf(componentEl), composedPath.indexOf(label));
  9905. };
  9906. label.addEventListener(customElementAncestorCheckEventType, listener, { once: true });
  9907. componentEl.dispatchEvent(new CustomEvent(customElementAncestorCheckEventType, { composed: true, bubbles: true }));
  9908. label.removeEventListener(customElementAncestorCheckEventType, listener);
  9909. const ancestorCustomElements = traversedElements
  9910. .filter((el) => el !== componentEl && el !== label)
  9911. .filter((el) => { var _a; return (_a = el.tagName) === null || _a === void 0 ? void 0 : _a.includes("-"); });
  9912. return ancestorCustomElements.length > 0;
  9913. }
  9914. /**
  9915. * Helper to set up label interactions on connectedCallback.
  9916. *
  9917. * @param component
  9918. */
  9919. function connectLabel(component) {
  9920. const labelEl = findLabelForComponent(component.el);
  9921. if (onLabelClickMap.has(labelEl) || (!labelEl && unlabeledComponents.has(component))) {
  9922. return;
  9923. }
  9924. const boundOnLabelDisconnected = onLabelDisconnected.bind(component);
  9925. if (labelEl) {
  9926. component.labelEl = labelEl;
  9927. const boundOnLabelClick = onLabelClick.bind(component);
  9928. onLabelClickMap.set(component.labelEl, boundOnLabelClick);
  9929. component.labelEl.addEventListener(labelClickEvent, boundOnLabelClick);
  9930. unlabeledComponents.delete(component);
  9931. document.removeEventListener(labelConnectedEvent, onLabelConnectedMap.get(component));
  9932. onLabelDisconnectedMap.set(component, boundOnLabelDisconnected);
  9933. document.addEventListener(labelDisconnectedEvent, boundOnLabelDisconnected);
  9934. }
  9935. else if (!unlabeledComponents.has(component)) {
  9936. boundOnLabelDisconnected();
  9937. document.removeEventListener(labelDisconnectedEvent, onLabelDisconnectedMap.get(component));
  9938. }
  9939. }
  9940. /**
  9941. * Helper to tear down label interactions on disconnectedCallback on labelable components.
  9942. *
  9943. * @param component
  9944. */
  9945. function disconnectLabel(component) {
  9946. unlabeledComponents.delete(component);
  9947. document.removeEventListener(labelConnectedEvent, onLabelConnectedMap.get(component));
  9948. document.removeEventListener(labelDisconnectedEvent, onLabelDisconnectedMap.get(component));
  9949. onLabelConnectedMap.delete(component);
  9950. onLabelDisconnectedMap.delete(component);
  9951. if (!component.labelEl) {
  9952. return;
  9953. }
  9954. const boundOnLabelClick = onLabelClickMap.get(component.labelEl);
  9955. component.labelEl.removeEventListener(labelClickEvent, boundOnLabelClick);
  9956. onLabelClickMap.delete(component.labelEl);
  9957. }
  9958. /**
  9959. * Helper to get the label text from a component.
  9960. *
  9961. * @param component
  9962. */
  9963. function getLabelText(component) {
  9964. var _a, _b;
  9965. return component.label || ((_b = (_a = component.labelEl) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || "";
  9966. }
  9967. function onLabelClick(event) {
  9968. if (this.disabled) {
  9969. return;
  9970. }
  9971. const containedLabelableChildClicked = this.el.contains(event.detail.sourceEvent.target);
  9972. if (containedLabelableChildClicked) {
  9973. return;
  9974. }
  9975. this.onLabelClick(event);
  9976. }
  9977. function onLabelConnected() {
  9978. if (unlabeledComponents.has(this)) {
  9979. connectLabel(this);
  9980. }
  9981. }
  9982. function onLabelDisconnected() {
  9983. unlabeledComponents.add(this);
  9984. const boundOnLabelConnected = onLabelConnectedMap.get(this) || onLabelConnected.bind(this);
  9985. onLabelConnectedMap.set(this, boundOnLabelConnected);
  9986. document.addEventListener(labelConnectedEvent, boundOnLabelConnected);
  9987. }
  9988. /**
  9989. * Exported for testing purposes.
  9990. */
  9991. const hiddenFormInputSlotName = "hidden-form-input";
  9992. function isCheckable(component) {
  9993. return "checked" in component;
  9994. }
  9995. const onFormResetMap = new WeakMap();
  9996. const formComponentSet = new WeakSet();
  9997. function hasRegisteredFormComponentParent(form, formComponentEl) {
  9998. // we use events as a way to test for nested form-associated components across shadow bounds
  9999. const formComponentRegisterEventName = "calciteInternalFormComponentRegister";
  10000. let hasRegisteredFormComponentParent = false;
  10001. form.addEventListener(formComponentRegisterEventName, (event) => {
  10002. hasRegisteredFormComponentParent = event
  10003. .composedPath()
  10004. .some((element) => formComponentSet.has(element));
  10005. event.stopPropagation();
  10006. }, { once: true });
  10007. formComponentEl.dispatchEvent(new CustomEvent(formComponentRegisterEventName, {
  10008. bubbles: true,
  10009. composed: true
  10010. }));
  10011. return hasRegisteredFormComponentParent;
  10012. }
  10013. /**
  10014. * Helper to submit a form.
  10015. *
  10016. * @param component
  10017. * @returns true if its associated form was submitted, false otherwise.
  10018. */
  10019. function submitForm(component) {
  10020. const { formEl } = component;
  10021. if (!formEl) {
  10022. return false;
  10023. }
  10024. "requestSubmit" in formEl ? formEl.requestSubmit() : formEl.submit();
  10025. return true;
  10026. }
  10027. /**
  10028. * Helper to reset a form.
  10029. *
  10030. * @param component
  10031. */
  10032. function resetForm(component) {
  10033. var _a;
  10034. (_a = component.formEl) === null || _a === void 0 ? void 0 : _a.reset();
  10035. }
  10036. /**
  10037. * Helper to set up form interactions on connectedCallback.
  10038. *
  10039. * @param component
  10040. */
  10041. function connectForm(component) {
  10042. const { el, value } = component;
  10043. const form = closestElementCrossShadowBoundary(el, "form");
  10044. if (!form || hasRegisteredFormComponentParent(form, el)) {
  10045. return;
  10046. }
  10047. component.formEl = form;
  10048. component.defaultValue = value;
  10049. if (isCheckable(component)) {
  10050. component.defaultChecked = component.checked;
  10051. }
  10052. const boundOnFormReset = (component.onFormReset || onFormReset).bind(component);
  10053. form.addEventListener("reset", boundOnFormReset);
  10054. onFormResetMap.set(component.el, boundOnFormReset);
  10055. formComponentSet.add(el);
  10056. }
  10057. function onFormReset() {
  10058. if (isCheckable(this)) {
  10059. this.checked = this.defaultChecked;
  10060. return;
  10061. }
  10062. this.value = this.defaultValue;
  10063. }
  10064. /**
  10065. * Helper to tear down form interactions on disconnectedCallback.
  10066. *
  10067. * @param component
  10068. */
  10069. function disconnectForm(component) {
  10070. const { el, formEl } = component;
  10071. if (!formEl) {
  10072. return;
  10073. }
  10074. const boundOnFormReset = onFormResetMap.get(el);
  10075. formEl.removeEventListener("reset", boundOnFormReset);
  10076. onFormResetMap.delete(el);
  10077. component.formEl = null;
  10078. formComponentSet.delete(el);
  10079. }
  10080. /**
  10081. * Helper for setting the default value on initialization after connectedCallback.
  10082. *
  10083. * Note that this is only needed if the default value cannot be determined on connectedCallback.
  10084. *
  10085. * @param component
  10086. * @param value
  10087. */
  10088. function afterConnectDefaultValueSet(component, value) {
  10089. component.defaultValue = value;
  10090. }
  10091. const hiddenInputChangeHandler = (event) => {
  10092. event.target.dispatchEvent(new CustomEvent("calciteInternalHiddenInputChange", { bubbles: true }));
  10093. };
  10094. const removeHiddenInputChangeEventListener = (input) => input.removeEventListener("change", hiddenInputChangeHandler);
  10095. /**
  10096. * Helper for maintaining a form-associated's hidden input in sync with the component.
  10097. *
  10098. * Based on Ionic's approach: https://github.com/ionic-team/ionic-framework/blob/e4bf052794af9aac07f887013b9250d2a045eba3/core/src/utils/helpers.ts#L198
  10099. *
  10100. * @param component
  10101. */
  10102. function syncHiddenFormInput(component) {
  10103. const { el, formEl, name, value } = component;
  10104. const { ownerDocument } = el;
  10105. const inputs = el.querySelectorAll(`input[slot="${hiddenFormInputSlotName}"]`);
  10106. if (!formEl || !name) {
  10107. inputs.forEach((input) => {
  10108. removeHiddenInputChangeEventListener(input);
  10109. input.remove();
  10110. });
  10111. return;
  10112. }
  10113. const values = Array.isArray(value) ? value : [value];
  10114. const extra = [];
  10115. const seen = new Set();
  10116. inputs.forEach((input) => {
  10117. const valueMatch = values.find((val) =>
  10118. /* intentional non-strict equality check */
  10119. val == input.value);
  10120. if (valueMatch != null) {
  10121. seen.add(valueMatch);
  10122. defaultSyncHiddenFormInput(component, input, valueMatch);
  10123. }
  10124. else {
  10125. extra.push(input);
  10126. }
  10127. });
  10128. let docFrag;
  10129. values.forEach((value) => {
  10130. if (seen.has(value)) {
  10131. return;
  10132. }
  10133. let input = extra.pop();
  10134. if (!input) {
  10135. input = ownerDocument.createElement("input");
  10136. input.slot = hiddenFormInputSlotName;
  10137. }
  10138. if (!docFrag) {
  10139. docFrag = ownerDocument.createDocumentFragment();
  10140. }
  10141. docFrag.append(input);
  10142. // emits when hidden input is autofilled
  10143. input.addEventListener("change", hiddenInputChangeHandler);
  10144. defaultSyncHiddenFormInput(component, input, value);
  10145. });
  10146. if (docFrag) {
  10147. el.append(docFrag);
  10148. }
  10149. extra.forEach((input) => {
  10150. removeHiddenInputChangeEventListener(input);
  10151. input.remove();
  10152. });
  10153. }
  10154. function defaultSyncHiddenFormInput(component, input, value) {
  10155. var _a;
  10156. const { defaultValue, disabled, name, required } = component;
  10157. // keep in sync to prevent losing reset value
  10158. input.defaultValue = defaultValue;
  10159. input.disabled = disabled;
  10160. input.name = name;
  10161. input.required = required;
  10162. input.tabIndex = -1;
  10163. if (isCheckable(component)) {
  10164. // keep in sync to prevent losing reset value
  10165. input.defaultChecked = component.defaultChecked;
  10166. // heuristic to support default/on mode from https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default-on
  10167. input.value = component.checked ? value || "on" : "";
  10168. // we disable the component when not checked to avoid having its value submitted
  10169. if (!disabled && !component.checked) {
  10170. input.disabled = true;
  10171. }
  10172. }
  10173. else {
  10174. input.value = value || "";
  10175. }
  10176. (_a = component.syncHiddenFormInput) === null || _a === void 0 ? void 0 : _a.call(component, input);
  10177. }
  10178. /**
  10179. * Helper to render the slot for form-associated component's hidden input.
  10180. *
  10181. * If the component has a default slot, this must be placed at the bottom of the component's root container to ensure it is the last child.
  10182. *
  10183. * render(): VNode {
  10184. * <Host>
  10185. * <div class={CSS.container}>
  10186. * // ...
  10187. * <HiddenFormInputSlot component={this} />
  10188. * </div>
  10189. * </Host>
  10190. * }
  10191. *
  10192. * Note that the hidden-form-input Sass mixin must be added to the component's style to apply specific styles.
  10193. *
  10194. * @param root0
  10195. * @param root0.component
  10196. */
  10197. const HiddenFormInputSlot = ({ component }) => {
  10198. syncHiddenFormInput(component);
  10199. return hAsync("slot", { name: hiddenFormInputSlotName });
  10200. };
  10201. const buttonCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-button:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-button{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-button{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-button{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-button{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-button{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-button:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-button:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-button-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-button-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-button-h{display:inline-block;inline-size:auto;vertical-align:middle}/*!@:host([round])*/[round].sc-calcite-button-h{border-radius:50px}/*!@:host([round]) a, :host([round]) button*/[round].sc-calcite-button-h a.sc-calcite-button,[round].sc-calcite-button-h button.sc-calcite-button{border-radius:50px}/*!@:host button, \n:host a*/.sc-calcite-button-h button.sc-calcite-button,.sc-calcite-button-h a.sc-calcite-button{outline-color:transparent}/*!@:host button:focus, \n:host a:focus*/.sc-calcite-button-h button.sc-calcite-button:focus,.sc-calcite-button-h a.sc-calcite-button:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@:host button,\n:host a*/.sc-calcite-button-h button.sc-calcite-button,.sc-calcite-button-h a.sc-calcite-button{--calcite-button-content-margin:0.5rem;--calcite-button-padding-x:7px;--calcite-button-padding-y:3px;padding-block:var(--calcite-button-padding-y);padding-inline:var(--calcite-button-padding-x);position:relative;box-sizing:border-box;display:flex;block-size:100%;inline-size:100%;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-appearance:none;appearance:none;align-items:center;justify-content:center;border-radius:0px;border-style:none;text-align:center;font-family:inherit;font-weight:var(--calcite-font-weight-normal);text-decoration-line:none;transition:color var(--calcite-animation-timing) ease-in-out, background-color var(--calcite-animation-timing) ease-in-out, box-shadow var(--calcite-animation-timing) ease-in-out, outline-color var(--calcite-internal-animation-timing-fast) ease-in-out}/*!@:host button:hover, \n:host a:hover*/.sc-calcite-button-h button.sc-calcite-button:hover,.sc-calcite-button-h a.sc-calcite-button:hover{text-decoration-line:none}/*!@.content*/.content.sc-calcite-button{display:flex;flex-basis:auto;margin-inline:var(--calcite-button-content-margin)}/*!@.icon-start-empty .content*/.icon-start-empty.sc-calcite-button .content.sc-calcite-button{margin-inline-start:unset}/*!@.icon-end-empty .content*/.icon-end-empty.sc-calcite-button .content.sc-calcite-button{margin-inline-end:unset}/*!@:host([scale=m]) button,\n:host([scale=m]) a*/[scale=m].sc-calcite-button-h button.sc-calcite-button,[scale=m].sc-calcite-button-h a.sc-calcite-button{--calcite-button-content-margin:0.75rem}/*!@:host([scale=l]) button,\n:host([scale=l]) a*/[scale=l].sc-calcite-button-h button.sc-calcite-button,[scale=l].sc-calcite-button-h a.sc-calcite-button{--calcite-button-content-margin:1rem}/*!@:host([width=auto])*/[width=auto].sc-calcite-button-h{inline-size:auto}/*!@:host([width=half])*/[width=half].sc-calcite-button-h{inline-size:50%}/*!@:host([width=full])*/[width=full].sc-calcite-button-h{inline-size:100%}/*!@:host([alignment=center]:not([width=auto])) a, \n:host([alignment=center]:not([width=auto])) button*/[alignment=center].sc-calcite-button-h:not([width=auto]) a.sc-calcite-button,[alignment=center].sc-calcite-button-h:not([width=auto]) button.sc-calcite-button{justify-content:center}/*!@:host([alignment=start]:not([width=auto])) a, \n:host([alignment=start]:not([width=auto])) button*/[alignment=start].sc-calcite-button-h:not([width=auto]) a.sc-calcite-button,[alignment=start].sc-calcite-button-h:not([width=auto]) button.sc-calcite-button{justify-content:flex-start}/*!@:host([alignment=end]:not([width=auto])) a, \n:host([alignment=end]:not([width=auto])) button*/[alignment=end].sc-calcite-button-h:not([width=auto]) a.sc-calcite-button,[alignment=end].sc-calcite-button-h:not([width=auto]) button.sc-calcite-button{justify-content:flex-end}/*!@:host([alignment*=space-between]:not([width=auto])) a, \n:host([alignment*=space-between]:not([width=auto])) button*/[alignment*=space-between].sc-calcite-button-h:not([width=auto]) a.sc-calcite-button,[alignment*=space-between].sc-calcite-button-h:not([width=auto]) button.sc-calcite-button{justify-content:space-between}/*!@:host([alignment=icon-start-space-between]:not([width=auto])) .icon--start*/[alignment=icon-start-space-between].sc-calcite-button-h:not([width=auto]) .icon--start.sc-calcite-button{margin-inline-end:auto}/*!@:host([alignment=icon-start-space-between]:not([width=auto])) a,\n:host([alignment=icon-start-space-between]:not([width=auto])) button*/[alignment=icon-start-space-between].sc-calcite-button-h:not([width=auto]) a.sc-calcite-button,[alignment=icon-start-space-between].sc-calcite-button-h:not([width=auto]) button.sc-calcite-button{text-align:unset}/*!@:host([alignment=icon-end-space-between]:not([width=auto])) .icon--end*/[alignment=icon-end-space-between].sc-calcite-button-h:not([width=auto]) .icon--end.sc-calcite-button{margin-inline-start:auto}/*!@:host([alignment=icon-end-space-between]:not([width=auto])) a,\n:host([alignment=icon-end-space-between]:not([width=auto])) button*/[alignment=icon-end-space-between].sc-calcite-button-h:not([width=auto]) a.sc-calcite-button,[alignment=icon-end-space-between].sc-calcite-button-h:not([width=auto]) button.sc-calcite-button{text-align:unset}/*!@:host([alignment=center]) a:not(.content--slotted) .icon--start + .icon--end,\n:host([alignment=center]) button:not(.content--slotted) .icon--start + .icon--end*/[alignment=center].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted) .icon--start.sc-calcite-button+.icon--end.sc-calcite-button,[alignment=center].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted) .icon--start.sc-calcite-button+.icon--end.sc-calcite-button{margin-inline-start:var(--calcite-button-content-margin)}/*!@.icon*/.icon.sc-calcite-button{position:relative;margin:0px;display:inline-flex;font-weight:var(--calcite-font-weight-normal);line-height:inherit}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-button-h[disabled] .sc-calcite-button-s>[calcite-hydrated][disabled],[disabled].sc-calcite-button-h [calcite-hydrated][disabled].sc-calcite-button{opacity:1}/*!@:host([loading])*/[loading].sc-calcite-button-h{pointer-events:none}/*!@:host([loading]) button, \n:host([loading]) a*/[loading].sc-calcite-button-h button.sc-calcite-button,[loading].sc-calcite-button-h a.sc-calcite-button{pointer-events:none;opacity:var(--calcite-ui-opacity-disabled)}@keyframes loader-in{0%{inline-size:0;opacity:0;transform:scale(0.5)}100%{inline-size:1em;opacity:1;transform:scale(1)}}@keyframes loader-out{0%{inline-size:1em;opacity:1;transform:scale(1)}100%{inline-size:0;opacity:0;transform:scale(0.5)}}/*!@.calcite-button--loader*/.calcite-button--loader.sc-calcite-button{display:flex}/*!@.calcite-button--loader calcite-loader*/.calcite-button--loader.sc-calcite-button calcite-loader.sc-calcite-button{margin:0px;transition:inline-size var(--calcite-internal-animation-timing-slow) ease-in-out, opacity var(--calcite-internal-animation-timing-slow) ease-in-out, transform var(--calcite-internal-animation-timing-slow) ease-in-out}/*!@.calcite-button--loader calcite-loader.loading-in*/.calcite-button--loader.sc-calcite-button calcite-loader.loading-in.sc-calcite-button{animation-name:loader-in;animation-duration:var(--calcite-internal-animation-timing-slow)}/*!@.calcite-button--loader calcite-loader.loading-out*/.calcite-button--loader.sc-calcite-button calcite-loader.loading-out.sc-calcite-button{animation-name:loader-out;animation-duration:var(--calcite-internal-animation-timing-slow)}/*!@:host([loading]) button.content--slotted .calcite-button--loader calcite-loader,\n:host([loading]) a.content--slotted .calcite-button--loader calcite-loader*/[loading].sc-calcite-button-h button.content--slotted.sc-calcite-button .calcite-button--loader.sc-calcite-button calcite-loader.sc-calcite-button,[loading].sc-calcite-button-h a.content--slotted.sc-calcite-button .calcite-button--loader.sc-calcite-button calcite-loader.sc-calcite-button{margin-inline-end:var(--calcite-button-content-margin)}/*!@:host([loading]) button:not(.content--slotted) .icon--start, \n:host([loading]) button:not(.content--slotted) .icon--end, \n:host([loading]) a:not(.content--slotted) .icon--start, \n:host([loading]) a:not(.content--slotted) .icon--end*/[loading].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted) .icon--start.sc-calcite-button,[loading].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted) .icon--end.sc-calcite-button,[loading].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted) .icon--start.sc-calcite-button,[loading].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted) .icon--end.sc-calcite-button{display:none}/*!@:host([appearance=solid]) button, \n:host([appearance=solid]) a*/[appearance=solid].sc-calcite-button-h button.sc-calcite-button,[appearance=solid].sc-calcite-button-h a.sc-calcite-button{border-width:1px;border-style:solid;border-color:transparent}/*!@:host([color=blue]) button, \n:host([color=blue]) a*/[color=blue].sc-calcite-button-h button.sc-calcite-button,[color=blue].sc-calcite-button-h a.sc-calcite-button{background-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-inverse)}/*!@:host([color=blue]) button:hover, :host([color=blue]) button:focus, \n:host([color=blue]) a:hover, \n:host([color=blue]) a:focus*/[color=blue].sc-calcite-button-h button.sc-calcite-button:hover,[color=blue].sc-calcite-button-h button.sc-calcite-button:focus,[color=blue].sc-calcite-button-h a.sc-calcite-button:hover,[color=blue].sc-calcite-button-h a.sc-calcite-button:focus{background-color:var(--calcite-ui-brand-hover)}/*!@:host([color=blue]) button:active, \n:host([color=blue]) a:active*/[color=blue].sc-calcite-button-h button.sc-calcite-button:active,[color=blue].sc-calcite-button-h a.sc-calcite-button:active{background-color:var(--calcite-ui-brand-press)}/*!@:host([color=blue]) button calcite-loader, \n:host([color=blue]) a calcite-loader*/[color=blue].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[color=blue].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-inverse)}/*!@:host([color=red]) button, \n:host([color=red]) a*/[color=red].sc-calcite-button-h button.sc-calcite-button,[color=red].sc-calcite-button-h a.sc-calcite-button{background-color:var(--calcite-ui-danger);color:var(--calcite-ui-text-inverse)}/*!@:host([color=red]) button:hover, :host([color=red]) button:focus, \n:host([color=red]) a:hover, \n:host([color=red]) a:focus*/[color=red].sc-calcite-button-h button.sc-calcite-button:hover,[color=red].sc-calcite-button-h button.sc-calcite-button:focus,[color=red].sc-calcite-button-h a.sc-calcite-button:hover,[color=red].sc-calcite-button-h a.sc-calcite-button:focus{background-color:var(--calcite-ui-danger-hover)}/*!@:host([color=red]) button:active, \n:host([color=red]) a:active*/[color=red].sc-calcite-button-h button.sc-calcite-button:active,[color=red].sc-calcite-button-h a.sc-calcite-button:active{background-color:var(--calcite-ui-danger-press)}/*!@:host([color=red]) button calcite-loader, \n:host([color=red]) a calcite-loader*/[color=red].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[color=red].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-inverse)}/*!@:host([color=neutral]) button, \n:host([color=neutral]) a*/[color=neutral].sc-calcite-button-h button.sc-calcite-button,[color=neutral].sc-calcite-button-h a.sc-calcite-button{background-color:var(--calcite-ui-foreground-3);color:var(--calcite-ui-text-1)}/*!@:host([color=neutral]) button:hover, :host([color=neutral]) button:focus, \n:host([color=neutral]) a:hover, \n:host([color=neutral]) a:focus*/[color=neutral].sc-calcite-button-h button.sc-calcite-button:hover,[color=neutral].sc-calcite-button-h button.sc-calcite-button:focus,[color=neutral].sc-calcite-button-h a.sc-calcite-button:hover,[color=neutral].sc-calcite-button-h a.sc-calcite-button:focus{background-color:var(--calcite-ui-foreground-2)}/*!@:host([color=neutral]) button:active, \n:host([color=neutral]) a:active*/[color=neutral].sc-calcite-button-h button.sc-calcite-button:active,[color=neutral].sc-calcite-button-h a.sc-calcite-button:active{background-color:var(--calcite-ui-foreground-1)}/*!@:host([color=neutral]) button calcite-loader, \n:host([color=neutral]) a calcite-loader*/[color=neutral].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[color=neutral].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([color=inverse]) button, \n:host([color=inverse]) a*/[color=inverse].sc-calcite-button-h button.sc-calcite-button,[color=inverse].sc-calcite-button-h a.sc-calcite-button{color:var(--calcite-ui-text-inverse);background-color:var(--calcite-ui-inverse)}/*!@:host([color=inverse]) button:hover, :host([color=inverse]) button:focus,\n:host([color=inverse]) a:hover,\n:host([color=inverse]) a:focus*/[color=inverse].sc-calcite-button-h button.sc-calcite-button:hover,[color=inverse].sc-calcite-button-h button.sc-calcite-button:focus,[color=inverse].sc-calcite-button-h a.sc-calcite-button:hover,[color=inverse].sc-calcite-button-h a.sc-calcite-button:focus{background-color:var(--calcite-ui-inverse-hover)}/*!@:host([color=inverse]) button:active,\n:host([color=inverse]) a:active*/[color=inverse].sc-calcite-button-h button.sc-calcite-button:active,[color=inverse].sc-calcite-button-h a.sc-calcite-button:active{background-color:var(--calcite-ui-inverse-press)}/*!@:host([color=inverse]) button calcite-loader, \n:host([color=inverse]) a calcite-loader*/[color=inverse].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[color=inverse].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-inverse)}/*!@:host([appearance=outline]) button, \n:host([appearance=outline]) a*/[appearance=outline].sc-calcite-button-h button.sc-calcite-button,[appearance=outline].sc-calcite-button-h a.sc-calcite-button{border-width:1px;border-style:solid;background-color:var(--calcite-ui-foreground-1);box-shadow:inset 0 0 0 1px transparent}/*!@:host([appearance=outline][color=blue]) button, \n:host([appearance=outline][color=blue]) a*/[appearance=outline][color=blue].sc-calcite-button-h button.sc-calcite-button,[appearance=outline][color=blue].sc-calcite-button-h a.sc-calcite-button{border-color:var(--calcite-ui-brand);background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-brand)}/*!@:host([appearance=outline][color=blue]) button:hover, \n:host([appearance=outline][color=blue]) a:hover*/[appearance=outline][color=blue].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=outline][color=blue].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-brand-hover);color:var(--calcite-ui-brand-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand-hover)}/*!@:host([appearance=outline][color=blue]) button:focus, \n:host([appearance=outline][color=blue]) a:focus*/[appearance=outline][color=blue].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=outline][color=blue].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-brand);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@:host([appearance=outline][color=blue]) button:active, \n:host([appearance=outline][color=blue]) a:active*/[appearance=outline][color=blue].sc-calcite-button-h button.sc-calcite-button:active,[appearance=outline][color=blue].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-brand-press);color:var(--calcite-ui-brand-press);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand-press)}/*!@:host([appearance=outline][color=blue]) button calcite-loader,\n:host([appearance=outline][color=blue]) a calcite-loader*/[appearance=outline][color=blue].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=outline][color=blue].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-brand)}/*!@:host([appearance=outline][color=red]) button, \n:host([appearance=outline][color=red]) a*/[appearance=outline][color=red].sc-calcite-button-h button.sc-calcite-button,[appearance=outline][color=red].sc-calcite-button-h a.sc-calcite-button{border-color:var(--calcite-ui-danger);background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-danger)}/*!@:host([appearance=outline][color=red]) button:hover, \n:host([appearance=outline][color=red]) a:hover*/[appearance=outline][color=red].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=outline][color=red].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-danger-hover);color:var(--calcite-ui-danger-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-danger-hover)}/*!@:host([appearance=outline][color=red]) button:focus, \n:host([appearance=outline][color=red]) a:focus*/[appearance=outline][color=red].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=outline][color=red].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-danger);color:var(--calcite-ui-danger);box-shadow:inset 0 0 0 2px var(--calcite-ui-danger)}/*!@:host([appearance=outline][color=red]) button:active, \n:host([appearance=outline][color=red]) a:active*/[appearance=outline][color=red].sc-calcite-button-h button.sc-calcite-button:active,[appearance=outline][color=red].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-danger-press);color:var(--calcite-ui-danger-press);box-shadow:inset 0 0 0 2px var(--calcite-ui-danger-press)}/*!@:host([appearance=outline][color=red]) button calcite-loader,\n:host([appearance=outline][color=red]) a calcite-loader*/[appearance=outline][color=red].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=outline][color=red].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-danger)}/*!@:host([appearance=outline][color=neutral]) button, \n:host([appearance=outline][color=neutral]) a*/[appearance=outline][color=neutral].sc-calcite-button-h button.sc-calcite-button,[appearance=outline][color=neutral].sc-calcite-button-h a.sc-calcite-button{background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1);border-color:var(--calcite-ui-foreground-3)}/*!@:host([appearance=outline][color=neutral]) button:hover,\n:host([appearance=outline][color=neutral]) a:hover*/[appearance=outline][color=neutral].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=outline][color=neutral].sc-calcite-button-h a.sc-calcite-button:hover{box-shadow:inset 0 0 0 1px var(--calcite-ui-foreground-3)}/*!@:host([appearance=outline][color=neutral]) button:focus,\n:host([appearance=outline][color=neutral]) a:focus*/[appearance=outline][color=neutral].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=outline][color=neutral].sc-calcite-button-h a.sc-calcite-button:focus{box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3)}/*!@:host([appearance=outline][color=neutral]) button:active,\n:host([appearance=outline][color=neutral]) a:active*/[appearance=outline][color=neutral].sc-calcite-button-h button.sc-calcite-button:active,[appearance=outline][color=neutral].sc-calcite-button-h a.sc-calcite-button:active{box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3)}/*!@:host([appearance=outline][color=neutral]) button calcite-loader, \n:host([appearance=outline][color=neutral]) a calcite-loader*/[appearance=outline][color=neutral].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=outline][color=neutral].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([appearance=outline][color=inverse]) button, \n:host([appearance=outline][color=inverse]) a*/[appearance=outline][color=inverse].sc-calcite-button-h button.sc-calcite-button,[appearance=outline][color=inverse].sc-calcite-button-h a.sc-calcite-button{background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1);border-color:var(--calcite-ui-inverse)}/*!@:host([appearance=outline][color=inverse]) button:hover,\n:host([appearance=outline][color=inverse]) a:hover*/[appearance=outline][color=inverse].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=outline][color=inverse].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-inverse-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-inverse-hover)}/*!@:host([appearance=outline][color=inverse]) button:focus,\n:host([appearance=outline][color=inverse]) a:focus*/[appearance=outline][color=inverse].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=outline][color=inverse].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-inverse);box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse)}/*!@:host([appearance=outline][color=inverse]) button:active,\n:host([appearance=outline][color=inverse]) a:active*/[appearance=outline][color=inverse].sc-calcite-button-h button.sc-calcite-button:active,[appearance=outline][color=inverse].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-inverse-press);box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse-press)}/*!@:host([appearance=outline][color=inverse]) button calcite-loader, \n:host([appearance=outline][color=inverse]) a calcite-loader*/[appearance=outline][color=inverse].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=outline][color=inverse].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([appearance=clear]) button, \n:host([appearance=clear]) a, \n:host([appearance=minimal]) button, \n:host([appearance=minimal]) a*/[appearance=clear].sc-calcite-button-h button.sc-calcite-button,[appearance=clear].sc-calcite-button-h a.sc-calcite-button,[appearance=minimal].sc-calcite-button-h button.sc-calcite-button,[appearance=minimal].sc-calcite-button-h a.sc-calcite-button{border-width:1px;border-style:solid;background-color:transparent;box-shadow:inset 0 0 0 1px transparent}/*!@:host([appearance=clear][color=blue]) button, \n:host([appearance=clear][color=blue]) a, \n:host([appearance=minimal][color=blue]) button, \n:host([appearance=minimal][color=blue]) a*/[appearance=clear][color=blue].sc-calcite-button-h button.sc-calcite-button,[appearance=clear][color=blue].sc-calcite-button-h a.sc-calcite-button,[appearance=minimal][color=blue].sc-calcite-button-h button.sc-calcite-button,[appearance=minimal][color=blue].sc-calcite-button-h a.sc-calcite-button{border-color:var(--calcite-ui-brand);background-color:transparent;color:var(--calcite-ui-brand)}/*!@:host([appearance=clear][color=blue]) button:hover, \n:host([appearance=clear][color=blue]) a:hover, \n:host([appearance=minimal][color=blue]) button:hover, \n:host([appearance=minimal][color=blue]) a:hover*/[appearance=clear][color=blue].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=clear][color=blue].sc-calcite-button-h a.sc-calcite-button:hover,[appearance=minimal][color=blue].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=minimal][color=blue].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-brand-hover);color:var(--calcite-ui-brand-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand-hover)}/*!@:host([appearance=clear][color=blue]) button:focus, \n:host([appearance=clear][color=blue]) a:focus, \n:host([appearance=minimal][color=blue]) button:focus, \n:host([appearance=minimal][color=blue]) a:focus*/[appearance=clear][color=blue].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=clear][color=blue].sc-calcite-button-h a.sc-calcite-button:focus,[appearance=minimal][color=blue].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=minimal][color=blue].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-brand);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@:host([appearance=clear][color=blue]) button:active, \n:host([appearance=clear][color=blue]) a:active, \n:host([appearance=minimal][color=blue]) button:active, \n:host([appearance=minimal][color=blue]) a:active*/[appearance=clear][color=blue].sc-calcite-button-h button.sc-calcite-button:active,[appearance=clear][color=blue].sc-calcite-button-h a.sc-calcite-button:active,[appearance=minimal][color=blue].sc-calcite-button-h button.sc-calcite-button:active,[appearance=minimal][color=blue].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-brand-press);color:var(--calcite-ui-brand-press);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand-press)}/*!@:host([appearance=clear][color=blue]) button calcite-loader,\n:host([appearance=clear][color=blue]) a calcite-loader,\n:host([appearance=minimal][color=blue]) button calcite-loader,\n:host([appearance=minimal][color=blue]) a calcite-loader*/[appearance=clear][color=blue].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=clear][color=blue].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=minimal][color=blue].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=minimal][color=blue].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-brand)}/*!@:host([appearance=clear][color=red]) button, \n:host([appearance=clear][color=red]) a, \n:host([appearance=minimal][color=red]) button, \n:host([appearance=minimal][color=red]) a*/[appearance=clear][color=red].sc-calcite-button-h button.sc-calcite-button,[appearance=clear][color=red].sc-calcite-button-h a.sc-calcite-button,[appearance=minimal][color=red].sc-calcite-button-h button.sc-calcite-button,[appearance=minimal][color=red].sc-calcite-button-h a.sc-calcite-button{border-color:var(--calcite-ui-danger);background-color:transparent;color:var(--calcite-ui-danger)}/*!@:host([appearance=clear][color=red]) button:hover, \n:host([appearance=clear][color=red]) a:hover, \n:host([appearance=minimal][color=red]) button:hover, \n:host([appearance=minimal][color=red]) a:hover*/[appearance=clear][color=red].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=clear][color=red].sc-calcite-button-h a.sc-calcite-button:hover,[appearance=minimal][color=red].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=minimal][color=red].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-danger-hover);color:var(--calcite-ui-danger-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-danger-hover)}/*!@:host([appearance=clear][color=red]) button:focus, \n:host([appearance=clear][color=red]) a:focus, \n:host([appearance=minimal][color=red]) button:focus, \n:host([appearance=minimal][color=red]) a:focus*/[appearance=clear][color=red].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=clear][color=red].sc-calcite-button-h a.sc-calcite-button:focus,[appearance=minimal][color=red].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=minimal][color=red].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-danger);color:var(--calcite-ui-danger);box-shadow:inset 0 0 0 2px var(--calcite-ui-danger)}/*!@:host([appearance=clear][color=red]) button:active, \n:host([appearance=clear][color=red]) a:active, \n:host([appearance=minimal][color=red]) button:active, \n:host([appearance=minimal][color=red]) a:active*/[appearance=clear][color=red].sc-calcite-button-h button.sc-calcite-button:active,[appearance=clear][color=red].sc-calcite-button-h a.sc-calcite-button:active,[appearance=minimal][color=red].sc-calcite-button-h button.sc-calcite-button:active,[appearance=minimal][color=red].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-danger-press);color:var(--calcite-ui-danger-press);box-shadow:inset 0 0 0 2px var(--calcite-ui-danger-press)}/*!@:host([appearance=clear][color=red]) button calcite-loader,\n:host([appearance=clear][color=red]) a calcite-loader,\n:host([appearance=minimal][color=red]) button calcite-loader,\n:host([appearance=minimal][color=red]) a calcite-loader*/[appearance=clear][color=red].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=clear][color=red].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=minimal][color=red].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=minimal][color=red].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-danger)}/*!@:host([appearance=clear][color=neutral]) button, \n:host([appearance=clear][color=neutral]) a, \n:host([appearance=minimal][color=neutral]) button, \n:host([appearance=minimal][color=neutral]) a*/[appearance=clear][color=neutral].sc-calcite-button-h button.sc-calcite-button,[appearance=clear][color=neutral].sc-calcite-button-h a.sc-calcite-button,[appearance=minimal][color=neutral].sc-calcite-button-h button.sc-calcite-button,[appearance=minimal][color=neutral].sc-calcite-button-h a.sc-calcite-button{background-color:transparent;color:var(--calcite-ui-text-1);border-color:var(--calcite-ui-foreground-3)}/*!@:host([appearance=clear][color=neutral]) button:hover,\n:host([appearance=clear][color=neutral]) a:hover,\n:host([appearance=minimal][color=neutral]) button:hover,\n:host([appearance=minimal][color=neutral]) a:hover*/[appearance=clear][color=neutral].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=clear][color=neutral].sc-calcite-button-h a.sc-calcite-button:hover,[appearance=minimal][color=neutral].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=minimal][color=neutral].sc-calcite-button-h a.sc-calcite-button:hover{box-shadow:inset 0 0 0 1px var(--calcite-ui-foreground-3)}/*!@:host([appearance=clear][color=neutral]) button:focus,\n:host([appearance=clear][color=neutral]) a:focus,\n:host([appearance=minimal][color=neutral]) button:focus,\n:host([appearance=minimal][color=neutral]) a:focus*/[appearance=clear][color=neutral].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=clear][color=neutral].sc-calcite-button-h a.sc-calcite-button:focus,[appearance=minimal][color=neutral].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=minimal][color=neutral].sc-calcite-button-h a.sc-calcite-button:focus{box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3)}/*!@:host([appearance=clear][color=neutral]) button:active,\n:host([appearance=clear][color=neutral]) a:active,\n:host([appearance=minimal][color=neutral]) button:active,\n:host([appearance=minimal][color=neutral]) a:active*/[appearance=clear][color=neutral].sc-calcite-button-h button.sc-calcite-button:active,[appearance=clear][color=neutral].sc-calcite-button-h a.sc-calcite-button:active,[appearance=minimal][color=neutral].sc-calcite-button-h button.sc-calcite-button:active,[appearance=minimal][color=neutral].sc-calcite-button-h a.sc-calcite-button:active{box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3)}/*!@:host([appearance=clear][color=neutral]) button calcite-loader, \n:host([appearance=clear][color=neutral]) a calcite-loader, \n:host([appearance=minimal][color=neutral]) button calcite-loader, \n:host([appearance=minimal][color=neutral]) a calcite-loader*/[appearance=clear][color=neutral].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=clear][color=neutral].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=minimal][color=neutral].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=minimal][color=neutral].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([appearance=clear][color=inverse]) button, \n:host([appearance=clear][color=inverse]) a, \n:host([appearance=minimal][color=inverse]) button, \n:host([appearance=minimal][color=inverse]) a*/[appearance=clear][color=inverse].sc-calcite-button-h button.sc-calcite-button,[appearance=clear][color=inverse].sc-calcite-button-h a.sc-calcite-button,[appearance=minimal][color=inverse].sc-calcite-button-h button.sc-calcite-button,[appearance=minimal][color=inverse].sc-calcite-button-h a.sc-calcite-button{background-color:transparent;color:var(--calcite-ui-text-1);border-color:var(--calcite-ui-inverse)}/*!@:host([appearance=clear][color=inverse]) button:hover,\n:host([appearance=clear][color=inverse]) a:hover,\n:host([appearance=minimal][color=inverse]) button:hover,\n:host([appearance=minimal][color=inverse]) a:hover*/[appearance=clear][color=inverse].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=clear][color=inverse].sc-calcite-button-h a.sc-calcite-button:hover,[appearance=minimal][color=inverse].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=minimal][color=inverse].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-inverse-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-inverse-hover)}/*!@:host([appearance=clear][color=inverse]) button:focus,\n:host([appearance=clear][color=inverse]) a:focus,\n:host([appearance=minimal][color=inverse]) button:focus,\n:host([appearance=minimal][color=inverse]) a:focus*/[appearance=clear][color=inverse].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=clear][color=inverse].sc-calcite-button-h a.sc-calcite-button:focus,[appearance=minimal][color=inverse].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=minimal][color=inverse].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-inverse);box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse)}/*!@:host([appearance=clear][color=inverse]) button:active,\n:host([appearance=clear][color=inverse]) a:active,\n:host([appearance=minimal][color=inverse]) button:active,\n:host([appearance=minimal][color=inverse]) a:active*/[appearance=clear][color=inverse].sc-calcite-button-h button.sc-calcite-button:active,[appearance=clear][color=inverse].sc-calcite-button-h a.sc-calcite-button:active,[appearance=minimal][color=inverse].sc-calcite-button-h button.sc-calcite-button:active,[appearance=minimal][color=inverse].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-inverse-press);box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse-press)}/*!@:host([appearance=clear][color=inverse]) button calcite-loader, \n:host([appearance=clear][color=inverse]) a calcite-loader, \n:host([appearance=minimal][color=inverse]) button calcite-loader, \n:host([appearance=minimal][color=inverse]) a calcite-loader*/[appearance=clear][color=inverse].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=clear][color=inverse].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=minimal][color=inverse].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=minimal][color=inverse].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([appearance=outline][split-child=primary]) button,\n:host([appearance=clear][split-child=primary]) button,\n:host([appearance=minimal][split-child=primary]) button*/[appearance=outline][split-child=primary].sc-calcite-button-h button.sc-calcite-button,[appearance=clear][split-child=primary].sc-calcite-button-h button.sc-calcite-button,[appearance=minimal][split-child=primary].sc-calcite-button-h button.sc-calcite-button{border-inline-end-width:0;border-inline-start-width:1px}/*!@:host([appearance=outline][split-child=secondary]) button,\n:host([appearance=clear][split-child=secondary]) button,\n:host([appearance=minimal][split-child=secondary]) button*/[appearance=outline][split-child=secondary].sc-calcite-button-h button.sc-calcite-button,[appearance=clear][split-child=secondary].sc-calcite-button-h button.sc-calcite-button,[appearance=minimal][split-child=secondary].sc-calcite-button-h button.sc-calcite-button{border-inline-start-width:0;border-inline-end-width:1px}/*!@:host([appearance=transparent]:not(.enable-editing-button)) button, \n:host([appearance=transparent]:not(.enable-editing-button)) a*/[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) button.sc-calcite-button,[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) a.sc-calcite-button{background-color:transparent}/*!@:host([appearance=transparent]:not(.enable-editing-button)) button:hover, :host([appearance=transparent]:not(.enable-editing-button)) button:focus,\n:host([appearance=transparent]:not(.enable-editing-button)) a:hover,\n:host([appearance=transparent]:not(.enable-editing-button)) a:focus*/[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) button.sc-calcite-button:hover,[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) button.sc-calcite-button:focus,[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) a.sc-calcite-button:hover,[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) a.sc-calcite-button:focus{background-color:var(--calcite-button-transparent-hover)}/*!@:host([appearance=transparent]:not(.enable-editing-button)) button:active,\n:host([appearance=transparent]:not(.enable-editing-button)) a:active*/[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) button.sc-calcite-button:active,[appearance=transparent].sc-calcite-button-h:not(.enable-editing-button) a.sc-calcite-button:active{background-color:var(--calcite-button-transparent-press)}/*!@:host([appearance=transparent][color=blue]) button,\n:host([appearance=transparent][color=blue]) a*/[appearance=transparent][color=blue].sc-calcite-button-h button.sc-calcite-button,[appearance=transparent][color=blue].sc-calcite-button-h a.sc-calcite-button{color:var(--calcite-ui-brand)}/*!@:host([appearance=transparent][color=blue]) button:hover,\n:host([appearance=transparent][color=blue]) a:hover*/[appearance=transparent][color=blue].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=transparent][color=blue].sc-calcite-button-h a.sc-calcite-button:hover{color:var(--calcite-ui-brand-hover)}/*!@:host([appearance=transparent][color=blue]) button:focus,\n:host([appearance=transparent][color=blue]) a:focus*/[appearance=transparent][color=blue].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=transparent][color=blue].sc-calcite-button-h a.sc-calcite-button:focus{color:var(--calcite-ui-brand)}/*!@:host([appearance=transparent][color=blue]) button:active,\n:host([appearance=transparent][color=blue]) a:active*/[appearance=transparent][color=blue].sc-calcite-button-h button.sc-calcite-button:active,[appearance=transparent][color=blue].sc-calcite-button-h a.sc-calcite-button:active{color:var(--calcite-ui-brand-press)}/*!@:host([appearance=transparent][color=blue]) button calcite-loader,\n:host([appearance=transparent][color=blue]) a calcite-loader*/[appearance=transparent][color=blue].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=transparent][color=blue].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-brand)}/*!@:host([appearance=transparent][color=red]) button,\n:host([appearance=transparent][color=red]) a*/[appearance=transparent][color=red].sc-calcite-button-h button.sc-calcite-button,[appearance=transparent][color=red].sc-calcite-button-h a.sc-calcite-button{color:var(--calcite-ui-danger)}/*!@:host([appearance=transparent][color=red]) button:hover,\n:host([appearance=transparent][color=red]) a:hover*/[appearance=transparent][color=red].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=transparent][color=red].sc-calcite-button-h a.sc-calcite-button:hover{color:var(--calcite-ui-danger-hover)}/*!@:host([appearance=transparent][color=red]) button:focus,\n:host([appearance=transparent][color=red]) a:focus*/[appearance=transparent][color=red].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=transparent][color=red].sc-calcite-button-h a.sc-calcite-button:focus{color:var(--calcite-ui-danger)}/*!@:host([appearance=transparent][color=red]) button:active,\n:host([appearance=transparent][color=red]) a:active*/[appearance=transparent][color=red].sc-calcite-button-h button.sc-calcite-button:active,[appearance=transparent][color=red].sc-calcite-button-h a.sc-calcite-button:active{color:var(--calcite-ui-danger-press)}/*!@:host([appearance=transparent][color=red]) button calcite-loader,\n:host([appearance=transparent][color=red]) a calcite-loader*/[appearance=transparent][color=red].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=transparent][color=red].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-danger)}/*!@:host([appearance=transparent][color=neutral]:not(.cancel-editing-button)) button, \n:host([appearance=transparent][color=neutral]:not(.cancel-editing-button)) a, \n:host([appearance=transparent][color=neutral]:not(.cancel-editing-button)) calcite-loader*/[appearance=transparent][color=neutral].sc-calcite-button-h:not(.cancel-editing-button) button.sc-calcite-button,[appearance=transparent][color=neutral].sc-calcite-button-h:not(.cancel-editing-button) a.sc-calcite-button,[appearance=transparent][color=neutral].sc-calcite-button-h:not(.cancel-editing-button) calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([appearance=transparent][color=neutral].cancel-editing-button) button*/[appearance=transparent][color=neutral].cancel-editing-button.sc-calcite-button-h button.sc-calcite-button{border-block-start-width:1px;border-block-end-width:1px;color:var(--calcite-ui-text-3);border-block-start-color:var(--calcite-ui-border-input);border-block-end-color:var(--calcite-ui-border-input);border-block-style:solid}/*!@:host([appearance=transparent][color=neutral].cancel-editing-button) button:not(.content--slotted)*/[appearance=transparent][color=neutral].cancel-editing-button.sc-calcite-button-h button.sc-calcite-button:not(.content--slotted){--calcite-button-padding-y:0}/*!@:host([appearance=transparent][color=neutral].cancel-editing-button) button:hover*/[appearance=transparent][color=neutral].cancel-editing-button.sc-calcite-button-h button.sc-calcite-button:hover{color:var(--calcite-ui-text-1)}/*!@:host([appearance=transparent][color=neutral].enable-editing-button) button*/[appearance=transparent][color=neutral].enable-editing-button.sc-calcite-button-h button.sc-calcite-button{background-color:transparent}/*!@:host(.confirm-changes-button) button:focus,\n:host(.cancel-editing-button) button:focus,\n:host(.enable-editing-button) button:focus*/.confirm-changes-button.sc-calcite-button-h button.sc-calcite-button:focus,.cancel-editing-button.sc-calcite-button-h button.sc-calcite-button:focus,.enable-editing-button.sc-calcite-button-h button.sc-calcite-button:focus{outline-offset:-2px}/*!@:host([appearance=transparent][color=inverse]) button, \n:host([appearance=transparent][color=inverse]) a, \n:host([appearance=transparent][color=inverse]) calcite-loader*/[appearance=transparent][color=inverse].sc-calcite-button-h button.sc-calcite-button,[appearance=transparent][color=inverse].sc-calcite-button-h a.sc-calcite-button,[appearance=transparent][color=inverse].sc-calcite-button-h calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-inverse)}/*!@:host([scale=s]) button.content--slotted, \n:host([scale=s]) a.content--slotted*/[scale=s].sc-calcite-button-h button.content--slotted.sc-calcite-button,[scale=s].sc-calcite-button-h a.content--slotted.sc-calcite-button{font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=s][appearance=transparent]) button.content--slotted,\n:host([scale=s][appearance=transparent]) a.content--slotted*/[scale=s][appearance=transparent].sc-calcite-button-h button.content--slotted.sc-calcite-button,[scale=s][appearance=transparent].sc-calcite-button-h a.content--slotted.sc-calcite-button{--calcite-button-padding-x:0.5rem;--calcite-button-padding-y:0.25rem}/*!@:host([scale=m]) button.content--slotted,\n:host([scale=m]) a.content--slotted*/[scale=m].sc-calcite-button-h button.content--slotted.sc-calcite-button,[scale=m].sc-calcite-button-h a.content--slotted.sc-calcite-button{--calcite-button-padding-x:11px;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=m]:not([appearance=transparent])) button.content--slotted,\n:host([scale=m]:not([appearance=transparent])) a.content--slotted*/[scale=m].sc-calcite-button-h:not([appearance=transparent]) button.content--slotted.sc-calcite-button,[scale=m].sc-calcite-button-h:not([appearance=transparent]) a.content--slotted.sc-calcite-button{--calcite-button-padding-y:7px}/*!@:host([scale=m][appearance=transparent]) button.content--slotted,\n:host([scale=m][appearance=transparent]) a.content--slotted*/[scale=m][appearance=transparent].sc-calcite-button-h button.content--slotted.sc-calcite-button,[scale=m][appearance=transparent].sc-calcite-button-h a.content--slotted.sc-calcite-button{--calcite-button-padding-x:0.75rem;--calcite-button-padding-y:0.5rem}/*!@:host([scale=l]) button.content--slotted,\n:host([scale=l]) a.content--slotted*/[scale=l].sc-calcite-button-h button.content--slotted.sc-calcite-button,[scale=l].sc-calcite-button-h a.content--slotted.sc-calcite-button{--calcite-button-padding-x:15px;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l]:not([appearance=transparent])) button.content--slotted,\n:host([scale=l]:not([appearance=transparent])) a.content--slotted*/[scale=l].sc-calcite-button-h:not([appearance=transparent]) button.content--slotted.sc-calcite-button,[scale=l].sc-calcite-button-h:not([appearance=transparent]) a.content--slotted.sc-calcite-button{--calcite-button-padding-y:11px}/*!@:host([scale=l][appearance=transparent]) button.content--slotted,\n:host([scale=l][appearance=transparent]) a.content--slotted*/[scale=l][appearance=transparent].sc-calcite-button-h button.content--slotted.sc-calcite-button,[scale=l][appearance=transparent].sc-calcite-button-h a.content--slotted.sc-calcite-button{--calcite-button-padding-x:1rem;--calcite-button-padding-y:0.75rem}/*!@:host([scale=s]) button:not(.content--slotted),\n:host([scale=s]) a:not(.content--slotted)*/[scale=s].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=s].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:0.125rem;--calcite-button-padding-y:3px;inline-size:1.5rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;min-block-size:1.5rem}/*!@:host([scale=s][appearance=transparent]) button:not(.content--slotted),\n:host([scale=s][appearance=transparent]) a:not(.content--slotted)*/[scale=s][appearance=transparent].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=s][appearance=transparent].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-y:0.25rem}/*!@:host([scale=m]) button:not(.content--slotted),\n:host([scale=m]) a:not(.content--slotted)*/[scale=m].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=m].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:0.125rem;--calcite-button-padding-y:7px;inline-size:2rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;min-block-size:2rem}/*!@:host([scale=m][appearance=transparent]) button:not(.content--slotted),\n:host([scale=m][appearance=transparent]) a:not(.content--slotted)*/[scale=m][appearance=transparent].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=m][appearance=transparent].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-y:0.5rem}/*!@:host([scale=l]) button:not(.content--slotted),\n:host([scale=l]) a:not(.content--slotted)*/[scale=l].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=l].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:0.125rem;--calcite-button-padding-y:9px;inline-size:2.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;min-block-size:2.75rem}/*!@:host([scale=l][appearance=transparent]) button:not(.content--slotted),\n:host([scale=l][appearance=transparent]) a:not(.content--slotted)*/[scale=l][appearance=transparent].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=l][appearance=transparent].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-y:0.625rem}/*!@:host([scale=s][icon-start][icon-end]) button:not(.content--slotted),\n:host([scale=s][icon-start][icon-end]) a:not(.content--slotted)*/[scale=s][icon-start][icon-end].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=s][icon-start][icon-end].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:23px;block-size:1.5rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=s][icon-start][icon-end][appearance=transparent]) button:not(.content--slotted),\n:host([scale=s][icon-start][icon-end][appearance=transparent]) a:not(.content--slotted)*/[scale=s][icon-start][icon-end][appearance=transparent].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=s][icon-start][icon-end][appearance=transparent].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:1.5rem}/*!@:host([scale=m][icon-start][icon-end]) button:not(.content--slotted),\n:host([scale=m][icon-start][icon-end]) a:not(.content--slotted)*/[scale=m][icon-start][icon-end].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=m][icon-start][icon-end].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:2rem;block-size:2rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=m][icon-start][icon-end][appearance=transparent]) button:not(.content--slotted),\n:host([scale=m][icon-start][icon-end][appearance=transparent]) a:not(.content--slotted)*/[scale=m][icon-start][icon-end][appearance=transparent].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=m][icon-start][icon-end][appearance=transparent].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:33px}/*!@:host([scale=l][icon-start][icon-end]) button:not(.content--slotted),\n:host([scale=l][icon-start][icon-end]) a:not(.content--slotted)*/[scale=l][icon-start][icon-end].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=l][icon-start][icon-end].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:43px;block-size:2.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l][icon-start][icon-end]) button:not(.content--slotted) .icon--start + .icon--end,\n:host([scale=l][icon-start][icon-end]) a:not(.content--slotted) .icon--start + .icon--end*/[scale=l][icon-start][icon-end].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted) .icon--start.sc-calcite-button+.icon--end.sc-calcite-button,[scale=l][icon-start][icon-end].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted) .icon--start.sc-calcite-button+.icon--end.sc-calcite-button{margin-inline-start:1rem}/*!@:host([scale=l][icon-start][icon-end][appearance=transparent]) button:not(.content--slotted),\n:host([scale=l][icon-start][icon-end][appearance=transparent]) a:not(.content--slotted)*/[scale=l][icon-start][icon-end][appearance=transparent].sc-calcite-button-h button.sc-calcite-button:not(.content--slotted),[scale=l][icon-start][icon-end][appearance=transparent].sc-calcite-button-h a.sc-calcite-button:not(.content--slotted){--calcite-button-padding-x:2.75rem}";
  10202. /** Passing a 'href' will render an anchor link, instead of a button. Role will be set to link, or button, depending on this. */
  10203. /** It is the consumers responsibility to add aria information, rel, target, for links, and any button attributes for form submission */
  10204. /** @slot - A slot for adding text. */
  10205. class Button {
  10206. constructor(hostRef) {
  10207. registerInstance(this, hostRef);
  10208. //--------------------------------------------------------------------------
  10209. //
  10210. // Properties
  10211. //
  10212. //--------------------------------------------------------------------------
  10213. /** Specifies the alignment of the component's elements. */
  10214. this.alignment = "center";
  10215. /** Specifies the appearance style of the component. */
  10216. this.appearance = "solid";
  10217. /** Specifies the color of the component. */
  10218. this.color = "blue";
  10219. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  10220. this.disabled = false;
  10221. /**
  10222. * Accessible name when the component is loading.
  10223. *
  10224. * @default "Loading"
  10225. */
  10226. this.intlLoading = TEXT$n.loading;
  10227. /**
  10228. * When `true`, a busy indicator is displayed and interaction is disabled.
  10229. */
  10230. this.loading = false;
  10231. /** When `true`, adds a round style to the component. */
  10232. this.round = false;
  10233. /** Specifies the size of the component. */
  10234. this.scale = "m";
  10235. /** Specifies if the component is a child of a `calcite-split-button`. */
  10236. this.splitChild = false;
  10237. /**
  10238. * Specifies the default behavior of the button.
  10239. *
  10240. * @mdn [type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type)
  10241. */
  10242. this.type = "button";
  10243. /** Specifies the width of the component. */
  10244. this.width = "auto";
  10245. /** watches for changing text content */
  10246. this.mutationObserver = createObserver();
  10247. /** determine if there is slotted content for styling purposes */
  10248. this.hasContent = false;
  10249. /** determine if loader present for styling purposes */
  10250. this.hasLoader = false;
  10251. // act on a requested or nearby form based on type
  10252. this.handleClick = () => {
  10253. const { type } = this;
  10254. if (this.href) {
  10255. return;
  10256. }
  10257. // this.type refers to type attribute, not child element type
  10258. if (type === "submit") {
  10259. submitForm(this);
  10260. }
  10261. else if (type === "reset") {
  10262. resetForm(this);
  10263. }
  10264. };
  10265. }
  10266. loadingChanged(newValue, oldValue) {
  10267. if (!!newValue && !oldValue) {
  10268. this.hasLoader = true;
  10269. }
  10270. if (!newValue && !!oldValue) {
  10271. window.setTimeout(() => {
  10272. this.hasLoader = false;
  10273. }, 300);
  10274. }
  10275. }
  10276. //--------------------------------------------------------------------------
  10277. //
  10278. // Lifecycle
  10279. //
  10280. //--------------------------------------------------------------------------
  10281. connectedCallback() {
  10282. this.hasLoader = this.loading;
  10283. this.setupTextContentObserver();
  10284. connectLabel(this);
  10285. this.formEl = closestElementCrossShadowBoundary(this.el, this.form ? `#${this.form}` : "form");
  10286. }
  10287. disconnectedCallback() {
  10288. var _a;
  10289. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  10290. disconnectLabel(this);
  10291. this.formEl = null;
  10292. }
  10293. componentWillLoad() {
  10294. }
  10295. componentDidRender() {
  10296. updateHostInteraction(this);
  10297. }
  10298. render() {
  10299. const childElType = this.href ? "a" : "button";
  10300. const Tag = childElType;
  10301. const loaderNode = this.hasLoader ? (hAsync("div", { class: CSS$N.buttonLoader }, hAsync("calcite-loader", { active: true, class: this.loading ? CSS$N.loadingIn : CSS$N.loadingOut, inline: true, label: this.intlLoading, scale: this.scale === "l" ? "m" : "s" }))) : null;
  10302. const iconStartEl = (hAsync("calcite-icon", { class: { [CSS$N.icon]: true, [CSS$N.iconStart]: true }, flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: this.scale === "l" ? "m" : "s" }));
  10303. const iconEndEl = (hAsync("calcite-icon", { class: { [CSS$N.icon]: true, [CSS$N.iconEnd]: true }, flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: this.scale === "l" ? "m" : "s" }));
  10304. const contentEl = (hAsync("span", { class: CSS$N.content }, hAsync("slot", null)));
  10305. return (hAsync(Tag, { "aria-label": getLabelText(this), class: {
  10306. [CSS$N.contentSlotted]: this.hasContent,
  10307. [CSS$N.iconStartEmpty]: !this.iconStart,
  10308. [CSS$N.iconEndEmpty]: !this.iconEnd
  10309. }, disabled: this.disabled || this.loading, href: childElType === "a" && this.href, name: childElType === "button" && this.name, onClick: this.handleClick, ref: (el) => (this.childEl = el), rel: childElType === "a" && this.rel, tabIndex: this.disabled || this.loading ? -1 : null, target: childElType === "a" && this.target, type: childElType === "button" && this.type }, loaderNode, this.iconStart ? iconStartEl : null, this.hasContent ? contentEl : null, this.iconEnd ? iconEndEl : null));
  10310. }
  10311. //--------------------------------------------------------------------------
  10312. //
  10313. // Public Methods
  10314. //
  10315. //--------------------------------------------------------------------------
  10316. /** Sets focus on the component. */
  10317. async setFocus() {
  10318. var _a;
  10319. (_a = this.childEl) === null || _a === void 0 ? void 0 : _a.focus();
  10320. }
  10321. updateHasContent() {
  10322. var _a, _b;
  10323. const slottedContent = this.el.textContent.trim().length > 0 || this.el.childNodes.length > 0;
  10324. this.hasContent =
  10325. this.el.childNodes.length === 1 && ((_a = this.el.childNodes[0]) === null || _a === void 0 ? void 0 : _a.nodeName) === "#text"
  10326. ? ((_b = this.el.textContent) === null || _b === void 0 ? void 0 : _b.trim().length) > 0
  10327. : slottedContent;
  10328. }
  10329. setupTextContentObserver() {
  10330. var _a;
  10331. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  10332. }
  10333. //--------------------------------------------------------------------------
  10334. //
  10335. // Private Methods
  10336. //
  10337. //--------------------------------------------------------------------------
  10338. onLabelClick() {
  10339. this.handleClick();
  10340. this.setFocus();
  10341. }
  10342. get el() { return getElement(this); }
  10343. static get watchers() { return {
  10344. "loading": ["loadingChanged"]
  10345. }; }
  10346. static get style() { return buttonCss; }
  10347. static get cmpMeta() { return {
  10348. "$flags$": 9,
  10349. "$tagName$": "calcite-button",
  10350. "$members$": {
  10351. "alignment": [513],
  10352. "appearance": [513],
  10353. "label": [1],
  10354. "color": [513],
  10355. "disabled": [516],
  10356. "href": [513],
  10357. "iconEnd": [513, "icon-end"],
  10358. "iconFlipRtl": [513, "icon-flip-rtl"],
  10359. "iconStart": [513, "icon-start"],
  10360. "intlLoading": [1, "intl-loading"],
  10361. "loading": [516],
  10362. "name": [513],
  10363. "rel": [513],
  10364. "form": [1],
  10365. "round": [516],
  10366. "scale": [513],
  10367. "splitChild": [520, "split-child"],
  10368. "target": [513],
  10369. "type": [1537],
  10370. "width": [513],
  10371. "hasContent": [32],
  10372. "hasLoader": [32],
  10373. "setFocus": [64]
  10374. },
  10375. "$listeners$": undefined,
  10376. "$lazyBundleId$": "-",
  10377. "$attrsToReflect$": [["alignment", "alignment"], ["appearance", "appearance"], ["color", "color"], ["disabled", "disabled"], ["href", "href"], ["iconEnd", "icon-end"], ["iconFlipRtl", "icon-flip-rtl"], ["iconStart", "icon-start"], ["loading", "loading"], ["name", "name"], ["rel", "rel"], ["round", "round"], ["scale", "scale"], ["splitChild", "split-child"], ["target", "target"], ["type", "type"], ["width", "width"]]
  10378. }; }
  10379. }
  10380. const CSS$M = {
  10381. container: "container",
  10382. header: "header",
  10383. footer: "footer",
  10384. title: "title",
  10385. subtitle: "subtitle",
  10386. checkboxWrapper: "checkbox-wrapper",
  10387. thumbnailWrapper: "thumbnail-wrapper"
  10388. };
  10389. const SLOTS$m = {
  10390. thumbnail: "thumbnail",
  10391. title: "title",
  10392. subtitle: "subtitle",
  10393. footerLeading: "footer-leading",
  10394. footerTrailing: "footer-trailing"
  10395. };
  10396. const TEXT$m = {
  10397. select: "Select",
  10398. deselect: "Deselect",
  10399. loading: "Loading"
  10400. };
  10401. const cardCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-card:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-card{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-card{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-card{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-card{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-card{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-card:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-card:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-card-h{display:none}/*!@:host*/.sc-calcite-card-h{display:block;max-inline-size:100%}/*!@:host .calcite-card-container*/.sc-calcite-card-h .calcite-card-container.sc-calcite-card{position:relative;display:flex;block-size:100%;flex-direction:column;justify-content:space-between;overflow:hidden;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-2);background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-3);--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);border-radius:var(--calcite-border-radius-base)}/*!@.container*/.container.sc-calcite-card{position:relative;display:flex;flex:1 1 auto;flex-direction:column}/*!@:host([loading]) .calcite-card-container *:not(calcite-loader):not(.calcite-card-loader-container)*/[loading].sc-calcite-card-h .calcite-card-container.sc-calcite-card *.sc-calcite-card:not(calcite-loader):not(.calcite-card-loader-container){pointer-events:none;opacity:0}/*!@:host([loading]) .calcite-card-loader-container*/[loading].sc-calcite-card-h .calcite-card-loader-container.sc-calcite-card{position:absolute;inset:0px;display:flex;align-items:center}/*!@.header, \n.footer*/.header.sc-calcite-card,.footer.sc-calcite-card{display:flex;padding-inline:0.75rem;padding-block:0.75rem 0.25rem}/*!@.header*/.header.sc-calcite-card{flex-direction:column}/*!@.footer*/.footer.sc-calcite-card{margin-block-start:auto;flex-direction:row;align-content:space-between;justify-content:space-between;padding-inline:0.75rem;padding-block:0.25rem 0.75rem}/*!@.card-content*/.card-content.sc-calcite-card{padding:0.75rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-ui-text-3)}/*!@:host([selected]) .calcite-card-container*/[selected].sc-calcite-card-h .calcite-card-container.sc-calcite-card{border-color:var(--calcite-ui-brand)}/*!@slot[name=title]::slotted(*), \n*::slotted([slot=title])*/slot[name=title].sc-calcite-card-s>*,*.sc-calcite-card-s>[slot=title]{margin:0px;font-size:var(--calcite-font-size--1);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@:host([selectable]) .header*/[selectable].sc-calcite-card-h .header.sc-calcite-card{padding-inline-end:2rem}/*!@slot[name=subtitle]::slotted(*), \n*::slotted([slot=subtitle])*/slot[name=subtitle].sc-calcite-card-s>*,*.sc-calcite-card-s>[slot=subtitle]{margin:0px;margin-block-start:0.5rem;font-size:var(--calcite-font-size--2);line-height:1.375;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2)}/*!@slot[name=thumbnail]::slotted(img), \nimg::slotted([slot=thumbnail])*/slot[name=thumbnail].sc-calcite-card-s>img,img.sc-calcite-card-s>[slot=thumbnail]{min-inline-size:100%;max-inline-size:100%}/*!@slot[name=footer-leading]::slotted(*), \n*::slotted([slot=footer-leading])*/slot[name=footer-leading].sc-calcite-card-s>*,*.sc-calcite-card-s>[slot=footer-leading]{align-self:center;font-size:var(--calcite-font-size--2);line-height:1.375;margin-inline-end:auto}/*!@slot[name=footer-trailing]::slotted(*), \n*::slotted([slot=footer-trailing])*/slot[name=footer-trailing].sc-calcite-card-s>*,*.sc-calcite-card-s>[slot=footer-trailing]{align-self:center;font-size:var(--calcite-font-size--2);line-height:1.375}/*!@.checkbox-wrapper*/.checkbox-wrapper.sc-calcite-card{position:absolute;margin:0px;padding:0px;inset-block-start:0.5rem;inset-inline-end:0.5rem}/*!@.thumbnail-wrapper*/.thumbnail-wrapper.sc-calcite-card{display:flex}/*!@.calcite-card-container.inline*/.calcite-card-container.inline.sc-calcite-card{flex-direction:row}/*!@.calcite-card-container.inline > .container*/.calcite-card-container.inline.sc-calcite-card>.container.sc-calcite-card{inline-size:60%}/*!@.calcite-card-container.inline > .thumbnail-wrapper*/.calcite-card-container.inline.sc-calcite-card>.thumbnail-wrapper.sc-calcite-card{inline-size:40%;align-items:flex-start}/*!@.calcite-card-container.inline slot[name=thumbnail]::slotted(img), \n.calcite-card-container.inline img::slotted([slot=thumbnail])*/.calcite-card-container.inline slot[name=thumbnail].sc-calcite-card-s>img,.calcite-card-container.inline img.sc-calcite-card-s>[slot=thumbnail]{inline-size:100%}/*!@slot[name=footer-leading]::slotted(*), \nslot[name=footer-trailing]::slotted(*)*/slot[name=footer-leading].sc-calcite-card-s>*,slot[name=footer-trailing].sc-calcite-card-s>*{display:flex;gap:0.25rem}";
  10402. /**
  10403. * Cards do not include a grid or bounding container
  10404. * - cards will expand to fit the width of their container
  10405. */
  10406. /**
  10407. * @slot - A slot for adding subheader/description content.
  10408. * @slot thumbnail - A slot for adding a thumbnail to the component.
  10409. * @slot title - A slot for adding a title.
  10410. * @slot subtitle - A slot for adding a subtitle or short summary.
  10411. * @slot footer-leading - A slot for adding a leading footer.
  10412. * @slot footer-trailing - A slot for adding a trailing footer.
  10413. */
  10414. class Card {
  10415. constructor(hostRef) {
  10416. registerInstance(this, hostRef);
  10417. this.calciteCardSelect = createEvent(this, "calciteCardSelect", 6);
  10418. //--------------------------------------------------------------------------
  10419. //
  10420. // Public Properties
  10421. //
  10422. //--------------------------------------------------------------------------
  10423. /** When `true`, a busy indicator is displayed. */
  10424. this.loading = false;
  10425. /** When `true`, the component is selected. */
  10426. this.selected = false;
  10427. /** When `true`, the component is selectable. */
  10428. this.selectable = false;
  10429. /**
  10430. * Accessible name when the component is loading.
  10431. *
  10432. * @default "Loading"
  10433. */
  10434. this.intlLoading = TEXT$m.loading;
  10435. /**
  10436. * When `selectable` is `true`, the accessible name for the component's checkbox for selection.
  10437. *
  10438. * @default "Select"
  10439. */
  10440. this.intlSelect = TEXT$m.select;
  10441. /**
  10442. * When `selectable` is `true`, the accessible name for the component's checkbox for deselection.
  10443. *
  10444. * @default "Deselect"
  10445. */
  10446. this.intlDeselect = TEXT$m.deselect;
  10447. /** Sets the placement of the thumbnail defined in the `thumbnail` slot. */
  10448. this.thumbnailPosition = "block-start";
  10449. //--------------------------------------------------------------------------
  10450. //
  10451. // Private State/Props
  10452. //
  10453. //--------------------------------------------------------------------------
  10454. //--------------------------------------------------------------------------
  10455. //
  10456. // Private Methods
  10457. //
  10458. //--------------------------------------------------------------------------
  10459. this.cardSelectClick = () => {
  10460. this.selectCard();
  10461. };
  10462. this.cardSelectKeyDown = (event) => {
  10463. switch (event.key) {
  10464. case " ":
  10465. case "Enter":
  10466. this.selectCard();
  10467. event.preventDefault();
  10468. break;
  10469. }
  10470. };
  10471. }
  10472. // --------------------------------------------------------------------------
  10473. //
  10474. // Lifecycle
  10475. //
  10476. // --------------------------------------------------------------------------
  10477. connectedCallback() {
  10478. connectConditionalSlotComponent(this);
  10479. }
  10480. disonnectedCallback() {
  10481. disconnectConditionalSlotComponent(this);
  10482. }
  10483. render() {
  10484. const thumbnailInline = this.thumbnailPosition.startsWith("inline");
  10485. const thumbnailStart = this.thumbnailPosition.endsWith("start");
  10486. return (hAsync("div", { class: { "calcite-card-container": true, inline: thumbnailInline } }, this.loading ? (hAsync("div", { class: "calcite-card-loader-container" }, hAsync("calcite-loader", { active: true, label: this.intlLoading }))) : null, thumbnailStart && this.renderThumbnail(), hAsync("section", { "aria-busy": toAriaBoolean(this.loading), class: { [CSS$M.container]: true } }, this.selectable ? this.renderCheckbox() : null, this.renderHeader(), hAsync("div", { class: "card-content" }, hAsync("slot", null)), this.renderFooter()), !thumbnailStart && this.renderThumbnail()));
  10487. }
  10488. selectCard() {
  10489. this.selected = !this.selected;
  10490. this.calciteCardSelect.emit();
  10491. }
  10492. renderThumbnail() {
  10493. return getSlotted(this.el, SLOTS$m.thumbnail) ? (hAsync("section", { class: CSS$M.thumbnailWrapper }, hAsync("slot", { name: SLOTS$m.thumbnail }))) : null;
  10494. }
  10495. renderCheckbox() {
  10496. const checkboxLabel = this.selected ? this.intlDeselect : this.intlSelect;
  10497. return (hAsync("calcite-label", { class: CSS$M.checkboxWrapper, onClick: this.cardSelectClick, onKeyDown: this.cardSelectKeyDown }, hAsync("calcite-checkbox", { checked: this.selected, label: checkboxLabel })));
  10498. }
  10499. renderHeader() {
  10500. const { el } = this;
  10501. const title = getSlotted(el, SLOTS$m.title);
  10502. const subtitle = getSlotted(el, SLOTS$m.subtitle);
  10503. const hasHeader = title || subtitle;
  10504. return hasHeader ? (hAsync("header", { class: CSS$M.header }, hAsync("slot", { name: SLOTS$m.title }), hAsync("slot", { name: SLOTS$m.subtitle }))) : null;
  10505. }
  10506. renderFooter() {
  10507. const { el } = this;
  10508. const leadingFooter = getSlotted(el, SLOTS$m.footerLeading);
  10509. const trailingFooter = getSlotted(el, SLOTS$m.footerTrailing);
  10510. const hasFooter = leadingFooter || trailingFooter;
  10511. return hasFooter ? (hAsync("footer", { class: CSS$M.footer }, hAsync("slot", { name: SLOTS$m.footerLeading }), hAsync("slot", { name: SLOTS$m.footerTrailing }))) : null;
  10512. }
  10513. get el() { return getElement(this); }
  10514. static get style() { return cardCss; }
  10515. static get cmpMeta() { return {
  10516. "$flags$": 9,
  10517. "$tagName$": "calcite-card",
  10518. "$members$": {
  10519. "loading": [516],
  10520. "selected": [1540],
  10521. "selectable": [516],
  10522. "intlLoading": [1, "intl-loading"],
  10523. "intlSelect": [1, "intl-select"],
  10524. "intlDeselect": [1, "intl-deselect"],
  10525. "thumbnailPosition": [513, "thumbnail-position"]
  10526. },
  10527. "$listeners$": undefined,
  10528. "$lazyBundleId$": "-",
  10529. "$attrsToReflect$": [["loading", "loading"], ["selected", "selected"], ["selectable", "selectable"], ["thumbnailPosition", "thumbnail-position"]]
  10530. }; }
  10531. }
  10532. const checkboxCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-checkbox:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-checkbox{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-checkbox{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-checkbox{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-checkbox{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-checkbox{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-checkbox:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-checkbox:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-checkbox-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-checkbox-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([scale=s])*/[scale=s].sc-calcite-checkbox-h{--calcite-checkbox-size:0.75rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-checkbox-h{--calcite-checkbox-size:var(--calcite-font-size--1)}/*!@:host([scale=l])*/[scale=l].sc-calcite-checkbox-h{--calcite-checkbox-size:1rem}/*!@:host*/.sc-calcite-checkbox-h{position:relative;display:inline-flex;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}/*!@:host .check-svg,\n:host .toggle*/.sc-calcite-checkbox-h .check-svg.sc-calcite-checkbox,.sc-calcite-checkbox-h .toggle.sc-calcite-checkbox{inline-size:var(--calcite-checkbox-size);block-size:var(--calcite-checkbox-size)}/*!@:host .check-svg*/.sc-calcite-checkbox-h .check-svg.sc-calcite-checkbox{pointer-events:none;box-sizing:border-box;display:block;overflow:hidden;background-color:var(--calcite-ui-foreground-1);fill:currentColor;stroke:currentColor;stroke-width:1;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);color:var(--calcite-ui-background)}/*!@:host([checked]) .check-svg, \n:host([indeterminate]) .check-svg*/[checked].sc-calcite-checkbox-h .check-svg.sc-calcite-checkbox,[indeterminate].sc-calcite-checkbox-h .check-svg.sc-calcite-checkbox{background-color:var(--calcite-ui-brand);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand)}/*!@:host([hovered]) .toggle .check-svg,\n:host .toggle:hover .check-svg*/[hovered].sc-calcite-checkbox-h .toggle.sc-calcite-checkbox .check-svg.sc-calcite-checkbox,.sc-calcite-checkbox-h .toggle.sc-calcite-checkbox:hover .check-svg.sc-calcite-checkbox{box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@.toggle*/.toggle.sc-calcite-checkbox{outline-color:transparent}/*!@.toggle:active, .toggle:focus, .toggle:focus-visible*/.toggle.sc-calcite-checkbox:active,.toggle.sc-calcite-checkbox:focus,.toggle.sc-calcite-checkbox:focus-visible{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-checkbox-h[disabled] .sc-calcite-checkbox-s>[calcite-hydrated][disabled],[disabled].sc-calcite-checkbox-h [calcite-hydrated][disabled].sc-calcite-checkbox{opacity:1}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-checkbox-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  10533. class Checkbox {
  10534. constructor(hostRef) {
  10535. registerInstance(this, hostRef);
  10536. this.calciteInternalCheckboxBlur = createEvent(this, "calciteInternalCheckboxBlur", 6);
  10537. this.calciteCheckboxChange = createEvent(this, "calciteCheckboxChange", 6);
  10538. this.calciteInternalCheckboxFocus = createEvent(this, "calciteInternalCheckboxFocus", 6);
  10539. //--------------------------------------------------------------------------
  10540. //
  10541. // Properties
  10542. //
  10543. //--------------------------------------------------------------------------
  10544. /** When `true`, the component is checked. */
  10545. this.checked = false;
  10546. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  10547. this.disabled = false;
  10548. /**
  10549. * The hovered state of the checkbox.
  10550. *
  10551. * @internal
  10552. */
  10553. this.hovered = false;
  10554. /**
  10555. * When `true`, the component is initially indeterminate, which is independent from its `checked` value.
  10556. *
  10557. * The state is visual only, and can look different across browsers.
  10558. *
  10559. * @mdn [indeterminate](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#indeterminate_state_checkboxes)
  10560. */
  10561. this.indeterminate = false;
  10562. /**
  10563. * When `true`, the component must have a value in order for the form to submit.
  10564. *
  10565. * @internal
  10566. */
  10567. this.required = false;
  10568. /** Specifies the size of the component. */
  10569. this.scale = "m";
  10570. //--------------------------------------------------------------------------
  10571. //
  10572. // Private Properties
  10573. //
  10574. //--------------------------------------------------------------------------
  10575. this.checkedPath = "M5.5 12L2 8.689l.637-.636L5.5 10.727l8.022-7.87.637.637z";
  10576. this.indeterminatePath = "M13 8v1H3V8z";
  10577. //--------------------------------------------------------------------------
  10578. //
  10579. // Private Methods
  10580. //
  10581. //--------------------------------------------------------------------------
  10582. this.getPath = () => this.indeterminate ? this.indeterminatePath : this.checked ? this.checkedPath : "";
  10583. this.toggle = () => {
  10584. if (!this.disabled) {
  10585. this.checked = !this.checked;
  10586. this.setFocus();
  10587. this.indeterminate = false;
  10588. this.calciteCheckboxChange.emit();
  10589. }
  10590. };
  10591. this.keyDownHandler = (event) => {
  10592. if (isActivationKey(event.key)) {
  10593. this.toggle();
  10594. event.preventDefault();
  10595. }
  10596. };
  10597. this.clickHandler = () => {
  10598. this.toggle();
  10599. };
  10600. //--------------------------------------------------------------------------
  10601. //
  10602. // Event Listeners
  10603. //
  10604. //--------------------------------------------------------------------------
  10605. this.onToggleBlur = () => {
  10606. this.calciteInternalCheckboxBlur.emit(false);
  10607. };
  10608. this.onToggleFocus = () => {
  10609. this.calciteInternalCheckboxFocus.emit(true);
  10610. };
  10611. this.onLabelClick = () => {
  10612. this.toggle();
  10613. };
  10614. }
  10615. //--------------------------------------------------------------------------
  10616. //
  10617. // Public Methods
  10618. //
  10619. //--------------------------------------------------------------------------
  10620. /** Sets focus on the component. */
  10621. async setFocus() {
  10622. var _a;
  10623. (_a = this.toggleEl) === null || _a === void 0 ? void 0 : _a.focus();
  10624. }
  10625. //--------------------------------------------------------------------------
  10626. //
  10627. // Lifecycle
  10628. //
  10629. //--------------------------------------------------------------------------
  10630. connectedCallback() {
  10631. this.guid = this.el.id || `calcite-checkbox-${guid()}`;
  10632. connectLabel(this);
  10633. connectForm(this);
  10634. }
  10635. disconnectedCallback() {
  10636. disconnectLabel(this);
  10637. disconnectForm(this);
  10638. }
  10639. componentDidRender() {
  10640. updateHostInteraction(this);
  10641. }
  10642. // --------------------------------------------------------------------------
  10643. //
  10644. // Render Methods
  10645. //
  10646. // --------------------------------------------------------------------------
  10647. render() {
  10648. return (hAsync(Host, { onClick: this.clickHandler, onKeyDown: this.keyDownHandler }, hAsync("div", { "aria-checked": toAriaBoolean(this.checked), "aria-label": getLabelText(this), class: "toggle", onBlur: this.onToggleBlur, onFocus: this.onToggleFocus, ref: (toggleEl) => (this.toggleEl = toggleEl), role: "checkbox", tabIndex: this.disabled ? undefined : 0 }, hAsync("svg", { "aria-hidden": "true", class: "check-svg", viewBox: "0 0 16 16" }, hAsync("path", { d: this.getPath() })), hAsync("slot", null)), hAsync(HiddenFormInputSlot, { component: this })));
  10649. }
  10650. get el() { return getElement(this); }
  10651. static get style() { return checkboxCss; }
  10652. static get cmpMeta() { return {
  10653. "$flags$": 9,
  10654. "$tagName$": "calcite-checkbox",
  10655. "$members$": {
  10656. "checked": [1540],
  10657. "disabled": [516],
  10658. "guid": [1537],
  10659. "hovered": [1540],
  10660. "indeterminate": [1540],
  10661. "label": [1],
  10662. "name": [520],
  10663. "required": [516],
  10664. "scale": [513],
  10665. "value": [8],
  10666. "setFocus": [64]
  10667. },
  10668. "$listeners$": undefined,
  10669. "$lazyBundleId$": "-",
  10670. "$attrsToReflect$": [["checked", "checked"], ["disabled", "disabled"], ["guid", "guid"], ["hovered", "hovered"], ["indeterminate", "indeterminate"], ["name", "name"], ["required", "required"], ["scale", "scale"]]
  10671. }; }
  10672. }
  10673. const CSS$L = {
  10674. title: "title",
  10675. close: "close",
  10676. imageContainer: "image-container",
  10677. chipIcon: "chip-icon",
  10678. closeIcon: "close-icon"
  10679. };
  10680. const TEXT$l = {
  10681. close: "Close"
  10682. };
  10683. const SLOTS$l = {
  10684. image: "image"
  10685. };
  10686. const ICONS$b = {
  10687. close: "x"
  10688. };
  10689. const chipCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-chip:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-chip{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-chip{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-chip{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-chip{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-chip{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-chip:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-chip:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-chip-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-chip-h{block-size:1.5rem;font-size:var(--calcite-font-size--2);--calcite-chip-spacing-unit-l:0.5rem;--calcite-chip-spacing-unit-s:0.25rem}/*!@:host([scale=s]) .image-container*/[scale=s].sc-calcite-chip-h .image-container.sc-calcite-chip{block-size:1.25rem;inline-size:1.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-chip-h{block-size:2rem;font-size:var(--calcite-font-size--1);--calcite-chip-spacing-unit-l:0.75rem;--calcite-chip-spacing-unit-s:6px}/*!@:host([scale=m]) .image-container*/[scale=m].sc-calcite-chip-h .image-container.sc-calcite-chip{block-size:1.5rem;inline-size:1.5rem;padding-inline-start:0.25rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-chip-h{block-size:2.75rem;font-size:var(--calcite-font-size-0);--calcite-chip-spacing-unit-l:1rem;--calcite-chip-spacing-unit-s:0.5rem}/*!@:host([scale=l]) .image-container*/[scale=l].sc-calcite-chip-h .image-container.sc-calcite-chip{block-size:2rem;inline-size:2rem;padding-inline-start:0.25rem}/*!@:host*/.sc-calcite-chip-h{box-sizing:border-box;display:inline-flex;cursor:default;align-items:center;border-radius:9999px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@.container*/.container.sc-calcite-chip{display:inline-flex;block-size:100%;max-inline-size:100%;align-items:center}/*!@.title*/.title.sc-calcite-chip{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}/*!@:host span*/.sc-calcite-chip-h span.sc-calcite-chip{padding-block:0;padding-inline:var(--calcite-chip-spacing-unit-l)}/*!@:host([closable]) span*/[closable].sc-calcite-chip-h span.sc-calcite-chip{padding-inline:var(--calcite-chip-spacing-unit-l) var(--calcite-chip-spacing-unit-s)}/*!@:host([icon]:not([closable])) span*/[icon].sc-calcite-chip-h:not([closable]) span.sc-calcite-chip{padding-block:0;padding-inline:var(--calcite-chip-spacing-unit-l)}/*!@:host button*/.sc-calcite-chip-h button.sc-calcite-chip{margin:0px;display:inline-flex;max-block-size:100%;min-block-size:100%;cursor:pointer;align-items:center;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-1);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;-webkit-appearance:none;border-start-start-radius:0;border-start-end-radius:50px;border-end-end-radius:50px;border-end-start-radius:0;padding-block:0;padding-inline:var(--calcite-chip-spacing-unit-s);color:inherit;--calcite-chip-transparent-hover:var(--calcite-button-transparent-hover);--calcite-chip-transparent-press:var(--calcite-button-transparent-press)}/*!@:host button:hover*/.sc-calcite-chip-h button.sc-calcite-chip:hover{background-color:var(--calcite-chip-transparent-hover)}/*!@:host button:focus*/.sc-calcite-chip-h button.sc-calcite-chip:focus{background-color:var(--calcite-chip-transparent-hover);outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host button:active*/.sc-calcite-chip-h button.sc-calcite-chip:active{background-color:var(--calcite-chip-transparent-press)}/*!@.image-container*/.image-container.sc-calcite-chip{display:inline-flex;overflow:hidden;border-radius:50%}/*!@:host slot[name=image]::slotted(*)*/.sc-calcite-chip-h slot[name=image].sc-calcite-chip-s>*{display:flex;block-size:100%;inline-size:100%;overflow:hidden;border-radius:50%}/*!@.chip-icon*/.chip-icon.sc-calcite-chip{position:relative;margin-block:0px;display:inline-flex;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);margin-inline-end:0;margin-inline-start:var(--calcite-chip-spacing-unit-l);border-start-start-radius:0;border-start-end-radius:50px;border-end-end-radius:50px;border-end-start-radius:0}/*!@:host([color=blue])*/[color=blue].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-info);color:var(--calcite-ui-text-inverse)}/*!@:host([color=red])*/[color=red].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-danger);color:var(--calcite-ui-text-inverse)}/*!@:host([color=yellow])*/[color=yellow].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-warning);color:#151515}/*!@:host([color=green])*/[color=green].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-success);color:#151515}/*!@:host([color=grey])*/[color=grey].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@:host([color=grey]) button,\n:host([color=grey]) .close-icon*/[color=grey].sc-calcite-chip-h button.sc-calcite-chip,[color=grey].sc-calcite-chip-h .close-icon.sc-calcite-chip{color:var(--calcite-ui-text-3)}/*!@:host([color=grey]) .chip-icon*/[color=grey].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}/*!@:host([appearance=clear]), \n:host([appearance=transparent])*/[appearance=clear].sc-calcite-chip-h,[appearance=transparent].sc-calcite-chip-h{background-color:transparent;color:var(--calcite-ui-text-1)}/*!@:host([color=blue][appearance=clear]),\n:host([color=blue][appearance=transparent])*/[color=blue][appearance=clear].sc-calcite-chip-h,[color=blue][appearance=transparent].sc-calcite-chip-h{border-color:var(--calcite-ui-info)}/*!@:host([color=blue][appearance=clear]) .chip-icon,\n:host([color=blue][appearance=transparent]) .chip-icon*/[color=blue][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip,[color=blue][appearance=transparent].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-info))}/*!@:host([color=red][appearance=clear]),\n:host([color=red][appearance=transparent])*/[color=red][appearance=clear].sc-calcite-chip-h,[color=red][appearance=transparent].sc-calcite-chip-h{border-color:var(--calcite-ui-danger)}/*!@:host([color=red][appearance=clear]) .chip-icon,\n:host([color=red][appearance=transparent]) .chip-icon*/[color=red][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip,[color=red][appearance=transparent].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-danger))}/*!@:host([color=yellow][appearance=clear]),\n:host([color=yellow][appearance=transparent])*/[color=yellow][appearance=clear].sc-calcite-chip-h,[color=yellow][appearance=transparent].sc-calcite-chip-h{border-color:var(--calcite-ui-warning)}/*!@:host([color=yellow][appearance=clear]) .chip-icon,\n:host([color=yellow][appearance=transparent]) .chip-icon*/[color=yellow][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip,[color=yellow][appearance=transparent].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-warning))}/*!@:host([color=green][appearance=clear]),\n:host([color=green][appearance=transparent])*/[color=green][appearance=clear].sc-calcite-chip-h,[color=green][appearance=transparent].sc-calcite-chip-h{border-color:var(--calcite-ui-success)}/*!@:host([color=green][appearance=clear]) .chip-icon,\n:host([color=green][appearance=transparent]) .chip-icon*/[color=green][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip,[color=green][appearance=transparent].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-success))}/*!@:host([color=grey][appearance=clear]),\n:host([color=grey][appearance=transparent])*/[color=grey][appearance=clear].sc-calcite-chip-h,[color=grey][appearance=transparent].sc-calcite-chip-h{border-color:var(--calcite-ui-border-1)}/*!@:host([color=grey][appearance=clear]) .chip-icon,\n:host([color=grey][appearance=transparent]) .chip-icon*/[color=grey][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip,[color=grey][appearance=transparent].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}/*!@:host([closed])*/[closed].sc-calcite-chip-h{display:none}";
  10690. /**
  10691. * @slot - A slot for adding text.
  10692. * @slot image - A slot for adding an image.
  10693. */
  10694. class Chip {
  10695. constructor(hostRef) {
  10696. registerInstance(this, hostRef);
  10697. this.calciteChipDismiss = createEvent(this, "calciteChipDismiss", 6);
  10698. //--------------------------------------------------------------------------
  10699. //
  10700. // Public Properties
  10701. //
  10702. //--------------------------------------------------------------------------
  10703. /** Specifies the appearance style of the component. */
  10704. this.appearance = "solid";
  10705. /** Specifies the color for the component. */
  10706. this.color = "grey";
  10707. /**
  10708. * When `true`, a close button is added to the component.
  10709. *
  10710. * @deprecated use `closable` instead.
  10711. */
  10712. this.dismissible = false;
  10713. /** When `true`, a close button is added to the component. */
  10714. this.closable = false;
  10715. /**
  10716. * Accessible name for the component's close button.
  10717. *
  10718. * @default "Close"
  10719. */
  10720. this.dismissLabel = TEXT$l.close;
  10721. /** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
  10722. this.iconFlipRtl = false;
  10723. /** Specifies the size of the component. */
  10724. this.scale = "m";
  10725. /** When `true`, hides the component. */
  10726. this.closed = false;
  10727. // --------------------------------------------------------------------------
  10728. //
  10729. // Private Methods
  10730. //
  10731. // --------------------------------------------------------------------------
  10732. this.closeClickHandler = (event) => {
  10733. event.preventDefault();
  10734. this.calciteChipDismiss.emit(this.el);
  10735. this.closed = true;
  10736. };
  10737. this.guid = guid();
  10738. }
  10739. handleDismissible(value) {
  10740. this.closable = value;
  10741. }
  10742. handleClosable(value) {
  10743. this.dismissible = value;
  10744. }
  10745. // --------------------------------------------------------------------------
  10746. //
  10747. // Lifecycle
  10748. //
  10749. // --------------------------------------------------------------------------
  10750. connectedCallback() {
  10751. connectConditionalSlotComponent(this);
  10752. if (this.dismissible) {
  10753. this.handleDismissible(this.dismissible);
  10754. }
  10755. if (this.closable) {
  10756. this.handleClosable(this.closable);
  10757. }
  10758. }
  10759. disconnectedCallback() {
  10760. disconnectConditionalSlotComponent(this);
  10761. }
  10762. //--------------------------------------------------------------------------
  10763. //
  10764. // Public Methods
  10765. //
  10766. //--------------------------------------------------------------------------
  10767. /** Sets focus on the component. */
  10768. async setFocus() {
  10769. var _a;
  10770. (_a = this.closeButton) === null || _a === void 0 ? void 0 : _a.focus();
  10771. }
  10772. //--------------------------------------------------------------------------
  10773. //
  10774. // Render Methods
  10775. //
  10776. //--------------------------------------------------------------------------
  10777. renderChipImage() {
  10778. const { el } = this;
  10779. const hasChipImage = getSlotted(el, SLOTS$l.image);
  10780. return hasChipImage ? (hAsync("div", { class: CSS$L.imageContainer, key: "image" }, hAsync("slot", { name: SLOTS$l.image }))) : null;
  10781. }
  10782. render() {
  10783. const iconEl = (hAsync("calcite-icon", { class: CSS$L.chipIcon, flipRtl: this.iconFlipRtl, icon: this.icon, scale: "s" }));
  10784. const closeButton = (hAsync("button", { "aria-describedby": this.guid, "aria-label": this.dismissLabel, class: CSS$L.close, onClick: this.closeClickHandler, ref: (el) => (this.closeButton = el) }, hAsync("calcite-icon", { class: CSS$L.closeIcon, icon: ICONS$b.close, scale: "s" })));
  10785. return (hAsync("div", { class: "container" }, this.renderChipImage(), this.icon ? iconEl : null, hAsync("span", { class: CSS$L.title, id: this.guid }, hAsync("slot", null)), this.closable ? closeButton : null));
  10786. }
  10787. get el() { return getElement(this); }
  10788. static get watchers() { return {
  10789. "dismissible": ["handleDismissible"],
  10790. "closable": ["handleClosable"]
  10791. }; }
  10792. static get style() { return chipCss; }
  10793. static get cmpMeta() { return {
  10794. "$flags$": 9,
  10795. "$tagName$": "calcite-chip",
  10796. "$members$": {
  10797. "appearance": [513],
  10798. "color": [513],
  10799. "dismissible": [1540],
  10800. "closable": [1540],
  10801. "dismissLabel": [1, "dismiss-label"],
  10802. "icon": [513],
  10803. "iconFlipRtl": [516, "icon-flip-rtl"],
  10804. "scale": [513],
  10805. "value": [8],
  10806. "closed": [1540],
  10807. "setFocus": [64]
  10808. },
  10809. "$listeners$": undefined,
  10810. "$lazyBundleId$": "-",
  10811. "$attrsToReflect$": [["appearance", "appearance"], ["color", "color"], ["dismissible", "dismissible"], ["closable", "closable"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["scale", "scale"], ["closed", "closed"]]
  10812. }; }
  10813. }
  10814. function createCommonjsModule(fn, basedir, module) {
  10815. return module = {
  10816. path: basedir,
  10817. exports: {},
  10818. require: function (path, base) {
  10819. return commonjsRequire();
  10820. }
  10821. }, fn(module, module.exports), module.exports;
  10822. }
  10823. function commonjsRequire () {
  10824. throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
  10825. }
  10826. var colorName$1 = {
  10827. "aliceblue": [240, 248, 255],
  10828. "antiquewhite": [250, 235, 215],
  10829. "aqua": [0, 255, 255],
  10830. "aquamarine": [127, 255, 212],
  10831. "azure": [240, 255, 255],
  10832. "beige": [245, 245, 220],
  10833. "bisque": [255, 228, 196],
  10834. "black": [0, 0, 0],
  10835. "blanchedalmond": [255, 235, 205],
  10836. "blue": [0, 0, 255],
  10837. "blueviolet": [138, 43, 226],
  10838. "brown": [165, 42, 42],
  10839. "burlywood": [222, 184, 135],
  10840. "cadetblue": [95, 158, 160],
  10841. "chartreuse": [127, 255, 0],
  10842. "chocolate": [210, 105, 30],
  10843. "coral": [255, 127, 80],
  10844. "cornflowerblue": [100, 149, 237],
  10845. "cornsilk": [255, 248, 220],
  10846. "crimson": [220, 20, 60],
  10847. "cyan": [0, 255, 255],
  10848. "darkblue": [0, 0, 139],
  10849. "darkcyan": [0, 139, 139],
  10850. "darkgoldenrod": [184, 134, 11],
  10851. "darkgray": [169, 169, 169],
  10852. "darkgreen": [0, 100, 0],
  10853. "darkgrey": [169, 169, 169],
  10854. "darkkhaki": [189, 183, 107],
  10855. "darkmagenta": [139, 0, 139],
  10856. "darkolivegreen": [85, 107, 47],
  10857. "darkorange": [255, 140, 0],
  10858. "darkorchid": [153, 50, 204],
  10859. "darkred": [139, 0, 0],
  10860. "darksalmon": [233, 150, 122],
  10861. "darkseagreen": [143, 188, 143],
  10862. "darkslateblue": [72, 61, 139],
  10863. "darkslategray": [47, 79, 79],
  10864. "darkslategrey": [47, 79, 79],
  10865. "darkturquoise": [0, 206, 209],
  10866. "darkviolet": [148, 0, 211],
  10867. "deeppink": [255, 20, 147],
  10868. "deepskyblue": [0, 191, 255],
  10869. "dimgray": [105, 105, 105],
  10870. "dimgrey": [105, 105, 105],
  10871. "dodgerblue": [30, 144, 255],
  10872. "firebrick": [178, 34, 34],
  10873. "floralwhite": [255, 250, 240],
  10874. "forestgreen": [34, 139, 34],
  10875. "fuchsia": [255, 0, 255],
  10876. "gainsboro": [220, 220, 220],
  10877. "ghostwhite": [248, 248, 255],
  10878. "gold": [255, 215, 0],
  10879. "goldenrod": [218, 165, 32],
  10880. "gray": [128, 128, 128],
  10881. "green": [0, 128, 0],
  10882. "greenyellow": [173, 255, 47],
  10883. "grey": [128, 128, 128],
  10884. "honeydew": [240, 255, 240],
  10885. "hotpink": [255, 105, 180],
  10886. "indianred": [205, 92, 92],
  10887. "indigo": [75, 0, 130],
  10888. "ivory": [255, 255, 240],
  10889. "khaki": [240, 230, 140],
  10890. "lavender": [230, 230, 250],
  10891. "lavenderblush": [255, 240, 245],
  10892. "lawngreen": [124, 252, 0],
  10893. "lemonchiffon": [255, 250, 205],
  10894. "lightblue": [173, 216, 230],
  10895. "lightcoral": [240, 128, 128],
  10896. "lightcyan": [224, 255, 255],
  10897. "lightgoldenrodyellow": [250, 250, 210],
  10898. "lightgray": [211, 211, 211],
  10899. "lightgreen": [144, 238, 144],
  10900. "lightgrey": [211, 211, 211],
  10901. "lightpink": [255, 182, 193],
  10902. "lightsalmon": [255, 160, 122],
  10903. "lightseagreen": [32, 178, 170],
  10904. "lightskyblue": [135, 206, 250],
  10905. "lightslategray": [119, 136, 153],
  10906. "lightslategrey": [119, 136, 153],
  10907. "lightsteelblue": [176, 196, 222],
  10908. "lightyellow": [255, 255, 224],
  10909. "lime": [0, 255, 0],
  10910. "limegreen": [50, 205, 50],
  10911. "linen": [250, 240, 230],
  10912. "magenta": [255, 0, 255],
  10913. "maroon": [128, 0, 0],
  10914. "mediumaquamarine": [102, 205, 170],
  10915. "mediumblue": [0, 0, 205],
  10916. "mediumorchid": [186, 85, 211],
  10917. "mediumpurple": [147, 112, 219],
  10918. "mediumseagreen": [60, 179, 113],
  10919. "mediumslateblue": [123, 104, 238],
  10920. "mediumspringgreen": [0, 250, 154],
  10921. "mediumturquoise": [72, 209, 204],
  10922. "mediumvioletred": [199, 21, 133],
  10923. "midnightblue": [25, 25, 112],
  10924. "mintcream": [245, 255, 250],
  10925. "mistyrose": [255, 228, 225],
  10926. "moccasin": [255, 228, 181],
  10927. "navajowhite": [255, 222, 173],
  10928. "navy": [0, 0, 128],
  10929. "oldlace": [253, 245, 230],
  10930. "olive": [128, 128, 0],
  10931. "olivedrab": [107, 142, 35],
  10932. "orange": [255, 165, 0],
  10933. "orangered": [255, 69, 0],
  10934. "orchid": [218, 112, 214],
  10935. "palegoldenrod": [238, 232, 170],
  10936. "palegreen": [152, 251, 152],
  10937. "paleturquoise": [175, 238, 238],
  10938. "palevioletred": [219, 112, 147],
  10939. "papayawhip": [255, 239, 213],
  10940. "peachpuff": [255, 218, 185],
  10941. "peru": [205, 133, 63],
  10942. "pink": [255, 192, 203],
  10943. "plum": [221, 160, 221],
  10944. "powderblue": [176, 224, 230],
  10945. "purple": [128, 0, 128],
  10946. "rebeccapurple": [102, 51, 153],
  10947. "red": [255, 0, 0],
  10948. "rosybrown": [188, 143, 143],
  10949. "royalblue": [65, 105, 225],
  10950. "saddlebrown": [139, 69, 19],
  10951. "salmon": [250, 128, 114],
  10952. "sandybrown": [244, 164, 96],
  10953. "seagreen": [46, 139, 87],
  10954. "seashell": [255, 245, 238],
  10955. "sienna": [160, 82, 45],
  10956. "silver": [192, 192, 192],
  10957. "skyblue": [135, 206, 235],
  10958. "slateblue": [106, 90, 205],
  10959. "slategray": [112, 128, 144],
  10960. "slategrey": [112, 128, 144],
  10961. "snow": [255, 250, 250],
  10962. "springgreen": [0, 255, 127],
  10963. "steelblue": [70, 130, 180],
  10964. "tan": [210, 180, 140],
  10965. "teal": [0, 128, 128],
  10966. "thistle": [216, 191, 216],
  10967. "tomato": [255, 99, 71],
  10968. "turquoise": [64, 224, 208],
  10969. "violet": [238, 130, 238],
  10970. "wheat": [245, 222, 179],
  10971. "white": [255, 255, 255],
  10972. "whitesmoke": [245, 245, 245],
  10973. "yellow": [255, 255, 0],
  10974. "yellowgreen": [154, 205, 50]
  10975. };
  10976. var isArrayish = function isArrayish(obj) {
  10977. if (!obj || typeof obj === 'string') {
  10978. return false;
  10979. }
  10980. return obj instanceof Array || Array.isArray(obj) ||
  10981. (obj.length >= 0 && (obj.splice instanceof Function ||
  10982. (Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
  10983. };
  10984. var simpleSwizzle = createCommonjsModule(function (module) {
  10985. var concat = Array.prototype.concat;
  10986. var slice = Array.prototype.slice;
  10987. var swizzle = module.exports = function swizzle(args) {
  10988. var results = [];
  10989. for (var i = 0, len = args.length; i < len; i++) {
  10990. var arg = args[i];
  10991. if (isArrayish(arg)) {
  10992. // http://jsperf.com/javascript-array-concat-vs-push/98
  10993. results = concat.call(results, slice.call(arg));
  10994. } else {
  10995. results.push(arg);
  10996. }
  10997. }
  10998. return results;
  10999. };
  11000. swizzle.wrap = function (fn) {
  11001. return function () {
  11002. return fn(swizzle(arguments));
  11003. };
  11004. };
  11005. });
  11006. var colorString = createCommonjsModule(function (module) {
  11007. /* MIT license */
  11008. var hasOwnProperty = Object.hasOwnProperty;
  11009. var reverseNames = {};
  11010. // create a list of reverse color names
  11011. for (var name in colorName$1) {
  11012. if (hasOwnProperty.call(colorName$1, name)) {
  11013. reverseNames[colorName$1[name]] = name;
  11014. }
  11015. }
  11016. var cs = module.exports = {
  11017. to: {},
  11018. get: {}
  11019. };
  11020. cs.get = function (string) {
  11021. var prefix = string.substring(0, 3).toLowerCase();
  11022. var val;
  11023. var model;
  11024. switch (prefix) {
  11025. case 'hsl':
  11026. val = cs.get.hsl(string);
  11027. model = 'hsl';
  11028. break;
  11029. case 'hwb':
  11030. val = cs.get.hwb(string);
  11031. model = 'hwb';
  11032. break;
  11033. default:
  11034. val = cs.get.rgb(string);
  11035. model = 'rgb';
  11036. break;
  11037. }
  11038. if (!val) {
  11039. return null;
  11040. }
  11041. return {model: model, value: val};
  11042. };
  11043. cs.get.rgb = function (string) {
  11044. if (!string) {
  11045. return null;
  11046. }
  11047. var abbr = /^#([a-f0-9]{3,4})$/i;
  11048. var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
  11049. var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
  11050. var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
  11051. var keyword = /^(\w+)$/;
  11052. var rgb = [0, 0, 0, 1];
  11053. var match;
  11054. var i;
  11055. var hexAlpha;
  11056. if (match = string.match(hex)) {
  11057. hexAlpha = match[2];
  11058. match = match[1];
  11059. for (i = 0; i < 3; i++) {
  11060. // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
  11061. var i2 = i * 2;
  11062. rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
  11063. }
  11064. if (hexAlpha) {
  11065. rgb[3] = parseInt(hexAlpha, 16) / 255;
  11066. }
  11067. } else if (match = string.match(abbr)) {
  11068. match = match[1];
  11069. hexAlpha = match[3];
  11070. for (i = 0; i < 3; i++) {
  11071. rgb[i] = parseInt(match[i] + match[i], 16);
  11072. }
  11073. if (hexAlpha) {
  11074. rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
  11075. }
  11076. } else if (match = string.match(rgba)) {
  11077. for (i = 0; i < 3; i++) {
  11078. rgb[i] = parseInt(match[i + 1], 0);
  11079. }
  11080. if (match[4]) {
  11081. if (match[5]) {
  11082. rgb[3] = parseFloat(match[4]) * 0.01;
  11083. } else {
  11084. rgb[3] = parseFloat(match[4]);
  11085. }
  11086. }
  11087. } else if (match = string.match(per)) {
  11088. for (i = 0; i < 3; i++) {
  11089. rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
  11090. }
  11091. if (match[4]) {
  11092. if (match[5]) {
  11093. rgb[3] = parseFloat(match[4]) * 0.01;
  11094. } else {
  11095. rgb[3] = parseFloat(match[4]);
  11096. }
  11097. }
  11098. } else if (match = string.match(keyword)) {
  11099. if (match[1] === 'transparent') {
  11100. return [0, 0, 0, 0];
  11101. }
  11102. if (!hasOwnProperty.call(colorName$1, match[1])) {
  11103. return null;
  11104. }
  11105. rgb = colorName$1[match[1]];
  11106. rgb[3] = 1;
  11107. return rgb;
  11108. } else {
  11109. return null;
  11110. }
  11111. for (i = 0; i < 3; i++) {
  11112. rgb[i] = clamp(rgb[i], 0, 255);
  11113. }
  11114. rgb[3] = clamp(rgb[3], 0, 1);
  11115. return rgb;
  11116. };
  11117. cs.get.hsl = function (string) {
  11118. if (!string) {
  11119. return null;
  11120. }
  11121. var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
  11122. var match = string.match(hsl);
  11123. if (match) {
  11124. var alpha = parseFloat(match[4]);
  11125. var h = ((parseFloat(match[1]) % 360) + 360) % 360;
  11126. var s = clamp(parseFloat(match[2]), 0, 100);
  11127. var l = clamp(parseFloat(match[3]), 0, 100);
  11128. var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
  11129. return [h, s, l, a];
  11130. }
  11131. return null;
  11132. };
  11133. cs.get.hwb = function (string) {
  11134. if (!string) {
  11135. return null;
  11136. }
  11137. var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
  11138. var match = string.match(hwb);
  11139. if (match) {
  11140. var alpha = parseFloat(match[4]);
  11141. var h = ((parseFloat(match[1]) % 360) + 360) % 360;
  11142. var w = clamp(parseFloat(match[2]), 0, 100);
  11143. var b = clamp(parseFloat(match[3]), 0, 100);
  11144. var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
  11145. return [h, w, b, a];
  11146. }
  11147. return null;
  11148. };
  11149. cs.to.hex = function () {
  11150. var rgba = simpleSwizzle(arguments);
  11151. return (
  11152. '#' +
  11153. hexDouble(rgba[0]) +
  11154. hexDouble(rgba[1]) +
  11155. hexDouble(rgba[2]) +
  11156. (rgba[3] < 1
  11157. ? (hexDouble(Math.round(rgba[3] * 255)))
  11158. : '')
  11159. );
  11160. };
  11161. cs.to.rgb = function () {
  11162. var rgba = simpleSwizzle(arguments);
  11163. return rgba.length < 4 || rgba[3] === 1
  11164. ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'
  11165. : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
  11166. };
  11167. cs.to.rgb.percent = function () {
  11168. var rgba = simpleSwizzle(arguments);
  11169. var r = Math.round(rgba[0] / 255 * 100);
  11170. var g = Math.round(rgba[1] / 255 * 100);
  11171. var b = Math.round(rgba[2] / 255 * 100);
  11172. return rgba.length < 4 || rgba[3] === 1
  11173. ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'
  11174. : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
  11175. };
  11176. cs.to.hsl = function () {
  11177. var hsla = simpleSwizzle(arguments);
  11178. return hsla.length < 4 || hsla[3] === 1
  11179. ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'
  11180. : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
  11181. };
  11182. // hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
  11183. // (hwb have alpha optional & 1 is default value)
  11184. cs.to.hwb = function () {
  11185. var hwba = simpleSwizzle(arguments);
  11186. var a = '';
  11187. if (hwba.length >= 4 && hwba[3] !== 1) {
  11188. a = ', ' + hwba[3];
  11189. }
  11190. return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
  11191. };
  11192. cs.to.keyword = function (rgb) {
  11193. return reverseNames[rgb.slice(0, 3)];
  11194. };
  11195. // helpers
  11196. function clamp(num, min, max) {
  11197. return Math.min(Math.max(min, num), max);
  11198. }
  11199. function hexDouble(num) {
  11200. var str = Math.round(num).toString(16).toUpperCase();
  11201. return (str.length < 2) ? '0' + str : str;
  11202. }
  11203. });
  11204. var colorName = {
  11205. "aliceblue": [240, 248, 255],
  11206. "antiquewhite": [250, 235, 215],
  11207. "aqua": [0, 255, 255],
  11208. "aquamarine": [127, 255, 212],
  11209. "azure": [240, 255, 255],
  11210. "beige": [245, 245, 220],
  11211. "bisque": [255, 228, 196],
  11212. "black": [0, 0, 0],
  11213. "blanchedalmond": [255, 235, 205],
  11214. "blue": [0, 0, 255],
  11215. "blueviolet": [138, 43, 226],
  11216. "brown": [165, 42, 42],
  11217. "burlywood": [222, 184, 135],
  11218. "cadetblue": [95, 158, 160],
  11219. "chartreuse": [127, 255, 0],
  11220. "chocolate": [210, 105, 30],
  11221. "coral": [255, 127, 80],
  11222. "cornflowerblue": [100, 149, 237],
  11223. "cornsilk": [255, 248, 220],
  11224. "crimson": [220, 20, 60],
  11225. "cyan": [0, 255, 255],
  11226. "darkblue": [0, 0, 139],
  11227. "darkcyan": [0, 139, 139],
  11228. "darkgoldenrod": [184, 134, 11],
  11229. "darkgray": [169, 169, 169],
  11230. "darkgreen": [0, 100, 0],
  11231. "darkgrey": [169, 169, 169],
  11232. "darkkhaki": [189, 183, 107],
  11233. "darkmagenta": [139, 0, 139],
  11234. "darkolivegreen": [85, 107, 47],
  11235. "darkorange": [255, 140, 0],
  11236. "darkorchid": [153, 50, 204],
  11237. "darkred": [139, 0, 0],
  11238. "darksalmon": [233, 150, 122],
  11239. "darkseagreen": [143, 188, 143],
  11240. "darkslateblue": [72, 61, 139],
  11241. "darkslategray": [47, 79, 79],
  11242. "darkslategrey": [47, 79, 79],
  11243. "darkturquoise": [0, 206, 209],
  11244. "darkviolet": [148, 0, 211],
  11245. "deeppink": [255, 20, 147],
  11246. "deepskyblue": [0, 191, 255],
  11247. "dimgray": [105, 105, 105],
  11248. "dimgrey": [105, 105, 105],
  11249. "dodgerblue": [30, 144, 255],
  11250. "firebrick": [178, 34, 34],
  11251. "floralwhite": [255, 250, 240],
  11252. "forestgreen": [34, 139, 34],
  11253. "fuchsia": [255, 0, 255],
  11254. "gainsboro": [220, 220, 220],
  11255. "ghostwhite": [248, 248, 255],
  11256. "gold": [255, 215, 0],
  11257. "goldenrod": [218, 165, 32],
  11258. "gray": [128, 128, 128],
  11259. "green": [0, 128, 0],
  11260. "greenyellow": [173, 255, 47],
  11261. "grey": [128, 128, 128],
  11262. "honeydew": [240, 255, 240],
  11263. "hotpink": [255, 105, 180],
  11264. "indianred": [205, 92, 92],
  11265. "indigo": [75, 0, 130],
  11266. "ivory": [255, 255, 240],
  11267. "khaki": [240, 230, 140],
  11268. "lavender": [230, 230, 250],
  11269. "lavenderblush": [255, 240, 245],
  11270. "lawngreen": [124, 252, 0],
  11271. "lemonchiffon": [255, 250, 205],
  11272. "lightblue": [173, 216, 230],
  11273. "lightcoral": [240, 128, 128],
  11274. "lightcyan": [224, 255, 255],
  11275. "lightgoldenrodyellow": [250, 250, 210],
  11276. "lightgray": [211, 211, 211],
  11277. "lightgreen": [144, 238, 144],
  11278. "lightgrey": [211, 211, 211],
  11279. "lightpink": [255, 182, 193],
  11280. "lightsalmon": [255, 160, 122],
  11281. "lightseagreen": [32, 178, 170],
  11282. "lightskyblue": [135, 206, 250],
  11283. "lightslategray": [119, 136, 153],
  11284. "lightslategrey": [119, 136, 153],
  11285. "lightsteelblue": [176, 196, 222],
  11286. "lightyellow": [255, 255, 224],
  11287. "lime": [0, 255, 0],
  11288. "limegreen": [50, 205, 50],
  11289. "linen": [250, 240, 230],
  11290. "magenta": [255, 0, 255],
  11291. "maroon": [128, 0, 0],
  11292. "mediumaquamarine": [102, 205, 170],
  11293. "mediumblue": [0, 0, 205],
  11294. "mediumorchid": [186, 85, 211],
  11295. "mediumpurple": [147, 112, 219],
  11296. "mediumseagreen": [60, 179, 113],
  11297. "mediumslateblue": [123, 104, 238],
  11298. "mediumspringgreen": [0, 250, 154],
  11299. "mediumturquoise": [72, 209, 204],
  11300. "mediumvioletred": [199, 21, 133],
  11301. "midnightblue": [25, 25, 112],
  11302. "mintcream": [245, 255, 250],
  11303. "mistyrose": [255, 228, 225],
  11304. "moccasin": [255, 228, 181],
  11305. "navajowhite": [255, 222, 173],
  11306. "navy": [0, 0, 128],
  11307. "oldlace": [253, 245, 230],
  11308. "olive": [128, 128, 0],
  11309. "olivedrab": [107, 142, 35],
  11310. "orange": [255, 165, 0],
  11311. "orangered": [255, 69, 0],
  11312. "orchid": [218, 112, 214],
  11313. "palegoldenrod": [238, 232, 170],
  11314. "palegreen": [152, 251, 152],
  11315. "paleturquoise": [175, 238, 238],
  11316. "palevioletred": [219, 112, 147],
  11317. "papayawhip": [255, 239, 213],
  11318. "peachpuff": [255, 218, 185],
  11319. "peru": [205, 133, 63],
  11320. "pink": [255, 192, 203],
  11321. "plum": [221, 160, 221],
  11322. "powderblue": [176, 224, 230],
  11323. "purple": [128, 0, 128],
  11324. "rebeccapurple": [102, 51, 153],
  11325. "red": [255, 0, 0],
  11326. "rosybrown": [188, 143, 143],
  11327. "royalblue": [65, 105, 225],
  11328. "saddlebrown": [139, 69, 19],
  11329. "salmon": [250, 128, 114],
  11330. "sandybrown": [244, 164, 96],
  11331. "seagreen": [46, 139, 87],
  11332. "seashell": [255, 245, 238],
  11333. "sienna": [160, 82, 45],
  11334. "silver": [192, 192, 192],
  11335. "skyblue": [135, 206, 235],
  11336. "slateblue": [106, 90, 205],
  11337. "slategray": [112, 128, 144],
  11338. "slategrey": [112, 128, 144],
  11339. "snow": [255, 250, 250],
  11340. "springgreen": [0, 255, 127],
  11341. "steelblue": [70, 130, 180],
  11342. "tan": [210, 180, 140],
  11343. "teal": [0, 128, 128],
  11344. "thistle": [216, 191, 216],
  11345. "tomato": [255, 99, 71],
  11346. "turquoise": [64, 224, 208],
  11347. "violet": [238, 130, 238],
  11348. "wheat": [245, 222, 179],
  11349. "white": [255, 255, 255],
  11350. "whitesmoke": [245, 245, 245],
  11351. "yellow": [255, 255, 0],
  11352. "yellowgreen": [154, 205, 50]
  11353. };
  11354. /* MIT license */
  11355. /* eslint-disable no-mixed-operators */
  11356. // NOTE: conversions should only return primitive values (i.e. arrays, or
  11357. // values that give correct `typeof` results).
  11358. // do not use box values types (i.e. Number(), String(), etc.)
  11359. const reverseKeywords = {};
  11360. for (const key of Object.keys(colorName)) {
  11361. reverseKeywords[colorName[key]] = key;
  11362. }
  11363. const convert$1 = {
  11364. rgb: {channels: 3, labels: 'rgb'},
  11365. hsl: {channels: 3, labels: 'hsl'},
  11366. hsv: {channels: 3, labels: 'hsv'},
  11367. hwb: {channels: 3, labels: 'hwb'},
  11368. cmyk: {channels: 4, labels: 'cmyk'},
  11369. xyz: {channels: 3, labels: 'xyz'},
  11370. lab: {channels: 3, labels: 'lab'},
  11371. lch: {channels: 3, labels: 'lch'},
  11372. hex: {channels: 1, labels: ['hex']},
  11373. keyword: {channels: 1, labels: ['keyword']},
  11374. ansi16: {channels: 1, labels: ['ansi16']},
  11375. ansi256: {channels: 1, labels: ['ansi256']},
  11376. hcg: {channels: 3, labels: ['h', 'c', 'g']},
  11377. apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
  11378. gray: {channels: 1, labels: ['gray']}
  11379. };
  11380. var conversions = convert$1;
  11381. // Hide .channels and .labels properties
  11382. for (const model of Object.keys(convert$1)) {
  11383. if (!('channels' in convert$1[model])) {
  11384. throw new Error('missing channels property: ' + model);
  11385. }
  11386. if (!('labels' in convert$1[model])) {
  11387. throw new Error('missing channel labels property: ' + model);
  11388. }
  11389. if (convert$1[model].labels.length !== convert$1[model].channels) {
  11390. throw new Error('channel and label counts mismatch: ' + model);
  11391. }
  11392. const {channels, labels} = convert$1[model];
  11393. delete convert$1[model].channels;
  11394. delete convert$1[model].labels;
  11395. Object.defineProperty(convert$1[model], 'channels', {value: channels});
  11396. Object.defineProperty(convert$1[model], 'labels', {value: labels});
  11397. }
  11398. convert$1.rgb.hsl = function (rgb) {
  11399. const r = rgb[0] / 255;
  11400. const g = rgb[1] / 255;
  11401. const b = rgb[2] / 255;
  11402. const min = Math.min(r, g, b);
  11403. const max = Math.max(r, g, b);
  11404. const delta = max - min;
  11405. let h;
  11406. let s;
  11407. if (max === min) {
  11408. h = 0;
  11409. } else if (r === max) {
  11410. h = (g - b) / delta;
  11411. } else if (g === max) {
  11412. h = 2 + (b - r) / delta;
  11413. } else if (b === max) {
  11414. h = 4 + (r - g) / delta;
  11415. }
  11416. h = Math.min(h * 60, 360);
  11417. if (h < 0) {
  11418. h += 360;
  11419. }
  11420. const l = (min + max) / 2;
  11421. if (max === min) {
  11422. s = 0;
  11423. } else if (l <= 0.5) {
  11424. s = delta / (max + min);
  11425. } else {
  11426. s = delta / (2 - max - min);
  11427. }
  11428. return [h, s * 100, l * 100];
  11429. };
  11430. convert$1.rgb.hsv = function (rgb) {
  11431. let rdif;
  11432. let gdif;
  11433. let bdif;
  11434. let h;
  11435. let s;
  11436. const r = rgb[0] / 255;
  11437. const g = rgb[1] / 255;
  11438. const b = rgb[2] / 255;
  11439. const v = Math.max(r, g, b);
  11440. const diff = v - Math.min(r, g, b);
  11441. const diffc = function (c) {
  11442. return (v - c) / 6 / diff + 1 / 2;
  11443. };
  11444. if (diff === 0) {
  11445. h = 0;
  11446. s = 0;
  11447. } else {
  11448. s = diff / v;
  11449. rdif = diffc(r);
  11450. gdif = diffc(g);
  11451. bdif = diffc(b);
  11452. if (r === v) {
  11453. h = bdif - gdif;
  11454. } else if (g === v) {
  11455. h = (1 / 3) + rdif - bdif;
  11456. } else if (b === v) {
  11457. h = (2 / 3) + gdif - rdif;
  11458. }
  11459. if (h < 0) {
  11460. h += 1;
  11461. } else if (h > 1) {
  11462. h -= 1;
  11463. }
  11464. }
  11465. return [
  11466. h * 360,
  11467. s * 100,
  11468. v * 100
  11469. ];
  11470. };
  11471. convert$1.rgb.hwb = function (rgb) {
  11472. const r = rgb[0];
  11473. const g = rgb[1];
  11474. let b = rgb[2];
  11475. const h = convert$1.rgb.hsl(rgb)[0];
  11476. const w = 1 / 255 * Math.min(r, Math.min(g, b));
  11477. b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
  11478. return [h, w * 100, b * 100];
  11479. };
  11480. convert$1.rgb.cmyk = function (rgb) {
  11481. const r = rgb[0] / 255;
  11482. const g = rgb[1] / 255;
  11483. const b = rgb[2] / 255;
  11484. const k = Math.min(1 - r, 1 - g, 1 - b);
  11485. const c = (1 - r - k) / (1 - k) || 0;
  11486. const m = (1 - g - k) / (1 - k) || 0;
  11487. const y = (1 - b - k) / (1 - k) || 0;
  11488. return [c * 100, m * 100, y * 100, k * 100];
  11489. };
  11490. function comparativeDistance(x, y) {
  11491. /*
  11492. See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
  11493. */
  11494. return (
  11495. ((x[0] - y[0]) ** 2) +
  11496. ((x[1] - y[1]) ** 2) +
  11497. ((x[2] - y[2]) ** 2)
  11498. );
  11499. }
  11500. convert$1.rgb.keyword = function (rgb) {
  11501. const reversed = reverseKeywords[rgb];
  11502. if (reversed) {
  11503. return reversed;
  11504. }
  11505. let currentClosestDistance = Infinity;
  11506. let currentClosestKeyword;
  11507. for (const keyword of Object.keys(colorName)) {
  11508. const value = colorName[keyword];
  11509. // Compute comparative distance
  11510. const distance = comparativeDistance(rgb, value);
  11511. // Check if its less, if so set as closest
  11512. if (distance < currentClosestDistance) {
  11513. currentClosestDistance = distance;
  11514. currentClosestKeyword = keyword;
  11515. }
  11516. }
  11517. return currentClosestKeyword;
  11518. };
  11519. convert$1.keyword.rgb = function (keyword) {
  11520. return colorName[keyword];
  11521. };
  11522. convert$1.rgb.xyz = function (rgb) {
  11523. let r = rgb[0] / 255;
  11524. let g = rgb[1] / 255;
  11525. let b = rgb[2] / 255;
  11526. // Assume sRGB
  11527. r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
  11528. g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
  11529. b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
  11530. const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
  11531. const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
  11532. const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
  11533. return [x * 100, y * 100, z * 100];
  11534. };
  11535. convert$1.rgb.lab = function (rgb) {
  11536. const xyz = convert$1.rgb.xyz(rgb);
  11537. let x = xyz[0];
  11538. let y = xyz[1];
  11539. let z = xyz[2];
  11540. x /= 95.047;
  11541. y /= 100;
  11542. z /= 108.883;
  11543. x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
  11544. y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
  11545. z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
  11546. const l = (116 * y) - 16;
  11547. const a = 500 * (x - y);
  11548. const b = 200 * (y - z);
  11549. return [l, a, b];
  11550. };
  11551. convert$1.hsl.rgb = function (hsl) {
  11552. const h = hsl[0] / 360;
  11553. const s = hsl[1] / 100;
  11554. const l = hsl[2] / 100;
  11555. let t2;
  11556. let t3;
  11557. let val;
  11558. if (s === 0) {
  11559. val = l * 255;
  11560. return [val, val, val];
  11561. }
  11562. if (l < 0.5) {
  11563. t2 = l * (1 + s);
  11564. } else {
  11565. t2 = l + s - l * s;
  11566. }
  11567. const t1 = 2 * l - t2;
  11568. const rgb = [0, 0, 0];
  11569. for (let i = 0; i < 3; i++) {
  11570. t3 = h + 1 / 3 * -(i - 1);
  11571. if (t3 < 0) {
  11572. t3++;
  11573. }
  11574. if (t3 > 1) {
  11575. t3--;
  11576. }
  11577. if (6 * t3 < 1) {
  11578. val = t1 + (t2 - t1) * 6 * t3;
  11579. } else if (2 * t3 < 1) {
  11580. val = t2;
  11581. } else if (3 * t3 < 2) {
  11582. val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
  11583. } else {
  11584. val = t1;
  11585. }
  11586. rgb[i] = val * 255;
  11587. }
  11588. return rgb;
  11589. };
  11590. convert$1.hsl.hsv = function (hsl) {
  11591. const h = hsl[0];
  11592. let s = hsl[1] / 100;
  11593. let l = hsl[2] / 100;
  11594. let smin = s;
  11595. const lmin = Math.max(l, 0.01);
  11596. l *= 2;
  11597. s *= (l <= 1) ? l : 2 - l;
  11598. smin *= lmin <= 1 ? lmin : 2 - lmin;
  11599. const v = (l + s) / 2;
  11600. const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
  11601. return [h, sv * 100, v * 100];
  11602. };
  11603. convert$1.hsv.rgb = function (hsv) {
  11604. const h = hsv[0] / 60;
  11605. const s = hsv[1] / 100;
  11606. let v = hsv[2] / 100;
  11607. const hi = Math.floor(h) % 6;
  11608. const f = h - Math.floor(h);
  11609. const p = 255 * v * (1 - s);
  11610. const q = 255 * v * (1 - (s * f));
  11611. const t = 255 * v * (1 - (s * (1 - f)));
  11612. v *= 255;
  11613. switch (hi) {
  11614. case 0:
  11615. return [v, t, p];
  11616. case 1:
  11617. return [q, v, p];
  11618. case 2:
  11619. return [p, v, t];
  11620. case 3:
  11621. return [p, q, v];
  11622. case 4:
  11623. return [t, p, v];
  11624. case 5:
  11625. return [v, p, q];
  11626. }
  11627. };
  11628. convert$1.hsv.hsl = function (hsv) {
  11629. const h = hsv[0];
  11630. const s = hsv[1] / 100;
  11631. const v = hsv[2] / 100;
  11632. const vmin = Math.max(v, 0.01);
  11633. let sl;
  11634. let l;
  11635. l = (2 - s) * v;
  11636. const lmin = (2 - s) * vmin;
  11637. sl = s * vmin;
  11638. sl /= (lmin <= 1) ? lmin : 2 - lmin;
  11639. sl = sl || 0;
  11640. l /= 2;
  11641. return [h, sl * 100, l * 100];
  11642. };
  11643. // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
  11644. convert$1.hwb.rgb = function (hwb) {
  11645. const h = hwb[0] / 360;
  11646. let wh = hwb[1] / 100;
  11647. let bl = hwb[2] / 100;
  11648. const ratio = wh + bl;
  11649. let f;
  11650. // Wh + bl cant be > 1
  11651. if (ratio > 1) {
  11652. wh /= ratio;
  11653. bl /= ratio;
  11654. }
  11655. const i = Math.floor(6 * h);
  11656. const v = 1 - bl;
  11657. f = 6 * h - i;
  11658. if ((i & 0x01) !== 0) {
  11659. f = 1 - f;
  11660. }
  11661. const n = wh + f * (v - wh); // Linear interpolation
  11662. let r;
  11663. let g;
  11664. let b;
  11665. /* eslint-disable max-statements-per-line,no-multi-spaces */
  11666. switch (i) {
  11667. default:
  11668. case 6:
  11669. case 0: r = v; g = n; b = wh; break;
  11670. case 1: r = n; g = v; b = wh; break;
  11671. case 2: r = wh; g = v; b = n; break;
  11672. case 3: r = wh; g = n; b = v; break;
  11673. case 4: r = n; g = wh; b = v; break;
  11674. case 5: r = v; g = wh; b = n; break;
  11675. }
  11676. /* eslint-enable max-statements-per-line,no-multi-spaces */
  11677. return [r * 255, g * 255, b * 255];
  11678. };
  11679. convert$1.cmyk.rgb = function (cmyk) {
  11680. const c = cmyk[0] / 100;
  11681. const m = cmyk[1] / 100;
  11682. const y = cmyk[2] / 100;
  11683. const k = cmyk[3] / 100;
  11684. const r = 1 - Math.min(1, c * (1 - k) + k);
  11685. const g = 1 - Math.min(1, m * (1 - k) + k);
  11686. const b = 1 - Math.min(1, y * (1 - k) + k);
  11687. return [r * 255, g * 255, b * 255];
  11688. };
  11689. convert$1.xyz.rgb = function (xyz) {
  11690. const x = xyz[0] / 100;
  11691. const y = xyz[1] / 100;
  11692. const z = xyz[2] / 100;
  11693. let r;
  11694. let g;
  11695. let b;
  11696. r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
  11697. g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
  11698. b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
  11699. // Assume sRGB
  11700. r = r > 0.0031308
  11701. ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
  11702. : r * 12.92;
  11703. g = g > 0.0031308
  11704. ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
  11705. : g * 12.92;
  11706. b = b > 0.0031308
  11707. ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
  11708. : b * 12.92;
  11709. r = Math.min(Math.max(0, r), 1);
  11710. g = Math.min(Math.max(0, g), 1);
  11711. b = Math.min(Math.max(0, b), 1);
  11712. return [r * 255, g * 255, b * 255];
  11713. };
  11714. convert$1.xyz.lab = function (xyz) {
  11715. let x = xyz[0];
  11716. let y = xyz[1];
  11717. let z = xyz[2];
  11718. x /= 95.047;
  11719. y /= 100;
  11720. z /= 108.883;
  11721. x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
  11722. y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
  11723. z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
  11724. const l = (116 * y) - 16;
  11725. const a = 500 * (x - y);
  11726. const b = 200 * (y - z);
  11727. return [l, a, b];
  11728. };
  11729. convert$1.lab.xyz = function (lab) {
  11730. const l = lab[0];
  11731. const a = lab[1];
  11732. const b = lab[2];
  11733. let x;
  11734. let y;
  11735. let z;
  11736. y = (l + 16) / 116;
  11737. x = a / 500 + y;
  11738. z = y - b / 200;
  11739. const y2 = y ** 3;
  11740. const x2 = x ** 3;
  11741. const z2 = z ** 3;
  11742. y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
  11743. x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
  11744. z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
  11745. x *= 95.047;
  11746. y *= 100;
  11747. z *= 108.883;
  11748. return [x, y, z];
  11749. };
  11750. convert$1.lab.lch = function (lab) {
  11751. const l = lab[0];
  11752. const a = lab[1];
  11753. const b = lab[2];
  11754. let h;
  11755. const hr = Math.atan2(b, a);
  11756. h = hr * 360 / 2 / Math.PI;
  11757. if (h < 0) {
  11758. h += 360;
  11759. }
  11760. const c = Math.sqrt(a * a + b * b);
  11761. return [l, c, h];
  11762. };
  11763. convert$1.lch.lab = function (lch) {
  11764. const l = lch[0];
  11765. const c = lch[1];
  11766. const h = lch[2];
  11767. const hr = h / 360 * 2 * Math.PI;
  11768. const a = c * Math.cos(hr);
  11769. const b = c * Math.sin(hr);
  11770. return [l, a, b];
  11771. };
  11772. convert$1.rgb.ansi16 = function (args, saturation = null) {
  11773. const [r, g, b] = args;
  11774. let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
  11775. value = Math.round(value / 50);
  11776. if (value === 0) {
  11777. return 30;
  11778. }
  11779. let ansi = 30
  11780. + ((Math.round(b / 255) << 2)
  11781. | (Math.round(g / 255) << 1)
  11782. | Math.round(r / 255));
  11783. if (value === 2) {
  11784. ansi += 60;
  11785. }
  11786. return ansi;
  11787. };
  11788. convert$1.hsv.ansi16 = function (args) {
  11789. // Optimization here; we already know the value and don't need to get
  11790. // it converted for us.
  11791. return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
  11792. };
  11793. convert$1.rgb.ansi256 = function (args) {
  11794. const r = args[0];
  11795. const g = args[1];
  11796. const b = args[2];
  11797. // We use the extended greyscale palette here, with the exception of
  11798. // black and white. normal palette only has 4 greyscale shades.
  11799. if (r === g && g === b) {
  11800. if (r < 8) {
  11801. return 16;
  11802. }
  11803. if (r > 248) {
  11804. return 231;
  11805. }
  11806. return Math.round(((r - 8) / 247) * 24) + 232;
  11807. }
  11808. const ansi = 16
  11809. + (36 * Math.round(r / 255 * 5))
  11810. + (6 * Math.round(g / 255 * 5))
  11811. + Math.round(b / 255 * 5);
  11812. return ansi;
  11813. };
  11814. convert$1.ansi16.rgb = function (args) {
  11815. let color = args % 10;
  11816. // Handle greyscale
  11817. if (color === 0 || color === 7) {
  11818. if (args > 50) {
  11819. color += 3.5;
  11820. }
  11821. color = color / 10.5 * 255;
  11822. return [color, color, color];
  11823. }
  11824. const mult = (~~(args > 50) + 1) * 0.5;
  11825. const r = ((color & 1) * mult) * 255;
  11826. const g = (((color >> 1) & 1) * mult) * 255;
  11827. const b = (((color >> 2) & 1) * mult) * 255;
  11828. return [r, g, b];
  11829. };
  11830. convert$1.ansi256.rgb = function (args) {
  11831. // Handle greyscale
  11832. if (args >= 232) {
  11833. const c = (args - 232) * 10 + 8;
  11834. return [c, c, c];
  11835. }
  11836. args -= 16;
  11837. let rem;
  11838. const r = Math.floor(args / 36) / 5 * 255;
  11839. const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
  11840. const b = (rem % 6) / 5 * 255;
  11841. return [r, g, b];
  11842. };
  11843. convert$1.rgb.hex = function (args) {
  11844. const integer = ((Math.round(args[0]) & 0xFF) << 16)
  11845. + ((Math.round(args[1]) & 0xFF) << 8)
  11846. + (Math.round(args[2]) & 0xFF);
  11847. const string = integer.toString(16).toUpperCase();
  11848. return '000000'.substring(string.length) + string;
  11849. };
  11850. convert$1.hex.rgb = function (args) {
  11851. const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
  11852. if (!match) {
  11853. return [0, 0, 0];
  11854. }
  11855. let colorString = match[0];
  11856. if (match[0].length === 3) {
  11857. colorString = colorString.split('').map(char => {
  11858. return char + char;
  11859. }).join('');
  11860. }
  11861. const integer = parseInt(colorString, 16);
  11862. const r = (integer >> 16) & 0xFF;
  11863. const g = (integer >> 8) & 0xFF;
  11864. const b = integer & 0xFF;
  11865. return [r, g, b];
  11866. };
  11867. convert$1.rgb.hcg = function (rgb) {
  11868. const r = rgb[0] / 255;
  11869. const g = rgb[1] / 255;
  11870. const b = rgb[2] / 255;
  11871. const max = Math.max(Math.max(r, g), b);
  11872. const min = Math.min(Math.min(r, g), b);
  11873. const chroma = (max - min);
  11874. let grayscale;
  11875. let hue;
  11876. if (chroma < 1) {
  11877. grayscale = min / (1 - chroma);
  11878. } else {
  11879. grayscale = 0;
  11880. }
  11881. if (chroma <= 0) {
  11882. hue = 0;
  11883. } else
  11884. if (max === r) {
  11885. hue = ((g - b) / chroma) % 6;
  11886. } else
  11887. if (max === g) {
  11888. hue = 2 + (b - r) / chroma;
  11889. } else {
  11890. hue = 4 + (r - g) / chroma;
  11891. }
  11892. hue /= 6;
  11893. hue %= 1;
  11894. return [hue * 360, chroma * 100, grayscale * 100];
  11895. };
  11896. convert$1.hsl.hcg = function (hsl) {
  11897. const s = hsl[1] / 100;
  11898. const l = hsl[2] / 100;
  11899. const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
  11900. let f = 0;
  11901. if (c < 1.0) {
  11902. f = (l - 0.5 * c) / (1.0 - c);
  11903. }
  11904. return [hsl[0], c * 100, f * 100];
  11905. };
  11906. convert$1.hsv.hcg = function (hsv) {
  11907. const s = hsv[1] / 100;
  11908. const v = hsv[2] / 100;
  11909. const c = s * v;
  11910. let f = 0;
  11911. if (c < 1.0) {
  11912. f = (v - c) / (1 - c);
  11913. }
  11914. return [hsv[0], c * 100, f * 100];
  11915. };
  11916. convert$1.hcg.rgb = function (hcg) {
  11917. const h = hcg[0] / 360;
  11918. const c = hcg[1] / 100;
  11919. const g = hcg[2] / 100;
  11920. if (c === 0.0) {
  11921. return [g * 255, g * 255, g * 255];
  11922. }
  11923. const pure = [0, 0, 0];
  11924. const hi = (h % 1) * 6;
  11925. const v = hi % 1;
  11926. const w = 1 - v;
  11927. let mg = 0;
  11928. /* eslint-disable max-statements-per-line */
  11929. switch (Math.floor(hi)) {
  11930. case 0:
  11931. pure[0] = 1; pure[1] = v; pure[2] = 0; break;
  11932. case 1:
  11933. pure[0] = w; pure[1] = 1; pure[2] = 0; break;
  11934. case 2:
  11935. pure[0] = 0; pure[1] = 1; pure[2] = v; break;
  11936. case 3:
  11937. pure[0] = 0; pure[1] = w; pure[2] = 1; break;
  11938. case 4:
  11939. pure[0] = v; pure[1] = 0; pure[2] = 1; break;
  11940. default:
  11941. pure[0] = 1; pure[1] = 0; pure[2] = w;
  11942. }
  11943. /* eslint-enable max-statements-per-line */
  11944. mg = (1.0 - c) * g;
  11945. return [
  11946. (c * pure[0] + mg) * 255,
  11947. (c * pure[1] + mg) * 255,
  11948. (c * pure[2] + mg) * 255
  11949. ];
  11950. };
  11951. convert$1.hcg.hsv = function (hcg) {
  11952. const c = hcg[1] / 100;
  11953. const g = hcg[2] / 100;
  11954. const v = c + g * (1.0 - c);
  11955. let f = 0;
  11956. if (v > 0.0) {
  11957. f = c / v;
  11958. }
  11959. return [hcg[0], f * 100, v * 100];
  11960. };
  11961. convert$1.hcg.hsl = function (hcg) {
  11962. const c = hcg[1] / 100;
  11963. const g = hcg[2] / 100;
  11964. const l = g * (1.0 - c) + 0.5 * c;
  11965. let s = 0;
  11966. if (l > 0.0 && l < 0.5) {
  11967. s = c / (2 * l);
  11968. } else
  11969. if (l >= 0.5 && l < 1.0) {
  11970. s = c / (2 * (1 - l));
  11971. }
  11972. return [hcg[0], s * 100, l * 100];
  11973. };
  11974. convert$1.hcg.hwb = function (hcg) {
  11975. const c = hcg[1] / 100;
  11976. const g = hcg[2] / 100;
  11977. const v = c + g * (1.0 - c);
  11978. return [hcg[0], (v - c) * 100, (1 - v) * 100];
  11979. };
  11980. convert$1.hwb.hcg = function (hwb) {
  11981. const w = hwb[1] / 100;
  11982. const b = hwb[2] / 100;
  11983. const v = 1 - b;
  11984. const c = v - w;
  11985. let g = 0;
  11986. if (c < 1) {
  11987. g = (v - c) / (1 - c);
  11988. }
  11989. return [hwb[0], c * 100, g * 100];
  11990. };
  11991. convert$1.apple.rgb = function (apple) {
  11992. return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
  11993. };
  11994. convert$1.rgb.apple = function (rgb) {
  11995. return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
  11996. };
  11997. convert$1.gray.rgb = function (args) {
  11998. return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  11999. };
  12000. convert$1.gray.hsl = function (args) {
  12001. return [0, 0, args[0]];
  12002. };
  12003. convert$1.gray.hsv = convert$1.gray.hsl;
  12004. convert$1.gray.hwb = function (gray) {
  12005. return [0, 100, gray[0]];
  12006. };
  12007. convert$1.gray.cmyk = function (gray) {
  12008. return [0, 0, 0, gray[0]];
  12009. };
  12010. convert$1.gray.lab = function (gray) {
  12011. return [gray[0], 0, 0];
  12012. };
  12013. convert$1.gray.hex = function (gray) {
  12014. const val = Math.round(gray[0] / 100 * 255) & 0xFF;
  12015. const integer = (val << 16) + (val << 8) + val;
  12016. const string = integer.toString(16).toUpperCase();
  12017. return '000000'.substring(string.length) + string;
  12018. };
  12019. convert$1.rgb.gray = function (rgb) {
  12020. const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
  12021. return [val / 255 * 100];
  12022. };
  12023. /*
  12024. This function routes a model to all other models.
  12025. all functions that are routed have a property `.conversion` attached
  12026. to the returned synthetic function. This property is an array
  12027. of strings, each with the steps in between the 'from' and 'to'
  12028. color models (inclusive).
  12029. conversions that are not possible simply are not included.
  12030. */
  12031. function buildGraph() {
  12032. const graph = {};
  12033. // https://jsperf.com/object-keys-vs-for-in-with-closure/3
  12034. const models = Object.keys(conversions);
  12035. for (let len = models.length, i = 0; i < len; i++) {
  12036. graph[models[i]] = {
  12037. // http://jsperf.com/1-vs-infinity
  12038. // micro-opt, but this is simple.
  12039. distance: -1,
  12040. parent: null
  12041. };
  12042. }
  12043. return graph;
  12044. }
  12045. // https://en.wikipedia.org/wiki/Breadth-first_search
  12046. function deriveBFS(fromModel) {
  12047. const graph = buildGraph();
  12048. const queue = [fromModel]; // Unshift -> queue -> pop
  12049. graph[fromModel].distance = 0;
  12050. while (queue.length) {
  12051. const current = queue.pop();
  12052. const adjacents = Object.keys(conversions[current]);
  12053. for (let len = adjacents.length, i = 0; i < len; i++) {
  12054. const adjacent = adjacents[i];
  12055. const node = graph[adjacent];
  12056. if (node.distance === -1) {
  12057. node.distance = graph[current].distance + 1;
  12058. node.parent = current;
  12059. queue.unshift(adjacent);
  12060. }
  12061. }
  12062. }
  12063. return graph;
  12064. }
  12065. function link(from, to) {
  12066. return function (args) {
  12067. return to(from(args));
  12068. };
  12069. }
  12070. function wrapConversion(toModel, graph) {
  12071. const path = [graph[toModel].parent, toModel];
  12072. let fn = conversions[graph[toModel].parent][toModel];
  12073. let cur = graph[toModel].parent;
  12074. while (graph[cur].parent) {
  12075. path.unshift(graph[cur].parent);
  12076. fn = link(conversions[graph[cur].parent][cur], fn);
  12077. cur = graph[cur].parent;
  12078. }
  12079. fn.conversion = path;
  12080. return fn;
  12081. }
  12082. var route = function (fromModel) {
  12083. const graph = deriveBFS(fromModel);
  12084. const conversion = {};
  12085. const models = Object.keys(graph);
  12086. for (let len = models.length, i = 0; i < len; i++) {
  12087. const toModel = models[i];
  12088. const node = graph[toModel];
  12089. if (node.parent === null) {
  12090. // No possible conversion, or this node is the source model.
  12091. continue;
  12092. }
  12093. conversion[toModel] = wrapConversion(toModel, graph);
  12094. }
  12095. return conversion;
  12096. };
  12097. const convert = {};
  12098. const models = Object.keys(conversions);
  12099. function wrapRaw(fn) {
  12100. const wrappedFn = function (...args) {
  12101. const arg0 = args[0];
  12102. if (arg0 === undefined || arg0 === null) {
  12103. return arg0;
  12104. }
  12105. if (arg0.length > 1) {
  12106. args = arg0;
  12107. }
  12108. return fn(args);
  12109. };
  12110. // Preserve .conversion property if there is one
  12111. if ('conversion' in fn) {
  12112. wrappedFn.conversion = fn.conversion;
  12113. }
  12114. return wrappedFn;
  12115. }
  12116. function wrapRounded(fn) {
  12117. const wrappedFn = function (...args) {
  12118. const arg0 = args[0];
  12119. if (arg0 === undefined || arg0 === null) {
  12120. return arg0;
  12121. }
  12122. if (arg0.length > 1) {
  12123. args = arg0;
  12124. }
  12125. const result = fn(args);
  12126. // We're assuming the result is an array here.
  12127. // see notice in conversions.js; don't use box types
  12128. // in conversion functions.
  12129. if (typeof result === 'object') {
  12130. for (let len = result.length, i = 0; i < len; i++) {
  12131. result[i] = Math.round(result[i]);
  12132. }
  12133. }
  12134. return result;
  12135. };
  12136. // Preserve .conversion property if there is one
  12137. if ('conversion' in fn) {
  12138. wrappedFn.conversion = fn.conversion;
  12139. }
  12140. return wrappedFn;
  12141. }
  12142. models.forEach(fromModel => {
  12143. convert[fromModel] = {};
  12144. Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
  12145. Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
  12146. const routes = route(fromModel);
  12147. const routeModels = Object.keys(routes);
  12148. routeModels.forEach(toModel => {
  12149. const fn = routes[toModel];
  12150. convert[fromModel][toModel] = wrapRounded(fn);
  12151. convert[fromModel][toModel].raw = wrapRaw(fn);
  12152. });
  12153. });
  12154. var colorConvert = convert;
  12155. const skippedModels = [
  12156. // To be honest, I don't really feel like keyword belongs in color convert, but eh.
  12157. 'keyword',
  12158. // Gray conflicts with some method names, and has its own method defined.
  12159. 'gray',
  12160. // Shouldn't really be in color-convert either...
  12161. 'hex',
  12162. ];
  12163. const hashedModelKeys = {};
  12164. for (const model of Object.keys(colorConvert)) {
  12165. hashedModelKeys[[...colorConvert[model].labels].sort().join('')] = model;
  12166. }
  12167. const limiters = {};
  12168. function Color(object, model) {
  12169. if (!(this instanceof Color)) {
  12170. return new Color(object, model);
  12171. }
  12172. if (model && model in skippedModels) {
  12173. model = null;
  12174. }
  12175. if (model && !(model in colorConvert)) {
  12176. throw new Error('Unknown model: ' + model);
  12177. }
  12178. let i;
  12179. let channels;
  12180. if (object == null) { // eslint-disable-line no-eq-null,eqeqeq
  12181. this.model = 'rgb';
  12182. this.color = [0, 0, 0];
  12183. this.valpha = 1;
  12184. } else if (object instanceof Color) {
  12185. this.model = object.model;
  12186. this.color = [...object.color];
  12187. this.valpha = object.valpha;
  12188. } else if (typeof object === 'string') {
  12189. const result = colorString.get(object);
  12190. if (result === null) {
  12191. throw new Error('Unable to parse color from string: ' + object);
  12192. }
  12193. this.model = result.model;
  12194. channels = colorConvert[this.model].channels;
  12195. this.color = result.value.slice(0, channels);
  12196. this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
  12197. } else if (object.length > 0) {
  12198. this.model = model || 'rgb';
  12199. channels = colorConvert[this.model].channels;
  12200. const newArray = Array.prototype.slice.call(object, 0, channels);
  12201. this.color = zeroArray(newArray, channels);
  12202. this.valpha = typeof object[channels] === 'number' ? object[channels] : 1;
  12203. } else if (typeof object === 'number') {
  12204. // This is always RGB - can be converted later on.
  12205. this.model = 'rgb';
  12206. this.color = [
  12207. (object >> 16) & 0xFF,
  12208. (object >> 8) & 0xFF,
  12209. object & 0xFF,
  12210. ];
  12211. this.valpha = 1;
  12212. } else {
  12213. this.valpha = 1;
  12214. const keys = Object.keys(object);
  12215. if ('alpha' in object) {
  12216. keys.splice(keys.indexOf('alpha'), 1);
  12217. this.valpha = typeof object.alpha === 'number' ? object.alpha : 0;
  12218. }
  12219. const hashedKeys = keys.sort().join('');
  12220. if (!(hashedKeys in hashedModelKeys)) {
  12221. throw new Error('Unable to parse color from object: ' + JSON.stringify(object));
  12222. }
  12223. this.model = hashedModelKeys[hashedKeys];
  12224. const {labels} = colorConvert[this.model];
  12225. const color = [];
  12226. for (i = 0; i < labels.length; i++) {
  12227. color.push(object[labels[i]]);
  12228. }
  12229. this.color = zeroArray(color);
  12230. }
  12231. // Perform limitations (clamping, etc.)
  12232. if (limiters[this.model]) {
  12233. channels = colorConvert[this.model].channels;
  12234. for (i = 0; i < channels; i++) {
  12235. const limit = limiters[this.model][i];
  12236. if (limit) {
  12237. this.color[i] = limit(this.color[i]);
  12238. }
  12239. }
  12240. }
  12241. this.valpha = Math.max(0, Math.min(1, this.valpha));
  12242. if (Object.freeze) {
  12243. Object.freeze(this);
  12244. }
  12245. }
  12246. Color.prototype = {
  12247. toString() {
  12248. return this.string();
  12249. },
  12250. toJSON() {
  12251. return this[this.model]();
  12252. },
  12253. string(places) {
  12254. let self = this.model in colorString.to ? this : this.rgb();
  12255. self = self.round(typeof places === 'number' ? places : 1);
  12256. const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
  12257. return colorString.to[self.model](args);
  12258. },
  12259. percentString(places) {
  12260. const self = this.rgb().round(typeof places === 'number' ? places : 1);
  12261. const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
  12262. return colorString.to.rgb.percent(args);
  12263. },
  12264. array() {
  12265. return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
  12266. },
  12267. object() {
  12268. const result = {};
  12269. const {channels} = colorConvert[this.model];
  12270. const {labels} = colorConvert[this.model];
  12271. for (let i = 0; i < channels; i++) {
  12272. result[labels[i]] = this.color[i];
  12273. }
  12274. if (this.valpha !== 1) {
  12275. result.alpha = this.valpha;
  12276. }
  12277. return result;
  12278. },
  12279. unitArray() {
  12280. const rgb = this.rgb().color;
  12281. rgb[0] /= 255;
  12282. rgb[1] /= 255;
  12283. rgb[2] /= 255;
  12284. if (this.valpha !== 1) {
  12285. rgb.push(this.valpha);
  12286. }
  12287. return rgb;
  12288. },
  12289. unitObject() {
  12290. const rgb = this.rgb().object();
  12291. rgb.r /= 255;
  12292. rgb.g /= 255;
  12293. rgb.b /= 255;
  12294. if (this.valpha !== 1) {
  12295. rgb.alpha = this.valpha;
  12296. }
  12297. return rgb;
  12298. },
  12299. round(places) {
  12300. places = Math.max(places || 0, 0);
  12301. return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
  12302. },
  12303. alpha(value) {
  12304. if (value !== undefined) {
  12305. return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);
  12306. }
  12307. return this.valpha;
  12308. },
  12309. // Rgb
  12310. red: getset('rgb', 0, maxfn(255)),
  12311. green: getset('rgb', 1, maxfn(255)),
  12312. blue: getset('rgb', 2, maxfn(255)),
  12313. hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360),
  12314. saturationl: getset('hsl', 1, maxfn(100)),
  12315. lightness: getset('hsl', 2, maxfn(100)),
  12316. saturationv: getset('hsv', 1, maxfn(100)),
  12317. value: getset('hsv', 2, maxfn(100)),
  12318. chroma: getset('hcg', 1, maxfn(100)),
  12319. gray: getset('hcg', 2, maxfn(100)),
  12320. white: getset('hwb', 1, maxfn(100)),
  12321. wblack: getset('hwb', 2, maxfn(100)),
  12322. cyan: getset('cmyk', 0, maxfn(100)),
  12323. magenta: getset('cmyk', 1, maxfn(100)),
  12324. yellow: getset('cmyk', 2, maxfn(100)),
  12325. black: getset('cmyk', 3, maxfn(100)),
  12326. x: getset('xyz', 0, maxfn(95.047)),
  12327. y: getset('xyz', 1, maxfn(100)),
  12328. z: getset('xyz', 2, maxfn(108.833)),
  12329. l: getset('lab', 0, maxfn(100)),
  12330. a: getset('lab', 1),
  12331. b: getset('lab', 2),
  12332. keyword(value) {
  12333. if (value !== undefined) {
  12334. return new Color(value);
  12335. }
  12336. return colorConvert[this.model].keyword(this.color);
  12337. },
  12338. hex(value) {
  12339. if (value !== undefined) {
  12340. return new Color(value);
  12341. }
  12342. return colorString.to.hex(this.rgb().round().color);
  12343. },
  12344. hexa(value) {
  12345. if (value !== undefined) {
  12346. return new Color(value);
  12347. }
  12348. const rgbArray = this.rgb().round().color;
  12349. let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
  12350. if (alphaHex.length === 1) {
  12351. alphaHex = '0' + alphaHex;
  12352. }
  12353. return colorString.to.hex(rgbArray) + alphaHex;
  12354. },
  12355. rgbNumber() {
  12356. const rgb = this.rgb().color;
  12357. return ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);
  12358. },
  12359. luminosity() {
  12360. // http://www.w3.org/TR/WCAG20/#relativeluminancedef
  12361. const rgb = this.rgb().color;
  12362. const lum = [];
  12363. for (const [i, element] of rgb.entries()) {
  12364. const chan = element / 255;
  12365. lum[i] = (chan <= 0.04045) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
  12366. }
  12367. return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
  12368. },
  12369. contrast(color2) {
  12370. // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
  12371. const lum1 = this.luminosity();
  12372. const lum2 = color2.luminosity();
  12373. if (lum1 > lum2) {
  12374. return (lum1 + 0.05) / (lum2 + 0.05);
  12375. }
  12376. return (lum2 + 0.05) / (lum1 + 0.05);
  12377. },
  12378. level(color2) {
  12379. // https://www.w3.org/TR/WCAG/#contrast-enhanced
  12380. const contrastRatio = this.contrast(color2);
  12381. if (contrastRatio >= 7) {
  12382. return 'AAA';
  12383. }
  12384. return (contrastRatio >= 4.5) ? 'AA' : '';
  12385. },
  12386. isDark() {
  12387. // YIQ equation from http://24ways.org/2010/calculating-color-contrast
  12388. const rgb = this.rgb().color;
  12389. const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;
  12390. return yiq < 128;
  12391. },
  12392. isLight() {
  12393. return !this.isDark();
  12394. },
  12395. negate() {
  12396. const rgb = this.rgb();
  12397. for (let i = 0; i < 3; i++) {
  12398. rgb.color[i] = 255 - rgb.color[i];
  12399. }
  12400. return rgb;
  12401. },
  12402. lighten(ratio) {
  12403. const hsl = this.hsl();
  12404. hsl.color[2] += hsl.color[2] * ratio;
  12405. return hsl;
  12406. },
  12407. darken(ratio) {
  12408. const hsl = this.hsl();
  12409. hsl.color[2] -= hsl.color[2] * ratio;
  12410. return hsl;
  12411. },
  12412. saturate(ratio) {
  12413. const hsl = this.hsl();
  12414. hsl.color[1] += hsl.color[1] * ratio;
  12415. return hsl;
  12416. },
  12417. desaturate(ratio) {
  12418. const hsl = this.hsl();
  12419. hsl.color[1] -= hsl.color[1] * ratio;
  12420. return hsl;
  12421. },
  12422. whiten(ratio) {
  12423. const hwb = this.hwb();
  12424. hwb.color[1] += hwb.color[1] * ratio;
  12425. return hwb;
  12426. },
  12427. blacken(ratio) {
  12428. const hwb = this.hwb();
  12429. hwb.color[2] += hwb.color[2] * ratio;
  12430. return hwb;
  12431. },
  12432. grayscale() {
  12433. // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
  12434. const rgb = this.rgb().color;
  12435. const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
  12436. return Color.rgb(value, value, value);
  12437. },
  12438. fade(ratio) {
  12439. return this.alpha(this.valpha - (this.valpha * ratio));
  12440. },
  12441. opaquer(ratio) {
  12442. return this.alpha(this.valpha + (this.valpha * ratio));
  12443. },
  12444. rotate(degrees) {
  12445. const hsl = this.hsl();
  12446. let hue = hsl.color[0];
  12447. hue = (hue + degrees) % 360;
  12448. hue = hue < 0 ? 360 + hue : hue;
  12449. hsl.color[0] = hue;
  12450. return hsl;
  12451. },
  12452. mix(mixinColor, weight) {
  12453. // Ported from sass implementation in C
  12454. // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
  12455. if (!mixinColor || !mixinColor.rgb) {
  12456. throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
  12457. }
  12458. const color1 = mixinColor.rgb();
  12459. const color2 = this.rgb();
  12460. const p = weight === undefined ? 0.5 : weight;
  12461. const w = 2 * p - 1;
  12462. const a = color1.alpha() - color2.alpha();
  12463. const w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2;
  12464. const w2 = 1 - w1;
  12465. return Color.rgb(
  12466. w1 * color1.red() + w2 * color2.red(),
  12467. w1 * color1.green() + w2 * color2.green(),
  12468. w1 * color1.blue() + w2 * color2.blue(),
  12469. color1.alpha() * p + color2.alpha() * (1 - p));
  12470. },
  12471. };
  12472. // Model conversion methods and static constructors
  12473. for (const model of Object.keys(colorConvert)) {
  12474. if (skippedModels.includes(model)) {
  12475. continue;
  12476. }
  12477. const {channels} = colorConvert[model];
  12478. // Conversion methods
  12479. Color.prototype[model] = function (...args) {
  12480. if (this.model === model) {
  12481. return new Color(this);
  12482. }
  12483. if (args.length > 0) {
  12484. return new Color(args, model);
  12485. }
  12486. return new Color([...assertArray(colorConvert[this.model][model].raw(this.color)), this.valpha], model);
  12487. };
  12488. // 'static' construction methods
  12489. Color[model] = function (...args) {
  12490. let color = args[0];
  12491. if (typeof color === 'number') {
  12492. color = zeroArray(args, channels);
  12493. }
  12494. return new Color(color, model);
  12495. };
  12496. }
  12497. function roundTo(number, places) {
  12498. return Number(number.toFixed(places));
  12499. }
  12500. function roundToPlace(places) {
  12501. return function (number) {
  12502. return roundTo(number, places);
  12503. };
  12504. }
  12505. function getset(model, channel, modifier) {
  12506. model = Array.isArray(model) ? model : [model];
  12507. for (const m of model) {
  12508. (limiters[m] || (limiters[m] = []))[channel] = modifier;
  12509. }
  12510. model = model[0];
  12511. return function (value) {
  12512. let result;
  12513. if (value !== undefined) {
  12514. if (modifier) {
  12515. value = modifier(value);
  12516. }
  12517. result = this[model]();
  12518. result.color[channel] = value;
  12519. return result;
  12520. }
  12521. result = this[model]().color[channel];
  12522. if (modifier) {
  12523. result = modifier(result);
  12524. }
  12525. return result;
  12526. };
  12527. }
  12528. function maxfn(max) {
  12529. return function (v) {
  12530. return Math.max(0, Math.min(max, v));
  12531. };
  12532. }
  12533. function assertArray(value) {
  12534. return Array.isArray(value) ? value : [value];
  12535. }
  12536. function zeroArray(array, length) {
  12537. for (let i = 0; i < length; i++) {
  12538. if (typeof array[i] !== 'number') {
  12539. array[i] = 0;
  12540. }
  12541. }
  12542. return array;
  12543. }
  12544. var color = Color;
  12545. const CSS$K = {
  12546. container: "container",
  12547. controlSection: "control-section",
  12548. hexOptions: "color-hex-options",
  12549. section: "section",
  12550. header: "header",
  12551. control: "control",
  12552. splitSection: "section--split",
  12553. colorModeContainer: "color-mode-container",
  12554. colorMode: "color-mode",
  12555. channels: "channels",
  12556. channel: "channel",
  12557. savedColors: "saved-colors",
  12558. savedColorsSection: "saved-colors-section",
  12559. saveColor: "save-color",
  12560. deleteColor: "delete-color",
  12561. savedColorsButtons: "saved-colors-buttons",
  12562. headerHex: "header--hex",
  12563. colorFieldAndSlider: "color-field-and-slider",
  12564. colorFieldAndSliderInteractive: "color-field-and-slider--interactive",
  12565. colorFieldAndSliderWrap: "color-field-and-slider-wrap",
  12566. scope: "scope",
  12567. hueScope: "scope--hue",
  12568. colorFieldScope: "scope--color-field",
  12569. savedColor: "saved-color"
  12570. };
  12571. const DEFAULT_COLOR$1 = color("#007AC2");
  12572. const DEFAULT_STORAGE_KEY_PREFIX = "calcite-color-";
  12573. const RGB_LIMITS = {
  12574. r: 255,
  12575. g: 255,
  12576. b: 255
  12577. };
  12578. const HSV_LIMITS = {
  12579. h: 360,
  12580. s: 100,
  12581. v: 100
  12582. };
  12583. const TEXT$k = {
  12584. b: "B",
  12585. blue: "Blue",
  12586. deleteColor: "Delete color",
  12587. g: "G",
  12588. green: "Green",
  12589. h: "H",
  12590. hsv: "HSV",
  12591. hex: "Hex",
  12592. hue: "Hue",
  12593. noColor: "No color",
  12594. r: "R",
  12595. red: "Red",
  12596. rgb: "RGB",
  12597. s: "S",
  12598. saturation: "Saturation",
  12599. saveColor: "Save color",
  12600. saved: "Saved",
  12601. v: "V",
  12602. value: "Value"
  12603. };
  12604. const DIMENSIONS = {
  12605. s: {
  12606. slider: {
  12607. height: 10,
  12608. width: 160
  12609. },
  12610. colorField: {
  12611. height: 80,
  12612. width: 160
  12613. },
  12614. thumb: {
  12615. radius: 8
  12616. }
  12617. },
  12618. m: {
  12619. slider: {
  12620. height: 14,
  12621. width: 272
  12622. },
  12623. colorField: {
  12624. height: 150,
  12625. width: 272
  12626. },
  12627. thumb: {
  12628. radius: 10
  12629. }
  12630. },
  12631. l: {
  12632. slider: {
  12633. height: 16,
  12634. width: 464
  12635. },
  12636. colorField: {
  12637. height: 200,
  12638. width: 464
  12639. },
  12640. thumb: {
  12641. radius: 12
  12642. }
  12643. }
  12644. };
  12645. const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
  12646. const decimalPlaces = (value) => {
  12647. const match = ("" + value).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
  12648. if (!match) {
  12649. return 0;
  12650. }
  12651. return Math.max(0,
  12652. // Number of digits right of decimal point.
  12653. (match[1] ? match[1].length : 0) -
  12654. // Adjust for scientific notation.
  12655. (match[2] ? +match[2] : 0));
  12656. };
  12657. const colorPickerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-color-picker:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-color-picker{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-color-picker{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-color-picker{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-color-picker{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-color-picker{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-color-picker:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-color-picker:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-color-picker-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-color-picker-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-color-picker-h{display:inline-block;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-normal)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-color-picker-h[disabled] .sc-calcite-color-picker-s>[calcite-hydrated][disabled],[disabled].sc-calcite-color-picker-h [calcite-hydrated][disabled].sc-calcite-color-picker{opacity:1}/*!@:host([scale=s]) .container*/[scale=s].sc-calcite-color-picker-h .container.sc-calcite-color-picker{inline-size:160px}/*!@:host([scale=s]) .saved-colors*/[scale=s].sc-calcite-color-picker-h .saved-colors.sc-calcite-color-picker{grid-template-columns:repeat(auto-fill, minmax(20px, 1fr))}/*!@:host([scale=s]) .channels*/[scale=s].sc-calcite-color-picker-h .channels.sc-calcite-color-picker{flex-direction:column}/*!@:host([scale=s]) .channel*/[scale=s].sc-calcite-color-picker-h .channel.sc-calcite-color-picker{inline-size:100%;margin-block-end:4px}/*!@:host([scale=s]) .channel:last-child*/[scale=s].sc-calcite-color-picker-h .channel.sc-calcite-color-picker:last-child{margin-block-end:0}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-color-picker-h .container.sc-calcite-color-picker{inline-size:272px}/*!@:host([scale=l]) .header*/[scale=l].sc-calcite-color-picker-h .header.sc-calcite-color-picker{padding-block-end:0px}/*!@:host([scale=l])*/[scale=l].sc-calcite-color-picker-h{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l]) .container*/[scale=l].sc-calcite-color-picker-h .container.sc-calcite-color-picker{inline-size:464px}/*!@:host([scale=l]) .color-field-and-slider*/[scale=l].sc-calcite-color-picker-h .color-field-and-slider.sc-calcite-color-picker{margin-block-end:-20px}/*!@:host([scale=l]) .section*/[scale=l].sc-calcite-color-picker-h .section.sc-calcite-color-picker{padding-block:0 16px;padding-inline:16px}/*!@:host([scale=l]) .section:first-of-type*/[scale=l].sc-calcite-color-picker-h .section.sc-calcite-color-picker:first-of-type{padding-block-start:16px}/*!@:host([scale=l]) .saved-colors*/[scale=l].sc-calcite-color-picker-h .saved-colors.sc-calcite-color-picker{grid-template-columns:repeat(auto-fill, minmax(28px, 1fr));grid-gap:12px;padding-block-start:16px}/*!@:host([scale=l]) .control-section*/[scale=l].sc-calcite-color-picker-h .control-section.sc-calcite-color-picker{flex-wrap:nowrap;align-items:baseline}/*!@:host([scale=l]) .control-section > :nth-child(2)*/[scale=l].sc-calcite-color-picker-h .control-section.sc-calcite-color-picker>.sc-calcite-color-picker:nth-child(2){margin-inline-start:12px}/*!@:host([scale=l]) .color-hex-options*/[scale=l].sc-calcite-color-picker-h .color-hex-options.sc-calcite-color-picker{display:flex;flex-shrink:1;flex-direction:column;justify-content:space-around;min-block-size:98px;inline-size:160px}/*!@:host([scale=l]) .color-mode-container*/[scale=l].sc-calcite-color-picker-h .color-mode-container.sc-calcite-color-picker{flex-shrink:3}/*!@:host([appearance=minimal]) .container*/[appearance=minimal].sc-calcite-color-picker-h .container.sc-calcite-color-picker{border:none}/*!@.container*/.container.sc-calcite-color-picker{background-color:var(--calcite-ui-foreground-1);display:inline-block;border:1px solid var(--calcite-ui-border-1)}/*!@.color-field-and-slider-wrap*/.color-field-and-slider-wrap.sc-calcite-color-picker{position:relative}/*!@.scope*/.scope.sc-calcite-color-picker{pointer-events:none;position:absolute;font-size:var(--calcite-font-size--1);outline-color:transparent;outline-offset:14px}/*!@.scope:focus*/.scope.sc-calcite-color-picker:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:16px}/*!@.color-field-and-slider*/.color-field-and-slider.sc-calcite-color-picker{margin-block-end:-16px;touch-action:none}/*!@.color-field-and-slider--interactive*/.color-field-and-slider--interactive.sc-calcite-color-picker{cursor:pointer}/*!@.control-section*/.control-section.sc-calcite-color-picker{display:flex;flex-direction:row;flex-wrap:wrap}/*!@.section*/.section.sc-calcite-color-picker{padding-block:0 12px;padding-inline:12px}/*!@.section:first-of-type*/.section.sc-calcite-color-picker:first-of-type{padding-block-start:12px}/*!@.color-hex-options,\n.section--split*/.color-hex-options.sc-calcite-color-picker,.section--split.sc-calcite-color-picker{flex-grow:1}/*!@.header*/.header.sc-calcite-color-picker{display:flex;align-items:center;justify-content:space-between;padding-block-end:0.25rem;color:var(--calcite-ui-text-1)}/*!@.header--hex,\n.color-mode-container*/.header--hex.sc-calcite-color-picker,.color-mode-container.sc-calcite-color-picker{padding-block-start:12px}/*!@.channels*/.channels.sc-calcite-color-picker{display:flex;justify-content:space-between}/*!@.channel*/.channel.sc-calcite-color-picker{inline-size:31%}/*!@.saved-colors*/.saved-colors.sc-calcite-color-picker{padding-block-start:12px;display:grid;grid-template-columns:repeat(auto-fill, minmax(24px, 1fr));grid-gap:8px;inline-size:100%}/*!@.saved-colors-buttons*/.saved-colors-buttons.sc-calcite-color-picker{display:flex}/*!@.saved-color*/.saved-color.sc-calcite-color-picker{outline-offset:0;outline-color:transparent;cursor:pointer}/*!@.saved-color:focus*/.saved-color.sc-calcite-color-picker:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.saved-color:hover*/.saved-color.sc-calcite-color-picker:hover{transition:outline-color var(--calcite-internal-animation-timing-fast) ease-in-out;outline:2px solid var(--calcite-ui-border-2);outline-offset:2px}";
  12658. const throttleFor60FpsInMs = 16;
  12659. const defaultValue = normalizeHex(DEFAULT_COLOR$1.hex());
  12660. const defaultFormat = "auto";
  12661. class ColorPicker {
  12662. constructor(hostRef) {
  12663. registerInstance(this, hostRef);
  12664. this.calciteColorPickerChange = createEvent(this, "calciteColorPickerChange", 6);
  12665. this.calciteColorPickerInput = createEvent(this, "calciteColorPickerInput", 6);
  12666. //--------------------------------------------------------------------------
  12667. //
  12668. // Public properties
  12669. //
  12670. //--------------------------------------------------------------------------
  12671. /**
  12672. * When `false`, an empty color (`null`) will be allowed as a `value`. Otherwise, a color value is enforced on the component.
  12673. *
  12674. * When `true`, a color value is enforced, and clearing the input or blurring will restore the last valid `value`. When `false`, an empty color (`null`) will be allowed as a `value`.
  12675. */
  12676. this.allowEmpty = false;
  12677. /**
  12678. * Specifies the appearance style of the component -
  12679. *
  12680. * `"solid"` (containing border) or `"minimal"` (no containing border).
  12681. */
  12682. this.appearance = "solid";
  12683. /**
  12684. * Internal prop for advanced use-cases.
  12685. *
  12686. * @internal
  12687. */
  12688. this.color = DEFAULT_COLOR$1;
  12689. /**
  12690. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  12691. */
  12692. this.disabled = false;
  12693. /**
  12694. * The format of `value`.
  12695. *
  12696. * When `"auto"`, the format will be inferred from `value` when set.
  12697. *
  12698. * @default "auto"
  12699. */
  12700. this.format = defaultFormat;
  12701. /** When `true`, hides the Hex input. */
  12702. this.hideHex = false;
  12703. /** When `true`, hides the RGB/HSV channel inputs. */
  12704. this.hideChannels = false;
  12705. /** When `true`, hides the saved colors section. */
  12706. this.hideSaved = false;
  12707. /**
  12708. * Accessible name for the RGB section's blue channel.
  12709. *
  12710. * @default "B"
  12711. */
  12712. this.intlB = TEXT$k.b;
  12713. /**
  12714. * Accessible name for the RGB section's blue channel description.
  12715. *
  12716. * @default "Blue"
  12717. */
  12718. this.intlBlue = TEXT$k.blue;
  12719. /**
  12720. * Accessible name for the delete color button.
  12721. *
  12722. * @default "Delete color"
  12723. */
  12724. this.intlDeleteColor = TEXT$k.deleteColor;
  12725. /**
  12726. * Accessible name for the RGB section's green channel.
  12727. *
  12728. * @default "G"
  12729. */
  12730. this.intlG = TEXT$k.g;
  12731. /**
  12732. * Accessible name for the RGB section's green channel description.
  12733. *
  12734. * @default "Green"
  12735. */
  12736. this.intlGreen = TEXT$k.green;
  12737. /**
  12738. * Accessible name for the HSV section's hue channel.
  12739. *
  12740. * @default "H"
  12741. */
  12742. this.intlH = TEXT$k.h;
  12743. /**
  12744. * Accessible name for the HSV mode.
  12745. *
  12746. * @default "HSV"
  12747. */
  12748. this.intlHsv = TEXT$k.hsv;
  12749. /**
  12750. * Accessible name for the Hex input.
  12751. *
  12752. * @default "Hex"
  12753. */
  12754. this.intlHex = TEXT$k.hex;
  12755. /**
  12756. * Accessible name for the HSV section's hue channel description.
  12757. *
  12758. * @default "Hue"
  12759. */
  12760. this.intlHue = TEXT$k.hue;
  12761. /**
  12762. * Accessible name for the Hex input when there is no color selected.
  12763. *
  12764. * @default "No color"
  12765. */
  12766. this.intlNoColor = TEXT$k.noColor;
  12767. /**
  12768. * Accessible name for the RGB section's red channel.
  12769. *
  12770. * @default "R"
  12771. */
  12772. this.intlR = TEXT$k.r;
  12773. /**
  12774. * Accessible name for the RGB section's red channel description.
  12775. *
  12776. * @default "Red"
  12777. */
  12778. this.intlRed = TEXT$k.red;
  12779. /**
  12780. * Accessible name for the RGB mode.
  12781. *
  12782. * @default "RGB"
  12783. */
  12784. this.intlRgb = TEXT$k.rgb;
  12785. /**
  12786. * Accessible name for the HSV section's saturation channel.
  12787. *
  12788. * @default "S"
  12789. */
  12790. this.intlS = TEXT$k.s;
  12791. /**
  12792. * Accessible name for the HSV section's saturation channel description.
  12793. *
  12794. * @default "Saturation"
  12795. */
  12796. this.intlSaturation = TEXT$k.saturation;
  12797. /**
  12798. * Accessible name for the save color button.
  12799. *
  12800. * @default "Save color"
  12801. */
  12802. this.intlSaveColor = TEXT$k.saveColor;
  12803. /**
  12804. * Accessible name for the saved colors section.
  12805. *
  12806. * @default "Saved"
  12807. */
  12808. this.intlSaved = TEXT$k.saved;
  12809. /**
  12810. * Accessible name for the HSV section's value channel.
  12811. *
  12812. * @default "V"
  12813. */
  12814. this.intlV = TEXT$k.v;
  12815. /**
  12816. * Accessible name for the HSV section's value channel description.
  12817. *
  12818. * @default "Value"
  12819. */
  12820. this.intlValue = TEXT$k.value;
  12821. /** Specifies the size of the component. */
  12822. this.scale = "m";
  12823. /**
  12824. * The component's value, where the value can be a CSS color string, or a RGB, HSL or HSV object.
  12825. *
  12826. * The type will be preserved as the color is updated.
  12827. *
  12828. * @default "#007ac2"
  12829. * @see [CSS Color](https://developer.mozilla.org/en-US/docs/Web/CSS/color)
  12830. * @see [ColorValue](https://github.com/Esri/calcite-components/blob/master/src/components/color-picker/interfaces.ts#L10)
  12831. */
  12832. this.value = defaultValue;
  12833. this.colorFieldAndSliderHovered = false;
  12834. this.hueThumbState = "idle";
  12835. this.internalColorUpdateContext = null;
  12836. this.mode = CSSColorMode.HEX;
  12837. this.shiftKeyChannelAdjustment = 0;
  12838. this.sliderThumbState = "idle";
  12839. this.colorFieldAndSliderInteractive = false;
  12840. this.channelMode = "rgb";
  12841. this.channels = this.toChannels(DEFAULT_COLOR$1);
  12842. this.dimensions = DIMENSIONS.m;
  12843. this.savedColors = [];
  12844. this.handleTabActivate = (event) => {
  12845. this.channelMode = event.currentTarget.getAttribute("data-color-mode");
  12846. this.updateChannelsFromColor(this.color);
  12847. };
  12848. this.handleColorFieldScopeKeyDown = (event) => {
  12849. const { key } = event;
  12850. const arrowKeyToXYOffset = {
  12851. ArrowUp: { x: 0, y: -10 },
  12852. ArrowRight: { x: 10, y: 0 },
  12853. ArrowDown: { x: 0, y: 10 },
  12854. ArrowLeft: { x: -10, y: 0 }
  12855. };
  12856. if (arrowKeyToXYOffset[key]) {
  12857. event.preventDefault();
  12858. this.scopeOrientation = key === "ArrowDown" || key === "ArrowUp" ? "vertical" : "horizontal";
  12859. this.captureColorFieldColor(this.colorFieldScopeLeft + arrowKeyToXYOffset[key].x || 0, this.colorFieldScopeTop + arrowKeyToXYOffset[key].y || 0, false);
  12860. }
  12861. };
  12862. this.handleHueScopeKeyDown = (event) => {
  12863. const modifier = event.shiftKey ? 10 : 1;
  12864. const { key } = event;
  12865. const arrowKeyToXOffset = {
  12866. ArrowUp: 1,
  12867. ArrowRight: 1,
  12868. ArrowDown: -1,
  12869. ArrowLeft: -1
  12870. };
  12871. if (arrowKeyToXOffset[key]) {
  12872. event.preventDefault();
  12873. const delta = arrowKeyToXOffset[key] * modifier;
  12874. const hue = this.baseColorFieldColor.hue();
  12875. const color = this.baseColorFieldColor.hue(hue + delta);
  12876. this.internalColorSet(color, false);
  12877. }
  12878. };
  12879. this.handleHexInputChange = (event) => {
  12880. event.stopPropagation();
  12881. const { allowEmpty, color: color$1 } = this;
  12882. const input = event.target;
  12883. const hex = input.value;
  12884. if (allowEmpty && !hex) {
  12885. this.internalColorSet(null);
  12886. return;
  12887. }
  12888. const normalizedHex = color$1 && normalizeHex(color$1.hex());
  12889. if (hex !== normalizedHex) {
  12890. this.internalColorSet(color(hex));
  12891. }
  12892. };
  12893. this.handleSavedColorSelect = (event) => {
  12894. const swatch = event.currentTarget;
  12895. this.internalColorSet(color(swatch.color));
  12896. };
  12897. this.handleChannelInput = (event) => {
  12898. const input = event.currentTarget;
  12899. const internalInput = event.detail.nativeEvent.target;
  12900. const channelIndex = Number(input.getAttribute("data-channel-index"));
  12901. const limit = this.channelMode === "rgb"
  12902. ? RGB_LIMITS[Object.keys(RGB_LIMITS)[channelIndex]]
  12903. : HSV_LIMITS[Object.keys(HSV_LIMITS)[channelIndex]];
  12904. let inputValue;
  12905. if (this.allowEmpty && !input.value) {
  12906. inputValue = "";
  12907. }
  12908. else {
  12909. const value = Number(input.value) + this.shiftKeyChannelAdjustment;
  12910. const clamped = clamp(value, 0, limit);
  12911. inputValue = clamped.toString();
  12912. }
  12913. input.value = inputValue;
  12914. internalInput.value = inputValue;
  12915. };
  12916. this.handleChannelChange = (event) => {
  12917. const input = event.currentTarget;
  12918. const channelIndex = Number(input.getAttribute("data-channel-index"));
  12919. const channels = [...this.channels];
  12920. const shouldClearChannels = this.allowEmpty && !input.value;
  12921. if (shouldClearChannels) {
  12922. this.channels = [null, null, null];
  12923. this.internalColorSet(null);
  12924. return;
  12925. }
  12926. channels[channelIndex] = Number(input.value);
  12927. this.updateColorFromChannels(channels);
  12928. };
  12929. this.handleSavedColorKeyDown = (event) => {
  12930. if (isActivationKey(event.key)) {
  12931. event.preventDefault();
  12932. this.handleSavedColorSelect(event);
  12933. }
  12934. };
  12935. this.handleColorFieldAndSliderPointerLeave = () => {
  12936. this.colorFieldAndSliderInteractive = false;
  12937. this.colorFieldAndSliderHovered = false;
  12938. if (this.sliderThumbState !== "drag" && this.hueThumbState !== "drag") {
  12939. this.hueThumbState = "idle";
  12940. this.sliderThumbState = "idle";
  12941. this.drawColorFieldAndSlider();
  12942. }
  12943. };
  12944. this.handleColorFieldAndSliderPointerDown = (event) => {
  12945. var _a, _b;
  12946. if (!isPrimaryPointerButton(event)) {
  12947. return;
  12948. }
  12949. const { offsetX, offsetY } = event;
  12950. const region = this.getCanvasRegion(offsetY);
  12951. if (region === "color-field") {
  12952. this.hueThumbState = "drag";
  12953. this.captureColorFieldColor(offsetX, offsetY);
  12954. (_a = this.colorFieldScopeNode) === null || _a === void 0 ? void 0 : _a.focus();
  12955. }
  12956. else if (region === "slider") {
  12957. this.sliderThumbState = "drag";
  12958. this.captureHueSliderColor(offsetX);
  12959. (_b = this.hueScopeNode) === null || _b === void 0 ? void 0 : _b.focus();
  12960. }
  12961. // prevent text selection outside of color field & slider area
  12962. event.preventDefault();
  12963. document.addEventListener("pointermove", this.globalPointerMoveHandler);
  12964. document.addEventListener("pointerup", this.globalPointerUpHandler, { once: true });
  12965. this.activeColorFieldAndSliderRect =
  12966. this.fieldAndSliderRenderingContext.canvas.getBoundingClientRect();
  12967. };
  12968. this.globalPointerUpHandler = (event) => {
  12969. if (!isPrimaryPointerButton(event)) {
  12970. return;
  12971. }
  12972. const previouslyDragging = this.sliderThumbState === "drag" || this.hueThumbState === "drag";
  12973. this.hueThumbState = "idle";
  12974. this.sliderThumbState = "idle";
  12975. this.activeColorFieldAndSliderRect = null;
  12976. this.drawColorFieldAndSlider();
  12977. if (previouslyDragging) {
  12978. this.calciteColorPickerChange.emit();
  12979. }
  12980. };
  12981. this.globalPointerMoveHandler = (event) => {
  12982. const { el, dimensions } = this;
  12983. const sliderThumbDragging = this.sliderThumbState === "drag";
  12984. const hueThumbDragging = this.hueThumbState === "drag";
  12985. if (!el.isConnected || (!sliderThumbDragging && !hueThumbDragging)) {
  12986. return;
  12987. }
  12988. let samplingX;
  12989. let samplingY;
  12990. const colorFieldAndSliderRect = this.activeColorFieldAndSliderRect;
  12991. const { clientX, clientY } = event;
  12992. if (this.colorFieldAndSliderHovered) {
  12993. samplingX = clientX - colorFieldAndSliderRect.x;
  12994. samplingY = clientY - colorFieldAndSliderRect.y;
  12995. }
  12996. else {
  12997. const colorFieldWidth = dimensions.colorField.width;
  12998. const colorFieldHeight = dimensions.colorField.height;
  12999. const hueSliderHeight = dimensions.slider.height;
  13000. if (clientX < colorFieldAndSliderRect.x + colorFieldWidth &&
  13001. clientX > colorFieldAndSliderRect.x) {
  13002. samplingX = clientX - colorFieldAndSliderRect.x;
  13003. }
  13004. else if (clientX < colorFieldAndSliderRect.x) {
  13005. samplingX = 0;
  13006. }
  13007. else {
  13008. samplingX = colorFieldWidth - 1;
  13009. }
  13010. if (clientY < colorFieldAndSliderRect.y + colorFieldHeight + hueSliderHeight &&
  13011. clientY > colorFieldAndSliderRect.y) {
  13012. samplingY = clientY - colorFieldAndSliderRect.y;
  13013. }
  13014. else if (clientY < colorFieldAndSliderRect.y) {
  13015. samplingY = 0;
  13016. }
  13017. else {
  13018. samplingY = colorFieldHeight + hueSliderHeight;
  13019. }
  13020. }
  13021. if (hueThumbDragging) {
  13022. this.captureColorFieldColor(samplingX, samplingY, false);
  13023. }
  13024. else {
  13025. this.captureHueSliderColor(samplingX);
  13026. }
  13027. };
  13028. this.handleColorFieldAndSliderPointerEnterOrMove = ({ offsetX, offsetY }) => {
  13029. const { dimensions: { colorField, slider, thumb } } = this;
  13030. this.colorFieldAndSliderInteractive = offsetY <= colorField.height + slider.height;
  13031. this.colorFieldAndSliderHovered = true;
  13032. const region = this.getCanvasRegion(offsetY);
  13033. if (region === "color-field") {
  13034. const prevHueThumbState = this.hueThumbState;
  13035. const color = this.baseColorFieldColor.hsv();
  13036. const centerX = Math.round(color.saturationv() / (HSV_LIMITS.s / colorField.width));
  13037. const centerY = Math.round(colorField.height - color.value() / (HSV_LIMITS.v / colorField.height));
  13038. const hoveringThumb = this.containsPoint(offsetX, offsetY, centerX, centerY, thumb.radius);
  13039. let transitionedBetweenHoverAndIdle = false;
  13040. if (prevHueThumbState === "idle" && hoveringThumb) {
  13041. this.hueThumbState = "hover";
  13042. transitionedBetweenHoverAndIdle = true;
  13043. }
  13044. else if (prevHueThumbState === "hover" && !hoveringThumb) {
  13045. this.hueThumbState = "idle";
  13046. transitionedBetweenHoverAndIdle = true;
  13047. }
  13048. if (this.hueThumbState !== "drag") {
  13049. if (transitionedBetweenHoverAndIdle) {
  13050. // refresh since we won't update color and thus no redraw
  13051. this.drawColorFieldAndSlider();
  13052. }
  13053. }
  13054. }
  13055. else if (region === "slider") {
  13056. const sliderThumbColor = this.baseColorFieldColor.hsv().saturationv(100).value(100);
  13057. const prevSliderThumbState = this.sliderThumbState;
  13058. const sliderThumbCenterX = Math.round(sliderThumbColor.hue() / (360 / slider.width));
  13059. const sliderThumbCenterY = Math.round((slider.height + this.getSliderCapSpacing()) / 2) + colorField.height;
  13060. const hoveringSliderThumb = this.containsPoint(offsetX, offsetY, sliderThumbCenterX, sliderThumbCenterY, thumb.radius);
  13061. let sliderThumbTransitionedBetweenHoverAndIdle = false;
  13062. if (prevSliderThumbState === "idle" && hoveringSliderThumb) {
  13063. this.sliderThumbState = "hover";
  13064. sliderThumbTransitionedBetweenHoverAndIdle = true;
  13065. }
  13066. else if (prevSliderThumbState === "hover" && !hoveringSliderThumb) {
  13067. this.sliderThumbState = "idle";
  13068. sliderThumbTransitionedBetweenHoverAndIdle = true;
  13069. }
  13070. if (this.sliderThumbState !== "drag") {
  13071. if (sliderThumbTransitionedBetweenHoverAndIdle) {
  13072. // refresh since we won't update color and thus no redraw
  13073. this.drawColorFieldAndSlider();
  13074. }
  13075. }
  13076. }
  13077. };
  13078. this.storeColorFieldScope = (node) => {
  13079. this.colorFieldScopeNode = node;
  13080. };
  13081. this.storeHueScope = (node) => {
  13082. this.hueScopeNode = node;
  13083. };
  13084. this.renderChannelsTabTitle = (channelMode) => {
  13085. const { channelMode: activeChannelMode, intlRgb, intlHsv } = this;
  13086. const active = channelMode === activeChannelMode;
  13087. const label = channelMode === "rgb" ? intlRgb : intlHsv;
  13088. return (hAsync("calcite-tab-title", { active: active, class: CSS$K.colorMode, "data-color-mode": channelMode, key: channelMode, onCalciteTabsActivate: this.handleTabActivate }, label));
  13089. };
  13090. this.renderChannelsTab = (channelMode) => {
  13091. const { channelMode: activeChannelMode, channels, intlB, intlBlue, intlG, intlGreen, intlH, intlHue, intlR, intlRed, intlS, intlSaturation, intlV, intlValue } = this;
  13092. const active = channelMode === activeChannelMode;
  13093. const isRgb = channelMode === "rgb";
  13094. const channelLabels = isRgb ? [intlR, intlG, intlB] : [intlH, intlS, intlV];
  13095. const channelAriaLabels = isRgb
  13096. ? [intlRed, intlGreen, intlBlue]
  13097. : [intlHue, intlSaturation, intlValue];
  13098. const direction = getElementDir(this.el);
  13099. return (hAsync("calcite-tab", { active: active, class: CSS$K.control, key: channelMode }, hAsync("div", { class: CSS$K.channels, dir: "ltr" }, channels.map((channel, index) =>
  13100. /* the channel container is ltr, so we apply the host's direction */
  13101. this.renderChannel(channel, index, channelLabels[index], channelAriaLabels[index], direction)))));
  13102. };
  13103. this.renderChannel = (value, index, label, ariaLabel, direction) => (hAsync("calcite-input", { class: CSS$K.channel, "data-channel-index": index, dir: direction, label: ariaLabel, numberButtonType: "none", numberingSystem: this.numberingSystem, onCalciteInputChange: this.handleChannelChange, onCalciteInputInput: this.handleChannelInput, onKeyDown: this.handleKeyDown, prefixText: label, scale: this.scale === "l" ? "m" : "s", type: "number", value: value === null || value === void 0 ? void 0 : value.toString() }));
  13104. this.deleteColor = () => {
  13105. const colorToDelete = this.color.hex();
  13106. const inStorage = this.savedColors.indexOf(colorToDelete) > -1;
  13107. if (!inStorage) {
  13108. return;
  13109. }
  13110. const savedColors = this.savedColors.filter((color) => color !== colorToDelete);
  13111. this.savedColors = savedColors;
  13112. const storageKey = `${DEFAULT_STORAGE_KEY_PREFIX}${this.storageId}`;
  13113. if (this.storageId) {
  13114. localStorage.setItem(storageKey, JSON.stringify(savedColors));
  13115. }
  13116. };
  13117. this.saveColor = () => {
  13118. const colorToSave = this.color.hex();
  13119. const alreadySaved = this.savedColors.indexOf(colorToSave) > -1;
  13120. if (alreadySaved) {
  13121. return;
  13122. }
  13123. const savedColors = [...this.savedColors, colorToSave];
  13124. this.savedColors = savedColors;
  13125. const storageKey = `${DEFAULT_STORAGE_KEY_PREFIX}${this.storageId}`;
  13126. if (this.storageId) {
  13127. localStorage.setItem(storageKey, JSON.stringify(savedColors));
  13128. }
  13129. };
  13130. this.drawColorFieldAndSlider = throttle$1(() => {
  13131. if (!this.fieldAndSliderRenderingContext) {
  13132. return;
  13133. }
  13134. this.drawColorField();
  13135. this.drawHueSlider();
  13136. }, throttleFor60FpsInMs);
  13137. this.captureColorFieldColor = (x, y, skipEqual = true) => {
  13138. const { dimensions: { colorField: { height, width } } } = this;
  13139. const saturation = Math.round((HSV_LIMITS.s / width) * x);
  13140. const value = Math.round((HSV_LIMITS.v / height) * (height - y));
  13141. this.internalColorSet(this.baseColorFieldColor.hsv().saturationv(saturation).value(value), skipEqual);
  13142. };
  13143. this.initColorFieldAndSlider = (canvas) => {
  13144. this.fieldAndSliderRenderingContext = canvas.getContext("2d");
  13145. this.updateCanvasSize(canvas);
  13146. };
  13147. }
  13148. handleColorChange(color, oldColor) {
  13149. this.drawColorFieldAndSlider();
  13150. this.updateChannelsFromColor(color);
  13151. this.previousColor = oldColor;
  13152. }
  13153. handleFormatChange(format) {
  13154. this.setMode(format);
  13155. this.internalColorSet(this.color, false, "internal");
  13156. }
  13157. handleScaleChange(scale = "m") {
  13158. var _a;
  13159. this.updateDimensions(scale);
  13160. this.updateCanvasSize((_a = this.fieldAndSliderRenderingContext) === null || _a === void 0 ? void 0 : _a.canvas);
  13161. }
  13162. handleValueChange(value, oldValue) {
  13163. const { allowEmpty, format } = this;
  13164. const checkMode = !allowEmpty || value;
  13165. let modeChanged = false;
  13166. if (checkMode) {
  13167. const nextMode = parseMode(value);
  13168. if (!nextMode || (format !== "auto" && nextMode !== format)) {
  13169. this.showIncompatibleColorWarning(value, format);
  13170. this.value = oldValue;
  13171. return;
  13172. }
  13173. modeChanged = this.mode !== nextMode;
  13174. this.setMode(nextMode);
  13175. }
  13176. const dragging = this.sliderThumbState === "drag" || this.hueThumbState === "drag";
  13177. if (this.internalColorUpdateContext === "initial") {
  13178. return;
  13179. }
  13180. if (this.internalColorUpdateContext === "user-interaction") {
  13181. this.calciteColorPickerInput.emit();
  13182. if (!dragging) {
  13183. this.calciteColorPickerChange.emit();
  13184. }
  13185. return;
  13186. }
  13187. const color$1 = allowEmpty && !value ? null : color(value);
  13188. const colorChanged = !colorEqual(color$1, this.color);
  13189. if (modeChanged || colorChanged) {
  13190. this.internalColorSet(color$1, true, "internal");
  13191. }
  13192. }
  13193. //--------------------------------------------------------------------------
  13194. //
  13195. // Internal State/Props
  13196. //
  13197. //--------------------------------------------------------------------------
  13198. get baseColorFieldColor() {
  13199. return this.color || this.previousColor || DEFAULT_COLOR$1;
  13200. }
  13201. // using @Listen as a workaround for VDOM listener not firing
  13202. handleChannelKeyUpOrDown(event) {
  13203. this.shiftKeyChannelAdjustment = 0;
  13204. const { key } = event;
  13205. if ((key !== "ArrowUp" && key !== "ArrowDown") ||
  13206. !event.composedPath().some((node) => { var _a; return (_a = node.classList) === null || _a === void 0 ? void 0 : _a.contains(CSS$K.channel); })) {
  13207. return;
  13208. }
  13209. const { shiftKey } = event;
  13210. event.preventDefault();
  13211. if (!this.color) {
  13212. this.internalColorSet(this.previousColor);
  13213. event.stopPropagation();
  13214. return;
  13215. }
  13216. // this gets applied to the input's up/down arrow increment/decrement
  13217. const complementaryBump = 9;
  13218. this.shiftKeyChannelAdjustment =
  13219. key === "ArrowUp" && shiftKey
  13220. ? complementaryBump
  13221. : key === "ArrowDown" && shiftKey
  13222. ? -complementaryBump
  13223. : 0;
  13224. }
  13225. //--------------------------------------------------------------------------
  13226. //
  13227. // Public Methods
  13228. //
  13229. //--------------------------------------------------------------------------
  13230. /** Sets focus on the component. */
  13231. async setFocus() {
  13232. return focusElement(this.colorFieldScopeNode);
  13233. }
  13234. //--------------------------------------------------------------------------
  13235. //
  13236. // Lifecycle
  13237. //
  13238. //--------------------------------------------------------------------------
  13239. componentWillLoad() {
  13240. const { allowEmpty, color: color$1, format, value } = this;
  13241. const willSetNoColor = allowEmpty && !value;
  13242. const parsedMode = parseMode(value);
  13243. const valueIsCompatible = willSetNoColor || (format === "auto" && parsedMode) || format === parsedMode;
  13244. const initialColor = willSetNoColor ? null : valueIsCompatible ? color(value) : color$1;
  13245. if (!valueIsCompatible) {
  13246. this.showIncompatibleColorWarning(value, format);
  13247. }
  13248. this.setMode(format);
  13249. this.internalColorSet(initialColor, false, "initial");
  13250. this.updateDimensions(this.scale);
  13251. const storageKey = `${DEFAULT_STORAGE_KEY_PREFIX}${this.storageId}`;
  13252. if (this.storageId && localStorage.getItem(storageKey)) {
  13253. this.savedColors = JSON.parse(localStorage.getItem(storageKey));
  13254. }
  13255. }
  13256. disconnectedCallback() {
  13257. document.removeEventListener("pointermove", this.globalPointerMoveHandler);
  13258. document.removeEventListener("pointerup", this.globalPointerUpHandler);
  13259. }
  13260. componentDidRender() {
  13261. updateHostInteraction(this);
  13262. }
  13263. //--------------------------------------------------------------------------
  13264. //
  13265. // Render Methods
  13266. //
  13267. //--------------------------------------------------------------------------
  13268. render() {
  13269. const { allowEmpty, color, intlDeleteColor, hideHex, hideChannels, hideSaved, intlHex, intlSaved, intlSaveColor, savedColors, scale } = this;
  13270. const selectedColorInHex = color ? color.hex() : null;
  13271. const hexInputScale = scale === "l" ? "m" : "s";
  13272. const { colorFieldAndSliderInteractive, colorFieldScopeTop, colorFieldScopeLeft, hueScopeLeft, hueScopeTop, scopeOrientation, dimensions: { colorField: { height: colorFieldHeight, width: colorFieldWidth }, slider: { height: sliderHeight } } } = this;
  13273. const hueTop = hueScopeTop !== null && hueScopeTop !== void 0 ? hueScopeTop : sliderHeight / 2 + colorFieldHeight;
  13274. const hueLeft = hueScopeLeft !== null && hueScopeLeft !== void 0 ? hueScopeLeft : (colorFieldWidth * DEFAULT_COLOR$1.hue()) / HSV_LIMITS.h;
  13275. const noColor = color === null;
  13276. const vertical = scopeOrientation === "vertical";
  13277. return (hAsync("div", { class: CSS$K.container }, hAsync("div", { class: CSS$K.colorFieldAndSliderWrap }, hAsync("canvas", { class: {
  13278. [CSS$K.colorFieldAndSlider]: true,
  13279. [CSS$K.colorFieldAndSliderInteractive]: colorFieldAndSliderInteractive
  13280. }, onPointerDown: this.handleColorFieldAndSliderPointerDown, onPointerEnter: this.handleColorFieldAndSliderPointerEnterOrMove, onPointerLeave: this.handleColorFieldAndSliderPointerLeave, onPointerMove: this.handleColorFieldAndSliderPointerEnterOrMove, ref: this.initColorFieldAndSlider }), hAsync("div", { "aria-label": vertical ? this.intlValue : this.intlSaturation, "aria-valuemax": vertical ? HSV_LIMITS.v : HSV_LIMITS.s, "aria-valuemin": "0", "aria-valuenow": (vertical ? color === null || color === void 0 ? void 0 : color.saturationv() : color === null || color === void 0 ? void 0 : color.value()) || "0", class: { [CSS$K.scope]: true, [CSS$K.colorFieldScope]: true }, onKeyDown: this.handleColorFieldScopeKeyDown, ref: this.storeColorFieldScope, role: "slider", style: { top: `${colorFieldScopeTop || 0}px`, left: `${colorFieldScopeLeft || 0}px` }, tabindex: "0" }), hAsync("div", { "aria-label": this.intlHue, "aria-valuemax": HSV_LIMITS.h, "aria-valuemin": "0", "aria-valuenow": (color === null || color === void 0 ? void 0 : color.round().hue()) || DEFAULT_COLOR$1.round().hue(), class: { [CSS$K.scope]: true, [CSS$K.hueScope]: true }, onKeyDown: this.handleHueScopeKeyDown, ref: this.storeHueScope, role: "slider", style: { top: `${hueTop}px`, left: `${hueLeft}px` }, tabindex: "0" })), hideHex && hideChannels ? null : (hAsync("div", { class: {
  13281. [CSS$K.controlSection]: true,
  13282. [CSS$K.section]: true
  13283. } }, hideHex ? null : (hAsync("div", { class: CSS$K.hexOptions }, hAsync("span", { class: {
  13284. [CSS$K.header]: true,
  13285. [CSS$K.headerHex]: true
  13286. } }, intlHex), hAsync("calcite-color-picker-hex-input", { allowEmpty: allowEmpty, class: CSS$K.control, numberingSystem: this.numberingSystem, onCalciteColorPickerHexInputChange: this.handleHexInputChange, scale: hexInputScale, value: selectedColorInHex }))), hideChannels ? null : (hAsync("calcite-tabs", { class: {
  13287. [CSS$K.colorModeContainer]: true,
  13288. [CSS$K.splitSection]: true
  13289. }, scale: hexInputScale }, hAsync("calcite-tab-nav", { slot: "tab-nav" }, this.renderChannelsTabTitle("rgb"), this.renderChannelsTabTitle("hsv")), this.renderChannelsTab("rgb"), this.renderChannelsTab("hsv"))))), hideSaved ? null : (hAsync("div", { class: { [CSS$K.savedColorsSection]: true, [CSS$K.section]: true } }, hAsync("div", { class: CSS$K.header }, hAsync("label", null, intlSaved), hAsync("div", { class: CSS$K.savedColorsButtons }, hAsync("calcite-button", { appearance: "transparent", class: CSS$K.deleteColor, color: "neutral", disabled: noColor, iconStart: "minus", label: intlDeleteColor, onClick: this.deleteColor, scale: hexInputScale, type: "button" }), hAsync("calcite-button", { appearance: "transparent", class: CSS$K.saveColor, color: "neutral", disabled: noColor, iconStart: "plus", label: intlSaveColor, onClick: this.saveColor, scale: hexInputScale, type: "button" }))), savedColors.length > 0 ? (hAsync("div", { class: CSS$K.savedColors }, [
  13290. ...savedColors.map((color) => (hAsync("calcite-color-picker-swatch", { active: selectedColorInHex === color, class: CSS$K.savedColor, color: color, key: color, onClick: this.handleSavedColorSelect, onKeyDown: this.handleSavedColorKeyDown, scale: scale, tabIndex: 0 })))
  13291. ])) : null))));
  13292. }
  13293. // --------------------------------------------------------------------------
  13294. //
  13295. // Private Methods
  13296. //
  13297. //--------------------------------------------------------------------------
  13298. handleKeyDown(event) {
  13299. if (event.key === "Enter") {
  13300. event.preventDefault();
  13301. }
  13302. }
  13303. showIncompatibleColorWarning(value, format) {
  13304. console.warn(`ignoring color value (${value}) as it is not compatible with the current format (${format})`);
  13305. }
  13306. setMode(format) {
  13307. this.mode = format === "auto" ? this.mode : format;
  13308. }
  13309. captureHueSliderColor(x) {
  13310. const { dimensions: { slider: { width } } } = this;
  13311. const hue = (360 / width) * x;
  13312. this.internalColorSet(this.baseColorFieldColor.hue(hue), false);
  13313. }
  13314. getCanvasRegion(y) {
  13315. const { dimensions: { colorField: { height: colorFieldHeight }, slider: { height: sliderHeight } } } = this;
  13316. if (y <= colorFieldHeight) {
  13317. return "color-field";
  13318. }
  13319. if (y <= colorFieldHeight + sliderHeight) {
  13320. return "slider";
  13321. }
  13322. return "none";
  13323. }
  13324. internalColorSet(color, skipEqual = true, context = "user-interaction") {
  13325. if (skipEqual && colorEqual(color, this.color)) {
  13326. return;
  13327. }
  13328. this.internalColorUpdateContext = context;
  13329. this.color = color;
  13330. this.value = this.toValue(color);
  13331. this.internalColorUpdateContext = null;
  13332. }
  13333. toValue(color, format = this.mode) {
  13334. if (!color) {
  13335. return null;
  13336. }
  13337. const hexMode = "hex";
  13338. if (format.includes(hexMode)) {
  13339. return normalizeHex(color.round()[hexMode]());
  13340. }
  13341. if (format.includes("-css")) {
  13342. return color[format.replace("-css", "").replace("a", "")]().round().string();
  13343. }
  13344. const colorObject = color[format]().round().object();
  13345. if (format.endsWith("a")) {
  13346. // normalize alpha prop
  13347. colorObject.a = colorObject.alpha;
  13348. delete colorObject.alpha;
  13349. }
  13350. return colorObject;
  13351. }
  13352. getSliderCapSpacing() {
  13353. const { dimensions: { slider: { height }, thumb: { radius } } } = this;
  13354. return radius * 2 - height;
  13355. }
  13356. updateDimensions(scale = "m") {
  13357. this.dimensions = DIMENSIONS[scale];
  13358. }
  13359. drawColorField() {
  13360. const context = this.fieldAndSliderRenderingContext;
  13361. const { dimensions: { colorField: { height, width } } } = this;
  13362. context.fillStyle = this.baseColorFieldColor.hsv().saturationv(100).value(100).string();
  13363. context.fillRect(0, 0, width, height);
  13364. const whiteGradient = context.createLinearGradient(0, 0, width, 0);
  13365. whiteGradient.addColorStop(0, "rgba(255,255,255,1)");
  13366. whiteGradient.addColorStop(1, "rgba(255,255,255,0)");
  13367. context.fillStyle = whiteGradient;
  13368. context.fillRect(0, 0, width, height);
  13369. const blackGradient = context.createLinearGradient(0, 0, 0, height);
  13370. blackGradient.addColorStop(0, "rgba(0,0,0,0)");
  13371. blackGradient.addColorStop(1, "rgba(0,0,0,1)");
  13372. context.fillStyle = blackGradient;
  13373. context.fillRect(0, 0, width, height);
  13374. this.drawActiveColorFieldColor();
  13375. }
  13376. setCanvasContextSize(canvas, { height, width }) {
  13377. const devicePixelRatio = window.devicePixelRatio || 1;
  13378. canvas.width = width * devicePixelRatio;
  13379. canvas.height = height * devicePixelRatio;
  13380. canvas.style.height = `${height}px`;
  13381. canvas.style.width = `${width}px`;
  13382. const context = canvas.getContext("2d");
  13383. context.scale(devicePixelRatio, devicePixelRatio);
  13384. }
  13385. updateCanvasSize(canvas) {
  13386. if (!canvas) {
  13387. return;
  13388. }
  13389. this.setCanvasContextSize(canvas, {
  13390. width: this.dimensions.colorField.width,
  13391. height: this.dimensions.colorField.height +
  13392. this.dimensions.slider.height +
  13393. this.getSliderCapSpacing() * 2
  13394. });
  13395. this.drawColorFieldAndSlider();
  13396. }
  13397. containsPoint(testPointX, testPointY, boundsX, boundsY, boundsRadius) {
  13398. return (Math.pow(testPointX - boundsX, 2) + Math.pow(testPointY - boundsY, 2) <=
  13399. Math.pow(boundsRadius, 2));
  13400. }
  13401. drawActiveColorFieldColor() {
  13402. const { color } = this;
  13403. if (!color) {
  13404. return;
  13405. }
  13406. const hsvColor = color.hsv();
  13407. const { dimensions: { colorField: { height, width }, thumb: { radius } } } = this;
  13408. const x = hsvColor.saturationv() / (HSV_LIMITS.s / width);
  13409. const y = height - hsvColor.value() / (HSV_LIMITS.v / height);
  13410. requestAnimationFrame(() => {
  13411. this.colorFieldScopeLeft = x;
  13412. this.colorFieldScopeTop = y;
  13413. });
  13414. this.drawThumb(this.fieldAndSliderRenderingContext, radius, x, y, hsvColor, this.hueThumbState);
  13415. }
  13416. drawThumb(context, radius, x, y, color, state) {
  13417. const startAngle = 0;
  13418. const endAngle = 2 * Math.PI;
  13419. context.beginPath();
  13420. context.arc(x, y, radius, startAngle, endAngle);
  13421. context.shadowBlur = state === "hover" ? 32 : 16;
  13422. context.shadowColor = `rgba(0, 0, 0, ${state === "drag" ? 0.32 : 0.16})`;
  13423. context.fillStyle = "#fff";
  13424. context.fill();
  13425. context.beginPath();
  13426. context.arc(x, y, radius - 3, startAngle, endAngle);
  13427. context.shadowBlur = 0;
  13428. context.shadowColor = "transparent";
  13429. context.fillStyle = color.rgb().string();
  13430. context.fill();
  13431. }
  13432. drawActiveHueSliderColor() {
  13433. const { color } = this;
  13434. if (!color) {
  13435. return;
  13436. }
  13437. const hsvColor = color.hsv().saturationv(100).value(100);
  13438. const { dimensions: { colorField: { height: colorFieldHeight }, slider: { height, width }, thumb: { radius } } } = this;
  13439. const x = hsvColor.hue() / (360 / width);
  13440. const y = height / 2 + colorFieldHeight;
  13441. requestAnimationFrame(() => {
  13442. this.hueScopeLeft = x;
  13443. this.hueScopeTop = y;
  13444. });
  13445. this.drawThumb(this.fieldAndSliderRenderingContext, radius, x, y, hsvColor, this.sliderThumbState);
  13446. }
  13447. drawHueSlider() {
  13448. const context = this.fieldAndSliderRenderingContext;
  13449. const { dimensions: { colorField: { height: colorFieldHeight }, slider: { height, width } } } = this;
  13450. const gradient = context.createLinearGradient(0, 0, width, 0);
  13451. const hueSliderColorStopKeywords = ["red", "yellow", "lime", "cyan", "blue", "magenta", "red"];
  13452. const offset = 1 / (hueSliderColorStopKeywords.length - 1);
  13453. let currentOffset = 0;
  13454. hueSliderColorStopKeywords.forEach((keyword) => {
  13455. gradient.addColorStop(currentOffset, color(keyword).string());
  13456. currentOffset += offset;
  13457. });
  13458. context.fillStyle = gradient;
  13459. context.clearRect(0, colorFieldHeight, width, height + this.getSliderCapSpacing() * 2);
  13460. context.fillRect(0, colorFieldHeight, width, height);
  13461. this.drawActiveHueSliderColor();
  13462. }
  13463. updateColorFromChannels(channels) {
  13464. this.internalColorSet(color(channels, this.channelMode));
  13465. }
  13466. updateChannelsFromColor(color) {
  13467. this.channels = color ? this.toChannels(color) : [null, null, null];
  13468. }
  13469. toChannels(color) {
  13470. const { channelMode } = this;
  13471. return color[channelMode]()
  13472. .array()
  13473. .map((value) => Math.floor(value));
  13474. }
  13475. get el() { return getElement(this); }
  13476. static get watchers() { return {
  13477. "color": ["handleColorChange"],
  13478. "format": ["handleFormatChange"],
  13479. "scale": ["handleScaleChange"],
  13480. "value": ["handleValueChange"]
  13481. }; }
  13482. static get style() { return colorPickerCss; }
  13483. static get cmpMeta() { return {
  13484. "$flags$": 9,
  13485. "$tagName$": "calcite-color-picker",
  13486. "$members$": {
  13487. "allowEmpty": [516, "allow-empty"],
  13488. "appearance": [513],
  13489. "color": [1040],
  13490. "disabled": [516],
  13491. "format": [513],
  13492. "hideHex": [516, "hide-hex"],
  13493. "hideChannels": [516, "hide-channels"],
  13494. "hideSaved": [516, "hide-saved"],
  13495. "intlB": [1, "intl-b"],
  13496. "intlBlue": [1, "intl-blue"],
  13497. "intlDeleteColor": [1, "intl-delete-color"],
  13498. "intlG": [1, "intl-g"],
  13499. "intlGreen": [1, "intl-green"],
  13500. "intlH": [1, "intl-h"],
  13501. "intlHsv": [1, "intl-hsv"],
  13502. "intlHex": [1, "intl-hex"],
  13503. "intlHue": [1, "intl-hue"],
  13504. "intlNoColor": [1, "intl-no-color"],
  13505. "intlR": [1, "intl-r"],
  13506. "intlRed": [1, "intl-red"],
  13507. "intlRgb": [1, "intl-rgb"],
  13508. "intlS": [1, "intl-s"],
  13509. "intlSaturation": [1, "intl-saturation"],
  13510. "intlSaveColor": [1, "intl-save-color"],
  13511. "intlSaved": [1, "intl-saved"],
  13512. "intlV": [1, "intl-v"],
  13513. "intlValue": [1, "intl-value"],
  13514. "scale": [513],
  13515. "storageId": [513, "storage-id"],
  13516. "numberingSystem": [513, "numbering-system"],
  13517. "value": [1025],
  13518. "colorFieldAndSliderInteractive": [32],
  13519. "channelMode": [32],
  13520. "channels": [32],
  13521. "dimensions": [32],
  13522. "savedColors": [32],
  13523. "colorFieldScopeTop": [32],
  13524. "colorFieldScopeLeft": [32],
  13525. "scopeOrientation": [32],
  13526. "hueScopeLeft": [32],
  13527. "hueScopeTop": [32],
  13528. "setFocus": [64]
  13529. },
  13530. "$listeners$": [[2, "keydown", "handleChannelKeyUpOrDown"], [2, "keyup", "handleChannelKeyUpOrDown"]],
  13531. "$lazyBundleId$": "-",
  13532. "$attrsToReflect$": [["allowEmpty", "allow-empty"], ["appearance", "appearance"], ["disabled", "disabled"], ["format", "format"], ["hideHex", "hide-hex"], ["hideChannels", "hide-channels"], ["hideSaved", "hide-saved"], ["scale", "scale"], ["storageId", "storage-id"], ["numberingSystem", "numbering-system"]]
  13533. }; }
  13534. }
  13535. const CSS$J = {
  13536. container: "container",
  13537. preview: "preview",
  13538. input: "input"
  13539. };
  13540. const colorPickerHexInputCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-color-picker-hex-input:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-color-picker-hex-input{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-color-picker-hex-input{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-color-picker-hex-input{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-color-picker-hex-input{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-color-picker-hex-input{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-color-picker-hex-input:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-color-picker-hex-input:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-color-picker-hex-input-h{display:none}/*!@:host*/.sc-calcite-color-picker-hex-input-h{display:block}/*!@.container*/.container.sc-calcite-color-picker-hex-input{display:inline-grid;inline-size:100%;align-items:center;grid-template-columns:1fr auto}/*!@.preview*/.preview.sc-calcite-color-picker-hex-input{grid-column:2/3;pointer-events:none;margin-block:0px;margin-inline:0.25rem;display:flex;align-items:center}/*!@.preview,\n.input*/.preview.sc-calcite-color-picker-hex-input,.input.sc-calcite-color-picker-hex-input{grid-row:1}/*!@.input*/.input.sc-calcite-color-picker-hex-input{grid-column:1/3;inline-size:100%;text-transform:uppercase}";
  13541. const DEFAULT_COLOR = color();
  13542. class ColorPickerHexInput {
  13543. constructor(hostRef) {
  13544. registerInstance(this, hostRef);
  13545. this.calciteColorPickerHexInputChange = createEvent(this, "calciteColorPickerHexInputChange", 6);
  13546. //--------------------------------------------------------------------------
  13547. //
  13548. // Public Properties
  13549. //
  13550. //--------------------------------------------------------------------------
  13551. /**
  13552. * When `false`, an empty color (`null`) will be allowed as a `value`. Otherwise, a color value is enforced on the component.
  13553. *
  13554. * When `true`, a color value is enforced, and clearing the input or blurring will restore the last valid `value`. When `false`, an empty color (`null`) will be allowed as a `value`.
  13555. */
  13556. this.allowEmpty = false;
  13557. /**
  13558. * Accessible name for the Hex input.
  13559. *
  13560. * @default "Hex"
  13561. */
  13562. this.intlHex = TEXT$k.hex;
  13563. /**
  13564. * Accessible name for the Hex input when there is no color selected.
  13565. *
  13566. * @default "No color"
  13567. */
  13568. this.intlNoColor = TEXT$k.noColor;
  13569. /** Specifies the size of the component. */
  13570. this.scale = "m";
  13571. /**
  13572. * The Hex value.
  13573. */
  13574. this.value = normalizeHex(DEFAULT_COLOR.hex());
  13575. this.onCalciteInternalInputBlur = () => {
  13576. const node = this.inputNode;
  13577. const inputValue = node.value;
  13578. const hex = `#${inputValue}`;
  13579. const willClearValue = this.allowEmpty && !inputValue;
  13580. if (willClearValue || (isValidHex(hex) && isLonghandHex(hex))) {
  13581. return;
  13582. }
  13583. // manipulating DOM directly since rerender doesn't update input value
  13584. node.value =
  13585. this.allowEmpty && !this.internalColor
  13586. ? ""
  13587. : this.formatForInternalInput(rgbToHex(this.internalColor.object()));
  13588. };
  13589. this.onInputChange = () => {
  13590. this.internalSetValue(this.inputNode.value, this.value);
  13591. };
  13592. /**
  13593. * The last valid/selected color. Used as a fallback if an invalid hex code is entered.
  13594. */
  13595. this.internalColor = DEFAULT_COLOR;
  13596. this.previousNonNullValue = this.value;
  13597. this.storeInputRef = (node) => {
  13598. this.inputNode = node;
  13599. };
  13600. }
  13601. //--------------------------------------------------------------------------
  13602. //
  13603. // Lifecycle
  13604. //
  13605. //--------------------------------------------------------------------------
  13606. connectedCallback() {
  13607. const { allowEmpty, value } = this;
  13608. if (value) {
  13609. const normalized = normalizeHex(value);
  13610. if (isValidHex(normalized)) {
  13611. this.internalSetValue(normalized, normalized, false);
  13612. }
  13613. return;
  13614. }
  13615. if (allowEmpty) {
  13616. this.internalSetValue(null, null, false);
  13617. }
  13618. }
  13619. handleValueChange(value, oldValue) {
  13620. this.internalSetValue(value, oldValue, false);
  13621. }
  13622. // using @Listen as a workaround for VDOM listener not firing
  13623. onInputKeyDown(event) {
  13624. const { altKey, ctrlKey, metaKey, shiftKey } = event;
  13625. const { internalColor, value } = this;
  13626. const { key } = event;
  13627. if (key === "Tab" || key === "Enter") {
  13628. this.onInputChange();
  13629. return;
  13630. }
  13631. const isNudgeKey = key === "ArrowDown" || key === "ArrowUp";
  13632. const oldValue = this.value;
  13633. if (isNudgeKey) {
  13634. if (!value) {
  13635. this.internalSetValue(this.previousNonNullValue, oldValue);
  13636. event.preventDefault();
  13637. return;
  13638. }
  13639. const direction = key === "ArrowUp" ? 1 : -1;
  13640. const bump = shiftKey ? 10 : 1;
  13641. this.internalSetValue(normalizeHex(this.nudgeRGBChannels(internalColor, bump * direction).hex()), oldValue);
  13642. event.preventDefault();
  13643. return;
  13644. }
  13645. const withModifiers = altKey || ctrlKey || metaKey;
  13646. const singleChar = key.length === 1;
  13647. const validHexChar = hexChar.test(key);
  13648. if (singleChar && !withModifiers && !validHexChar) {
  13649. event.preventDefault();
  13650. }
  13651. }
  13652. onPaste(event) {
  13653. const hex = event.clipboardData.getData("text");
  13654. if (isValidHex(hex)) {
  13655. event.preventDefault();
  13656. this.inputNode.value = hex.slice(1);
  13657. }
  13658. }
  13659. //--------------------------------------------------------------------------
  13660. //
  13661. // Lifecycle
  13662. //
  13663. //--------------------------------------------------------------------------
  13664. render() {
  13665. const { intlHex, value } = this;
  13666. const hexInputValue = this.formatForInternalInput(value);
  13667. return (hAsync("div", { class: CSS$J.container }, hAsync("calcite-input", { class: CSS$J.input, label: intlHex, maxLength: 6, numberingSystem: this.numberingSystem, onCalciteInputChange: this.onInputChange, onCalciteInternalInputBlur: this.onCalciteInternalInputBlur, onKeyDown: this.handleKeyDown, onPaste: this.onPaste, prefixText: "#", ref: this.storeInputRef, scale: this.scale, value: hexInputValue }), hexInputValue ? (hAsync("calcite-color-picker-swatch", { active: true, class: CSS$J.preview, color: `#${hexInputValue}`, scale: this.scale })) : null));
  13668. }
  13669. //--------------------------------------------------------------------------
  13670. //
  13671. // Public Methods
  13672. //
  13673. //--------------------------------------------------------------------------
  13674. /** Sets focus on the component. */
  13675. async setFocus() {
  13676. focusElement(this.inputNode);
  13677. }
  13678. //--------------------------------------------------------------------------
  13679. //
  13680. // Private Methods
  13681. //
  13682. //--------------------------------------------------------------------------
  13683. internalSetValue(value, oldValue, emit = true) {
  13684. if (value) {
  13685. const normalized = normalizeHex(value);
  13686. if (isValidHex(normalized)) {
  13687. const { internalColor } = this;
  13688. const changed = !internalColor || normalized !== normalizeHex(internalColor.hex());
  13689. this.internalColor = color(normalized);
  13690. this.previousNonNullValue = normalized;
  13691. this.value = normalized;
  13692. if (changed && emit) {
  13693. this.calciteColorPickerHexInputChange.emit();
  13694. }
  13695. return;
  13696. }
  13697. }
  13698. else if (this.allowEmpty) {
  13699. this.internalColor = null;
  13700. this.value = null;
  13701. if (emit) {
  13702. this.calciteColorPickerHexInputChange.emit();
  13703. }
  13704. return;
  13705. }
  13706. this.value = oldValue;
  13707. }
  13708. formatForInternalInput(hex) {
  13709. return hex ? hex.replace("#", "") : "";
  13710. }
  13711. nudgeRGBChannels(color$1, amount) {
  13712. return color.rgb(color$1.array().map((channel) => channel + amount));
  13713. }
  13714. handleKeyDown(event) {
  13715. if (event.key === "Enter") {
  13716. event.preventDefault();
  13717. }
  13718. }
  13719. get el() { return getElement(this); }
  13720. static get watchers() { return {
  13721. "value": ["handleValueChange"]
  13722. }; }
  13723. static get style() { return colorPickerHexInputCss; }
  13724. static get cmpMeta() { return {
  13725. "$flags$": 9,
  13726. "$tagName$": "calcite-color-picker-hex-input",
  13727. "$members$": {
  13728. "allowEmpty": [4, "allow-empty"],
  13729. "intlHex": [1, "intl-hex"],
  13730. "intlNoColor": [1, "intl-no-color"],
  13731. "scale": [513],
  13732. "value": [1537],
  13733. "numberingSystem": [1, "numbering-system"],
  13734. "internalColor": [32],
  13735. "setFocus": [64]
  13736. },
  13737. "$listeners$": [[2, "keydown", "onInputKeyDown"]],
  13738. "$lazyBundleId$": "-",
  13739. "$attrsToReflect$": [["scale", "scale"], ["value", "value"]]
  13740. }; }
  13741. }
  13742. const CSS$I = {
  13743. swatch: "swatch",
  13744. noColorIcon: "no-color-icon"
  13745. };
  13746. const COLORS = {
  13747. borderLight: "rgba(0, 0, 0, 0.3)",
  13748. borderDark: "rgba(255, 255, 255, 0.15)"
  13749. };
  13750. const colorPickerSwatchCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-color-picker-swatch:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-color-picker-swatch{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-color-picker-swatch{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-color-picker-swatch{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-color-picker-swatch{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-color-picker-swatch{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-color-picker-swatch:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-color-picker-swatch:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-color-picker-swatch-h{display:none}/*!@:host*/.sc-calcite-color-picker-swatch-h{position:relative;display:inline-flex}/*!@:host([scale=s])*/[scale=s].sc-calcite-color-picker-swatch-h{block-size:1.25rem;inline-size:1.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-color-picker-swatch-h{block-size:1.5rem;inline-size:1.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-color-picker-swatch-h{block-size:2rem;inline-size:2rem}/*!@.swatch*/.swatch.sc-calcite-color-picker-swatch{overflow:visible;block-size:inherit;inline-size:inherit}/*!@.swatch rect*/.swatch.sc-calcite-color-picker-swatch rect.sc-calcite-color-picker-swatch{transition-property:all;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@.no-color-icon*/.no-color-icon.sc-calcite-color-picker-swatch{position:absolute;inset:0px;block-size:100%;inline-size:100%}";
  13751. class ColorPickerSwatch {
  13752. constructor(hostRef) {
  13753. registerInstance(this, hostRef);
  13754. //--------------------------------------------------------------------------
  13755. //
  13756. // Properties
  13757. //
  13758. //--------------------------------------------------------------------------
  13759. /**
  13760. * When `true`, the component is active.
  13761. */
  13762. this.active = false;
  13763. /**
  13764. * Specifies the size of the component.
  13765. */
  13766. this.scale = "m";
  13767. }
  13768. handleColorChange(color$1) {
  13769. this.internalColor = color(color$1);
  13770. }
  13771. //--------------------------------------------------------------------------
  13772. //
  13773. // Lifecycle
  13774. //
  13775. //--------------------------------------------------------------------------
  13776. componentWillLoad() {
  13777. this.handleColorChange(this.color);
  13778. }
  13779. render() {
  13780. const { active, el, internalColor } = this;
  13781. const borderRadius = active ? "100%" : "0";
  13782. const hex = internalColor.hex();
  13783. const theme = getThemeName(el);
  13784. const borderColor = theme === "light" ? COLORS.borderLight : COLORS.borderDark;
  13785. return (hAsync("svg", { class: CSS$I.swatch, xmlns: "http://www.w3.org/2000/svg" }, hAsync("title", null, hex), hAsync("rect", { fill: hex, height: "100%", id: "swatch", rx: borderRadius, stroke: borderColor, "stroke-width": "2", style: { "clip-path": `inset(0 round ${borderRadius})` }, width: "100%" })));
  13786. }
  13787. get el() { return getElement(this); }
  13788. static get watchers() { return {
  13789. "color": ["handleColorChange"]
  13790. }; }
  13791. static get style() { return colorPickerSwatchCss; }
  13792. static get cmpMeta() { return {
  13793. "$flags$": 9,
  13794. "$tagName$": "calcite-color-picker-swatch",
  13795. "$members$": {
  13796. "active": [516],
  13797. "color": [1],
  13798. "scale": [513]
  13799. },
  13800. "$listeners$": undefined,
  13801. "$lazyBundleId$": "-",
  13802. "$attrsToReflect$": [["active", "active"], ["scale", "scale"]]
  13803. }; }
  13804. }
  13805. const filter = (data, value) => {
  13806. const escapedValue = escapeRegExp(value);
  13807. const regex = new RegExp(escapedValue, "i");
  13808. if (data.length === 0) {
  13809. console.warn(`No data was passed to the filter function.
  13810. The data argument should be an array of objects`);
  13811. }
  13812. const find = (input, RE) => {
  13813. if ((input === null || input === void 0 ? void 0 : input.constant) || (input === null || input === void 0 ? void 0 : input.filterDisabled)) {
  13814. return true;
  13815. }
  13816. let found = false;
  13817. forIn(input, (val) => {
  13818. if (typeof val === "function" || val == null /* intentional == to catch undefined */) {
  13819. return;
  13820. }
  13821. if (Array.isArray(val) || (typeof val === "object" && val !== null)) {
  13822. if (find(val, RE)) {
  13823. found = true;
  13824. }
  13825. }
  13826. else if (RE.test(val)) {
  13827. found = true;
  13828. }
  13829. });
  13830. return found;
  13831. };
  13832. const result = data.filter((item) => {
  13833. return find(item, regex);
  13834. });
  13835. return result;
  13836. };
  13837. function getSide(placement) {
  13838. return placement.split('-')[0];
  13839. }
  13840. function getAlignment(placement) {
  13841. return placement.split('-')[1];
  13842. }
  13843. function getMainAxisFromPlacement(placement) {
  13844. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  13845. }
  13846. function getLengthFromAxis(axis) {
  13847. return axis === 'y' ? 'height' : 'width';
  13848. }
  13849. function computeCoordsFromPlacement(_ref, placement, rtl) {
  13850. let {
  13851. reference,
  13852. floating
  13853. } = _ref;
  13854. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  13855. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  13856. const mainAxis = getMainAxisFromPlacement(placement);
  13857. const length = getLengthFromAxis(mainAxis);
  13858. const commonAlign = reference[length] / 2 - floating[length] / 2;
  13859. const side = getSide(placement);
  13860. const isVertical = mainAxis === 'x';
  13861. let coords;
  13862. switch (side) {
  13863. case 'top':
  13864. coords = {
  13865. x: commonX,
  13866. y: reference.y - floating.height
  13867. };
  13868. break;
  13869. case 'bottom':
  13870. coords = {
  13871. x: commonX,
  13872. y: reference.y + reference.height
  13873. };
  13874. break;
  13875. case 'right':
  13876. coords = {
  13877. x: reference.x + reference.width,
  13878. y: commonY
  13879. };
  13880. break;
  13881. case 'left':
  13882. coords = {
  13883. x: reference.x - floating.width,
  13884. y: commonY
  13885. };
  13886. break;
  13887. default:
  13888. coords = {
  13889. x: reference.x,
  13890. y: reference.y
  13891. };
  13892. }
  13893. switch (getAlignment(placement)) {
  13894. case 'start':
  13895. coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  13896. break;
  13897. case 'end':
  13898. coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  13899. break;
  13900. }
  13901. return coords;
  13902. }
  13903. /**
  13904. * Computes the `x` and `y` coordinates that will place the floating element
  13905. * next to a reference element when it is given a certain positioning strategy.
  13906. *
  13907. * This export does not have any `platform` interface logic. You will need to
  13908. * write one for the platform you are using Floating UI with.
  13909. */
  13910. const computePosition$1 = async (reference, floating, config) => {
  13911. const {
  13912. placement = 'bottom',
  13913. strategy = 'absolute',
  13914. middleware = [],
  13915. platform
  13916. } = config;
  13917. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  13918. let rects = await platform.getElementRects({
  13919. reference,
  13920. floating,
  13921. strategy
  13922. });
  13923. let {
  13924. x,
  13925. y
  13926. } = computeCoordsFromPlacement(rects, placement, rtl);
  13927. let statefulPlacement = placement;
  13928. let middlewareData = {};
  13929. let resetCount = 0;
  13930. for (let i = 0; i < middleware.length; i++) {
  13931. const {
  13932. name,
  13933. fn
  13934. } = middleware[i];
  13935. const {
  13936. x: nextX,
  13937. y: nextY,
  13938. data,
  13939. reset
  13940. } = await fn({
  13941. x,
  13942. y,
  13943. initialPlacement: placement,
  13944. placement: statefulPlacement,
  13945. strategy,
  13946. middlewareData,
  13947. rects,
  13948. platform,
  13949. elements: {
  13950. reference,
  13951. floating
  13952. }
  13953. });
  13954. x = nextX != null ? nextX : x;
  13955. y = nextY != null ? nextY : y;
  13956. middlewareData = { ...middlewareData,
  13957. [name]: { ...middlewareData[name],
  13958. ...data
  13959. }
  13960. };
  13961. if (reset && resetCount <= 50) {
  13962. resetCount++;
  13963. if (typeof reset === 'object') {
  13964. if (reset.placement) {
  13965. statefulPlacement = reset.placement;
  13966. }
  13967. if (reset.rects) {
  13968. rects = reset.rects === true ? await platform.getElementRects({
  13969. reference,
  13970. floating,
  13971. strategy
  13972. }) : reset.rects;
  13973. }
  13974. ({
  13975. x,
  13976. y
  13977. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  13978. }
  13979. i = -1;
  13980. continue;
  13981. }
  13982. }
  13983. return {
  13984. x,
  13985. y,
  13986. placement: statefulPlacement,
  13987. strategy,
  13988. middlewareData
  13989. };
  13990. };
  13991. function expandPaddingObject(padding) {
  13992. return {
  13993. top: 0,
  13994. right: 0,
  13995. bottom: 0,
  13996. left: 0,
  13997. ...padding
  13998. };
  13999. }
  14000. function getSideObjectFromPadding(padding) {
  14001. return typeof padding !== 'number' ? expandPaddingObject(padding) : {
  14002. top: padding,
  14003. right: padding,
  14004. bottom: padding,
  14005. left: padding
  14006. };
  14007. }
  14008. function rectToClientRect(rect) {
  14009. return { ...rect,
  14010. top: rect.y,
  14011. left: rect.x,
  14012. right: rect.x + rect.width,
  14013. bottom: rect.y + rect.height
  14014. };
  14015. }
  14016. /**
  14017. * Resolves with an object of overflow side offsets that determine how much the
  14018. * element is overflowing a given clipping boundary.
  14019. * - positive = overflowing the boundary by that number of pixels
  14020. * - negative = how many pixels left before it will overflow
  14021. * - 0 = lies flush with the boundary
  14022. * @see https://floating-ui.com/docs/detectOverflow
  14023. */
  14024. async function detectOverflow(middlewareArguments, options) {
  14025. var _await$platform$isEle;
  14026. if (options === void 0) {
  14027. options = {};
  14028. }
  14029. const {
  14030. x,
  14031. y,
  14032. platform,
  14033. rects,
  14034. elements,
  14035. strategy
  14036. } = middlewareArguments;
  14037. const {
  14038. boundary = 'clippingAncestors',
  14039. rootBoundary = 'viewport',
  14040. elementContext = 'floating',
  14041. altBoundary = false,
  14042. padding = 0
  14043. } = options;
  14044. const paddingObject = getSideObjectFromPadding(padding);
  14045. const altContext = elementContext === 'floating' ? 'reference' : 'floating';
  14046. const element = elements[altBoundary ? altContext : elementContext];
  14047. const clippingClientRect = rectToClientRect(await platform.getClippingRect({
  14048. element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
  14049. boundary,
  14050. rootBoundary,
  14051. strategy
  14052. }));
  14053. const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  14054. rect: elementContext === 'floating' ? { ...rects.floating,
  14055. x,
  14056. y
  14057. } : rects.reference,
  14058. offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
  14059. strategy
  14060. }) : rects[elementContext]);
  14061. return {
  14062. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  14063. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  14064. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  14065. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  14066. };
  14067. }
  14068. const min$1 = Math.min;
  14069. const max$1 = Math.max;
  14070. function within(min$1$1, value, max$1$1) {
  14071. return max$1(min$1$1, min$1(value, max$1$1));
  14072. }
  14073. /**
  14074. * Positions an inner element of the floating element such that it is centered
  14075. * to the reference element.
  14076. * @see https://floating-ui.com/docs/arrow
  14077. */
  14078. const arrow = options => ({
  14079. name: 'arrow',
  14080. options,
  14081. async fn(middlewareArguments) {
  14082. // Since `element` is required, we don't Partial<> the type
  14083. const {
  14084. element,
  14085. padding = 0
  14086. } = options != null ? options : {};
  14087. const {
  14088. x,
  14089. y,
  14090. placement,
  14091. rects,
  14092. platform
  14093. } = middlewareArguments;
  14094. if (element == null) {
  14095. return {};
  14096. }
  14097. const paddingObject = getSideObjectFromPadding(padding);
  14098. const coords = {
  14099. x,
  14100. y
  14101. };
  14102. const axis = getMainAxisFromPlacement(placement);
  14103. const alignment = getAlignment(placement);
  14104. const length = getLengthFromAxis(axis);
  14105. const arrowDimensions = await platform.getDimensions(element);
  14106. const minProp = axis === 'y' ? 'top' : 'left';
  14107. const maxProp = axis === 'y' ? 'bottom' : 'right';
  14108. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  14109. const startDiff = coords[axis] - rects.reference[axis];
  14110. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  14111. let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  14112. if (clientSize === 0) {
  14113. clientSize = rects.floating[length];
  14114. }
  14115. const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
  14116. // point is outside the floating element's bounds
  14117. const min = paddingObject[minProp];
  14118. const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
  14119. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  14120. const offset = within(min, center, max); // Make sure that arrow points at the reference
  14121. const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
  14122. const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
  14123. const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
  14124. return {
  14125. [axis]: coords[axis] - alignmentOffset,
  14126. data: {
  14127. [axis]: offset,
  14128. centerOffset: center - offset
  14129. }
  14130. };
  14131. }
  14132. });
  14133. const hash$1 = {
  14134. left: 'right',
  14135. right: 'left',
  14136. bottom: 'top',
  14137. top: 'bottom'
  14138. };
  14139. function getOppositePlacement(placement) {
  14140. return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
  14141. }
  14142. function getAlignmentSides(placement, rects, rtl) {
  14143. if (rtl === void 0) {
  14144. rtl = false;
  14145. }
  14146. const alignment = getAlignment(placement);
  14147. const mainAxis = getMainAxisFromPlacement(placement);
  14148. const length = getLengthFromAxis(mainAxis);
  14149. let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
  14150. if (rects.reference[length] > rects.floating[length]) {
  14151. mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  14152. }
  14153. return {
  14154. main: mainAlignmentSide,
  14155. cross: getOppositePlacement(mainAlignmentSide)
  14156. };
  14157. }
  14158. const hash = {
  14159. start: 'end',
  14160. end: 'start'
  14161. };
  14162. function getOppositeAlignmentPlacement(placement) {
  14163. return placement.replace(/start|end/g, matched => hash[matched]);
  14164. }
  14165. const sides = ['top', 'right', 'bottom', 'left'];
  14166. const allPlacements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
  14167. function getPlacementList(alignment, autoAlignment, allowedPlacements) {
  14168. const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
  14169. return allowedPlacementsSortedByAlignment.filter(placement => {
  14170. if (alignment) {
  14171. return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
  14172. }
  14173. return true;
  14174. });
  14175. }
  14176. /**
  14177. * Automatically chooses the `placement` which has the most space available.
  14178. * @see https://floating-ui.com/docs/autoPlacement
  14179. */
  14180. const autoPlacement = function (options) {
  14181. if (options === void 0) {
  14182. options = {};
  14183. }
  14184. return {
  14185. name: 'autoPlacement',
  14186. options,
  14187. async fn(middlewareArguments) {
  14188. var _middlewareData$autoP, _middlewareData$autoP2, _middlewareData$autoP3, _middlewareData$autoP4, _placementsSortedByLe;
  14189. const {
  14190. x,
  14191. y,
  14192. rects,
  14193. middlewareData,
  14194. placement,
  14195. platform,
  14196. elements
  14197. } = middlewareArguments;
  14198. const {
  14199. alignment = null,
  14200. allowedPlacements = allPlacements,
  14201. autoAlignment = true,
  14202. ...detectOverflowOptions
  14203. } = options;
  14204. const placements = getPlacementList(alignment, autoAlignment, allowedPlacements);
  14205. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  14206. const currentIndex = (_middlewareData$autoP = (_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.index) != null ? _middlewareData$autoP : 0;
  14207. const currentPlacement = placements[currentIndex];
  14208. if (currentPlacement == null) {
  14209. return {};
  14210. }
  14211. const {
  14212. main,
  14213. cross
  14214. } = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))); // Make `computeCoords` start from the right place
  14215. if (placement !== currentPlacement) {
  14216. return {
  14217. x,
  14218. y,
  14219. reset: {
  14220. placement: placements[0]
  14221. }
  14222. };
  14223. }
  14224. const currentOverflows = [overflow[getSide(currentPlacement)], overflow[main], overflow[cross]];
  14225. const allOverflows = [...((_middlewareData$autoP3 = (_middlewareData$autoP4 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP4.overflows) != null ? _middlewareData$autoP3 : []), {
  14226. placement: currentPlacement,
  14227. overflows: currentOverflows
  14228. }];
  14229. const nextPlacement = placements[currentIndex + 1]; // There are more placements to check
  14230. if (nextPlacement) {
  14231. return {
  14232. data: {
  14233. index: currentIndex + 1,
  14234. overflows: allOverflows
  14235. },
  14236. reset: {
  14237. placement: nextPlacement
  14238. }
  14239. };
  14240. }
  14241. const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);
  14242. const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find(_ref => {
  14243. let {
  14244. overflows
  14245. } = _ref;
  14246. return overflows.every(overflow => overflow <= 0);
  14247. })) == null ? void 0 : _placementsSortedByLe.placement;
  14248. const resetPlacement = placementThatFitsOnAllSides != null ? placementThatFitsOnAllSides : placementsSortedByLeastOverflow[0].placement;
  14249. if (resetPlacement !== placement) {
  14250. return {
  14251. data: {
  14252. index: currentIndex + 1,
  14253. overflows: allOverflows
  14254. },
  14255. reset: {
  14256. placement: resetPlacement
  14257. }
  14258. };
  14259. }
  14260. return {};
  14261. }
  14262. };
  14263. };
  14264. function getExpandedPlacements(placement) {
  14265. const oppositePlacement = getOppositePlacement(placement);
  14266. return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
  14267. }
  14268. /**
  14269. * Changes the placement of the floating element to one that will fit if the
  14270. * initially specified `placement` does not.
  14271. * @see https://floating-ui.com/docs/flip
  14272. */
  14273. const flip = function (options) {
  14274. if (options === void 0) {
  14275. options = {};
  14276. }
  14277. return {
  14278. name: 'flip',
  14279. options,
  14280. async fn(middlewareArguments) {
  14281. var _middlewareData$flip;
  14282. const {
  14283. placement,
  14284. middlewareData,
  14285. rects,
  14286. initialPlacement,
  14287. platform,
  14288. elements
  14289. } = middlewareArguments;
  14290. const {
  14291. mainAxis: checkMainAxis = true,
  14292. crossAxis: checkCrossAxis = true,
  14293. fallbackPlacements: specifiedFallbackPlacements,
  14294. fallbackStrategy = 'bestFit',
  14295. flipAlignment = true,
  14296. ...detectOverflowOptions
  14297. } = options;
  14298. const side = getSide(placement);
  14299. const isBasePlacement = side === initialPlacement;
  14300. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
  14301. const placements = [initialPlacement, ...fallbackPlacements];
  14302. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  14303. const overflows = [];
  14304. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  14305. if (checkMainAxis) {
  14306. overflows.push(overflow[side]);
  14307. }
  14308. if (checkCrossAxis) {
  14309. const {
  14310. main,
  14311. cross
  14312. } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
  14313. overflows.push(overflow[main], overflow[cross]);
  14314. }
  14315. overflowsData = [...overflowsData, {
  14316. placement,
  14317. overflows
  14318. }]; // One or more sides is overflowing
  14319. if (!overflows.every(side => side <= 0)) {
  14320. var _middlewareData$flip$, _middlewareData$flip2;
  14321. const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
  14322. const nextPlacement = placements[nextIndex];
  14323. if (nextPlacement) {
  14324. // Try next placement and re-run the lifecycle
  14325. return {
  14326. data: {
  14327. index: nextIndex,
  14328. overflows: overflowsData
  14329. },
  14330. reset: {
  14331. placement: nextPlacement
  14332. }
  14333. };
  14334. }
  14335. let resetPlacement = 'bottom';
  14336. switch (fallbackStrategy) {
  14337. case 'bestFit':
  14338. {
  14339. var _overflowsData$map$so;
  14340. const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
  14341. if (placement) {
  14342. resetPlacement = placement;
  14343. }
  14344. break;
  14345. }
  14346. case 'initialPlacement':
  14347. resetPlacement = initialPlacement;
  14348. break;
  14349. }
  14350. if (placement !== resetPlacement) {
  14351. return {
  14352. reset: {
  14353. placement: resetPlacement
  14354. }
  14355. };
  14356. }
  14357. }
  14358. return {};
  14359. }
  14360. };
  14361. };
  14362. function getSideOffsets(overflow, rect) {
  14363. return {
  14364. top: overflow.top - rect.height,
  14365. right: overflow.right - rect.width,
  14366. bottom: overflow.bottom - rect.height,
  14367. left: overflow.left - rect.width
  14368. };
  14369. }
  14370. function isAnySideFullyClipped(overflow) {
  14371. return sides.some(side => overflow[side] >= 0);
  14372. }
  14373. /**
  14374. * Provides data to hide the floating element in applicable situations, such as
  14375. * when it is not in the same clipping context as the reference element.
  14376. * @see https://floating-ui.com/docs/hide
  14377. */
  14378. const hide = function (_temp) {
  14379. let {
  14380. strategy = 'referenceHidden',
  14381. ...detectOverflowOptions
  14382. } = _temp === void 0 ? {} : _temp;
  14383. return {
  14384. name: 'hide',
  14385. async fn(middlewareArguments) {
  14386. const {
  14387. rects
  14388. } = middlewareArguments;
  14389. switch (strategy) {
  14390. case 'referenceHidden':
  14391. {
  14392. const overflow = await detectOverflow(middlewareArguments, { ...detectOverflowOptions,
  14393. elementContext: 'reference'
  14394. });
  14395. const offsets = getSideOffsets(overflow, rects.reference);
  14396. return {
  14397. data: {
  14398. referenceHiddenOffsets: offsets,
  14399. referenceHidden: isAnySideFullyClipped(offsets)
  14400. }
  14401. };
  14402. }
  14403. case 'escaped':
  14404. {
  14405. const overflow = await detectOverflow(middlewareArguments, { ...detectOverflowOptions,
  14406. altBoundary: true
  14407. });
  14408. const offsets = getSideOffsets(overflow, rects.floating);
  14409. return {
  14410. data: {
  14411. escapedOffsets: offsets,
  14412. escaped: isAnySideFullyClipped(offsets)
  14413. }
  14414. };
  14415. }
  14416. default:
  14417. {
  14418. return {};
  14419. }
  14420. }
  14421. }
  14422. };
  14423. };
  14424. async function convertValueToCoords(middlewareArguments, value) {
  14425. const {
  14426. placement,
  14427. platform,
  14428. elements
  14429. } = middlewareArguments;
  14430. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  14431. const side = getSide(placement);
  14432. const alignment = getAlignment(placement);
  14433. const isVertical = getMainAxisFromPlacement(placement) === 'x';
  14434. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  14435. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  14436. const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
  14437. let {
  14438. mainAxis,
  14439. crossAxis,
  14440. alignmentAxis
  14441. } = typeof rawValue === 'number' ? {
  14442. mainAxis: rawValue,
  14443. crossAxis: 0,
  14444. alignmentAxis: null
  14445. } : {
  14446. mainAxis: 0,
  14447. crossAxis: 0,
  14448. alignmentAxis: null,
  14449. ...rawValue
  14450. };
  14451. if (alignment && typeof alignmentAxis === 'number') {
  14452. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  14453. }
  14454. return isVertical ? {
  14455. x: crossAxis * crossAxisMulti,
  14456. y: mainAxis * mainAxisMulti
  14457. } : {
  14458. x: mainAxis * mainAxisMulti,
  14459. y: crossAxis * crossAxisMulti
  14460. };
  14461. }
  14462. /**
  14463. * Displaces the floating element from its reference element.
  14464. * @see https://floating-ui.com/docs/offset
  14465. */
  14466. const offset = function (value) {
  14467. if (value === void 0) {
  14468. value = 0;
  14469. }
  14470. return {
  14471. name: 'offset',
  14472. options: value,
  14473. async fn(middlewareArguments) {
  14474. const {
  14475. x,
  14476. y
  14477. } = middlewareArguments;
  14478. const diffCoords = await convertValueToCoords(middlewareArguments, value);
  14479. return {
  14480. x: x + diffCoords.x,
  14481. y: y + diffCoords.y,
  14482. data: diffCoords
  14483. };
  14484. }
  14485. };
  14486. };
  14487. function getCrossAxis(axis) {
  14488. return axis === 'x' ? 'y' : 'x';
  14489. }
  14490. /**
  14491. * Shifts the floating element in order to keep it in view when it will overflow
  14492. * a clipping boundary.
  14493. * @see https://floating-ui.com/docs/shift
  14494. */
  14495. const shift = function (options) {
  14496. if (options === void 0) {
  14497. options = {};
  14498. }
  14499. return {
  14500. name: 'shift',
  14501. options,
  14502. async fn(middlewareArguments) {
  14503. const {
  14504. x,
  14505. y,
  14506. placement
  14507. } = middlewareArguments;
  14508. const {
  14509. mainAxis: checkMainAxis = true,
  14510. crossAxis: checkCrossAxis = false,
  14511. limiter = {
  14512. fn: _ref => {
  14513. let {
  14514. x,
  14515. y
  14516. } = _ref;
  14517. return {
  14518. x,
  14519. y
  14520. };
  14521. }
  14522. },
  14523. ...detectOverflowOptions
  14524. } = options;
  14525. const coords = {
  14526. x,
  14527. y
  14528. };
  14529. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  14530. const mainAxis = getMainAxisFromPlacement(getSide(placement));
  14531. const crossAxis = getCrossAxis(mainAxis);
  14532. let mainAxisCoord = coords[mainAxis];
  14533. let crossAxisCoord = coords[crossAxis];
  14534. if (checkMainAxis) {
  14535. const minSide = mainAxis === 'y' ? 'top' : 'left';
  14536. const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
  14537. const min = mainAxisCoord + overflow[minSide];
  14538. const max = mainAxisCoord - overflow[maxSide];
  14539. mainAxisCoord = within(min, mainAxisCoord, max);
  14540. }
  14541. if (checkCrossAxis) {
  14542. const minSide = crossAxis === 'y' ? 'top' : 'left';
  14543. const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
  14544. const min = crossAxisCoord + overflow[minSide];
  14545. const max = crossAxisCoord - overflow[maxSide];
  14546. crossAxisCoord = within(min, crossAxisCoord, max);
  14547. }
  14548. const limitedCoords = limiter.fn({ ...middlewareArguments,
  14549. [mainAxis]: mainAxisCoord,
  14550. [crossAxis]: crossAxisCoord
  14551. });
  14552. return { ...limitedCoords,
  14553. data: {
  14554. x: limitedCoords.x - x,
  14555. y: limitedCoords.y - y
  14556. }
  14557. };
  14558. }
  14559. };
  14560. };
  14561. function isWindow(value) {
  14562. return value && value.document && value.location && value.alert && value.setInterval;
  14563. }
  14564. function getWindow(node) {
  14565. if (node == null) {
  14566. return window;
  14567. }
  14568. if (!isWindow(node)) {
  14569. const ownerDocument = node.ownerDocument;
  14570. return ownerDocument ? ownerDocument.defaultView || window : window;
  14571. }
  14572. return node;
  14573. }
  14574. function getComputedStyle$1(element) {
  14575. return getWindow(element).getComputedStyle(element);
  14576. }
  14577. function getNodeName(node) {
  14578. return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
  14579. }
  14580. function getUAString() {
  14581. const uaData = navigator.userAgentData;
  14582. if (uaData != null && uaData.brands) {
  14583. return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
  14584. }
  14585. return navigator.userAgent;
  14586. }
  14587. function isHTMLElement(value) {
  14588. return value instanceof getWindow(value).HTMLElement;
  14589. }
  14590. function isElement(value) {
  14591. return value instanceof getWindow(value).Element;
  14592. }
  14593. function isNode(value) {
  14594. return value instanceof getWindow(value).Node;
  14595. }
  14596. function isShadowRoot(node) {
  14597. // Browsers without `ShadowRoot` support
  14598. if (typeof ShadowRoot === 'undefined') {
  14599. return false;
  14600. }
  14601. const OwnElement = getWindow(node).ShadowRoot;
  14602. return node instanceof OwnElement || node instanceof ShadowRoot;
  14603. }
  14604. function isOverflowElement(element) {
  14605. // Firefox wants us to check `-x` and `-y` variations as well
  14606. const {
  14607. overflow,
  14608. overflowX,
  14609. overflowY,
  14610. display
  14611. } = getComputedStyle$1(element);
  14612. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
  14613. }
  14614. function isTableElement(element) {
  14615. return ['table', 'td', 'th'].includes(getNodeName(element));
  14616. }
  14617. function isContainingBlock(element) {
  14618. // TODO: Try and use feature detection here instead
  14619. const isFirefox = /firefox/i.test(getUAString());
  14620. const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
  14621. // create a containing block.
  14622. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  14623. return css.transform !== 'none' || css.perspective !== 'none' || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat
  14624. value => {
  14625. const contain = css.contain;
  14626. return contain != null ? contain.includes(value) : false;
  14627. });
  14628. }
  14629. function isLayoutViewport() {
  14630. // Not Safari
  14631. return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
  14632. // • Always-visible scrollbar or not
  14633. // • Width of <html>, etc.
  14634. // const vV = win.visualViewport;
  14635. // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
  14636. }
  14637. function isLastTraversableNode(node) {
  14638. return ['html', 'body', '#document'].includes(getNodeName(node));
  14639. }
  14640. const min = Math.min;
  14641. const max = Math.max;
  14642. const round = Math.round;
  14643. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  14644. var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
  14645. if (includeScale === void 0) {
  14646. includeScale = false;
  14647. }
  14648. if (isFixedStrategy === void 0) {
  14649. isFixedStrategy = false;
  14650. }
  14651. const clientRect = element.getBoundingClientRect();
  14652. let scaleX = 1;
  14653. let scaleY = 1;
  14654. if (includeScale && isHTMLElement(element)) {
  14655. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  14656. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  14657. }
  14658. const win = isElement(element) ? getWindow(element) : window;
  14659. const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  14660. const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
  14661. const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
  14662. const width = clientRect.width / scaleX;
  14663. const height = clientRect.height / scaleY;
  14664. return {
  14665. width,
  14666. height,
  14667. top: y,
  14668. right: x + width,
  14669. bottom: y + height,
  14670. left: x,
  14671. x,
  14672. y
  14673. };
  14674. }
  14675. function getDocumentElement(node) {
  14676. return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
  14677. }
  14678. function getNodeScroll(element) {
  14679. if (isElement(element)) {
  14680. return {
  14681. scrollLeft: element.scrollLeft,
  14682. scrollTop: element.scrollTop
  14683. };
  14684. }
  14685. return {
  14686. scrollLeft: element.pageXOffset,
  14687. scrollTop: element.pageYOffset
  14688. };
  14689. }
  14690. function getWindowScrollBarX(element) {
  14691. // If <html> has a CSS width greater than the viewport, then this will be
  14692. // incorrect for RTL.
  14693. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  14694. }
  14695. function isScaled(element) {
  14696. const rect = getBoundingClientRect(element);
  14697. return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
  14698. }
  14699. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  14700. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  14701. const documentElement = getDocumentElement(offsetParent);
  14702. const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
  14703. isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
  14704. let scroll = {
  14705. scrollLeft: 0,
  14706. scrollTop: 0
  14707. };
  14708. const offsets = {
  14709. x: 0,
  14710. y: 0
  14711. };
  14712. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  14713. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  14714. scroll = getNodeScroll(offsetParent);
  14715. }
  14716. if (isHTMLElement(offsetParent)) {
  14717. const offsetRect = getBoundingClientRect(offsetParent, true);
  14718. offsets.x = offsetRect.x + offsetParent.clientLeft;
  14719. offsets.y = offsetRect.y + offsetParent.clientTop;
  14720. } else if (documentElement) {
  14721. offsets.x = getWindowScrollBarX(documentElement);
  14722. }
  14723. }
  14724. return {
  14725. x: rect.left + scroll.scrollLeft - offsets.x,
  14726. y: rect.top + scroll.scrollTop - offsets.y,
  14727. width: rect.width,
  14728. height: rect.height
  14729. };
  14730. }
  14731. function getParentNode(node) {
  14732. if (getNodeName(node) === 'html') {
  14733. return node;
  14734. }
  14735. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  14736. // @ts-ignore
  14737. node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  14738. node.parentNode || ( // DOM Element detected
  14739. isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
  14740. getDocumentElement(node) // fallback
  14741. );
  14742. }
  14743. function getTrueOffsetParent(element) {
  14744. if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
  14745. return null;
  14746. }
  14747. return element.offsetParent;
  14748. }
  14749. function getContainingBlock(element) {
  14750. let currentNode = getParentNode(element);
  14751. if (isShadowRoot(currentNode)) {
  14752. currentNode = currentNode.host;
  14753. }
  14754. while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
  14755. if (isContainingBlock(currentNode)) {
  14756. return currentNode;
  14757. } else {
  14758. const parent = currentNode.parentNode;
  14759. currentNode = isShadowRoot(parent) ? parent.host : parent;
  14760. }
  14761. }
  14762. return null;
  14763. } // Gets the closest ancestor positioned element. Handles some edge cases,
  14764. // such as table ancestors and cross browser bugs.
  14765. function getOffsetParent(element) {
  14766. const window = getWindow(element);
  14767. let offsetParent = getTrueOffsetParent(element);
  14768. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  14769. offsetParent = getTrueOffsetParent(offsetParent);
  14770. }
  14771. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
  14772. return window;
  14773. }
  14774. return offsetParent || getContainingBlock(element) || window;
  14775. }
  14776. function getDimensions(element) {
  14777. if (isHTMLElement(element)) {
  14778. return {
  14779. width: element.offsetWidth,
  14780. height: element.offsetHeight
  14781. };
  14782. }
  14783. const rect = getBoundingClientRect(element);
  14784. return {
  14785. width: rect.width,
  14786. height: rect.height
  14787. };
  14788. }
  14789. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  14790. let {
  14791. rect,
  14792. offsetParent,
  14793. strategy
  14794. } = _ref;
  14795. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  14796. const documentElement = getDocumentElement(offsetParent);
  14797. if (offsetParent === documentElement) {
  14798. return rect;
  14799. }
  14800. let scroll = {
  14801. scrollLeft: 0,
  14802. scrollTop: 0
  14803. };
  14804. const offsets = {
  14805. x: 0,
  14806. y: 0
  14807. };
  14808. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  14809. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  14810. scroll = getNodeScroll(offsetParent);
  14811. }
  14812. if (isHTMLElement(offsetParent)) {
  14813. const offsetRect = getBoundingClientRect(offsetParent, true);
  14814. offsets.x = offsetRect.x + offsetParent.clientLeft;
  14815. offsets.y = offsetRect.y + offsetParent.clientTop;
  14816. } // This doesn't appear to be need to be negated.
  14817. // else if (documentElement) {
  14818. // offsets.x = getWindowScrollBarX(documentElement);
  14819. // }
  14820. }
  14821. return { ...rect,
  14822. x: rect.x - scroll.scrollLeft + offsets.x,
  14823. y: rect.y - scroll.scrollTop + offsets.y
  14824. };
  14825. }
  14826. function getViewportRect(element, strategy) {
  14827. const win = getWindow(element);
  14828. const html = getDocumentElement(element);
  14829. const visualViewport = win.visualViewport;
  14830. let width = html.clientWidth;
  14831. let height = html.clientHeight;
  14832. let x = 0;
  14833. let y = 0;
  14834. if (visualViewport) {
  14835. width = visualViewport.width;
  14836. height = visualViewport.height;
  14837. const layoutViewport = isLayoutViewport();
  14838. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  14839. x = visualViewport.offsetLeft;
  14840. y = visualViewport.offsetTop;
  14841. }
  14842. }
  14843. return {
  14844. width,
  14845. height,
  14846. x,
  14847. y
  14848. };
  14849. }
  14850. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  14851. function getDocumentRect(element) {
  14852. var _element$ownerDocumen;
  14853. const html = getDocumentElement(element);
  14854. const scroll = getNodeScroll(element);
  14855. const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  14856. const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  14857. const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  14858. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  14859. const y = -scroll.scrollTop;
  14860. if (getComputedStyle$1(body || html).direction === 'rtl') {
  14861. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  14862. }
  14863. return {
  14864. width,
  14865. height,
  14866. x,
  14867. y
  14868. };
  14869. }
  14870. function getNearestOverflowAncestor(node) {
  14871. const parentNode = getParentNode(node);
  14872. if (isLastTraversableNode(parentNode)) {
  14873. // @ts-ignore assume body is always available
  14874. return node.ownerDocument.body;
  14875. }
  14876. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  14877. return parentNode;
  14878. }
  14879. return getNearestOverflowAncestor(parentNode);
  14880. }
  14881. function getOverflowAncestors(node, list) {
  14882. var _node$ownerDocument;
  14883. if (list === void 0) {
  14884. list = [];
  14885. }
  14886. const scrollableAncestor = getNearestOverflowAncestor(node);
  14887. const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
  14888. const win = getWindow(scrollableAncestor);
  14889. const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
  14890. const updatedList = list.concat(target);
  14891. return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
  14892. updatedList.concat(getOverflowAncestors(target));
  14893. }
  14894. function contains(parent, child) {
  14895. const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
  14896. if (parent.contains(child)) {
  14897. return true;
  14898. } // then fallback to custom implementation with Shadow DOM support
  14899. else if (rootNode && isShadowRoot(rootNode)) {
  14900. let next = child;
  14901. do {
  14902. // use `===` replace node.isSameNode()
  14903. if (next && parent === next) {
  14904. return true;
  14905. } // @ts-ignore: need a better way to handle this...
  14906. next = next.parentNode || next.host;
  14907. } while (next);
  14908. }
  14909. return false;
  14910. }
  14911. function getNearestParentCapableOfEscapingClipping(element, clippingAncestors) {
  14912. let currentNode = element;
  14913. while (currentNode && !isLastTraversableNode(currentNode) && // @ts-expect-error
  14914. !clippingAncestors.includes(currentNode)) {
  14915. if (isElement(currentNode) && ['absolute', 'fixed'].includes(getComputedStyle$1(currentNode).position)) {
  14916. break;
  14917. }
  14918. const parentNode = getParentNode(currentNode);
  14919. currentNode = isShadowRoot(parentNode) ? parentNode.host : parentNode;
  14920. }
  14921. return currentNode;
  14922. }
  14923. function getInnerBoundingClientRect(element, strategy) {
  14924. const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
  14925. const top = clientRect.top + element.clientTop;
  14926. const left = clientRect.left + element.clientLeft;
  14927. return {
  14928. top,
  14929. left,
  14930. x: left,
  14931. y: top,
  14932. right: left + element.clientWidth,
  14933. bottom: top + element.clientHeight,
  14934. width: element.clientWidth,
  14935. height: element.clientHeight
  14936. };
  14937. }
  14938. function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
  14939. if (clippingParent === 'viewport') {
  14940. return rectToClientRect(getViewportRect(element, strategy));
  14941. }
  14942. if (isElement(clippingParent)) {
  14943. return getInnerBoundingClientRect(clippingParent, strategy);
  14944. }
  14945. return rectToClientRect(getDocumentRect(getDocumentElement(element)));
  14946. } // A "clipping ancestor" is an overflowable container with the characteristic of
  14947. // clipping (or hiding) overflowing elements with a position different from
  14948. // `initial`
  14949. function getClippingAncestors(element) {
  14950. const clippingAncestors = getOverflowAncestors(element);
  14951. const nearestEscapableParent = getNearestParentCapableOfEscapingClipping(element, clippingAncestors);
  14952. let clipperElement = null;
  14953. if (nearestEscapableParent && isHTMLElement(nearestEscapableParent)) {
  14954. const offsetParent = getOffsetParent(nearestEscapableParent);
  14955. if (isOverflowElement(nearestEscapableParent)) {
  14956. clipperElement = nearestEscapableParent;
  14957. } else if (isHTMLElement(offsetParent)) {
  14958. clipperElement = offsetParent;
  14959. }
  14960. }
  14961. if (!isElement(clipperElement)) {
  14962. return [];
  14963. } // @ts-ignore isElement check ensures we return Array<Element>
  14964. return clippingAncestors.filter(clippingAncestors => clipperElement && isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
  14965. } // Gets the maximum area that the element is visible in due to any number of
  14966. // clipping ancestors
  14967. function getClippingRect(_ref) {
  14968. let {
  14969. element,
  14970. boundary,
  14971. rootBoundary,
  14972. strategy
  14973. } = _ref;
  14974. const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
  14975. const clippingAncestors = [...mainClippingAncestors, rootBoundary];
  14976. const firstClippingAncestor = clippingAncestors[0];
  14977. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  14978. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  14979. accRect.top = max(rect.top, accRect.top);
  14980. accRect.right = min(rect.right, accRect.right);
  14981. accRect.bottom = min(rect.bottom, accRect.bottom);
  14982. accRect.left = max(rect.left, accRect.left);
  14983. return accRect;
  14984. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  14985. return {
  14986. width: clippingRect.right - clippingRect.left,
  14987. height: clippingRect.bottom - clippingRect.top,
  14988. x: clippingRect.left,
  14989. y: clippingRect.top
  14990. };
  14991. }
  14992. const platform = {
  14993. getClippingRect,
  14994. convertOffsetParentRelativeRectToViewportRelativeRect,
  14995. isElement,
  14996. getDimensions,
  14997. getOffsetParent,
  14998. getDocumentElement,
  14999. getElementRects: _ref => {
  15000. let {
  15001. reference,
  15002. floating,
  15003. strategy
  15004. } = _ref;
  15005. return {
  15006. reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
  15007. floating: { ...getDimensions(floating),
  15008. x: 0,
  15009. y: 0
  15010. }
  15011. };
  15012. },
  15013. getClientRects: element => Array.from(element.getClientRects()),
  15014. isRTL: element => getComputedStyle$1(element).direction === 'rtl'
  15015. };
  15016. /**
  15017. * Computes the `x` and `y` coordinates that will place the floating element
  15018. * next to a reference element when it is given a certain CSS positioning
  15019. * strategy.
  15020. */
  15021. const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
  15022. platform,
  15023. ...options
  15024. });
  15025. const floatingUIBrowserCheck = patchFloatingUiForNonChromiumBrowsers();
  15026. async function patchFloatingUiForNonChromiumBrowsers() {
  15027. }
  15028. const placementDataAttribute = "data-placement";
  15029. /**
  15030. * Exported for testing purposes only
  15031. */
  15032. const repositionDebounceTimeout = 100;
  15033. const effectivePlacements = [
  15034. "top",
  15035. "bottom",
  15036. "right",
  15037. "left",
  15038. "top-start",
  15039. "top-end",
  15040. "bottom-start",
  15041. "bottom-end",
  15042. "right-start",
  15043. "right-end",
  15044. "left-start",
  15045. "left-end"
  15046. ];
  15047. const defaultMenuPlacement = "bottom-start";
  15048. const FloatingCSS = {
  15049. animation: "calcite-floating-ui-anim",
  15050. animationActive: "calcite-floating-ui-anim--active"
  15051. };
  15052. function getMiddleware({ placement, disableFlip, flipPlacements, offsetDistance, offsetSkidding, arrowEl, type }) {
  15053. const defaultMiddleware = [shift(), hide()];
  15054. if (type === "menu") {
  15055. return [
  15056. ...defaultMiddleware,
  15057. flip({
  15058. fallbackPlacements: flipPlacements || ["top-start", "top", "top-end", "bottom-start", "bottom", "bottom-end"]
  15059. })
  15060. ];
  15061. }
  15062. if (type === "popover" || type === "tooltip") {
  15063. const middleware = [
  15064. ...defaultMiddleware,
  15065. offset({
  15066. mainAxis: typeof offsetDistance === "number" ? offsetDistance : 0,
  15067. crossAxis: typeof offsetSkidding === "number" ? offsetSkidding : 0
  15068. })
  15069. ];
  15070. if (placement === "auto" || placement === "auto-start" || placement === "auto-end") {
  15071. middleware.push(autoPlacement({ alignment: placement === "auto-start" ? "start" : placement === "auto-end" ? "end" : null }));
  15072. }
  15073. else if (!disableFlip) {
  15074. middleware.push(flip(flipPlacements ? { fallbackPlacements: flipPlacements } : {}));
  15075. }
  15076. if (arrowEl) {
  15077. middleware.push(arrow({
  15078. element: arrowEl
  15079. }));
  15080. }
  15081. return middleware;
  15082. }
  15083. return [];
  15084. }
  15085. function filterComputedPlacements(placements, el) {
  15086. const filteredPlacements = placements.filter((placement) => effectivePlacements.includes(placement));
  15087. if (filteredPlacements.length !== placements.length) {
  15088. console.warn(`${el.tagName}: Invalid value found in: flipPlacements. Try any of these: ${effectivePlacements
  15089. .map((placement) => `"${placement}"`)
  15090. .join(", ")
  15091. .trim()}`, { el });
  15092. }
  15093. return filteredPlacements;
  15094. }
  15095. /*
  15096. In floating-ui, "*-start" and "*-end" are already flipped in RTL.
  15097. There is no need for our "*-leading" and "*-trailing" values anymore.
  15098. https://github.com/floating-ui/floating-ui/issues/1530
  15099. https://github.com/floating-ui/floating-ui/issues/1563
  15100. */
  15101. function getEffectivePlacement(floatingEl, placement) {
  15102. const placements = ["left", "right"];
  15103. if (getElementDir(floatingEl) === "rtl") {
  15104. placements.reverse();
  15105. }
  15106. return placement
  15107. .replace(/-leading/gi, "-start")
  15108. .replace(/-trailing/gi, "-end")
  15109. .replace(/leading/gi, placements[0])
  15110. .replace(/trailing/gi, placements[1]);
  15111. }
  15112. /**
  15113. * Convenience function to manage `reposition` calls for FloatingUIComponents that use `positionFloatingUI.
  15114. *
  15115. * Note: this is not needed for components that use `calcite-popover`.
  15116. *
  15117. * @param component
  15118. * @param options
  15119. * @param options.referenceEl
  15120. * @param options.floatingEl
  15121. * @param options.overlayPositioning
  15122. * @param options.placement
  15123. * @param options.disableFlip
  15124. * @param options.flipPlacements
  15125. * @param options.offsetDistance
  15126. * @param options.offsetSkidding
  15127. * @param options.arrowEl
  15128. * @param options.type
  15129. * @param delayed
  15130. */
  15131. async function reposition(component, options, delayed = false) {
  15132. if (!component.open) {
  15133. return;
  15134. }
  15135. return delayed ? debouncedReposition(options) : positionFloatingUI(options);
  15136. }
  15137. const debouncedReposition = debounce(positionFloatingUI, repositionDebounceTimeout, {
  15138. leading: true,
  15139. maxWait: repositionDebounceTimeout
  15140. });
  15141. /**
  15142. * Positions the floating element relative to the reference element.
  15143. *
  15144. * **Note:** exported for testing purposes only
  15145. *
  15146. * @param root0
  15147. * @param root0.referenceEl
  15148. * @param root0.floatingEl
  15149. * @param root0.overlayPositioning
  15150. * @param root0.placement
  15151. * @param root0.disableFlip
  15152. * @param root0.flipPlacements
  15153. * @param root0.offsetDistance
  15154. * @param root0.offsetSkidding
  15155. * @param root0.arrowEl
  15156. * @param root0.type
  15157. * @param root0.includeArrow
  15158. */
  15159. async function positionFloatingUI({ referenceEl, floatingEl, overlayPositioning = "absolute", placement, disableFlip, flipPlacements, offsetDistance, offsetSkidding, includeArrow = false, arrowEl, type }) {
  15160. var _a;
  15161. if (!referenceEl || !floatingEl || (includeArrow && !arrowEl)) {
  15162. return null;
  15163. }
  15164. await floatingUIBrowserCheck;
  15165. const { x, y, placement: effectivePlacement, strategy: position, middlewareData } = await computePosition(referenceEl, floatingEl, {
  15166. strategy: overlayPositioning,
  15167. placement: placement === "auto" || placement === "auto-start" || placement === "auto-end"
  15168. ? undefined
  15169. : getEffectivePlacement(floatingEl, placement),
  15170. middleware: getMiddleware({
  15171. placement,
  15172. disableFlip,
  15173. flipPlacements,
  15174. offsetDistance,
  15175. offsetSkidding,
  15176. arrowEl,
  15177. type
  15178. })
  15179. });
  15180. if (middlewareData === null || middlewareData === void 0 ? void 0 : middlewareData.arrow) {
  15181. const { x: arrowX, y: arrowY } = middlewareData.arrow;
  15182. Object.assign(arrowEl.style, {
  15183. left: arrowX != null ? `${arrowX}px` : "",
  15184. top: arrowY != null ? `${arrowY}px` : ""
  15185. });
  15186. }
  15187. const referenceHidden = (_a = middlewareData === null || middlewareData === void 0 ? void 0 : middlewareData.hide) === null || _a === void 0 ? void 0 : _a.referenceHidden;
  15188. const visibility = referenceHidden ? "hidden" : null;
  15189. const pointerEvents = visibility ? "none" : null;
  15190. floatingEl.setAttribute(placementDataAttribute, effectivePlacement);
  15191. const transform = `translate(${Math.round(x)}px,${Math.round(y)}px)`;
  15192. Object.assign(floatingEl.style, {
  15193. visibility,
  15194. pointerEvents,
  15195. position,
  15196. top: "0",
  15197. left: "0",
  15198. transform
  15199. });
  15200. }
  15201. /**
  15202. * Exported for testing purposes only
  15203. *
  15204. * @internal
  15205. */
  15206. const cleanupMap = new WeakMap();
  15207. /**
  15208. * Helper to set up floating element interactions on connectedCallback.
  15209. *
  15210. * @param component
  15211. * @param referenceEl
  15212. * @param floatingEl
  15213. */
  15214. function connectFloatingUI(component, referenceEl, floatingEl) {
  15215. if (!floatingEl || !referenceEl) {
  15216. return;
  15217. }
  15218. disconnectFloatingUI(component, referenceEl, floatingEl);
  15219. const position = component.overlayPositioning;
  15220. // ensure position matches for initial positioning
  15221. floatingEl.style.position = position;
  15222. if (position === "absolute") {
  15223. moveOffScreen(floatingEl);
  15224. }
  15225. const runAutoUpdate = (_refEl, _floatingEl, updateCallback) => {
  15226. updateCallback();
  15227. return () => {
  15228. /* noop */
  15229. };
  15230. };
  15231. cleanupMap.set(component, runAutoUpdate(referenceEl, floatingEl, () => component.reposition()));
  15232. }
  15233. /**
  15234. * Helper to tear down floating element interactions on disconnectedCallback.
  15235. *
  15236. * @param component
  15237. * @param referenceEl
  15238. * @param floatingEl
  15239. */
  15240. function disconnectFloatingUI(component, referenceEl, floatingEl) {
  15241. if (!floatingEl || !referenceEl) {
  15242. return;
  15243. }
  15244. getTransitionTarget(floatingEl).removeEventListener("transitionend", handleTransitionElTransitionEnd);
  15245. const cleanup = cleanupMap.get(component);
  15246. if (cleanup) {
  15247. cleanup();
  15248. }
  15249. cleanupMap.delete(component);
  15250. }
  15251. const visiblePointerSize = 4;
  15252. /**
  15253. * Default offset the position of the floating element away from the reference element.
  15254. *
  15255. * @default 6
  15256. */
  15257. const defaultOffsetDistance = Math.ceil(Math.hypot(visiblePointerSize, visiblePointerSize));
  15258. /**
  15259. * This utils applies floating element styles to avoid affecting layout when closed.
  15260. *
  15261. * This should be called when the closing transition will start.
  15262. *
  15263. * @param floatingEl
  15264. */
  15265. function updateAfterClose(floatingEl) {
  15266. if (!floatingEl || floatingEl.style.position !== "absolute") {
  15267. return;
  15268. }
  15269. getTransitionTarget(floatingEl).addEventListener("transitionend", handleTransitionElTransitionEnd);
  15270. }
  15271. function getTransitionTarget(floatingEl) {
  15272. // assumes floatingEl w/ shadowRoot is a FloatingUIComponent
  15273. return floatingEl.shadowRoot || floatingEl;
  15274. }
  15275. function handleTransitionElTransitionEnd(event) {
  15276. const floatingTransitionEl = event.target;
  15277. if (
  15278. // using any prop from floating-ui transition
  15279. event.propertyName === "opacity" &&
  15280. floatingTransitionEl.classList.contains(FloatingCSS.animation)) {
  15281. const floatingEl = getFloatingElFromTransitionTarget(floatingTransitionEl);
  15282. moveOffScreen(floatingEl);
  15283. getTransitionTarget(floatingEl).removeEventListener("transitionend", handleTransitionElTransitionEnd);
  15284. }
  15285. }
  15286. function moveOffScreen(floatingEl) {
  15287. floatingEl.style.transform = "";
  15288. floatingEl.style.top = "-99999px";
  15289. floatingEl.style.left = "-99999px";
  15290. }
  15291. function getFloatingElFromTransitionTarget(floatingTransitionEl) {
  15292. return closestElementCrossShadowBoundary(floatingTransitionEl, `[${placementDataAttribute}]`);
  15293. }
  15294. const ComboboxItem$1 = "CALCITE-COMBOBOX-ITEM";
  15295. const ComboboxItemGroup$1 = "CALCITE-COMBOBOX-ITEM-GROUP";
  15296. const ComboboxChildSelector = `${ComboboxItem$1}, ${ComboboxItemGroup$1}`;
  15297. const TEXT$j = {
  15298. removeTag: "Remove tag"
  15299. };
  15300. function getAncestors(element) {
  15301. var _a, _b;
  15302. const parent = (_a = element.parentElement) === null || _a === void 0 ? void 0 : _a.closest(ComboboxChildSelector);
  15303. const grandparent = (_b = parent === null || parent === void 0 ? void 0 : parent.parentElement) === null || _b === void 0 ? void 0 : _b.closest(ComboboxChildSelector);
  15304. return [parent, grandparent].filter((el) => el);
  15305. }
  15306. function getItemAncestors(item) {
  15307. var _a;
  15308. return (((_a = item.ancestors) === null || _a === void 0 ? void 0 : _a.filter((el) => el.nodeName === "CALCITE-COMBOBOX-ITEM")) || []);
  15309. }
  15310. function getItemChildren(item) {
  15311. return nodeListToArray(item.querySelectorAll("calcite-combobox-item"));
  15312. }
  15313. function hasActiveChildren(node) {
  15314. const items = nodeListToArray(node.querySelectorAll("calcite-combobox-item"));
  15315. return items.filter((item) => item.selected).length > 0;
  15316. }
  15317. function getDepth(element) {
  15318. {
  15319. return 0;
  15320. }
  15321. }
  15322. const comboboxCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-combobox:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-combobox{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-combobox{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-combobox{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-combobox{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-combobox{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-combobox:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-combobox:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-combobox-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-combobox-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-combobox-h{position:relative;display:block}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-combobox-h[disabled] .sc-calcite-combobox-s>[calcite-hydrated][disabled],[disabled].sc-calcite-combobox-h [calcite-hydrated][disabled].sc-calcite-combobox{opacity:1}/*!@:host([scale=s])*/[scale=s].sc-calcite-combobox-h{font-size:var(--calcite-font-size--2);--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-input-height:1.5rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-combobox-h{font-size:var(--calcite-font-size--1);--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-input-height:2rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-combobox-h{font-size:var(--calcite-font-size-0);--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-input-height:2.75rem}/*!@.wrapper*/.wrapper.sc-calcite-combobox{display:flex;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1);outline-color:transparent;padding-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);padding-inline:var(--calcite-combobox-item-spacing-unit-l)}/*!@:host(:focus-within) .wrapper, \n.wrapper--active*/.sc-calcite-combobox-h:focus-within .wrapper.sc-calcite-combobox,.wrapper--active.sc-calcite-combobox{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.wrapper--single*/.wrapper--single.sc-calcite-combobox{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l);cursor:pointer;flex-wrap:nowrap}/*!@.grid-input*/.grid-input.sc-calcite-combobox{display:flex;flex-grow:1;flex-wrap:wrap;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px}/*!@.input*/.input.sc-calcite-combobox{flex-grow:1;-webkit-appearance:none;appearance:none;border-style:none;background-color:transparent;padding:0px;font-family:inherit;color:var(--calcite-ui-text-1);font-size:inherit;block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);min-inline-size:120px;margin-block-end:var(--calcite-combobox-item-spacing-unit-s)}/*!@.input:focus*/.input.sc-calcite-combobox:focus{outline:2px solid transparent;outline-offset:2px}/*!@.input--transparent*/.input--transparent.sc-calcite-combobox{opacity:0}/*!@.input--single*/.input--single.sc-calcite-combobox{margin-block:0px;padding:0px}/*!@.wrapper--active .input-single*/.wrapper--active.sc-calcite-combobox .input-single.sc-calcite-combobox{cursor:text}/*!@.input--hidden*/.input--hidden.sc-calcite-combobox{pointer-events:none;inline-size:0px;min-inline-size:0px;opacity:0}/*!@.input--icon*/.input--icon.sc-calcite-combobox{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l)}/*!@.input-wrap*/.input-wrap.sc-calcite-combobox{display:flex;flex-grow:1}/*!@.input-wrap--single*/.input-wrap--single.sc-calcite-combobox{flex:1 1 0%;overflow:hidden}/*!@.label*/.label.sc-calcite-combobox{pointer-events:none;display:flex;max-inline-size:100%;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;font-weight:var(--calcite-font-weight-normal);block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}/*!@.label--icon*/.label--icon.sc-calcite-combobox{padding-inline:var(--calcite-combobox-item-spacing-unit-l)}/*!@.icon-end, \n.icon-start*/.icon-end.sc-calcite-combobox,.icon-start.sc-calcite-combobox{display:flex;inline-size:1rem;cursor:pointer;align-items:center}/*!@.icon-end*/.icon-end.sc-calcite-combobox{flex:none}/*!@.floating-ui-container*/.floating-ui-container.sc-calcite-combobox{display:block;position:absolute;z-index:900;visibility:hidden;pointer-events:none;inline-size:0;block-size:0;overflow:hidden}/*!@.floating-ui-container .calcite-floating-ui-anim*/.floating-ui-container.sc-calcite-combobox .calcite-floating-ui-anim.sc-calcite-combobox{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}/*!@.floating-ui-container[data-placement^=bottom] .calcite-floating-ui-anim*/.floating-ui-container[data-placement^=bottom].sc-calcite-combobox .calcite-floating-ui-anim.sc-calcite-combobox{transform:translateY(-5px)}/*!@.floating-ui-container[data-placement^=top] .calcite-floating-ui-anim*/.floating-ui-container[data-placement^=top].sc-calcite-combobox .calcite-floating-ui-anim.sc-calcite-combobox{transform:translateY(5px)}/*!@.floating-ui-container[data-placement^=left] .calcite-floating-ui-anim*/.floating-ui-container[data-placement^=left].sc-calcite-combobox .calcite-floating-ui-anim.sc-calcite-combobox{transform:translateX(5px)}/*!@.floating-ui-container[data-placement^=right] .calcite-floating-ui-anim*/.floating-ui-container[data-placement^=right].sc-calcite-combobox .calcite-floating-ui-anim.sc-calcite-combobox{transform:translateX(-5px)}/*!@.floating-ui-container[data-placement] .calcite-floating-ui-anim--active*/.floating-ui-container[data-placement].sc-calcite-combobox .calcite-floating-ui-anim--active.sc-calcite-combobox{opacity:1;visibility:visible;transform:translate(0)}/*!@.floating-ui-container--active*/.floating-ui-container--active.sc-calcite-combobox{pointer-events:initial;visibility:visible;inline-size:unset;block-size:unset;overflow:unset}@media (forced-colors: active){/*!@.wrapper,\n.floating-ui-container--active*/.wrapper.sc-calcite-combobox,.floating-ui-container--active.sc-calcite-combobox{border:1px solid canvasText}}/*!@.screen-readers-only*/.screen-readers-only.sc-calcite-combobox{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}/*!@.list-container*/.list-container.sc-calcite-combobox{max-block-size:45vh;overflow-y:auto;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}/*!@.list*/.list.sc-calcite-combobox{margin:0px;display:block;padding:0px}/*!@.list--hide*/.list--hide.sc-calcite-combobox{block-size:0px;overflow:hidden}/*!@.chip*/.chip.sc-calcite-combobox{margin-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);margin-inline:0 var(--calcite-combobox-item-spacing-unit-s);max-inline-size:100%}/*!@.chip--active*/.chip--active.sc-calcite-combobox{background-color:var(--calcite-ui-foreground-3)}/*!@.item*/.item.sc-calcite-combobox{display:block}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-combobox-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  15323. const isGroup = (el) => el.tagName === ComboboxItemGroup$1;
  15324. const itemUidPrefix = "combobox-item-";
  15325. const chipUidPrefix = "combobox-chip-";
  15326. const labelUidPrefix = "combobox-label-";
  15327. const listboxUidPrefix = "combobox-listbox-";
  15328. const inputUidPrefix = "combobox-input-";
  15329. /**
  15330. * @slot - A slot for adding `calcite-combobox-item`s.
  15331. */
  15332. class Combobox {
  15333. constructor(hostRef) {
  15334. registerInstance(this, hostRef);
  15335. this.calciteLookupChange = createEvent(this, "calciteLookupChange", 6);
  15336. this.calciteComboboxChange = createEvent(this, "calciteComboboxChange", 6);
  15337. this.calciteComboboxFilterChange = createEvent(this, "calciteComboboxFilterChange", 6);
  15338. this.calciteComboboxChipDismiss = createEvent(this, "calciteComboboxChipDismiss", 6);
  15339. this.calciteComboboxBeforeClose = createEvent(this, "calciteComboboxBeforeClose", 6);
  15340. this.calciteComboboxClose = createEvent(this, "calciteComboboxClose", 6);
  15341. this.calciteComboboxBeforeOpen = createEvent(this, "calciteComboboxBeforeOpen", 6);
  15342. this.calciteComboboxOpen = createEvent(this, "calciteComboboxOpen", 6);
  15343. //--------------------------------------------------------------------------
  15344. //
  15345. // Public Properties
  15346. //
  15347. //--------------------------------------------------------------------------
  15348. /**
  15349. * When `true`, displays and positions the component.
  15350. *
  15351. * @deprecated use `open` instead.
  15352. */
  15353. this.active = false;
  15354. /**When `true`, displays and positions the component. */
  15355. this.open = false;
  15356. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  15357. this.disabled = false;
  15358. /** Specifies the maximum number of `calcite-combobox-item`s (including nested children) to display before displaying a scrollbar. */
  15359. this.maxItems = 0;
  15360. /**
  15361. * Determines the type of positioning to use for the overlaid content.
  15362. *
  15363. * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
  15364. *
  15365. * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
  15366. *
  15367. */
  15368. this.overlayPositioning = "absolute";
  15369. /**
  15370. * When `true`, the component must have a value in order for the form to submit.
  15371. *
  15372. * @internal
  15373. */
  15374. this.required = false;
  15375. /**
  15376. * Specifies the selection mode -
  15377. * `"multi"` (allow any number of selected items),
  15378. * `"single"` (allow only one selection), or
  15379. * `"ancestors"` (like `"multi"`, but show ancestors of selected items as selected. Only the deepest children are shown in `calcite-chip`s).
  15380. */
  15381. this.selectionMode = "multi";
  15382. /** Specifies the size of the component. */
  15383. this.scale = "m";
  15384. /** The component's value(s) from the selected `calcite-combobox-item`(s). */
  15385. this.value = null;
  15386. /**
  15387. * Accessible name for the component's remove tag when a `calcite-combobox-item` is selected.
  15388. *
  15389. * @default "Remove tag"
  15390. */
  15391. this.intlRemoveTag = TEXT$j.removeTag;
  15392. //--------------------------------------------------------------------------
  15393. //
  15394. // Private State/Props
  15395. //
  15396. //--------------------------------------------------------------------------
  15397. this.placement = defaultMenuPlacement;
  15398. this.internalValueChangeFlag = false;
  15399. this.items = [];
  15400. this.groupItems = [];
  15401. this.selectedItems = [];
  15402. this.visibleItems = [];
  15403. this.activeItemIndex = -1;
  15404. this.activeChipIndex = -1;
  15405. this.activeDescendant = "";
  15406. this.text = "";
  15407. this.textInput = null;
  15408. this.mutationObserver = createObserver();
  15409. this.resizeObserver = createObserver();
  15410. this.guid = guid();
  15411. this.inputHeight = 0;
  15412. this.ignoreSelectedEventsFlag = false;
  15413. this.openTransitionProp = "opacity";
  15414. // --------------------------------------------------------------------------
  15415. //
  15416. // Private Methods
  15417. //
  15418. // --------------------------------------------------------------------------
  15419. this.setFilteredPlacements = () => {
  15420. const { el, flipPlacements } = this;
  15421. this.filteredFlipPlacements = flipPlacements
  15422. ? filterComputedPlacements(flipPlacements, el)
  15423. : null;
  15424. };
  15425. this.getValue = () => {
  15426. const items = this.selectedItems.map((item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.toString(); });
  15427. return (items === null || items === void 0 ? void 0 : items.length) ? (items.length > 1 ? items : items[0]) : "";
  15428. };
  15429. this.onLabelClick = () => {
  15430. this.setFocus();
  15431. };
  15432. this.keydownHandler = (event) => {
  15433. const { key } = event;
  15434. switch (key) {
  15435. case "Tab":
  15436. this.activeChipIndex = -1;
  15437. this.activeItemIndex = -1;
  15438. if (this.allowCustomValues && this.text) {
  15439. this.addCustomChip(this.text, true);
  15440. event.preventDefault();
  15441. }
  15442. else if (this.open) {
  15443. this.open = false;
  15444. event.preventDefault();
  15445. }
  15446. break;
  15447. case "ArrowLeft":
  15448. this.previousChip();
  15449. event.preventDefault();
  15450. break;
  15451. case "ArrowRight":
  15452. this.nextChip();
  15453. event.preventDefault();
  15454. break;
  15455. case "ArrowUp":
  15456. event.preventDefault();
  15457. this.shiftActiveItemIndex(-1);
  15458. if (!this.comboboxInViewport()) {
  15459. this.el.scrollIntoView();
  15460. }
  15461. break;
  15462. case "ArrowDown":
  15463. event.preventDefault();
  15464. if (!this.open) {
  15465. this.open = true;
  15466. }
  15467. this.shiftActiveItemIndex(1);
  15468. if (!this.comboboxInViewport()) {
  15469. this.el.scrollIntoView();
  15470. }
  15471. break;
  15472. case " ":
  15473. if (!this.textInput.value) {
  15474. event.preventDefault();
  15475. this.open = true;
  15476. this.shiftActiveItemIndex(1);
  15477. }
  15478. break;
  15479. case "Home":
  15480. if (!this.open) {
  15481. return;
  15482. }
  15483. event.preventDefault();
  15484. this.updateActiveItemIndex(0);
  15485. this.scrollToActiveItem();
  15486. if (!this.comboboxInViewport()) {
  15487. this.el.scrollIntoView();
  15488. }
  15489. break;
  15490. case "End":
  15491. if (!this.open) {
  15492. return;
  15493. }
  15494. event.preventDefault();
  15495. this.updateActiveItemIndex(this.visibleItems.length - 1);
  15496. this.scrollToActiveItem();
  15497. if (!this.comboboxInViewport()) {
  15498. this.el.scrollIntoView();
  15499. }
  15500. break;
  15501. case "Escape":
  15502. this.open = false;
  15503. event.preventDefault();
  15504. break;
  15505. case "Enter":
  15506. if (this.activeItemIndex > -1) {
  15507. this.toggleSelection(this.visibleItems[this.activeItemIndex]);
  15508. event.preventDefault();
  15509. }
  15510. else if (this.activeChipIndex > -1) {
  15511. this.removeActiveChip();
  15512. event.preventDefault();
  15513. }
  15514. else if (this.allowCustomValues && this.text) {
  15515. this.addCustomChip(this.text, true);
  15516. event.preventDefault();
  15517. }
  15518. else if (!event.defaultPrevented) {
  15519. if (submitForm(this)) {
  15520. event.preventDefault();
  15521. }
  15522. }
  15523. break;
  15524. case "Delete":
  15525. case "Backspace":
  15526. if (this.activeChipIndex > -1) {
  15527. event.preventDefault();
  15528. this.removeActiveChip();
  15529. }
  15530. else if (!this.text && this.isMulti()) {
  15531. event.preventDefault();
  15532. this.removeLastChip();
  15533. }
  15534. break;
  15535. }
  15536. };
  15537. this.toggleCloseEnd = () => {
  15538. this.open = false;
  15539. this.el.removeEventListener("calciteComboboxClose", this.toggleCloseEnd);
  15540. };
  15541. this.toggleOpenEnd = () => {
  15542. this.open = false;
  15543. this.el.removeEventListener("calciteComboboxOpen", this.toggleOpenEnd);
  15544. };
  15545. this.setMaxScrollerHeight = async () => {
  15546. const { listContainerEl, open, referenceEl } = this;
  15547. if (!listContainerEl || !open) {
  15548. return;
  15549. }
  15550. await this.reposition(true);
  15551. const maxScrollerHeight = this.getMaxScrollerHeight();
  15552. listContainerEl.style.maxHeight = maxScrollerHeight > 0 ? `${maxScrollerHeight}px` : "";
  15553. listContainerEl.style.minWidth = `${referenceEl.clientWidth}px`;
  15554. await this.reposition(true);
  15555. };
  15556. this.calciteChipDismissHandler = (event, comboboxItem) => {
  15557. this.open = false;
  15558. const selection = this.items.find((item) => item === comboboxItem);
  15559. if (selection) {
  15560. this.toggleSelection(selection, false);
  15561. }
  15562. this.calciteComboboxChipDismiss.emit(event.detail);
  15563. };
  15564. this.clickHandler = (event) => {
  15565. if (event.composedPath().some((node) => node.tagName === "CALCITE-CHIP")) {
  15566. return;
  15567. }
  15568. this.open = !this.open;
  15569. this.updateActiveItemIndex(0);
  15570. this.setFocus();
  15571. };
  15572. this.setInactiveIfNotContained = (event) => {
  15573. const composedPath = event.composedPath();
  15574. if (!this.open || composedPath.includes(this.el) || composedPath.includes(this.referenceEl)) {
  15575. return;
  15576. }
  15577. if (this.allowCustomValues && this.text.trim().length) {
  15578. this.addCustomChip(this.text);
  15579. }
  15580. if (this.selectionMode === "single") {
  15581. if (this.textInput) {
  15582. this.textInput.value = "";
  15583. }
  15584. this.text = "";
  15585. this.filterItems("");
  15586. this.updateActiveItemIndex(-1);
  15587. }
  15588. this.open = false;
  15589. };
  15590. this.setFloatingEl = (el) => {
  15591. this.floatingEl = el;
  15592. connectFloatingUI(this, this.referenceEl, this.floatingEl);
  15593. };
  15594. this.setContainerEl = (el) => {
  15595. this.resizeObserver.observe(el);
  15596. this.listContainerEl = el;
  15597. this.transitionEl = el;
  15598. connectOpenCloseComponent(this);
  15599. };
  15600. this.setReferenceEl = (el) => {
  15601. this.referenceEl = el;
  15602. connectFloatingUI(this, this.referenceEl, this.floatingEl);
  15603. };
  15604. this.inputHandler = (event) => {
  15605. const value = event.target.value;
  15606. this.text = value;
  15607. this.filterItems(value);
  15608. if (value) {
  15609. this.activeChipIndex = -1;
  15610. }
  15611. };
  15612. this.filterItems = (() => {
  15613. const find = (item, filteredData) => item &&
  15614. filteredData.some(({ label, value }) => {
  15615. if (isGroup(item)) {
  15616. return value === item.label;
  15617. }
  15618. return (value === item.textLabel ||
  15619. value === item.value ||
  15620. label === item.textLabel ||
  15621. label === item.value);
  15622. });
  15623. return debounce((text) => {
  15624. const filteredData = filter(this.data, text);
  15625. const items = this.getCombinedItems();
  15626. items.forEach((item) => {
  15627. const hidden = !find(item, filteredData);
  15628. item.hidden = hidden;
  15629. const [parent, grandparent] = item.ancestors;
  15630. if (find(parent, filteredData) || find(grandparent, filteredData)) {
  15631. item.hidden = false;
  15632. }
  15633. if (!hidden) {
  15634. item.ancestors.forEach((ancestor) => (ancestor.hidden = false));
  15635. }
  15636. });
  15637. this.visibleItems = this.getVisibleItems();
  15638. this.calciteComboboxFilterChange.emit({ visibleItems: [...this.visibleItems], text: text });
  15639. }, 100);
  15640. })();
  15641. this.internalCalciteLookupChangeEvent = () => {
  15642. this.calciteLookupChange.emit(this.selectedItems);
  15643. };
  15644. this.emitCalciteLookupChange = debounce(this.internalCalciteLookupChangeEvent, 0);
  15645. this.internalComboboxChangeEvent = () => {
  15646. const { selectedItems } = this;
  15647. this.calciteComboboxChange.emit({ selectedItems });
  15648. };
  15649. this.emitComboboxChange = debounce(this.internalComboboxChangeEvent, 0);
  15650. this.updateItems = () => {
  15651. this.items = this.getItems();
  15652. this.groupItems = this.getGroupItems();
  15653. this.data = this.getData();
  15654. this.selectedItems = this.getSelectedItems();
  15655. this.visibleItems = this.getVisibleItems();
  15656. this.needsIcon = this.getNeedsIcon();
  15657. if (!this.allowCustomValues) {
  15658. this.setMaxScrollerHeight();
  15659. }
  15660. };
  15661. this.scrollToActiveItem = () => {
  15662. const activeItem = this.visibleItems[this.activeItemIndex];
  15663. const height = this.calculateSingleItemHeight(activeItem);
  15664. const { offsetHeight, scrollTop } = this.listContainerEl;
  15665. if (offsetHeight + scrollTop < activeItem.offsetTop + height) {
  15666. this.listContainerEl.scrollTop = activeItem.offsetTop - offsetHeight + height;
  15667. }
  15668. else if (activeItem.offsetTop < scrollTop) {
  15669. this.listContainerEl.scrollTop = activeItem.offsetTop;
  15670. }
  15671. };
  15672. this.comboboxFocusHandler = () => {
  15673. var _a;
  15674. (_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
  15675. };
  15676. this.comboboxBlurHandler = (event) => {
  15677. this.setInactiveIfNotContained(event);
  15678. };
  15679. }
  15680. activeHandler(value) {
  15681. if (this.disabled) {
  15682. this.active = false;
  15683. this.open = false;
  15684. return;
  15685. }
  15686. this.open = value;
  15687. }
  15688. openHandler(value) {
  15689. if (!value) {
  15690. updateAfterClose(this.floatingEl);
  15691. }
  15692. if (this.disabled) {
  15693. this.active = false;
  15694. this.open = false;
  15695. return;
  15696. }
  15697. this.active = value;
  15698. this.setMaxScrollerHeight();
  15699. }
  15700. handleDisabledChange(value) {
  15701. if (!value) {
  15702. this.active = false;
  15703. this.open = false;
  15704. }
  15705. }
  15706. maxItemsHandler() {
  15707. this.setMaxScrollerHeight();
  15708. }
  15709. overlayPositioningHandler() {
  15710. this.reposition(true);
  15711. }
  15712. valueHandler(value) {
  15713. if (!this.internalValueChangeFlag) {
  15714. const items = this.getItems();
  15715. if (Array.isArray(value)) {
  15716. items.forEach((item) => (item.selected = value.includes(item.value)));
  15717. }
  15718. else if (value) {
  15719. items.forEach((item) => (item.selected = value === item.value));
  15720. }
  15721. else {
  15722. items.forEach((item) => (item.selected = false));
  15723. }
  15724. this.updateItems();
  15725. }
  15726. }
  15727. flipPlacementsHandler() {
  15728. this.setFilteredPlacements();
  15729. this.reposition(true);
  15730. }
  15731. //--------------------------------------------------------------------------
  15732. //
  15733. // Event Listeners
  15734. //
  15735. //--------------------------------------------------------------------------
  15736. documentClickHandler(event) {
  15737. if (!isPrimaryPointerButton(event)) {
  15738. return;
  15739. }
  15740. this.setInactiveIfNotContained(event);
  15741. }
  15742. calciteComboboxItemChangeHandler(event) {
  15743. if (this.ignoreSelectedEventsFlag) {
  15744. return;
  15745. }
  15746. const target = event.target;
  15747. const newIndex = this.visibleItems.indexOf(target);
  15748. this.updateActiveItemIndex(newIndex);
  15749. this.toggleSelection(target, target.selected);
  15750. }
  15751. //--------------------------------------------------------------------------
  15752. //
  15753. // Public Methods
  15754. //
  15755. //--------------------------------------------------------------------------
  15756. /**
  15757. * Updates the position of the component.
  15758. *
  15759. * @param delayed
  15760. */
  15761. async reposition(delayed = false) {
  15762. const { floatingEl, referenceEl, placement, overlayPositioning, filteredFlipPlacements } = this;
  15763. return reposition(this, {
  15764. floatingEl,
  15765. referenceEl,
  15766. overlayPositioning,
  15767. placement,
  15768. flipPlacements: filteredFlipPlacements,
  15769. type: "menu"
  15770. }, delayed);
  15771. }
  15772. /** Sets focus on the component. */
  15773. async setFocus() {
  15774. var _a;
  15775. (_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
  15776. this.activeChipIndex = -1;
  15777. this.activeItemIndex = -1;
  15778. }
  15779. // --------------------------------------------------------------------------
  15780. //
  15781. // Lifecycle
  15782. //
  15783. // --------------------------------------------------------------------------
  15784. connectedCallback() {
  15785. var _a;
  15786. this.internalValueChangeFlag = true;
  15787. this.value = this.getValue();
  15788. this.internalValueChangeFlag = false;
  15789. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  15790. connectLabel(this);
  15791. connectForm(this);
  15792. connectOpenCloseComponent(this);
  15793. this.setFilteredPlacements();
  15794. this.reposition(true);
  15795. if (this.active) {
  15796. this.activeHandler(this.active);
  15797. }
  15798. if (this.open) {
  15799. this.openHandler(this.open);
  15800. }
  15801. }
  15802. componentWillLoad() {
  15803. this.updateItems();
  15804. }
  15805. componentDidLoad() {
  15806. afterConnectDefaultValueSet(this, this.getValue());
  15807. this.reposition(true);
  15808. }
  15809. componentDidRender() {
  15810. if (this.el.offsetHeight !== this.inputHeight) {
  15811. this.reposition(true);
  15812. this.inputHeight = this.el.offsetHeight;
  15813. }
  15814. updateHostInteraction(this);
  15815. }
  15816. disconnectedCallback() {
  15817. var _a, _b;
  15818. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  15819. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
  15820. disconnectLabel(this);
  15821. disconnectForm(this);
  15822. disconnectFloatingUI(this, this.referenceEl, this.floatingEl);
  15823. disconnectOpenCloseComponent(this);
  15824. }
  15825. selectedItemsHandler() {
  15826. this.internalValueChangeFlag = true;
  15827. this.value = this.getValue();
  15828. this.internalValueChangeFlag = false;
  15829. }
  15830. /** when search text is cleared, reset active to */
  15831. textHandler() {
  15832. this.updateActiveItemIndex(-1);
  15833. }
  15834. comboboxInViewport() {
  15835. const bounding = this.el.getBoundingClientRect();
  15836. return (bounding.top >= 0 &&
  15837. bounding.left >= 0 &&
  15838. bounding.right <= (window.innerWidth || document.documentElement.clientWidth) &&
  15839. bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight));
  15840. }
  15841. onBeforeOpen() {
  15842. this.calciteComboboxBeforeOpen.emit();
  15843. }
  15844. onOpen() {
  15845. this.calciteComboboxOpen.emit();
  15846. }
  15847. onBeforeClose() {
  15848. this.calciteComboboxBeforeClose.emit();
  15849. }
  15850. onClose() {
  15851. this.calciteComboboxClose.emit();
  15852. }
  15853. getMaxScrollerHeight() {
  15854. const items = this.getCombinedItems().filter((item) => !item.hidden);
  15855. const { maxItems } = this;
  15856. let itemsToProcess = 0;
  15857. let maxScrollerHeight = 0;
  15858. if (items.length > maxItems) {
  15859. items.forEach((item) => {
  15860. if (itemsToProcess < maxItems && maxItems > 0) {
  15861. const height = this.calculateSingleItemHeight(item);
  15862. if (height > 0) {
  15863. maxScrollerHeight += height;
  15864. itemsToProcess++;
  15865. }
  15866. }
  15867. });
  15868. }
  15869. return maxScrollerHeight;
  15870. }
  15871. calculateSingleItemHeight(item) {
  15872. let height = item.offsetHeight;
  15873. // if item has children items, don't count their height twice
  15874. const children = Array.from(item.querySelectorAll(ComboboxChildSelector));
  15875. children
  15876. .map((child) => child === null || child === void 0 ? void 0 : child.offsetHeight)
  15877. .forEach((offsetHeight) => {
  15878. height -= offsetHeight;
  15879. });
  15880. return height;
  15881. }
  15882. getCombinedItems() {
  15883. return [...this.groupItems, ...this.items];
  15884. }
  15885. toggleSelection(item, value = !item.selected) {
  15886. if (!item) {
  15887. return;
  15888. }
  15889. if (this.isMulti()) {
  15890. item.selected = value;
  15891. this.updateAncestors(item);
  15892. this.selectedItems = this.getSelectedItems();
  15893. this.emitCalciteLookupChange();
  15894. this.emitComboboxChange();
  15895. this.resetText();
  15896. this.filterItems("");
  15897. }
  15898. else {
  15899. this.ignoreSelectedEventsFlag = true;
  15900. this.items.forEach((el) => (el.selected = el === item ? value : false));
  15901. this.ignoreSelectedEventsFlag = false;
  15902. this.selectedItems = this.getSelectedItems();
  15903. this.emitComboboxChange();
  15904. if (this.textInput) {
  15905. this.textInput.value = item.textLabel;
  15906. }
  15907. this.open = false;
  15908. this.updateActiveItemIndex(-1);
  15909. this.resetText();
  15910. this.filterItems("");
  15911. }
  15912. }
  15913. updateAncestors(item) {
  15914. if (this.selectionMode !== "ancestors") {
  15915. return;
  15916. }
  15917. const ancestors = getItemAncestors(item);
  15918. const children = getItemChildren(item);
  15919. if (item.selected) {
  15920. ancestors.forEach((el) => {
  15921. el.selected = true;
  15922. });
  15923. }
  15924. else {
  15925. children.forEach((el) => (el.selected = false));
  15926. [...ancestors].forEach((el) => {
  15927. if (!hasActiveChildren(el)) {
  15928. el.selected = false;
  15929. }
  15930. });
  15931. }
  15932. }
  15933. getVisibleItems() {
  15934. return this.items.filter((item) => !item.hidden);
  15935. }
  15936. getSelectedItems() {
  15937. if (!this.isMulti()) {
  15938. const match = this.items.find(({ selected }) => selected);
  15939. return match ? [match] : [];
  15940. }
  15941. return (this.items
  15942. .filter((item) => item.selected && (this.selectionMode !== "ancestors" || !hasActiveChildren(item)))
  15943. /** Preserve order of entered tags */
  15944. .sort((a, b) => {
  15945. const aIdx = this.selectedItems.indexOf(a);
  15946. const bIdx = this.selectedItems.indexOf(b);
  15947. if (aIdx > -1 && bIdx > -1) {
  15948. return aIdx - bIdx;
  15949. }
  15950. return bIdx - aIdx;
  15951. }));
  15952. }
  15953. getData() {
  15954. return this.items.map((item) => ({
  15955. constant: item.constant,
  15956. filterDisabled: item.filterDisabled,
  15957. value: item.value,
  15958. label: item.textLabel
  15959. }));
  15960. }
  15961. getNeedsIcon() {
  15962. return this.selectionMode === "single" && this.items.some((item) => item.icon);
  15963. }
  15964. resetText() {
  15965. if (this.textInput) {
  15966. this.textInput.value = "";
  15967. }
  15968. this.text = "";
  15969. }
  15970. getItems() {
  15971. const items = Array.from(this.el.querySelectorAll(ComboboxItem$1));
  15972. return items.filter((item) => !item.disabled);
  15973. }
  15974. getGroupItems() {
  15975. return Array.from(this.el.querySelectorAll(ComboboxItemGroup$1));
  15976. }
  15977. addCustomChip(value, focus) {
  15978. const existingItem = this.items.find((el) => el.textLabel === value);
  15979. if (existingItem) {
  15980. this.toggleSelection(existingItem, true);
  15981. }
  15982. else {
  15983. if (!this.isMulti()) {
  15984. this.toggleSelection(this.selectedItems[this.selectedItems.length - 1], false);
  15985. }
  15986. const item = document.createElement(ComboboxItem$1);
  15987. item.value = value;
  15988. item.textLabel = value;
  15989. item.selected = true;
  15990. this.el.appendChild(item);
  15991. this.resetText();
  15992. if (focus) {
  15993. this.setFocus();
  15994. }
  15995. this.updateItems();
  15996. this.filterItems("");
  15997. this.emitCalciteLookupChange();
  15998. this.emitComboboxChange();
  15999. }
  16000. }
  16001. removeActiveChip() {
  16002. this.toggleSelection(this.selectedItems[this.activeChipIndex], false);
  16003. this.setFocus();
  16004. }
  16005. removeLastChip() {
  16006. this.toggleSelection(this.selectedItems[this.selectedItems.length - 1], false);
  16007. this.setFocus();
  16008. }
  16009. previousChip() {
  16010. if (this.text) {
  16011. return;
  16012. }
  16013. const length = this.selectedItems.length - 1;
  16014. const active = this.activeChipIndex;
  16015. this.activeChipIndex = active === -1 ? length : Math.max(active - 1, 0);
  16016. this.updateActiveItemIndex(-1);
  16017. this.focusChip();
  16018. }
  16019. nextChip() {
  16020. if (this.text || this.activeChipIndex === -1) {
  16021. return;
  16022. }
  16023. const last = this.selectedItems.length - 1;
  16024. const newIndex = this.activeChipIndex + 1;
  16025. if (newIndex > last) {
  16026. this.activeChipIndex = -1;
  16027. this.setFocus();
  16028. }
  16029. else {
  16030. this.activeChipIndex = newIndex;
  16031. this.focusChip();
  16032. }
  16033. this.updateActiveItemIndex(-1);
  16034. }
  16035. focusChip() {
  16036. var _a;
  16037. const guid = (_a = this.selectedItems[this.activeChipIndex]) === null || _a === void 0 ? void 0 : _a.guid;
  16038. const chip = guid
  16039. ? this.referenceEl.querySelector(`#${chipUidPrefix}${guid}`)
  16040. : null;
  16041. chip === null || chip === void 0 ? void 0 : chip.setFocus();
  16042. }
  16043. shiftActiveItemIndex(delta) {
  16044. const { length } = this.visibleItems;
  16045. const newIndex = (this.activeItemIndex + length + delta) % length;
  16046. this.updateActiveItemIndex(newIndex);
  16047. this.scrollToActiveItem();
  16048. }
  16049. updateActiveItemIndex(index) {
  16050. var _a;
  16051. this.activeItemIndex = index;
  16052. let activeDescendant = null;
  16053. this.visibleItems.forEach((el, i) => {
  16054. if (i === index) {
  16055. el.active = true;
  16056. activeDescendant = `${itemUidPrefix}${el.guid}`;
  16057. }
  16058. else {
  16059. el.active = false;
  16060. }
  16061. });
  16062. this.activeDescendant = activeDescendant;
  16063. if (this.activeItemIndex > -1) {
  16064. this.activeChipIndex = -1;
  16065. (_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
  16066. }
  16067. }
  16068. isMulti() {
  16069. return this.selectionMode !== "single";
  16070. }
  16071. //--------------------------------------------------------------------------
  16072. //
  16073. // Render Methods
  16074. //
  16075. //--------------------------------------------------------------------------
  16076. renderChips() {
  16077. const { activeChipIndex, scale, selectionMode, intlRemoveTag } = this;
  16078. return this.selectedItems.map((item, i) => {
  16079. const chipClasses = {
  16080. chip: true,
  16081. "chip--active": activeChipIndex === i
  16082. };
  16083. const ancestors = [...getItemAncestors(item)].reverse();
  16084. const pathLabel = [...ancestors, item].map((el) => el.textLabel);
  16085. const label = selectionMode !== "ancestors" ? item.textLabel : pathLabel.join(" / ");
  16086. return (hAsync("calcite-chip", { class: chipClasses, dismissLabel: intlRemoveTag, dismissible: true, icon: item.icon, id: item.guid ? `${chipUidPrefix}${item.guid}` : null, key: item.textLabel, onCalciteChipDismiss: (event) => this.calciteChipDismissHandler(event, item), scale: scale, title: label, value: item.value }, label));
  16087. });
  16088. }
  16089. renderInput() {
  16090. const { guid, active, disabled, placeholder, selectionMode, selectedItems, open } = this;
  16091. const single = selectionMode === "single";
  16092. const selectedItem = selectedItems[0];
  16093. const showLabel = !(open || active) && single && !!selectedItem;
  16094. return (hAsync("span", { class: {
  16095. "input-wrap": true,
  16096. "input-wrap--single": single
  16097. } }, showLabel && (hAsync("span", { class: {
  16098. label: true,
  16099. "label--icon": !!(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon)
  16100. }, key: "label" }, selectedItem.textLabel)), hAsync("input", { "aria-activedescendant": this.activeDescendant, "aria-autocomplete": "list", "aria-controls": `${listboxUidPrefix}${guid}`, "aria-label": getLabelText(this), class: {
  16101. input: true,
  16102. "input--single": true,
  16103. "input--transparent": this.activeChipIndex > -1,
  16104. "input--hidden": showLabel,
  16105. "input--icon": !!this.placeholderIcon
  16106. }, disabled: disabled, id: `${inputUidPrefix}${guid}`, key: "input", onBlur: this.comboboxBlurHandler, onFocus: this.comboboxFocusHandler, onInput: this.inputHandler, placeholder: placeholder, ref: (el) => (this.textInput = el), type: "text" })));
  16107. }
  16108. renderListBoxOptions() {
  16109. return this.visibleItems.map((item) => (hAsync("li", { "aria-selected": toAriaBoolean(item.selected), id: item.guid ? `${itemUidPrefix}${item.guid}` : null, role: "option", tabindex: "-1" }, item.textLabel)));
  16110. }
  16111. renderFloatingUIContainer() {
  16112. const { active, setFloatingEl, setContainerEl, open } = this;
  16113. const classes = {
  16114. "list-container": true,
  16115. [FloatingCSS.animation]: true,
  16116. [FloatingCSS.animationActive]: open || active
  16117. };
  16118. return (hAsync("div", { "aria-hidden": "true", class: {
  16119. "floating-ui-container": true,
  16120. "floating-ui-container--active": open || active
  16121. }, ref: setFloatingEl }, hAsync("div", { class: classes, ref: setContainerEl }, hAsync("ul", { class: { list: true, "list--hide": !(open || active) } }, hAsync("slot", null)))));
  16122. }
  16123. renderIconStart() {
  16124. const { selectedItems, placeholderIcon, selectionMode } = this;
  16125. const selectedItem = selectedItems[0];
  16126. const selectedIcon = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon;
  16127. const singleSelectionMode = selectionMode === "single";
  16128. const iconAtStart = !this.open && selectedItem
  16129. ? !!selectedIcon && singleSelectionMode
  16130. : !!this.placeholderIcon && (!selectedItem || singleSelectionMode);
  16131. return (iconAtStart && (hAsync("span", { class: "icon-start" }, hAsync("calcite-icon", { class: "selected-icon", icon: !this.open && selectedItem ? selectedIcon : placeholderIcon, scale: "s" }))));
  16132. }
  16133. renderIconEnd() {
  16134. const { active, open } = this;
  16135. return (hAsync("span", { class: "icon-end" }, hAsync("calcite-icon", { icon: active || open ? "chevron-up" : "chevron-down", scale: "s" })));
  16136. }
  16137. render() {
  16138. const { active, guid, label, open } = this;
  16139. const single = this.selectionMode === "single";
  16140. return (hAsync(Host, null, hAsync("div", { "aria-autocomplete": "list", "aria-controls": `${listboxUidPrefix}${guid}`, "aria-expanded": toAriaBoolean(open || active), "aria-haspopup": "listbox", "aria-labelledby": `${labelUidPrefix}${guid}`, "aria-live": "polite", "aria-owns": `${listboxUidPrefix}${guid}`, class: {
  16141. wrapper: true,
  16142. "wrapper--single": single || !this.selectedItems.length,
  16143. "wrapper--active": open || active
  16144. }, onClick: this.clickHandler, onKeyDown: this.keydownHandler, ref: this.setReferenceEl, role: "combobox" }, hAsync("div", { class: "grid-input" }, this.renderIconStart(), !single && this.renderChips(), hAsync("label", { class: "screen-readers-only", htmlFor: `${inputUidPrefix}${guid}`, id: `${labelUidPrefix}${guid}` }, label), this.renderInput()), this.renderIconEnd()), hAsync("ul", { "aria-labelledby": `${labelUidPrefix}${guid}`, "aria-multiselectable": "true", class: "screen-readers-only", id: `${listboxUidPrefix}${guid}`, role: "listbox", tabIndex: -1 }, this.renderListBoxOptions()), this.renderFloatingUIContainer(), hAsync(HiddenFormInputSlot, { component: this })));
  16145. }
  16146. get el() { return getElement(this); }
  16147. static get watchers() { return {
  16148. "active": ["activeHandler"],
  16149. "open": ["openHandler"],
  16150. "disabled": ["handleDisabledChange"],
  16151. "maxItems": ["maxItemsHandler"],
  16152. "overlayPositioning": ["overlayPositioningHandler"],
  16153. "value": ["valueHandler"],
  16154. "flipPlacements": ["flipPlacementsHandler"],
  16155. "selectedItems": ["selectedItemsHandler"],
  16156. "text": ["textHandler"]
  16157. }; }
  16158. static get style() { return comboboxCss; }
  16159. static get cmpMeta() { return {
  16160. "$flags$": 9,
  16161. "$tagName$": "calcite-combobox",
  16162. "$members$": {
  16163. "active": [1540],
  16164. "open": [1540],
  16165. "disabled": [516],
  16166. "label": [1],
  16167. "placeholder": [1],
  16168. "placeholderIcon": [513, "placeholder-icon"],
  16169. "maxItems": [514, "max-items"],
  16170. "name": [513],
  16171. "allowCustomValues": [516, "allow-custom-values"],
  16172. "overlayPositioning": [513, "overlay-positioning"],
  16173. "required": [516],
  16174. "selectionMode": [513, "selection-mode"],
  16175. "scale": [513],
  16176. "value": [1025],
  16177. "intlRemoveTag": [1, "intl-remove-tag"],
  16178. "flipPlacements": [16],
  16179. "items": [32],
  16180. "groupItems": [32],
  16181. "selectedItems": [32],
  16182. "visibleItems": [32],
  16183. "needsIcon": [32],
  16184. "activeItemIndex": [32],
  16185. "activeChipIndex": [32],
  16186. "activeDescendant": [32],
  16187. "text": [32],
  16188. "reposition": [64],
  16189. "setFocus": [64]
  16190. },
  16191. "$listeners$": [[5, "pointerdown", "documentClickHandler"], [0, "calciteComboboxItemChange", "calciteComboboxItemChangeHandler"]],
  16192. "$lazyBundleId$": "-",
  16193. "$attrsToReflect$": [["active", "active"], ["open", "open"], ["disabled", "disabled"], ["placeholderIcon", "placeholder-icon"], ["maxItems", "max-items"], ["name", "name"], ["allowCustomValues", "allow-custom-values"], ["overlayPositioning", "overlay-positioning"], ["required", "required"], ["selectionMode", "selection-mode"], ["scale", "scale"]]
  16194. }; }
  16195. }
  16196. const CSS$H = {
  16197. icon: "icon",
  16198. iconActive: "icon--active",
  16199. custom: "icon--custom",
  16200. dot: "icon--dot",
  16201. single: "label--single",
  16202. label: "label",
  16203. active: "label--active",
  16204. selected: "label--selected",
  16205. title: "title",
  16206. textContainer: "text-container"
  16207. };
  16208. const comboboxItemCss = "@charset \"UTF-8\";@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-combobox-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-combobox-item{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-combobox-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-combobox-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-combobox-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-combobox-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-combobox-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-combobox-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-combobox-item-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-combobox-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@.scale--s*/.scale--s.sc-calcite-combobox-item{font-size:var(--calcite-font-size--2);line-height:1rem;--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-item-spacing-indent:0.5rem}/*!@.scale--m*/.scale--m.sc-calcite-combobox-item{font-size:var(--calcite-font-size--1);line-height:1rem;--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-item-spacing-indent:0.75rem}/*!@.scale--l*/.scale--l.sc-calcite-combobox-item{font-size:var(--calcite-font-size-0);line-height:1.25rem;--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-item-spacing-indent:1rem}/*!@.container*/.container.sc-calcite-combobox-item{--calcite-combobox-item-indent-value:calc(\n var(--calcite-combobox-item-spacing-indent) * var(--calcite-combobox-item-spacing-indent-multiplier)\n )}/*!@:host(:focus)*/.sc-calcite-combobox-item-h:focus{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-combobox-item-h[disabled] .sc-calcite-combobox-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-combobox-item-h [calcite-hydrated][disabled].sc-calcite-combobox-item{opacity:1}/*!@:host, \nul*/.sc-calcite-combobox-item-h,ul.sc-calcite-combobox-item{margin:0px;display:flex;flex-direction:column;padding:0px}/*!@:host(:focus), \nul:focus*/.sc-calcite-combobox-item-h:focus,ul.sc-calcite-combobox-item:focus{outline:2px solid transparent;outline-offset:2px}/*!@.label*/.label.sc-calcite-combobox-item{position:relative;box-sizing:border-box;display:flex;inline-size:100%;min-inline-size:100%;cursor:pointer;align-items:center;color:var(--calcite-ui-text-3);text-decoration-line:none;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);outline-color:transparent;padding-block:var(--calcite-combobox-item-spacing-unit-s);padding-inline:var(--calcite-combobox-item-spacing-unit-l)}/*!@:host([disabled]) .label*/[disabled].sc-calcite-combobox-item-h .label.sc-calcite-combobox-item{cursor:default}/*!@.label--selected*/.label--selected.sc-calcite-combobox-item{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@.label--active*/.label--active.sc-calcite-combobox-item{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.label:hover, \n.label:active*/.label.sc-calcite-combobox-item:hover,.label.sc-calcite-combobox-item:active{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1);text-decoration-line:none;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@.title*/.title.sc-calcite-combobox-item{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l)}/*!@.icon*/.icon.sc-calcite-combobox-item{display:inline-flex;opacity:0;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);color:var(--calcite-ui-border-1)}/*!@.icon--indent*/.icon--indent.sc-calcite-combobox-item{padding-inline-start:var(--calcite-combobox-item-indent-value)}/*!@.icon--custom*/.icon--custom.sc-calcite-combobox-item{margin-block-start:-1px;color:var(--calcite-ui-text-3)}/*!@.icon--active*/.icon--active.sc-calcite-combobox-item{color:var(--calcite-ui-text-1)}/*!@.icon--dot*/.icon--dot.sc-calcite-combobox-item{display:flex;justify-content:flex-end;min-inline-size:var(--calcite-combobox-item-spacing-unit-l)}/*!@.icon--dot:before*/.icon--dot.sc-calcite-combobox-item:before{text-align:start;content:\"•\"}/*!@.label--active .icon*/.label--active.sc-calcite-combobox-item .icon.sc-calcite-combobox-item{opacity:1}/*!@.label--selected .icon*/.label--selected.sc-calcite-combobox-item .icon.sc-calcite-combobox-item{opacity:1;color:var(--calcite-ui-brand)}/*!@:host(:hover[disabled]) .icon*/.sc-calcite-combobox-item-h:hover[disabled] .icon.sc-calcite-combobox-item{opacity:1}";
  16209. /**
  16210. * @slot - A slot for adding nested `calcite-combobox-item`s.
  16211. */
  16212. class ComboboxItem {
  16213. constructor(hostRef) {
  16214. registerInstance(this, hostRef);
  16215. this.calciteComboboxItemChange = createEvent(this, "calciteComboboxItemChange", 6);
  16216. // --------------------------------------------------------------------------
  16217. //
  16218. // Properties
  16219. //
  16220. // --------------------------------------------------------------------------
  16221. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  16222. this.disabled = false;
  16223. /**
  16224. * When `true`, the component is selected.
  16225. */
  16226. this.selected = false;
  16227. /** When `true`, the component is active. */
  16228. this.active = false;
  16229. /** The `id` attribute of the component. When omitted, a globally unique identifier is used. */
  16230. this.guid = guid();
  16231. this.scale = "m";
  16232. // --------------------------------------------------------------------------
  16233. //
  16234. // Private Methods
  16235. //
  16236. // --------------------------------------------------------------------------
  16237. this.itemClickHandler = (event) => {
  16238. event.preventDefault();
  16239. if (this.disabled) {
  16240. return;
  16241. }
  16242. this.selected = !this.selected;
  16243. };
  16244. }
  16245. selectedWatchHandler() {
  16246. this.calciteComboboxItemChange.emit(this.el);
  16247. }
  16248. // --------------------------------------------------------------------------
  16249. //
  16250. // Lifecycle
  16251. //
  16252. // --------------------------------------------------------------------------
  16253. connectedCallback() {
  16254. this.ancestors = getAncestors(this.el);
  16255. this.scale = getElementProp(this.el, "scale", this.scale);
  16256. connectConditionalSlotComponent(this);
  16257. }
  16258. disconnectedCallback() {
  16259. disconnectConditionalSlotComponent(this);
  16260. }
  16261. componentDidRender() {
  16262. updateHostInteraction(this);
  16263. }
  16264. // --------------------------------------------------------------------------
  16265. //
  16266. // Public Methods
  16267. //
  16268. // --------------------------------------------------------------------------
  16269. /**
  16270. * Used to toggle the selection state. By default this won't trigger an event.
  16271. * The first argument allows the value to be coerced, rather than swapping values.
  16272. *
  16273. * @param coerce
  16274. */
  16275. async toggleSelected(coerce) {
  16276. if (this.disabled) {
  16277. return;
  16278. }
  16279. this.selected = typeof coerce === "boolean" ? coerce : !this.selected;
  16280. }
  16281. // --------------------------------------------------------------------------
  16282. //
  16283. // Render Methods
  16284. //
  16285. // --------------------------------------------------------------------------
  16286. renderIcon(isSingle) {
  16287. const { icon, disabled, selected } = this;
  16288. const level = `${CSS$H.icon}--indent`;
  16289. const defaultIcon = isSingle ? "dot" : "check";
  16290. const iconPath = disabled ? "circle-disallowed" : defaultIcon;
  16291. const showDot = isSingle && !icon && !disabled;
  16292. return showDot ? (hAsync("span", { class: {
  16293. [CSS$H.icon]: true,
  16294. [CSS$H.dot]: true,
  16295. [level]: true
  16296. } })) : (hAsync("calcite-icon", { class: {
  16297. [CSS$H.icon]: !icon,
  16298. [CSS$H.custom]: !!icon,
  16299. [CSS$H.iconActive]: icon && selected,
  16300. [level]: true
  16301. }, icon: icon || iconPath, scale: "s" }));
  16302. }
  16303. renderChildren() {
  16304. if (getSlotted(this.el)) {
  16305. return (hAsync("ul", { key: "default-slot-container" }, hAsync("slot", null)));
  16306. }
  16307. return null;
  16308. }
  16309. render() {
  16310. const isSingleSelect = getElementProp(this.el, "selection-mode", "multi") === "single";
  16311. const classes = {
  16312. [CSS$H.label]: true,
  16313. [CSS$H.selected]: this.selected,
  16314. [CSS$H.active]: this.active,
  16315. [CSS$H.single]: isSingleSelect
  16316. };
  16317. const depth = getDepth();
  16318. return (hAsync(Host, { "aria-hidden": "true" }, hAsync("div", { class: `container scale--${this.scale}`, style: { "--calcite-combobox-item-spacing-indent-multiplier": `${depth}` } }, hAsync("li", { class: classes, id: this.guid, onClick: this.itemClickHandler }, this.renderIcon(isSingleSelect), hAsync("span", { class: CSS$H.title }, this.textLabel)), this.renderChildren())));
  16319. }
  16320. get el() { return getElement(this); }
  16321. static get watchers() { return {
  16322. "selected": ["selectedWatchHandler"]
  16323. }; }
  16324. static get style() { return comboboxItemCss; }
  16325. static get cmpMeta() { return {
  16326. "$flags$": 9,
  16327. "$tagName$": "calcite-combobox-item",
  16328. "$members$": {
  16329. "disabled": [516],
  16330. "selected": [1540],
  16331. "active": [516],
  16332. "ancestors": [1040],
  16333. "guid": [513],
  16334. "icon": [513],
  16335. "textLabel": [513, "text-label"],
  16336. "value": [8],
  16337. "constant": [516],
  16338. "filterDisabled": [516, "filter-disabled"],
  16339. "toggleSelected": [64]
  16340. },
  16341. "$listeners$": undefined,
  16342. "$lazyBundleId$": "-",
  16343. "$attrsToReflect$": [["disabled", "disabled"], ["selected", "selected"], ["active", "active"], ["guid", "guid"], ["icon", "icon"], ["textLabel", "text-label"], ["constant", "constant"], ["filterDisabled", "filter-disabled"]]
  16344. }; }
  16345. }
  16346. const CSS$G = {
  16347. list: "list",
  16348. label: "label",
  16349. title: "title"
  16350. };
  16351. const comboboxItemGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-combobox-item-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-combobox-item-group{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-combobox-item-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-combobox-item-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-combobox-item-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-combobox-item-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-combobox-item-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-combobox-item-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-combobox-item-group-h{display:none}/*!@.scale--s*/.scale--s.sc-calcite-combobox-item-group{font-size:var(--calcite-font-size--2);line-height:1rem;--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-item-spacing-indent-1:0.5rem;--calcite-combobox-item-spacing-indent-2:1rem}/*!@.scale--m*/.scale--m.sc-calcite-combobox-item-group{font-size:var(--calcite-font-size--1);line-height:1rem;--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-item-spacing-indent-1:0.75rem;--calcite-combobox-item-spacing-indent-2:1.5rem}/*!@.scale--l*/.scale--l.sc-calcite-combobox-item-group{font-size:var(--calcite-font-size-0);line-height:1.25rem;--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-item-spacing-indent-1:1rem;--calcite-combobox-item-spacing-indent-2:2rem}/*!@:host, \n.list*/.sc-calcite-combobox-item-group-h,.list.sc-calcite-combobox-item-group{margin:0px;display:flex;flex-direction:column;padding:0px}/*!@:host(:focus), \n.list:focus*/.sc-calcite-combobox-item-group-h:focus,.list.sc-calcite-combobox-item-group:focus{outline:2px solid transparent;outline-offset:2px}/*!@.label*/.label.sc-calcite-combobox-item-group{box-sizing:border-box;display:flex;inline-size:100%;min-inline-size:0px;max-inline-size:100%;color:var(--calcite-ui-text-3)}/*!@.label--indent-1*/.label--indent-1.sc-calcite-combobox-item-group{padding-inline-start:var(--calcite-combobox-item-spacing-indent-1)}/*!@.label--indent-2*/.label--indent-2.sc-calcite-combobox-item-group{padding-inline-start:var(--calcite-combobox-item-spacing-indent-2)}/*!@.title*/.title.sc-calcite-combobox-item-group{border:0 solid;display:block;flex:1 1 0%;border-block-end-width:1px;font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-2);word-wrap:break-word;word-break:break-word;border-block-end-color:var(--calcite-ui-border-3);padding-block:var(--calcite-combobox-item-spacing-unit-l);padding-inline:0;margin-inline:var(--calcite-combobox-item-spacing-unit-s)}";
  16352. /**
  16353. * @slot - A slot for adding `calcite-combobox-item`s.
  16354. */
  16355. class ComboboxItemGroup {
  16356. constructor(hostRef) {
  16357. registerInstance(this, hostRef);
  16358. this.guid = guid();
  16359. this.scale = "m";
  16360. }
  16361. // --------------------------------------------------------------------------
  16362. //
  16363. // Lifecycle
  16364. //
  16365. // --------------------------------------------------------------------------
  16366. connectedCallback() {
  16367. this.ancestors = getAncestors(this.el);
  16368. this.scale = getElementProp(this.el, "scale", this.scale);
  16369. }
  16370. // --------------------------------------------------------------------------
  16371. //
  16372. // Render Methods
  16373. //
  16374. // --------------------------------------------------------------------------
  16375. render() {
  16376. const { el, scale } = this;
  16377. const indent = `${CSS$G.label}--indent-${getDepth()}`;
  16378. return (hAsync("ul", { "aria-labelledby": this.guid, class: { [CSS$G.list]: true, [`scale--${scale}`]: true }, role: "group" }, hAsync("li", { class: { [CSS$G.label]: true, [indent]: true }, id: this.guid, role: "presentation" }, hAsync("span", { class: CSS$G.title }, this.label)), hAsync("slot", null)));
  16379. }
  16380. get el() { return getElement(this); }
  16381. static get style() { return comboboxItemGroupCss; }
  16382. static get cmpMeta() { return {
  16383. "$flags$": 9,
  16384. "$tagName$": "calcite-combobox-item-group",
  16385. "$members$": {
  16386. "ancestors": [1040],
  16387. "label": [1]
  16388. },
  16389. "$listeners$": undefined,
  16390. "$lazyBundleId$": "-",
  16391. "$attrsToReflect$": []
  16392. }; }
  16393. }
  16394. /**
  16395. * Check if date is within a min and max
  16396. *
  16397. * @param date
  16398. * @param min
  16399. * @param max
  16400. */
  16401. function inRange(date, min, max) {
  16402. const time = date.getTime();
  16403. const afterMin = !(min instanceof Date) || time >= min.getTime();
  16404. const beforeMax = !(max instanceof Date) || time <= max.getTime();
  16405. return afterMin && beforeMax;
  16406. }
  16407. /**
  16408. * Ensures date is within range,
  16409. * returns min or max if out of bounds
  16410. *
  16411. * @param date
  16412. * @param min
  16413. * @param max
  16414. */
  16415. function dateFromRange(date, min, max) {
  16416. if (!(date instanceof Date)) {
  16417. return null;
  16418. }
  16419. const time = date.getTime();
  16420. const beforeMin = min instanceof Date && time < min.getTime();
  16421. const afterMax = max instanceof Date && time > max.getTime();
  16422. if (beforeMin) {
  16423. return min;
  16424. }
  16425. if (afterMax) {
  16426. return max;
  16427. }
  16428. return date;
  16429. }
  16430. /**
  16431. * Parse an iso8601 string (YYYY-mm-dd) into a valid date.
  16432. * TODO: handle time when time of day UI is added
  16433. *
  16434. * @param iso8601
  16435. * @param isEndDate
  16436. */
  16437. function dateFromISO(iso8601, isEndDate = false) {
  16438. if (iso8601 instanceof Date) {
  16439. return iso8601;
  16440. }
  16441. if (!iso8601 || typeof iso8601 !== "string") {
  16442. return null;
  16443. }
  16444. const d = iso8601.split(/[: T-]/).map(parseFloat);
  16445. const date = new Date(d[0], (d[1] || 1) - 1, d[2] || 1);
  16446. date.setFullYear(d[0]);
  16447. if (isNaN(date.getTime())) {
  16448. throw new Error(`Invalid ISO 8601 date: "${iso8601}"`);
  16449. }
  16450. if (isEndDate) {
  16451. return setEndOfDay(date);
  16452. }
  16453. return date;
  16454. }
  16455. /**
  16456. * Return first portion of ISO string (YYYY-mm-dd)
  16457. *
  16458. * @param date
  16459. */
  16460. function dateToISO(date) {
  16461. if (typeof date === "string") {
  16462. return date;
  16463. }
  16464. if (date instanceof Date) {
  16465. return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().split("T")[0];
  16466. }
  16467. return "";
  16468. }
  16469. /**
  16470. * Check if two dates are the same day, month, year
  16471. *
  16472. * @param d1
  16473. * @param d2
  16474. */
  16475. function sameDate(d1, d2) {
  16476. return (d1 instanceof Date &&
  16477. d2 instanceof Date &&
  16478. d1.getDate() === d2.getDate() &&
  16479. d1.getMonth() === d2.getMonth() &&
  16480. d1.getFullYear() === d2.getFullYear());
  16481. }
  16482. /**
  16483. * Get a date one month in the past
  16484. *
  16485. * @param date
  16486. */
  16487. function prevMonth(date) {
  16488. const month = date.getMonth();
  16489. const nextDate = new Date(date);
  16490. nextDate.setMonth(month - 1);
  16491. // date doesn't exist in new month, use last day
  16492. if (month === nextDate.getMonth()) {
  16493. return new Date(date.getFullYear(), month, 0);
  16494. }
  16495. return nextDate;
  16496. }
  16497. /**
  16498. * Get a date one month in the future
  16499. *
  16500. * @param date
  16501. */
  16502. function nextMonth(date) {
  16503. const month = date.getMonth();
  16504. const nextDate = new Date(date);
  16505. nextDate.setMonth(month + 1);
  16506. // date doesn't exist in new month, use last day
  16507. if ((month + 2) % 7 === nextDate.getMonth() % 7) {
  16508. return new Date(date.getFullYear(), month + 2, 0);
  16509. }
  16510. return nextDate;
  16511. }
  16512. /**
  16513. * Parse numeric units for day, month, and year from a localized string
  16514. * month starts at 0 (can pass to date constructor)
  16515. *
  16516. * @param str
  16517. * @param localeData
  16518. */
  16519. function parseDateString(str, localeData) {
  16520. const { separator, unitOrder } = localeData;
  16521. const order = getOrder(unitOrder);
  16522. const values = str.split(separator).map((part) => numberStringFormatter.delocalize(part));
  16523. return {
  16524. day: parseInt(values[order.indexOf("d")]),
  16525. month: parseInt(values[order.indexOf("m")]) - 1,
  16526. year: parseInt(values[order.indexOf("y")])
  16527. };
  16528. }
  16529. /**
  16530. * Based on the unitOrder string, find order of month, day, and year for locale
  16531. *
  16532. * @param unitOrder
  16533. */
  16534. function getOrder(unitOrder) {
  16535. const signifiers = ["d", "m", "y"];
  16536. const order = unitOrder.toLowerCase();
  16537. return signifiers.sort((a, b) => order.indexOf(a) - order.indexOf(b));
  16538. }
  16539. /**
  16540. * Get number of days between two dates
  16541. *
  16542. * @param date1
  16543. * @param date2
  16544. */
  16545. function getDaysDiff(date1, date2) {
  16546. const ts1 = date1.getTime();
  16547. const ts2 = date2.getTime();
  16548. return (ts1 - ts2) / (1000 * 3600 * 24);
  16549. }
  16550. /**
  16551. * Set time of the day to the end.
  16552. *
  16553. * @param {Date} date Date.
  16554. * @returns {Date} Date with time set to end of day .
  16555. */
  16556. function setEndOfDay(date) {
  16557. date.setHours(23, 59, 59, 999);
  16558. return date;
  16559. }
  16560. /**
  16561. * Maps value to valueAsDate
  16562. *
  16563. * @param value
  16564. */
  16565. function getValueAsDateRange(value) {
  16566. return value.map((v, index) => dateFromISO(v, index === 1));
  16567. }
  16568. const HEADING_LEVEL$6 = 2;
  16569. const TEXT$i = {
  16570. nextMonth: "Next month",
  16571. prevMonth: "Previous month",
  16572. year: "Year"
  16573. };
  16574. const datePickerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-date-picker:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-date-picker{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-date-picker{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-date-picker{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-date-picker{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-date-picker{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-date-picker:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-date-picker:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-date-picker-h{display:none}/*!@:host*/.sc-calcite-date-picker-h{position:relative;display:inline-block;inline-size:100%;overflow:visible;border-radius:0px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-2);background-color:var(--calcite-ui-foreground-1);vertical-align:top}/*!@:host([scale=s])*/[scale=s].sc-calcite-date-picker-h{max-inline-size:216px}/*!@:host([scale=m])*/[scale=m].sc-calcite-date-picker-h{max-inline-size:286px}/*!@:host([scale=l])*/[scale=l].sc-calcite-date-picker-h{max-inline-size:398px}";
  16575. class DatePicker {
  16576. constructor(hostRef) {
  16577. registerInstance(this, hostRef);
  16578. this.calciteDatePickerChange = createEvent(this, "calciteDatePickerChange", 6);
  16579. this.calciteDatePickerRangeChange = createEvent(this, "calciteDatePickerRangeChange", 6);
  16580. /**
  16581. * Localized string for "previous month" (used for aria label)
  16582. *
  16583. * @default "Previous month"
  16584. */
  16585. this.intlPrevMonth = TEXT$i.prevMonth;
  16586. /**
  16587. * Localized string for "next month" (used for aria label)
  16588. *
  16589. * @default "Next month"
  16590. */
  16591. this.intlNextMonth = TEXT$i.nextMonth;
  16592. /**
  16593. * Localized string for "year" (used for aria label)
  16594. *
  16595. * @default "Year"
  16596. */
  16597. this.intlYear = TEXT$i.year;
  16598. /** specify the scale of the date picker */
  16599. this.scale = "m";
  16600. /** Range mode activation */
  16601. this.range = false;
  16602. /** Disables the default behaviour on the third click of narrowing or extending the range and instead starts a new range. */
  16603. this.proximitySelectionDisabled = false;
  16604. this.globalAttributes = {};
  16605. //--------------------------------------------------------------------------
  16606. //
  16607. // Private State/Props
  16608. //
  16609. //--------------------------------------------------------------------------
  16610. this.effectiveLocale = "";
  16611. //--------------------------------------------------------------------------
  16612. //
  16613. // Private Methods
  16614. //
  16615. //--------------------------------------------------------------------------
  16616. this.keyDownHandler = (event) => {
  16617. if (event.key === "Escape") {
  16618. this.reset();
  16619. }
  16620. };
  16621. this.monthHeaderSelectChange = (event) => {
  16622. const date = new Date(event.detail);
  16623. if (!this.range) {
  16624. this.activeDate = date;
  16625. }
  16626. else {
  16627. if (this.activeRange === "end") {
  16628. this.activeEndDate = date;
  16629. }
  16630. else {
  16631. this.activeStartDate = date;
  16632. }
  16633. this.mostRecentRangeValue = date;
  16634. }
  16635. };
  16636. this.monthActiveDateChange = (event) => {
  16637. const date = new Date(event.detail);
  16638. if (!this.range) {
  16639. this.activeDate = date;
  16640. }
  16641. else {
  16642. if (this.activeRange === "end") {
  16643. this.activeEndDate = date;
  16644. }
  16645. else {
  16646. this.activeStartDate = date;
  16647. }
  16648. this.mostRecentRangeValue = date;
  16649. }
  16650. };
  16651. this.monthHoverChange = (event) => {
  16652. if (!this.startAsDate) {
  16653. this.hoverRange = undefined;
  16654. return;
  16655. }
  16656. const date = new Date(event.detail);
  16657. this.hoverRange = {
  16658. focused: this.activeRange || "start",
  16659. start: this.startAsDate,
  16660. end: this.endAsDate
  16661. };
  16662. if (!this.proximitySelectionDisabled) {
  16663. if (this.endAsDate) {
  16664. const startDiff = getDaysDiff(date, this.startAsDate);
  16665. const endDiff = getDaysDiff(date, this.endAsDate);
  16666. if (endDiff > 0) {
  16667. this.hoverRange.end = date;
  16668. this.hoverRange.focused = "end";
  16669. }
  16670. else if (startDiff < 0) {
  16671. this.hoverRange.start = date;
  16672. this.hoverRange.focused = "start";
  16673. }
  16674. else if (startDiff > endDiff) {
  16675. this.hoverRange.start = date;
  16676. this.hoverRange.focused = "start";
  16677. }
  16678. else {
  16679. this.hoverRange.end = date;
  16680. this.hoverRange.focused = "end";
  16681. }
  16682. }
  16683. else {
  16684. if (date < this.startAsDate) {
  16685. this.hoverRange = {
  16686. focused: "start",
  16687. start: date,
  16688. end: this.startAsDate
  16689. };
  16690. }
  16691. else {
  16692. this.hoverRange.end = date;
  16693. this.hoverRange.focused = "end";
  16694. }
  16695. }
  16696. }
  16697. else {
  16698. if (!this.endAsDate) {
  16699. if (date < this.startAsDate) {
  16700. this.hoverRange = {
  16701. focused: "start",
  16702. start: date,
  16703. end: this.startAsDate
  16704. };
  16705. }
  16706. else {
  16707. this.hoverRange.end = date;
  16708. this.hoverRange.focused = "end";
  16709. }
  16710. }
  16711. else {
  16712. this.hoverRange = undefined;
  16713. }
  16714. }
  16715. event.stopPropagation();
  16716. };
  16717. this.monthMouseOutChange = () => {
  16718. if (this.hoverRange) {
  16719. this.hoverRange = undefined;
  16720. }
  16721. };
  16722. /**
  16723. * Reset active date and close
  16724. */
  16725. this.reset = () => {
  16726. var _a, _b, _c, _d, _e, _f;
  16727. if (!Array.isArray(this.valueAsDate) &&
  16728. this.valueAsDate &&
  16729. ((_a = this.valueAsDate) === null || _a === void 0 ? void 0 : _a.getTime()) !== ((_b = this.activeDate) === null || _b === void 0 ? void 0 : _b.getTime())) {
  16730. this.activeDate = new Date(this.valueAsDate);
  16731. }
  16732. if (this.startAsDate && ((_c = this.startAsDate) === null || _c === void 0 ? void 0 : _c.getTime()) !== ((_d = this.activeStartDate) === null || _d === void 0 ? void 0 : _d.getTime())) {
  16733. this.activeStartDate = new Date(this.startAsDate);
  16734. }
  16735. if (this.endAsDate && ((_e = this.endAsDate) === null || _e === void 0 ? void 0 : _e.getTime()) !== ((_f = this.activeEndDate) === null || _f === void 0 ? void 0 : _f.getTime())) {
  16736. this.activeEndDate = new Date(this.endAsDate);
  16737. }
  16738. };
  16739. /**
  16740. * Event handler for when the selected date changes
  16741. *
  16742. * @param event
  16743. */
  16744. this.monthDateChange = (event) => {
  16745. const date = new Date(event.detail);
  16746. if (!this.range) {
  16747. this.value = date ? dateToISO(date) : "";
  16748. this.valueAsDate = date || null;
  16749. this.activeDate = date || null;
  16750. this.calciteDatePickerChange.emit(date);
  16751. return;
  16752. }
  16753. if (!this.startAsDate || (!this.endAsDate && date < this.startAsDate)) {
  16754. if (this.startAsDate) {
  16755. this.setEndDate(new Date(this.startAsDate));
  16756. }
  16757. if (this.activeRange == "end") {
  16758. this.setEndDate(date);
  16759. }
  16760. else {
  16761. this.setStartDate(date);
  16762. }
  16763. }
  16764. else if (!this.endAsDate) {
  16765. this.setEndDate(date);
  16766. }
  16767. else {
  16768. if (!this.proximitySelectionDisabled) {
  16769. if (this.activeRange) {
  16770. if (this.activeRange == "end") {
  16771. this.setEndDate(date);
  16772. }
  16773. else {
  16774. this.setStartDate(date);
  16775. }
  16776. }
  16777. else {
  16778. const startDiff = getDaysDiff(date, this.startAsDate);
  16779. const endDiff = getDaysDiff(date, this.endAsDate);
  16780. if (endDiff === 0 || startDiff < 0) {
  16781. this.setStartDate(date);
  16782. }
  16783. else if (startDiff === 0 || endDiff < 0) {
  16784. this.setEndDate(date);
  16785. }
  16786. else if (startDiff < endDiff) {
  16787. this.setStartDate(date);
  16788. }
  16789. else {
  16790. this.setEndDate(date);
  16791. }
  16792. }
  16793. }
  16794. else {
  16795. this.setStartDate(date);
  16796. this.endAsDate = this.activeEndDate = this.end = undefined;
  16797. }
  16798. }
  16799. this.calciteDatePickerChange.emit(date);
  16800. };
  16801. }
  16802. handleValueAsDate(date) {
  16803. if (!Array.isArray(date) && date && date !== this.activeDate) {
  16804. this.activeDate = date;
  16805. }
  16806. }
  16807. handleRangeChange() {
  16808. const { startAsDate: startDate, endAsDate: endDate } = this;
  16809. this.activeEndDate = endDate;
  16810. this.activeStartDate = startDate;
  16811. }
  16812. onMinChanged(min) {
  16813. if (min) {
  16814. this.minAsDate = dateFromISO(min);
  16815. }
  16816. }
  16817. onMaxChanged(max) {
  16818. if (max) {
  16819. this.maxAsDate = dateFromISO(max);
  16820. }
  16821. }
  16822. // --------------------------------------------------------------------------
  16823. //
  16824. // Lifecycle
  16825. //
  16826. // --------------------------------------------------------------------------
  16827. connectedCallback() {
  16828. connectLocalized(this);
  16829. if (Array.isArray(this.value)) {
  16830. this.valueAsDate = getValueAsDateRange(this.value);
  16831. this.start = this.value[0];
  16832. this.end = this.value[1];
  16833. }
  16834. else if (this.value) {
  16835. this.valueAsDate = dateFromISO(this.value);
  16836. }
  16837. if (this.start) {
  16838. this.setStartAsDate(dateFromISO(this.start));
  16839. }
  16840. if (this.end) {
  16841. this.setEndAsDate(dateFromISO(this.end));
  16842. }
  16843. if (this.min) {
  16844. this.minAsDate = dateFromISO(this.min);
  16845. }
  16846. if (this.max) {
  16847. this.maxAsDate = dateFromISO(this.max);
  16848. }
  16849. }
  16850. disconnectedCallback() {
  16851. disconnectLocalized(this);
  16852. }
  16853. async componentWillLoad() {
  16854. await this.loadLocaleData();
  16855. this.onMinChanged(this.min);
  16856. this.onMaxChanged(this.max);
  16857. }
  16858. render() {
  16859. var _a;
  16860. const date = dateFromRange(this.range ? this.startAsDate : this.valueAsDate, this.minAsDate, this.maxAsDate);
  16861. const activeStartDate = this.range
  16862. ? this.getActiveStartDate(date, this.minAsDate, this.maxAsDate)
  16863. : this.getActiveDate(date, this.minAsDate, this.maxAsDate);
  16864. let activeDate = activeStartDate;
  16865. const endDate = this.range
  16866. ? dateFromRange(this.endAsDate, this.minAsDate, this.maxAsDate)
  16867. : null;
  16868. const activeEndDate = this.getActiveEndDate(endDate, this.minAsDate, this.maxAsDate);
  16869. if ((this.activeRange === "end" ||
  16870. (((_a = this.hoverRange) === null || _a === void 0 ? void 0 : _a.focused) === "end" && (!this.proximitySelectionDisabled || endDate))) &&
  16871. activeEndDate) {
  16872. activeDate = activeEndDate;
  16873. }
  16874. if (this.range && this.mostRecentRangeValue) {
  16875. activeDate = this.mostRecentRangeValue;
  16876. }
  16877. const minDate = this.range && this.activeRange
  16878. ? this.activeRange === "start"
  16879. ? this.minAsDate
  16880. : date || this.minAsDate
  16881. : this.minAsDate;
  16882. const maxDate = this.range && this.activeRange
  16883. ? this.activeRange === "start"
  16884. ? endDate || this.maxAsDate
  16885. : this.maxAsDate
  16886. : this.maxAsDate;
  16887. return (hAsync(Host, { onBlur: this.reset, onKeyDown: this.keyDownHandler, role: "application" }, this.renderCalendar(activeDate, maxDate, minDate, date, endDate)));
  16888. }
  16889. valueHandler(value) {
  16890. if (Array.isArray(value)) {
  16891. this.valueAsDate = getValueAsDateRange(value);
  16892. this.start = value[0];
  16893. this.end = value[1];
  16894. }
  16895. else if (value) {
  16896. this.valueAsDate = dateFromISO(value);
  16897. this.start = "";
  16898. this.end = "";
  16899. }
  16900. }
  16901. startWatcher(start) {
  16902. this.setStartAsDate(dateFromISO(start));
  16903. }
  16904. endWatcher(end) {
  16905. this.setEndAsDate(dateFromISO(end));
  16906. }
  16907. async loadLocaleData() {
  16908. {
  16909. return;
  16910. }
  16911. }
  16912. /**
  16913. * Render calcite-date-picker-month-header and calcite-date-picker-month
  16914. *
  16915. * @param activeDate
  16916. * @param maxDate
  16917. * @param minDate
  16918. * @param date
  16919. * @param endDate
  16920. */
  16921. renderCalendar(activeDate, maxDate, minDate, date, endDate) {
  16922. return (this.localeData && [
  16923. hAsync("calcite-date-picker-month-header", { activeDate: activeDate, headingLevel: this.headingLevel || HEADING_LEVEL$6, intlNextMonth: this.intlNextMonth, intlPrevMonth: this.intlPrevMonth, intlYear: this.intlYear, localeData: this.localeData, max: maxDate, min: minDate, onCalciteDatePickerSelect: this.monthHeaderSelectChange, scale: this.scale, selectedDate: this.activeRange === "end" ? endDate : date || new Date() }),
  16924. hAsync("calcite-date-picker-month", { activeDate: activeDate, endDate: this.range ? endDate : undefined, hoverRange: this.hoverRange, localeData: this.localeData, max: maxDate, min: minDate, onCalciteDatePickerActiveDateChange: this.monthActiveDateChange, onCalciteDatePickerSelect: this.monthDateChange, onCalciteInternalDatePickerHover: this.monthHoverChange, onCalciteInternalDatePickerMouseOut: this.monthMouseOutChange, scale: this.scale, selectedDate: this.activeRange === "end" ? endDate : date, startDate: this.range ? date : undefined })
  16925. ]);
  16926. }
  16927. /**
  16928. * Update date instance of start if valid
  16929. *
  16930. * @param startDate
  16931. * @param emit
  16932. */
  16933. setStartAsDate(startDate, emit) {
  16934. this.startAsDate = startDate;
  16935. this.mostRecentRangeValue = this.startAsDate;
  16936. if (emit) {
  16937. this.calciteDatePickerRangeChange.emit({
  16938. startDate,
  16939. endDate: this.endAsDate
  16940. });
  16941. }
  16942. }
  16943. /**
  16944. * Update date instance of end if valid
  16945. *
  16946. * @param endDate
  16947. * @param emit
  16948. */
  16949. setEndAsDate(endDate, emit) {
  16950. this.endAsDate = endDate ? setEndOfDay(endDate) : endDate;
  16951. this.mostRecentRangeValue = this.endAsDate;
  16952. if (emit) {
  16953. this.calciteDatePickerRangeChange.emit({
  16954. startDate: this.startAsDate,
  16955. endDate
  16956. });
  16957. }
  16958. }
  16959. setEndDate(date) {
  16960. this.end = date ? dateToISO(date) : "";
  16961. this.setEndAsDate(date, true);
  16962. this.activeEndDate = date || null;
  16963. }
  16964. setStartDate(date) {
  16965. this.start = date ? dateToISO(date) : "";
  16966. this.setStartAsDate(date, true);
  16967. this.activeStartDate = date || null;
  16968. }
  16969. /**
  16970. * Get an active date using the value, or current date as default
  16971. *
  16972. * @param value
  16973. * @param min
  16974. * @param max
  16975. */
  16976. getActiveDate(value, min, max) {
  16977. return dateFromRange(this.activeDate, min, max) || value || dateFromRange(new Date(), min, max);
  16978. }
  16979. getActiveStartDate(value, min, max) {
  16980. return (dateFromRange(this.activeStartDate, min, max) || value || dateFromRange(new Date(), min, max));
  16981. }
  16982. getActiveEndDate(value, min, max) {
  16983. return (dateFromRange(this.activeEndDate, min, max) || value || dateFromRange(new Date(), min, max));
  16984. }
  16985. static get assetsDirs() { return ["assets"]; }
  16986. get el() { return getElement(this); }
  16987. static get watchers() { return {
  16988. "valueAsDate": ["handleValueAsDate"],
  16989. "startAsDate": ["handleRangeChange"],
  16990. "endAsDate": ["handleRangeChange"],
  16991. "min": ["onMinChanged"],
  16992. "max": ["onMaxChanged"],
  16993. "value": ["valueHandler"],
  16994. "start": ["startWatcher"],
  16995. "end": ["endWatcher"],
  16996. "effectiveLocale": ["loadLocaleData"]
  16997. }; }
  16998. static get style() { return datePickerCss; }
  16999. static get cmpMeta() { return {
  17000. "$flags$": 9,
  17001. "$tagName$": "calcite-date-picker",
  17002. "$members$": {
  17003. "activeRange": [513, "active-range"],
  17004. "value": [1025],
  17005. "headingLevel": [514, "heading-level"],
  17006. "valueAsDate": [1040],
  17007. "startAsDate": [1040],
  17008. "endAsDate": [1040],
  17009. "minAsDate": [1040],
  17010. "maxAsDate": [1040],
  17011. "min": [1537],
  17012. "max": [1537],
  17013. "intlPrevMonth": [1, "intl-prev-month"],
  17014. "intlNextMonth": [1, "intl-next-month"],
  17015. "intlYear": [1, "intl-year"],
  17016. "locale": [1],
  17017. "numberingSystem": [513, "numbering-system"],
  17018. "scale": [513],
  17019. "range": [516],
  17020. "start": [1537],
  17021. "end": [1537],
  17022. "proximitySelectionDisabled": [516, "proximity-selection-disabled"],
  17023. "activeDate": [32],
  17024. "activeStartDate": [32],
  17025. "activeEndDate": [32],
  17026. "globalAttributes": [32],
  17027. "effectiveLocale": [32],
  17028. "localeData": [32],
  17029. "hoverRange": [32]
  17030. },
  17031. "$listeners$": undefined,
  17032. "$lazyBundleId$": "-",
  17033. "$attrsToReflect$": [["activeRange", "active-range"], ["headingLevel", "heading-level"], ["min", "min"], ["max", "max"], ["numberingSystem", "numbering-system"], ["scale", "scale"], ["range", "range"], ["start", "start"], ["end", "end"], ["proximitySelectionDisabled", "proximity-selection-disabled"]]
  17034. }; }
  17035. }
  17036. const datePickerDayCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-date-picker-day:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-date-picker-day{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-date-picker-day{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-date-picker-day{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-date-picker-day{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-date-picker-day{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-date-picker-day:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-date-picker-day:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-date-picker-day-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-date-picker-day-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-date-picker-day-h{display:flex;min-inline-size:0px;cursor:pointer;justify-content:center;color:var(--calcite-ui-text-3);inline-size:14.2857142857%}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-date-picker-day-h[disabled] .sc-calcite-date-picker-day-s>[calcite-hydrated][disabled],[disabled].sc-calcite-date-picker-day-h [calcite-hydrated][disabled].sc-calcite-date-picker-day{opacity:1}/*!@.day-v-wrapper*/.day-v-wrapper.sc-calcite-date-picker-day{flex:1 1 auto}/*!@.day-wrapper*/.day-wrapper.sc-calcite-date-picker-day{display:flex;flex-direction:column;align-items:center}/*!@.day*/.day.sc-calcite-date-picker-day{display:flex;align-items:center;justify-content:center;border-radius:9999px;font-size:var(--calcite-font-size--2);line-height:1rem;line-height:1;color:var(--calcite-ui-text-3);opacity:var(--calcite-ui-opacity-disabled);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;background:none;box-shadow:0 0 0 2px transparent}/*!@.text*/.text.sc-calcite-date-picker-day{margin-block:1px 0px;margin-inline-start:0px}/*!@:host([scale=s]) .day-v-wrapper*/[scale=s].sc-calcite-date-picker-day-h .day-v-wrapper.sc-calcite-date-picker-day{padding-block:0.125rem}/*!@:host([scale=s]) .day-wrapper*/[scale=s].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{padding:0px}/*!@:host([scale=s]) .day*/[scale=s].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{block-size:27px;inline-size:27px;font-size:var(--calcite-font-size--2)}/*!@:host([scale=m]) .day-v-wrapper*/[scale=m].sc-calcite-date-picker-day-h .day-v-wrapper.sc-calcite-date-picker-day{padding-block:0.25rem}/*!@:host([scale=m]) .day-wrapper*/[scale=m].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{padding-inline:0.25rem}/*!@:host([scale=m]) .day*/[scale=m].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{block-size:33px;inline-size:33px;font-size:var(--calcite-font-size--1)}/*!@:host([scale=l]) .day-v-wrapper*/[scale=l].sc-calcite-date-picker-day-h .day-v-wrapper.sc-calcite-date-picker-day{padding-block:0.25rem}/*!@:host([scale=l]) .day-wrapper*/[scale=l].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{padding-inline:0.25rem}/*!@:host([scale=l]) .day*/[scale=l].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{block-size:43px;inline-size:43px;font-size:var(--calcite-font-size-0)}/*!@:host([current-month]) .day*/[current-month].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{opacity:1}/*!@:host(:hover:not([disabled])) .day, \n:host([active]:not([range])) .day*/.sc-calcite-date-picker-day-h:hover:not([disabled]) .day.sc-calcite-date-picker-day,[active].sc-calcite-date-picker-day-h:not([range]) .day.sc-calcite-date-picker-day{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@:host(:focus), \n:host([active])*/.sc-calcite-date-picker-day-h:focus,[active].sc-calcite-date-picker-day-h{outline:2px solid transparent;outline-offset:2px}/*!@:host(:focus:not([disabled])) .day*/.sc-calcite-date-picker-day-h:focus:not([disabled]) .day.sc-calcite-date-picker-day{outline:2px solid var(--calcite-ui-brand);outline-offset:2px;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host([selected]) .day*/[selected].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{font-weight:var(--calcite-font-weight-medium);background-color:var(--calcite-ui-brand) !important;color:var(--calcite-ui-foreground-1) !important}/*!@:host([range][selected]) .day-wrapper*/[range][selected].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{background-color:var(--calcite-ui-foreground-current)}/*!@:host([start-of-range]) .day-wrapper*/[start-of-range].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{border-start-start-radius:40%;border-end-start-radius:40%}/*!@:host([end-of-range]) .day-wrapper*/[end-of-range].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{border-start-end-radius:40%;border-end-end-radius:40%}/*!@:host([start-of-range]) :not(.calcite--rtl) .day-wrapper*/[start-of-range].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset 4px 0 var(--calcite-ui-foreground-1)}/*!@:host([start-of-range]) .calcite--rtl .day-wrapper*/[start-of-range].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset -4px 0 var(--calcite-ui-foreground-1)}/*!@:host([start-of-range]) .day*/[start-of-range].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{opacity:1}/*!@:host([end-of-range]) :not(.calcite--rtl) .day-wrapper*/[end-of-range].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset -4px 0 var(--calcite-ui-foreground-1)}/*!@:host([end-of-range]) .calcite--rtl .day-wrapper*/[end-of-range].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset 4px 0 var(--calcite-ui-foreground-1)}/*!@:host([end-of-range]) .day*/[end-of-range].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{opacity:1}/*!@:host([start-of-range]:not(:focus)) :not(.calcite--rtl) .day*/[start-of-range].sc-calcite-date-picker-day-h:not(:focus) .sc-calcite-date-picker-day:not(.calcite--rtl) .day.sc-calcite-date-picker-day{box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host([start-of-range]:not(:focus)) .calcite--rtl .day*/[start-of-range].sc-calcite-date-picker-day-h:not(:focus) .calcite--rtl.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{box-shadow:0 0 0 -2px var(--calcite-ui-foreground-1)}/*!@:host([end-of-range]:not(:focus)) :not(.calcite--rtl) .day*/[end-of-range].sc-calcite-date-picker-day-h:not(:focus) .sc-calcite-date-picker-day:not(.calcite--rtl) .day.sc-calcite-date-picker-day{box-shadow:0 0 0 -2px var(--calcite-ui-foreground-1)}/*!@:host([end-of-range]:not(:focus)) .calcite--rtl .day*/[end-of-range].sc-calcite-date-picker-day-h:not(:focus) .calcite--rtl.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host([start-of-range][scale=l]) :not(.calcite--rtl) .day-wrapper*/[start-of-range][scale=l].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset 8px 0 var(--calcite-ui-foreground-1)}/*!@:host([start-of-range][scale=l]) .calcite--rtl .day-wrapper*/[start-of-range][scale=l].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset -8px 0 var(--calcite-ui-foreground-1)}/*!@:host([end-of-range][scale=l]) :not(.calcite--rtl) .day-wrapper*/[end-of-range][scale=l].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset -8px 0 var(--calcite-ui-foreground-1)}/*!@:host([end-of-range][scale=l]) .calcite--rtl .day-wrapper*/[end-of-range][scale=l].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset 8px 0 var(--calcite-ui-foreground-1)}/*!@:host([highlighted]) .day-wrapper*/[highlighted].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{background-color:var(--calcite-ui-foreground-current)}/*!@:host([highlighted]) .day-wrapper .day*/[highlighted].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{color:var(--calcite-ui-text-1)}/*!@:host([highlighted]:not([active]:focus)) .day*/[highlighted].sc-calcite-date-picker-day-h:not([active]:focus) .day.sc-calcite-date-picker-day{border-radius:0px;color:var(--calcite-ui-text-1)}/*!@:host([range-hover]:not([selected])) .day-wrapper*/[range-hover].sc-calcite-date-picker-day-h:not([selected]) .day-wrapper.sc-calcite-date-picker-day{background-color:var(--calcite-ui-foreground-2)}/*!@:host([range-hover]:not([selected])) .day*/[range-hover].sc-calcite-date-picker-day-h:not([selected]) .day.sc-calcite-date-picker-day{border-radius:0px}/*!@:host([start-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper*/[start-of-range][range-hover].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day{background-image:linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));border-radius:0px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([start-of-range][range-hover]) .calcite--rtl .day-wrapper*/[start-of-range][range-hover].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));border-radius:0px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([end-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper*/[end-of-range][range-hover].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day{background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));border-radius:0px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([end-of-range][range-hover]) .calcite--rtl .day-wrapper*/[end-of-range][range-hover].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));border-radius:0px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host(:hover[end-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,\n:host(:hover[start-of-range][range-hover]) .calcite--rtl .day-wrapper*/.sc-calcite-date-picker-day-h:hover[end-of-range][range-hover] .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[start-of-range][range-hover] .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1));border-radius:0px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host(:hover[start-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,\n:host(:hover[end-of-range][range-hover]) .calcite--rtl .day-wrapper*/.sc-calcite-date-picker-day-h:hover[start-of-range][range-hover] .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[end-of-range][range-hover] .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1));border-radius:0px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host(:hover[range-hover]:not([selected]).focused--start) :not(.calcite--rtl) .day-wrapper*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day{background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2))}/*!@:host(:hover[range-hover]:not([selected]).focused--start) .calcite--rtl .day-wrapper*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current))}/*!@:host(:hover[range-hover]:not([selected]).focused--start) .day*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start .day.sc-calcite-date-picker-day{border-radius:9999px;opacity:1;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host(:hover[range-hover]:not([selected]).focused--end) :not(.calcite--rtl) .day-wrapper*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day{background-image:linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current))}/*!@:host(:hover[range-hover]:not([selected]).focused--end) .calcite--rtl .day-wrapper*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2))}/*!@:host(:hover[range-hover]:not([selected]).focused--end) .day*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end .day.sc-calcite-date-picker-day{border-radius:9999px;opacity:1;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) :not(.calcite--rtl) .day-wrapper,\n:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) .calcite--rtl .day-wrapper*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start.hover--outside-range .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end.hover--outside-range .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:linear-gradient(to right, var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2))}/*!@:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) :not(.calcite--rtl) .day, \n:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) .calcite--rtl .day*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start.hover--outside-range .sc-calcite-date-picker-day:not(.calcite--rtl) .day.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end.hover--outside-range .calcite--rtl.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{border-radius:9999px;opacity:1;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) :not(.calcite--rtl) .day-wrapper,\n:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) .calcite--rtl .day-wrapper*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end.hover--outside-range .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start.hover--outside-range .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{background-image:linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1))}/*!@:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) :not(.calcite--rtl) .day, \n:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) .calcite--rtl .day*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end.hover--outside-range .sc-calcite-date-picker-day:not(.calcite--rtl) .day.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start.hover--outside-range .calcite--rtl.sc-calcite-date-picker-day .day.sc-calcite-date-picker-day{border-radius:9999px;opacity:1;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host(:hover[start-of-range].hover--inside-range.focused--end) .day-wrapper, \n:host(:hover[end-of-range].hover--inside-range.focused--start) .day-wrapper*/.sc-calcite-date-picker-day-h:hover[start-of-range].hover--inside-range.focused--end .day-wrapper.sc-calcite-date-picker-day,.sc-calcite-date-picker-day-h:hover[end-of-range].hover--inside-range.focused--start .day-wrapper.sc-calcite-date-picker-day{background-image:none}/*!@:host([start-of-range].hover--inside-range.focused--end) .day-wrapper, \n:host([end-of-range].hover--inside-range.focused--start) .day-wrapper*/[start-of-range].hover--inside-range.focused--end.sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day,[end-of-range].hover--inside-range.focused--start.sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{background-color:var(--calcite-ui-foreground-2)}/*!@:host([highlighted]:last-child) :not(.calcite--rtl) .day-wrapper,\n:host([range-hover]:last-child) :not(.calcite--rtl) .day-wrapper,\n:host([highlighted]:first-child) .calcite--rtl .day-wrapper,\n:host([range-hover]:first-child) .calcite--rtl .day-wrapper*/[highlighted].sc-calcite-date-picker-day-h:last-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:last-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[highlighted].sc-calcite-date-picker-day-h:first-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:first-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset -4px 0px 0px 0px var(--calcite-ui-foreground-1)}/*!@:host([highlighted]:first-child) :not(.calcite--rtl) .day-wrapper,\n:host([range-hover]:first-child) :not(.calcite--rtl) .day-wrapper,\n:host([highlighted]:last-child) .calcite--rtl .day-wrapper,\n:host([range-hover]:last-child) .calcite--rtl .day-wrapper*/[highlighted].sc-calcite-date-picker-day-h:first-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:first-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[highlighted].sc-calcite-date-picker-day-h:last-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:last-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset 4px 0px 0px 0px var(--calcite-ui-foreground-1)}/*!@:host([scale=s][highlighted]:last-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=s][range-hover]:last-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=s][highlighted]:first-child) .calcite--rtl .day-wrapper,\n:host([scale=s][range-hover]:first-child) .calcite--rtl .day-wrapper*/[scale=s][highlighted].sc-calcite-date-picker-day-h:last-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=s][range-hover].sc-calcite-date-picker-day-h:last-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=s][highlighted].sc-calcite-date-picker-day-h:first-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day,[scale=s][range-hover].sc-calcite-date-picker-day-h:first-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset -1px 0px 0px 0px var(--calcite-ui-foreground-1)}/*!@:host([scale=s][highlighted]:first-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=s][range-hover]:first-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=s][highlighted]:last-child) .calcite--rtl .day-wrapper,\n:host([scale=s][range-hover]:last-child) .calcite--rtl .day-wrapper*/[scale=s][highlighted].sc-calcite-date-picker-day-h:first-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=s][range-hover].sc-calcite-date-picker-day-h:first-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=s][highlighted].sc-calcite-date-picker-day-h:last-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day,[scale=s][range-hover].sc-calcite-date-picker-day-h:last-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset 1px 0px 0px 0px var(--calcite-ui-foreground-1)}/*!@:host([scale=l][highlighted]:first-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=l][range-hover]:first-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=l][highlighted]:last-child) .calcite--rtl .day-wrapper,\n:host([scale=l][range-hover]:last-child) .calcite--rtl .day-wrapper*/[scale=l][highlighted].sc-calcite-date-picker-day-h:first-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=l][range-hover].sc-calcite-date-picker-day-h:first-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=l][highlighted].sc-calcite-date-picker-day-h:last-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day,[scale=l][range-hover].sc-calcite-date-picker-day-h:last-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset 6px 0px 0px 0px var(--calcite-ui-foreground-1)}/*!@:host([highlighted]:first-child) .day-wrapper,\n:host([range-hover]:first-child) .day-wrapper*/[highlighted].sc-calcite-date-picker-day-h:first-child .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:first-child .day-wrapper.sc-calcite-date-picker-day{border-start-start-radius:45%;border-end-start-radius:45%}/*!@:host([highlighted]:last-child) .day-wrapper,\n:host([range-hover]:last-child) .day-wrapper*/[highlighted].sc-calcite-date-picker-day-h:last-child .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:last-child .day-wrapper.sc-calcite-date-picker-day{border-start-end-radius:45%;border-end-end-radius:45%}/*!@:host([scale=l][highlighted]:last-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=l][range-hover]:last-child) :not(.calcite--rtl) .day-wrapper,\n:host([scale=l][highlighted]:first-child) .calcite--rtl .day-wrapper,\n:host([scale=l][range-hover]:first-child) .calcite--rtl .day-wrapper*/[scale=l][highlighted].sc-calcite-date-picker-day-h:last-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=l][range-hover].sc-calcite-date-picker-day-h:last-child .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day,[scale=l][highlighted].sc-calcite-date-picker-day-h:first-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day,[scale=l][range-hover].sc-calcite-date-picker-day-h:first-child .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset -6px 0px 0px 0px var(--calcite-ui-foreground-1)}@media (forced-colors: active){/*!@:host(:hover:not([disabled])) .day, \n:host([active]:not([range])) .day*/.sc-calcite-date-picker-day-h:hover:not([disabled]) .day.sc-calcite-date-picker-day,[active].sc-calcite-date-picker-day-h:not([range]) .day.sc-calcite-date-picker-day{border-radius:0px}/*!@:host([selected])*/[selected].sc-calcite-date-picker-day-h{outline:2px solid canvasText}/*!@:host([selected]) .day*/[selected].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{border-radius:0px;background-color:highlight}/*!@:host([range][selected]) .day-wrapper,\n:host([highlighted]) .day-wrapper,\n:host([range-hover]:not([selected])) .day-wrapper*/[range][selected].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day,[highlighted].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day,[range-hover].sc-calcite-date-picker-day-h:not([selected]) .day-wrapper.sc-calcite-date-picker-day{background-color:highlight}/*!@:host([range][selected][start-of-range]) .day-wrapper,\n:host([range][selected][end-of-range]) .day-wrapper*/[range][selected][start-of-range].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day,[range][selected][end-of-range].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{background-color:canvas}}";
  17037. class DatePickerDay {
  17038. constructor(hostRef) {
  17039. registerInstance(this, hostRef);
  17040. this.calciteDaySelect = createEvent(this, "calciteDaySelect", 6);
  17041. this.calciteInternalDayHover = createEvent(this, "calciteInternalDayHover", 6);
  17042. /** Date is outside of range and can't be selected */
  17043. this.disabled = false;
  17044. /** Date is in the current month. */
  17045. this.currentMonth = false;
  17046. /** Date is the current selected date of the picker */
  17047. this.selected = false;
  17048. /** Date is currently highlighted as part of the range */
  17049. this.highlighted = false;
  17050. /** Showing date range */
  17051. this.range = false;
  17052. /** Date is the start of date range */
  17053. this.startOfRange = false;
  17054. /** Date is the end of date range */
  17055. this.endOfRange = false;
  17056. /** Date is being hovered and within the set range */
  17057. this.rangeHover = false;
  17058. /** Date is actively in focus for keyboard navigation */
  17059. this.active = false;
  17060. //--------------------------------------------------------------------------
  17061. //
  17062. // Event Listeners
  17063. //
  17064. //--------------------------------------------------------------------------
  17065. this.onClick = () => {
  17066. !this.disabled && this.calciteDaySelect.emit();
  17067. };
  17068. this.keyDownHandler = (event) => {
  17069. if (isActivationKey(event.key)) {
  17070. !this.disabled && this.calciteDaySelect.emit();
  17071. event.preventDefault();
  17072. }
  17073. };
  17074. }
  17075. mouseoverHandler() {
  17076. this.calciteInternalDayHover.emit();
  17077. }
  17078. //--------------------------------------------------------------------------
  17079. //
  17080. // Lifecycle
  17081. //
  17082. //--------------------------------------------------------------------------
  17083. componentWillLoad() {
  17084. this.parentDatePickerEl = closestElementCrossShadowBoundary(this.el, "calcite-date-picker");
  17085. }
  17086. render() {
  17087. if (this.parentDatePickerEl) {
  17088. const { numberingSystem, lang: locale } = this.parentDatePickerEl;
  17089. numberStringFormatter.numberFormatOptions = {
  17090. useGrouping: false,
  17091. ...(numberingSystem && { numberingSystem }),
  17092. ...(locale && { locale })
  17093. };
  17094. }
  17095. const formattedDay = numberStringFormatter.localize(String(this.day));
  17096. const dir = getElementDir(this.el);
  17097. return (hAsync(Host, { onClick: this.onClick, onKeyDown: this.keyDownHandler, role: "gridcell" }, hAsync("div", { class: { "day-v-wrapper": true, [CSS_UTILITY.rtl]: dir === "rtl" } }, hAsync("div", { class: "day-wrapper" }, hAsync("span", { class: "day" }, hAsync("span", { class: "text" }, formattedDay))))));
  17098. }
  17099. componentDidRender() {
  17100. updateHostInteraction(this, this.isTabbable);
  17101. }
  17102. isTabbable() {
  17103. return this.active;
  17104. }
  17105. get el() { return getElement(this); }
  17106. static get style() { return datePickerDayCss; }
  17107. static get cmpMeta() { return {
  17108. "$flags$": 9,
  17109. "$tagName$": "calcite-date-picker-day",
  17110. "$members$": {
  17111. "day": [2],
  17112. "disabled": [516],
  17113. "currentMonth": [516, "current-month"],
  17114. "selected": [516],
  17115. "highlighted": [516],
  17116. "range": [516],
  17117. "startOfRange": [516, "start-of-range"],
  17118. "endOfRange": [516, "end-of-range"],
  17119. "rangeHover": [516, "range-hover"],
  17120. "active": [516],
  17121. "scale": [513],
  17122. "value": [16]
  17123. },
  17124. "$listeners$": [[1, "pointerover", "mouseoverHandler"]],
  17125. "$lazyBundleId$": "-",
  17126. "$attrsToReflect$": [["disabled", "disabled"], ["currentMonth", "current-month"], ["selected", "selected"], ["highlighted", "highlighted"], ["range", "range"], ["startOfRange", "start-of-range"], ["endOfRange", "end-of-range"], ["rangeHover", "range-hover"], ["active", "active"], ["scale", "scale"]]
  17127. }; }
  17128. }
  17129. const datePickerMonthCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-date-picker-month:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-date-picker-month{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-date-picker-month{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-date-picker-month{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-date-picker-month{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-date-picker-month{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-date-picker-month:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-date-picker-month:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-date-picker-month-h{display:none}/*!@.calender*/.calender.sc-calcite-date-picker-month{margin-block-end:0.25rem}/*!@.week-headers*/.week-headers.sc-calcite-date-picker-month{display:flex;border-width:0px;border-block-start-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-block:0px;padding-inline:0.25rem}/*!@.week-header*/.week-header.sc-calcite-date-picker-month{text-align:center;font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-3);inline-size:14.2857142857%}/*!@:host([scale=s]) .week-header*/[scale=s].sc-calcite-date-picker-month-h .week-header.sc-calcite-date-picker-month{padding-inline:0px;padding-block:0.5rem 0.75rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m]) .week-header*/[scale=m].sc-calcite-date-picker-month-h .week-header.sc-calcite-date-picker-month{padding-inline:0px;padding-block:0.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=l]) .week-header*/[scale=l].sc-calcite-date-picker-month-h .week-header.sc-calcite-date-picker-month{padding-inline:0px;padding-block:1rem 1.25rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@.week-days*/.week-days.sc-calcite-date-picker-month{display:flex;flex-direction:row;padding-block:0px;padding-inline:6px}/*!@.week-days:focus*/.week-days.sc-calcite-date-picker-month:focus{outline:2px solid transparent;outline-offset:2px}";
  17130. class DatePickerMonth {
  17131. constructor(hostRef) {
  17132. registerInstance(this, hostRef);
  17133. this.calciteDatePickerSelect = createEvent(this, "calciteDatePickerSelect", 6);
  17134. this.calciteInternalDatePickerHover = createEvent(this, "calciteInternalDatePickerHover", 6);
  17135. this.calciteDatePickerActiveDateChange = createEvent(this, "calciteDatePickerActiveDateChange", 6);
  17136. this.calciteInternalDatePickerMouseOut = createEvent(this, "calciteInternalDatePickerMouseOut", 6);
  17137. /** Date currently active.*/
  17138. this.activeDate = new Date();
  17139. //--------------------------------------------------------------------------
  17140. //
  17141. // Event Listeners
  17142. //
  17143. //--------------------------------------------------------------------------
  17144. this.keyDownHandler = (event) => {
  17145. if (event.defaultPrevented) {
  17146. return;
  17147. }
  17148. const isRTL = this.el.dir === "rtl";
  17149. switch (event.key) {
  17150. case "ArrowUp":
  17151. event.preventDefault();
  17152. this.addDays(-7);
  17153. break;
  17154. case "ArrowRight":
  17155. event.preventDefault();
  17156. this.addDays(isRTL ? -1 : 1);
  17157. break;
  17158. case "ArrowDown":
  17159. event.preventDefault();
  17160. this.addDays(7);
  17161. break;
  17162. case "ArrowLeft":
  17163. event.preventDefault();
  17164. this.addDays(isRTL ? 1 : -1);
  17165. break;
  17166. case "PageUp":
  17167. event.preventDefault();
  17168. this.addMonths(-1);
  17169. break;
  17170. case "PageDown":
  17171. event.preventDefault();
  17172. this.addMonths(1);
  17173. break;
  17174. case "Home":
  17175. event.preventDefault();
  17176. this.activeDate.setDate(1);
  17177. this.addDays();
  17178. break;
  17179. case "End":
  17180. event.preventDefault();
  17181. this.activeDate.setDate(new Date(this.activeDate.getFullYear(), this.activeDate.getMonth() + 1, 0).getDate());
  17182. this.addDays();
  17183. break;
  17184. case "Enter":
  17185. case " ":
  17186. event.preventDefault();
  17187. break;
  17188. case "Tab":
  17189. this.activeFocus = false;
  17190. }
  17191. };
  17192. /**
  17193. * Once user is not interacting via keyboard,
  17194. * disable auto focusing of active date
  17195. */
  17196. this.disableActiveFocus = () => {
  17197. this.activeFocus = false;
  17198. };
  17199. this.dayHover = (event) => {
  17200. const target = event.target;
  17201. if (target.disabled) {
  17202. this.calciteInternalDatePickerMouseOut.emit();
  17203. }
  17204. else {
  17205. this.calciteInternalDatePickerHover.emit(target.value);
  17206. }
  17207. event.stopPropagation();
  17208. };
  17209. this.daySelect = (event) => {
  17210. const target = event.target;
  17211. this.calciteDatePickerSelect.emit(target.value);
  17212. };
  17213. }
  17214. mouseoutHandler() {
  17215. this.calciteInternalDatePickerMouseOut.emit();
  17216. }
  17217. //--------------------------------------------------------------------------
  17218. //
  17219. // Lifecycle
  17220. //
  17221. //--------------------------------------------------------------------------
  17222. render() {
  17223. const month = this.activeDate.getMonth();
  17224. const year = this.activeDate.getFullYear();
  17225. const startOfWeek = this.localeData.weekStart % 7;
  17226. const { abbreviated, short, narrow } = this.localeData.days;
  17227. const weekDays = this.scale === "s" ? narrow || short || abbreviated : short || abbreviated || narrow;
  17228. const adjustedWeekDays = [...weekDays.slice(startOfWeek, 7), ...weekDays.slice(0, startOfWeek)];
  17229. const curMonDays = this.getCurrentMonthDays(month, year);
  17230. const prevMonDays = this.getPrevMonthdays(month, year, startOfWeek);
  17231. const nextMonDays = this.getNextMonthDays(month, year, startOfWeek);
  17232. const days = [
  17233. ...prevMonDays.map((day) => {
  17234. const date = new Date(year, month - 1, day);
  17235. return this.renderDateDay(false, day, date);
  17236. }),
  17237. ...curMonDays.map((day) => {
  17238. const date = new Date(year, month, day);
  17239. const active = sameDate(date, this.activeDate);
  17240. return this.renderDateDay(active, day, date, true, true);
  17241. }),
  17242. ...nextMonDays.map((day) => {
  17243. const date = new Date(year, month + 1, day);
  17244. return this.renderDateDay(false, day, date);
  17245. })
  17246. ];
  17247. const weeks = [];
  17248. for (let i = 0; i < days.length; i += 7) {
  17249. weeks.push(days.slice(i, i + 7));
  17250. }
  17251. return (hAsync(Host, { onFocusOut: this.disableActiveFocus, onKeyDown: this.keyDownHandler }, hAsync("div", { class: "calender", role: "grid" }, hAsync("div", { class: "week-headers", role: "row" }, adjustedWeekDays.map((weekday) => (hAsync("span", { class: "week-header", role: "columnheader" }, weekday)))), weeks.map((days) => (hAsync("div", { class: "week-days", role: "row" }, days))))));
  17252. }
  17253. //--------------------------------------------------------------------------
  17254. //
  17255. // Private Methods
  17256. //
  17257. //--------------------------------------------------------------------------
  17258. /**
  17259. * Add n months to the current month
  17260. *
  17261. * @param step
  17262. */
  17263. addMonths(step) {
  17264. const nextDate = new Date(this.activeDate);
  17265. nextDate.setMonth(this.activeDate.getMonth() + step);
  17266. this.calciteDatePickerActiveDateChange.emit(dateFromRange(nextDate, this.min, this.max));
  17267. this.activeFocus = true;
  17268. }
  17269. /**
  17270. * Add n days to the current date
  17271. *
  17272. * @param step
  17273. */
  17274. addDays(step = 0) {
  17275. const nextDate = new Date(this.activeDate);
  17276. nextDate.setDate(this.activeDate.getDate() + step);
  17277. this.calciteDatePickerActiveDateChange.emit(dateFromRange(nextDate, this.min, this.max));
  17278. this.activeFocus = true;
  17279. }
  17280. /**
  17281. * Get dates for last days of the previous month
  17282. *
  17283. * @param month
  17284. * @param year
  17285. * @param startOfWeek
  17286. */
  17287. getPrevMonthdays(month, year, startOfWeek) {
  17288. const lastDate = new Date(year, month, 0);
  17289. const date = lastDate.getDate();
  17290. const day = lastDate.getDay();
  17291. const days = [];
  17292. if (day - 6 === startOfWeek) {
  17293. return days;
  17294. }
  17295. for (let i = lastDate.getDay() - startOfWeek; i >= 0; i--) {
  17296. days.push(date - i);
  17297. }
  17298. return days;
  17299. }
  17300. /**
  17301. * Get dates for the current month
  17302. *
  17303. * @param month
  17304. * @param year
  17305. */
  17306. getCurrentMonthDays(month, year) {
  17307. const num = new Date(year, month + 1, 0).getDate();
  17308. const days = [];
  17309. for (let i = 0; i < num; i++) {
  17310. days.push(i + 1);
  17311. }
  17312. return days;
  17313. }
  17314. /**
  17315. * Get dates for first days of the next month
  17316. *
  17317. * @param month
  17318. * @param year
  17319. * @param startOfWeek
  17320. */
  17321. getNextMonthDays(month, year, startOfWeek) {
  17322. const endDay = new Date(year, month + 1, 0).getDay();
  17323. const days = [];
  17324. if (endDay === (startOfWeek + 6) % 7) {
  17325. return days;
  17326. }
  17327. for (let i = 0; i < (6 - (endDay - startOfWeek)) % 7; i++) {
  17328. days.push(i + 1);
  17329. }
  17330. return days;
  17331. }
  17332. /**
  17333. * Determine if the date is in between the start and end dates
  17334. *
  17335. * @param date
  17336. */
  17337. betweenSelectedRange(date) {
  17338. return !!(this.startDate &&
  17339. this.endDate &&
  17340. date > this.startDate &&
  17341. date < this.endDate &&
  17342. !this.isRangeHover(date));
  17343. }
  17344. /**
  17345. * Determine if the date should be in selected state
  17346. *
  17347. * @param date
  17348. */
  17349. isSelected(date) {
  17350. return !!(sameDate(date, this.selectedDate) ||
  17351. (this.startDate && sameDate(date, this.startDate)) ||
  17352. (this.endDate && sameDate(date, this.endDate)));
  17353. }
  17354. /**
  17355. * Determine if the date is the start of the date range
  17356. *
  17357. * @param date
  17358. */
  17359. isStartOfRange(date) {
  17360. return !!(this.startDate &&
  17361. !sameDate(this.startDate, this.endDate) &&
  17362. sameDate(this.startDate, date) &&
  17363. !this.isEndOfRange(date));
  17364. }
  17365. isEndOfRange(date) {
  17366. return !!((this.endDate && !sameDate(this.startDate, this.endDate) && sameDate(this.endDate, date)) ||
  17367. (!this.endDate &&
  17368. this.hoverRange &&
  17369. sameDate(this.startDate, this.hoverRange.end) &&
  17370. sameDate(date, this.hoverRange.end)));
  17371. }
  17372. /**
  17373. * Render calcite-date-picker-day
  17374. *
  17375. * @param active
  17376. * @param day
  17377. * @param date
  17378. * @param currentMonth
  17379. * @param ref
  17380. */
  17381. renderDateDay(active, day, date, currentMonth, ref) {
  17382. var _a;
  17383. const isFocusedOnStart = this.isFocusedOnStart();
  17384. const isHoverInRange = this.isHoverInRange() ||
  17385. (!this.endDate && this.hoverRange && sameDate((_a = this.hoverRange) === null || _a === void 0 ? void 0 : _a.end, this.startDate));
  17386. return (hAsync("calcite-date-picker-day", { active: active, class: {
  17387. "hover--inside-range": this.startDate && isHoverInRange,
  17388. "hover--outside-range": this.startDate && !isHoverInRange,
  17389. "focused--start": isFocusedOnStart,
  17390. "focused--end": !isFocusedOnStart
  17391. }, currentMonth: currentMonth, day: day, disabled: !inRange(date, this.min, this.max), endOfRange: this.isEndOfRange(date), highlighted: this.betweenSelectedRange(date), key: date.toDateString(), onCalciteDaySelect: this.daySelect, onCalciteInternalDayHover: this.dayHover, range: !!this.startDate && !!this.endDate && !sameDate(this.startDate, this.endDate), rangeHover: this.isRangeHover(date), ref: (el) => {
  17392. // when moving via keyboard, focus must be updated on active date
  17393. if (ref && active && this.activeFocus) {
  17394. el === null || el === void 0 ? void 0 : el.focus();
  17395. }
  17396. }, scale: this.scale, selected: this.isSelected(date), startOfRange: this.isStartOfRange(date), value: date }));
  17397. }
  17398. isFocusedOnStart() {
  17399. var _a;
  17400. return ((_a = this.hoverRange) === null || _a === void 0 ? void 0 : _a.focused) === "start";
  17401. }
  17402. isHoverInRange() {
  17403. if (!this.hoverRange) {
  17404. return false;
  17405. }
  17406. const { start, end } = this.hoverRange;
  17407. return !!((!this.isFocusedOnStart() && this.startDate && (!this.endDate || end < this.endDate)) ||
  17408. (this.isFocusedOnStart() && this.startDate && start > this.startDate));
  17409. }
  17410. isRangeHover(date) {
  17411. if (!this.hoverRange) {
  17412. return false;
  17413. }
  17414. const { start, end } = this.hoverRange;
  17415. const isStart = this.isFocusedOnStart();
  17416. const insideRange = this.isHoverInRange();
  17417. const cond1 = insideRange &&
  17418. ((!isStart && date > this.startDate && (date < end || sameDate(date, end))) ||
  17419. (isStart && date < this.endDate && (date > start || sameDate(date, start))));
  17420. const cond2 = !insideRange &&
  17421. ((!isStart && date >= this.endDate && (date < end || sameDate(date, end))) ||
  17422. (isStart &&
  17423. (date < this.startDate || (this.endDate && sameDate(date, this.startDate))) &&
  17424. (date > start || sameDate(date, start))));
  17425. return cond1 || cond2;
  17426. }
  17427. get el() { return getElement(this); }
  17428. static get style() { return datePickerMonthCss; }
  17429. static get cmpMeta() { return {
  17430. "$flags$": 9,
  17431. "$tagName$": "calcite-date-picker-month",
  17432. "$members$": {
  17433. "selectedDate": [16],
  17434. "activeDate": [16],
  17435. "startDate": [16],
  17436. "endDate": [16],
  17437. "min": [16],
  17438. "max": [16],
  17439. "scale": [513],
  17440. "localeData": [16],
  17441. "hoverRange": [16]
  17442. },
  17443. "$listeners$": [[1, "pointerout", "mouseoutHandler"]],
  17444. "$lazyBundleId$": "-",
  17445. "$attrsToReflect$": [["scale", "scale"]]
  17446. }; }
  17447. }
  17448. const BUDDHIST_CALENDAR_YEAR_OFFSET = 543;
  17449. const datePickerMonthHeaderCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-date-picker-month-header:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-date-picker-month-header{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-date-picker-month-header{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-date-picker-month-header{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-date-picker-month-header{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-date-picker-month-header{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-date-picker-month-header:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-date-picker-month-header:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-date-picker-month-header-h{display:none}/*!@:host*/.sc-calcite-date-picker-month-header-h{display:block}/*!@.header*/.header.sc-calcite-date-picker-month-header{display:flex;justify-content:space-between;padding-block:0px;padding-inline:0.25rem}/*!@:host([scale=s]) .text*/[scale=s].sc-calcite-date-picker-month-header-h .text.sc-calcite-date-picker-month-header{margin-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=s]) .chevron*/[scale=s].sc-calcite-date-picker-month-header-h .chevron.sc-calcite-date-picker-month-header{block-size:2.25rem}/*!@:host([scale=m]) .text*/[scale=m].sc-calcite-date-picker-month-header-h .text.sc-calcite-date-picker-month-header{margin-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=m]) .chevron*/[scale=m].sc-calcite-date-picker-month-header-h .chevron.sc-calcite-date-picker-month-header{block-size:3rem}/*!@:host([scale=l]) .text*/[scale=l].sc-calcite-date-picker-month-header-h .text.sc-calcite-date-picker-month-header{margin-block:1rem;font-size:var(--calcite-font-size-1);line-height:1.5rem}/*!@:host([scale=l]) .chevron*/[scale=l].sc-calcite-date-picker-month-header-h .chevron.sc-calcite-date-picker-month-header{block-size:3.5rem}/*!@.chevron*/.chevron.sc-calcite-date-picker-month-header{margin-inline:-0.25rem;box-sizing:content-box;display:flex;flex-grow:0;cursor:pointer;align-items:center;justify-content:center;border-style:none;background-color:var(--calcite-ui-foreground-1);padding-inline:0.25rem;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;inline-size:14.2857142857%}/*!@.chevron:focus*/.chevron.sc-calcite-date-picker-month-header:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.chevron:hover, .chevron:focus*/.chevron.sc-calcite-date-picker-month-header:hover,.chevron.sc-calcite-date-picker-month-header:focus{background-color:var(--calcite-ui-foreground-2);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}/*!@.chevron:active*/.chevron.sc-calcite-date-picker-month-header:active{background-color:var(--calcite-ui-foreground-3)}/*!@.chevron[aria-disabled=true]*/.chevron[aria-disabled=true].sc-calcite-date-picker-month-header{pointer-events:none;opacity:0}/*!@.text*/.text.sc-calcite-date-picker-month-header{margin-block:auto;display:flex;inline-size:100%;flex:1 1 auto;align-items:center;justify-content:center;text-align:center;line-height:1}/*!@.text--reverse*/.text--reverse.sc-calcite-date-picker-month-header{flex-direction:row-reverse}/*!@.month, \n.year, \n.suffix*/.month.sc-calcite-date-picker-month-header,.year.sc-calcite-date-picker-month-header,.suffix.sc-calcite-date-picker-month-header{margin-inline:0.25rem;margin-block:auto;display:inline-block;background-color:var(--calcite-ui-foreground-1);font-weight:var(--calcite-font-weight-medium);line-height:1.25;color:var(--calcite-ui-text-1);font-size:inherit}/*!@.year*/.year.sc-calcite-date-picker-month-header{position:relative;inline-size:2.5rem;border-style:none;background-color:transparent;text-align:center;font-family:inherit;outline-color:transparent}/*!@.year:hover*/.year.sc-calcite-date-picker-month-header:hover{transition-duration:100ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-property:outline-color;outline:2px solid var(--calcite-ui-border-2);outline-offset:2px}/*!@.year:focus*/.year.sc-calcite-date-picker-month-header:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.year--suffix*/.year--suffix.sc-calcite-date-picker-month-header{text-align:start}/*!@.year-wrap*/.year-wrap.sc-calcite-date-picker-month-header{position:relative}/*!@.suffix*/.suffix.sc-calcite-date-picker-month-header{inset-block-start:0px;white-space:nowrap;text-align:start;inset-inline-start:0}";
  17450. class DatePickerMonthHeader {
  17451. constructor(hostRef) {
  17452. registerInstance(this, hostRef);
  17453. this.calciteDatePickerSelect = createEvent(this, "calciteDatePickerSelect", 6);
  17454. //--------------------------------------------------------------------------
  17455. //
  17456. // Private State/Props
  17457. //
  17458. //--------------------------------------------------------------------------
  17459. this.globalAttributes = {};
  17460. //--------------------------------------------------------------------------
  17461. //
  17462. // Private Methods
  17463. //
  17464. //--------------------------------------------------------------------------
  17465. /**
  17466. * Increment year on UP/DOWN keys
  17467. *
  17468. * @param event
  17469. */
  17470. this.onYearKey = (event) => {
  17471. const localizedYear = this.parseCalendarYear(event.target.value);
  17472. switch (event.key) {
  17473. case "ArrowDown":
  17474. event.preventDefault();
  17475. this.setYear({ localizedYear, offset: -1 });
  17476. break;
  17477. case "ArrowUp":
  17478. event.preventDefault();
  17479. this.setYear({ localizedYear, offset: 1 });
  17480. break;
  17481. }
  17482. };
  17483. this.onYearChange = (event) => {
  17484. this.setYear({
  17485. localizedYear: this.parseCalendarYear(event.target.value)
  17486. });
  17487. };
  17488. this.onYearInput = (event) => {
  17489. this.setYear({
  17490. localizedYear: this.parseCalendarYear(event.target.value),
  17491. commit: false
  17492. });
  17493. };
  17494. this.prevMonthClick = (event) => {
  17495. this.handleArrowClick(event, this.prevMonthDate);
  17496. };
  17497. this.prevMonthKeydown = (event) => {
  17498. if (isActivationKey(event.key)) {
  17499. this.prevMonthClick(event);
  17500. }
  17501. };
  17502. this.nextMonthClick = (event) => {
  17503. this.handleArrowClick(event, this.nextMonthDate);
  17504. };
  17505. this.nextMonthKeydown = (event) => {
  17506. if (isActivationKey(event.key)) {
  17507. this.nextMonthClick(event);
  17508. }
  17509. };
  17510. /*
  17511. * Update active month on clicks of left/right arrows
  17512. */
  17513. this.handleArrowClick = (event, date) => {
  17514. event.preventDefault();
  17515. this.calciteDatePickerSelect.emit(date);
  17516. };
  17517. }
  17518. //--------------------------------------------------------------------------
  17519. //
  17520. // Lifecycle
  17521. //
  17522. //--------------------------------------------------------------------------
  17523. componentWillLoad() {
  17524. this.parentDatePickerEl = closestElementCrossShadowBoundary(this.el, "calcite-date-picker");
  17525. }
  17526. connectedCallback() {
  17527. this.setNextPrevMonthDates();
  17528. }
  17529. render() {
  17530. return hAsync("div", { class: "header" }, this.renderContent());
  17531. }
  17532. renderContent() {
  17533. var _a;
  17534. if (!this.activeDate || !this.localeData) {
  17535. return null;
  17536. }
  17537. if (this.parentDatePickerEl) {
  17538. const { numberingSystem, lang: locale } = this.parentDatePickerEl;
  17539. numberStringFormatter.numberFormatOptions = {
  17540. useGrouping: false,
  17541. ...(numberingSystem && { numberingSystem }),
  17542. ...(locale && { locale })
  17543. };
  17544. }
  17545. const activeMonth = this.activeDate.getMonth();
  17546. const { months, unitOrder } = this.localeData;
  17547. const localizedMonth = (months.wide || months.narrow || months.abbreviated)[activeMonth];
  17548. const localizedYear = this.formatCalendarYear(this.activeDate.getFullYear());
  17549. const iconScale = this.scale === "l" ? "m" : "s";
  17550. const order = getOrder(unitOrder);
  17551. const reverse = order.indexOf("y") < order.indexOf("m");
  17552. const suffix = (_a = this.localeData.year) === null || _a === void 0 ? void 0 : _a.suffix;
  17553. return (hAsync(Fragment, null, hAsync("a", { "aria-disabled": `${this.prevMonthDate.getMonth() === activeMonth}`, "aria-label": this.intlPrevMonth, class: "chevron", href: "#", onClick: this.prevMonthClick, onKeyDown: this.prevMonthKeydown, role: "button", tabindex: this.prevMonthDate.getMonth() === activeMonth ? -1 : 0 }, hAsync("calcite-icon", { "flip-rtl": true, icon: "chevron-left", scale: iconScale })), hAsync("div", { class: { text: true, "text--reverse": reverse } }, hAsync(Heading, { class: "month", level: this.headingLevel }, localizedMonth), hAsync("span", { class: "year-wrap" }, hAsync("input", { "aria-label": this.intlYear, class: {
  17554. year: true,
  17555. "year--suffix": !!suffix
  17556. }, inputmode: "numeric", maxlength: "4", minlength: "1", onChange: this.onYearChange, onInput: this.onYearInput, onKeyDown: this.onYearKey, pattern: "\\d*", ref: (el) => (this.yearInput = el), type: "text", value: localizedYear }), suffix && hAsync("span", { class: "suffix" }, suffix))), hAsync("a", { "aria-disabled": `${this.nextMonthDate.getMonth() === activeMonth}`, "aria-label": this.intlNextMonth, class: "chevron", href: "#", onClick: this.nextMonthClick, onKeyDown: this.nextMonthKeydown, role: "button", tabindex: this.nextMonthDate.getMonth() === activeMonth ? -1 : 0 }, hAsync("calcite-icon", { "flip-rtl": true, icon: "chevron-right", scale: iconScale }))));
  17557. }
  17558. setNextPrevMonthDates() {
  17559. if (!this.activeDate) {
  17560. return;
  17561. }
  17562. this.nextMonthDate = dateFromRange(nextMonth(this.activeDate), this.min, this.max);
  17563. this.prevMonthDate = dateFromRange(prevMonth(this.activeDate), this.min, this.max);
  17564. }
  17565. formatCalendarYear(year) {
  17566. const { localeData } = this;
  17567. const buddhistCalendar = localeData["default-calendar"] === "buddhist";
  17568. const yearOffset = buddhistCalendar ? BUDDHIST_CALENDAR_YEAR_OFFSET : 0;
  17569. return numberStringFormatter.localize(`${year + yearOffset}`);
  17570. }
  17571. parseCalendarYear(year) {
  17572. const { localeData } = this;
  17573. const buddhistCalendar = localeData["default-calendar"] === "buddhist";
  17574. const yearOffset = buddhistCalendar ? BUDDHIST_CALENDAR_YEAR_OFFSET : 0;
  17575. const parsedYear = Number(numberStringFormatter.delocalize(year)) - yearOffset;
  17576. return numberStringFormatter.localize(`${parsedYear}`);
  17577. }
  17578. getInRangeDate({ localizedYear, offset = 0 }) {
  17579. const { min, max, activeDate } = this;
  17580. const parsedYear = Number(numberStringFormatter.delocalize(localizedYear));
  17581. const length = parsedYear.toString().length;
  17582. const year = isNaN(parsedYear) ? false : parsedYear + offset;
  17583. const inRange = year && (!min || min.getFullYear() <= year) && (!max || max.getFullYear() >= year);
  17584. // if you've supplied a year and it's in range
  17585. if (year && inRange && length === localizedYear.length) {
  17586. const nextDate = new Date(activeDate);
  17587. nextDate.setFullYear(year);
  17588. return dateFromRange(nextDate, min, max);
  17589. }
  17590. }
  17591. /**
  17592. * Parse localized year string from input,
  17593. * set to active if in range
  17594. *
  17595. * @param root0
  17596. * @param root0.localizedYear
  17597. * @param root0.commit
  17598. * @param root0.offset
  17599. */
  17600. setYear({ localizedYear, commit = true, offset = 0 }) {
  17601. const { yearInput, activeDate } = this;
  17602. const inRangeDate = this.getInRangeDate({ localizedYear, offset });
  17603. // if you've supplied a year and it's in range, update active date
  17604. if (inRangeDate) {
  17605. this.calciteDatePickerSelect.emit(inRangeDate);
  17606. }
  17607. if (commit) {
  17608. yearInput.value = this.formatCalendarYear((inRangeDate || activeDate).getFullYear());
  17609. }
  17610. }
  17611. get el() { return getElement(this); }
  17612. static get watchers() { return {
  17613. "min": ["setNextPrevMonthDates"],
  17614. "max": ["setNextPrevMonthDates"],
  17615. "activeDate": ["setNextPrevMonthDates"]
  17616. }; }
  17617. static get style() { return datePickerMonthHeaderCss; }
  17618. static get cmpMeta() { return {
  17619. "$flags$": 9,
  17620. "$tagName$": "calcite-date-picker-month-header",
  17621. "$members$": {
  17622. "selectedDate": [16],
  17623. "activeDate": [16],
  17624. "headingLevel": [2, "heading-level"],
  17625. "min": [16],
  17626. "max": [16],
  17627. "intlPrevMonth": [1, "intl-prev-month"],
  17628. "intlNextMonth": [1, "intl-next-month"],
  17629. "intlYear": [1, "intl-year"],
  17630. "scale": [513],
  17631. "localeData": [16],
  17632. "globalAttributes": [32],
  17633. "nextMonthDate": [32],
  17634. "prevMonthDate": [32]
  17635. },
  17636. "$listeners$": undefined,
  17637. "$lazyBundleId$": "-",
  17638. "$attrsToReflect$": [["scale", "scale"]]
  17639. }; }
  17640. }
  17641. const SLOTS$k = {
  17642. dropdownTrigger: "dropdown-trigger"
  17643. };
  17644. const dropdownCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-dropdown:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-dropdown{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-dropdown{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-dropdown{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-dropdown{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-dropdown{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-dropdown:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-dropdown:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-dropdown-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-dropdown-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-dropdown-h{display:inline-flex;flex:0 1 auto}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-dropdown-h[disabled] .sc-calcite-dropdown-s>[calcite-hydrated][disabled],[disabled].sc-calcite-dropdown-h [calcite-hydrated][disabled].sc-calcite-dropdown{opacity:1}/*!@:host .calcite-dropdown-wrapper*/.sc-calcite-dropdown-h .calcite-dropdown-wrapper.sc-calcite-dropdown{display:block;position:absolute;z-index:900;visibility:hidden;pointer-events:none;inline-size:0;block-size:0;overflow:hidden}/*!@.calcite-dropdown-wrapper .calcite-floating-ui-anim*/.calcite-dropdown-wrapper.sc-calcite-dropdown .calcite-floating-ui-anim.sc-calcite-dropdown{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}/*!@.calcite-dropdown-wrapper[data-placement^=bottom] .calcite-floating-ui-anim*/.calcite-dropdown-wrapper[data-placement^=bottom].sc-calcite-dropdown .calcite-floating-ui-anim.sc-calcite-dropdown{transform:translateY(-5px)}/*!@.calcite-dropdown-wrapper[data-placement^=top] .calcite-floating-ui-anim*/.calcite-dropdown-wrapper[data-placement^=top].sc-calcite-dropdown .calcite-floating-ui-anim.sc-calcite-dropdown{transform:translateY(5px)}/*!@.calcite-dropdown-wrapper[data-placement^=left] .calcite-floating-ui-anim*/.calcite-dropdown-wrapper[data-placement^=left].sc-calcite-dropdown .calcite-floating-ui-anim.sc-calcite-dropdown{transform:translateX(5px)}/*!@.calcite-dropdown-wrapper[data-placement^=right] .calcite-floating-ui-anim*/.calcite-dropdown-wrapper[data-placement^=right].sc-calcite-dropdown .calcite-floating-ui-anim.sc-calcite-dropdown{transform:translateX(-5px)}/*!@.calcite-dropdown-wrapper[data-placement] .calcite-floating-ui-anim--active*/.calcite-dropdown-wrapper[data-placement].sc-calcite-dropdown .calcite-floating-ui-anim--active.sc-calcite-dropdown{opacity:1;visibility:visible;transform:translate(0)}/*!@:host([open]) .calcite-dropdown-wrapper*/[open].sc-calcite-dropdown-h .calcite-dropdown-wrapper.sc-calcite-dropdown{pointer-events:initial;visibility:visible;inline-size:unset;block-size:unset;overflow:unset}/*!@:host .calcite-dropdown-content*/.sc-calcite-dropdown-h .calcite-dropdown-content.sc-calcite-dropdown{max-block-size:45vh;inline-size:auto;overflow-y:auto;overflow-x:hidden;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}/*!@.calcite-dropdown-trigger-container*/.calcite-dropdown-trigger-container.sc-calcite-dropdown{position:relative;display:flex;flex:1 1 auto}@media (forced-colors: active){/*!@:host([open]) .calcite-dropdown-wrapper*/[open].sc-calcite-dropdown-h .calcite-dropdown-wrapper.sc-calcite-dropdown{border:1px solid canvasText}}/*!@:host([width=s])*/[width=s].sc-calcite-dropdown-h{--calcite-dropdown-width:12rem}/*!@:host([width=m])*/[width=m].sc-calcite-dropdown-h{--calcite-dropdown-width:14rem}/*!@:host([width=l])*/[width=l].sc-calcite-dropdown-h{--calcite-dropdown-width:16rem}";
  17645. /**
  17646. * @slot - A slot for adding `calcite-dropdown-group` components. Every `calcite-dropdown-item` must have a parent `calcite-dropdown-group`, even if the `groupTitle` property is not set.
  17647. * @slot dropdown-trigger - A slot for the element that triggers the `calcite-dropdown`.
  17648. */
  17649. class Dropdown {
  17650. constructor(hostRef) {
  17651. registerInstance(this, hostRef);
  17652. this.calciteDropdownSelect = createEvent(this, "calciteDropdownSelect", 6);
  17653. this.calciteDropdownBeforeClose = createEvent(this, "calciteDropdownBeforeClose", 6);
  17654. this.calciteDropdownClose = createEvent(this, "calciteDropdownClose", 6);
  17655. this.calciteDropdownBeforeOpen = createEvent(this, "calciteDropdownBeforeOpen", 6);
  17656. this.calciteDropdownOpen = createEvent(this, "calciteDropdownOpen", 6);
  17657. //--------------------------------------------------------------------------
  17658. //
  17659. // Public Properties
  17660. //
  17661. //--------------------------------------------------------------------------
  17662. /**
  17663. * Opens or closes the dropdown
  17664. *
  17665. * @deprecated use open instead.
  17666. */
  17667. this.active = false;
  17668. /** When true, opens the dropdown */
  17669. this.open = false;
  17670. /**
  17671. allow the dropdown to remain open after a selection is made
  17672. if the selection-mode of the selected item's containing group is "none", the dropdown will always close
  17673. */
  17674. this.disableCloseOnSelect = false;
  17675. /** is the dropdown disabled */
  17676. this.disabled = false;
  17677. /**
  17678. specify the maximum number of calcite-dropdown-items to display before showing the scroller, must be greater than 0 -
  17679. this value does not include groupTitles passed to calcite-dropdown-group
  17680. */
  17681. this.maxItems = 0;
  17682. /**
  17683. * Determines the type of positioning to use for the overlaid content.
  17684. *
  17685. * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
  17686. *
  17687. * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
  17688. *
  17689. */
  17690. this.overlayPositioning = "absolute";
  17691. /**
  17692. * Determines where the dropdown will be positioned relative to the button.
  17693. *
  17694. * @default "bottom-start"
  17695. */
  17696. this.placement = defaultMenuPlacement;
  17697. /** specify the scale of dropdown, defaults to m */
  17698. this.scale = "m";
  17699. /**
  17700. * **read-only** The currently selected items
  17701. *
  17702. * @readonly
  17703. */
  17704. this.selectedItems = [];
  17705. /** specify whether the dropdown is opened by hover or click of a trigger element */
  17706. this.type = "click";
  17707. this.items = [];
  17708. this.groups = [];
  17709. this.mutationObserver = createObserver();
  17710. this.resizeObserver = createObserver();
  17711. this.openTransitionProp = "visibility";
  17712. this.guid = `calcite-dropdown-${guid()}`;
  17713. this.defaultAssignedElements = [];
  17714. //--------------------------------------------------------------------------
  17715. //
  17716. // Private Methods
  17717. //
  17718. //--------------------------------------------------------------------------
  17719. this.slotChangeHandler = (event) => {
  17720. this.defaultAssignedElements = event.target.assignedElements({
  17721. flatten: true
  17722. });
  17723. this.updateItems();
  17724. };
  17725. this.setFilteredPlacements = () => {
  17726. const { el, flipPlacements } = this;
  17727. this.filteredFlipPlacements = flipPlacements
  17728. ? filterComputedPlacements(flipPlacements, el)
  17729. : null;
  17730. };
  17731. this.updateTriggers = (event) => {
  17732. this.triggers = event.target.assignedElements({
  17733. flatten: true
  17734. });
  17735. this.reposition(true);
  17736. };
  17737. this.updateItems = () => {
  17738. this.items = this.groups
  17739. .map((group) => Array.from(group === null || group === void 0 ? void 0 : group.querySelectorAll("calcite-dropdown-item")))
  17740. .reduce((previousValue, currentValue) => [...previousValue, ...currentValue], []);
  17741. this.updateSelectedItems();
  17742. this.reposition(true);
  17743. };
  17744. this.updateGroups = (event) => {
  17745. const groups = event.target
  17746. .assignedElements({ flatten: true })
  17747. .filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-dropdown-group"));
  17748. this.groups = groups;
  17749. this.updateItems();
  17750. };
  17751. this.resizeObserverCallback = (entries) => {
  17752. entries.forEach((entry) => {
  17753. const { target } = entry;
  17754. if (target === this.referenceEl) {
  17755. this.setDropdownWidth();
  17756. }
  17757. else if (target === this.scrollerEl) {
  17758. this.setMaxScrollerHeight();
  17759. }
  17760. });
  17761. };
  17762. this.setDropdownWidth = () => {
  17763. const { referenceEl, scrollerEl } = this;
  17764. const referenceElWidth = referenceEl === null || referenceEl === void 0 ? void 0 : referenceEl.clientWidth;
  17765. if (!referenceElWidth || !scrollerEl) {
  17766. return;
  17767. }
  17768. scrollerEl.style.minWidth = `${referenceElWidth}px`;
  17769. };
  17770. this.setMaxScrollerHeight = () => {
  17771. const { scrollerEl } = this;
  17772. if (!scrollerEl) {
  17773. return;
  17774. }
  17775. this.reposition(true);
  17776. const maxScrollerHeight = this.getMaxScrollerHeight();
  17777. scrollerEl.style.maxHeight = maxScrollerHeight > 0 ? `${maxScrollerHeight}px` : "";
  17778. this.reposition(true);
  17779. };
  17780. this.setScrollerAndTransitionEl = (el) => {
  17781. this.resizeObserver.observe(el);
  17782. this.scrollerEl = el;
  17783. this.transitionEl = el;
  17784. connectOpenCloseComponent(this);
  17785. };
  17786. this.setReferenceEl = (el) => {
  17787. this.referenceEl = el;
  17788. connectFloatingUI(this, this.referenceEl, this.floatingEl);
  17789. this.resizeObserver.observe(el);
  17790. };
  17791. this.setFloatingEl = (el) => {
  17792. this.floatingEl = el;
  17793. connectFloatingUI(this, this.referenceEl, this.floatingEl);
  17794. };
  17795. this.keyDownHandler = (event) => {
  17796. const target = event.target;
  17797. if (target !== this.referenceEl) {
  17798. return;
  17799. }
  17800. const { defaultPrevented, key } = event;
  17801. if (defaultPrevented) {
  17802. return;
  17803. }
  17804. if (this.open) {
  17805. if (key === "Escape") {
  17806. this.closeCalciteDropdown();
  17807. event.preventDefault();
  17808. return;
  17809. }
  17810. else if (event.shiftKey && key === "Tab") {
  17811. this.closeCalciteDropdown();
  17812. event.preventDefault();
  17813. return;
  17814. }
  17815. }
  17816. if (isActivationKey(key)) {
  17817. this.openCalciteDropdown();
  17818. event.preventDefault();
  17819. }
  17820. else if (key === "Escape") {
  17821. this.closeCalciteDropdown();
  17822. event.preventDefault();
  17823. }
  17824. };
  17825. this.focusOnFirstActiveOrFirstItem = () => {
  17826. this.getFocusableElement(this.items.find((item) => item.selected) || this.items[0]);
  17827. };
  17828. this.toggleOpenEnd = () => {
  17829. this.focusOnFirstActiveOrFirstItem();
  17830. this.el.removeEventListener("calciteDropdownOpen", this.toggleOpenEnd);
  17831. };
  17832. this.openCalciteDropdown = () => {
  17833. this.open = !this.open;
  17834. if (this.open) {
  17835. this.el.addEventListener("calciteDropdownOpen", this.toggleOpenEnd);
  17836. }
  17837. };
  17838. }
  17839. activeHandler(value) {
  17840. this.open = value;
  17841. }
  17842. openHandler(value) {
  17843. if (!this.disabled) {
  17844. if (value) {
  17845. this.reposition(true);
  17846. }
  17847. else {
  17848. updateAfterClose(this.floatingEl);
  17849. }
  17850. this.active = value;
  17851. return;
  17852. }
  17853. if (!value) {
  17854. updateAfterClose(this.floatingEl);
  17855. }
  17856. this.open = false;
  17857. }
  17858. handleDisabledChange(value) {
  17859. if (!value) {
  17860. this.open = false;
  17861. }
  17862. }
  17863. flipPlacementsHandler() {
  17864. this.setFilteredPlacements();
  17865. this.reposition(true);
  17866. }
  17867. maxItemsHandler() {
  17868. this.setMaxScrollerHeight();
  17869. }
  17870. overlayPositioningHandler() {
  17871. this.reposition(true);
  17872. }
  17873. placementHandler() {
  17874. this.reposition(true);
  17875. }
  17876. //--------------------------------------------------------------------------
  17877. //
  17878. // Lifecycle
  17879. //
  17880. //--------------------------------------------------------------------------
  17881. connectedCallback() {
  17882. var _a;
  17883. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  17884. this.setFilteredPlacements();
  17885. this.reposition(true);
  17886. if (this.open) {
  17887. this.openHandler(this.open);
  17888. }
  17889. if (this.active) {
  17890. this.activeHandler(this.active);
  17891. }
  17892. connectOpenCloseComponent(this);
  17893. }
  17894. componentDidLoad() {
  17895. this.reposition(true);
  17896. }
  17897. componentDidRender() {
  17898. updateHostInteraction(this);
  17899. }
  17900. disconnectedCallback() {
  17901. var _a, _b;
  17902. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  17903. disconnectFloatingUI(this, this.referenceEl, this.floatingEl);
  17904. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
  17905. disconnectOpenCloseComponent(this);
  17906. }
  17907. render() {
  17908. const { open, guid } = this;
  17909. return (hAsync(Host, null, hAsync("div", { class: "calcite-dropdown-trigger-container", id: `${guid}-menubutton`, onClick: this.openCalciteDropdown, onKeyDown: this.keyDownHandler, ref: this.setReferenceEl }, hAsync("slot", { "aria-controls": `${guid}-menu`, "aria-expanded": toAriaBoolean(open), "aria-haspopup": "menu", name: SLOTS$k.dropdownTrigger, onSlotchange: this.updateTriggers })), hAsync("div", { "aria-hidden": toAriaBoolean(!open), class: "calcite-dropdown-wrapper", ref: this.setFloatingEl }, hAsync("div", { "aria-labelledby": `${guid}-menubutton`, class: {
  17910. ["calcite-dropdown-content"]: true,
  17911. [FloatingCSS.animation]: true,
  17912. [FloatingCSS.animationActive]: open
  17913. }, id: `${guid}-menu`, ref: this.setScrollerAndTransitionEl, role: "menu" }, hAsync("slot", { onSlotchange: this.updateGroups })))));
  17914. }
  17915. //--------------------------------------------------------------------------
  17916. //
  17917. // Public Methods
  17918. //
  17919. //--------------------------------------------------------------------------
  17920. /**
  17921. * Updates the position of the component.
  17922. *
  17923. * @param delayed
  17924. */
  17925. async reposition(delayed = false) {
  17926. const { floatingEl, referenceEl, placement, overlayPositioning, filteredFlipPlacements } = this;
  17927. return reposition(this, {
  17928. floatingEl,
  17929. referenceEl,
  17930. overlayPositioning,
  17931. placement,
  17932. flipPlacements: filteredFlipPlacements,
  17933. type: "menu"
  17934. }, delayed);
  17935. }
  17936. closeCalciteDropdownOnClick(event) {
  17937. if (!isPrimaryPointerButton(event) || !this.open || event.composedPath().includes(this.el)) {
  17938. return;
  17939. }
  17940. this.closeCalciteDropdown(false);
  17941. }
  17942. closeCalciteDropdownOnEvent(event) {
  17943. this.closeCalciteDropdown();
  17944. event.stopPropagation();
  17945. }
  17946. closeCalciteDropdownOnOpenEvent(event) {
  17947. if (event.composedPath().includes(this.el)) {
  17948. return;
  17949. }
  17950. this.open = false;
  17951. }
  17952. mouseEnterHandler() {
  17953. if (this.type === "hover") {
  17954. this.openCalciteDropdown();
  17955. }
  17956. }
  17957. mouseLeaveHandler() {
  17958. if (this.type === "hover") {
  17959. this.closeCalciteDropdown();
  17960. }
  17961. }
  17962. calciteInternalDropdownItemKeyEvent(event) {
  17963. const { keyboardEvent } = event.detail;
  17964. // handle edge
  17965. const target = keyboardEvent.target;
  17966. const itemToFocus = target.nodeName !== "A" ? target : target.parentNode;
  17967. const isFirstItem = this.itemIndex(itemToFocus) === 0;
  17968. const isLastItem = this.itemIndex(itemToFocus) === this.items.length - 1;
  17969. switch (keyboardEvent.key) {
  17970. case "Tab":
  17971. if (isLastItem && !keyboardEvent.shiftKey) {
  17972. this.closeCalciteDropdown();
  17973. }
  17974. else if (isFirstItem && keyboardEvent.shiftKey) {
  17975. this.closeCalciteDropdown();
  17976. }
  17977. else if (keyboardEvent.shiftKey) {
  17978. this.focusPrevItem(itemToFocus);
  17979. }
  17980. else {
  17981. this.focusNextItem(itemToFocus);
  17982. }
  17983. break;
  17984. case "ArrowDown":
  17985. this.focusNextItem(itemToFocus);
  17986. break;
  17987. case "ArrowUp":
  17988. this.focusPrevItem(itemToFocus);
  17989. break;
  17990. case "Home":
  17991. this.focusFirstItem();
  17992. break;
  17993. case "End":
  17994. this.focusLastItem();
  17995. break;
  17996. }
  17997. event.stopPropagation();
  17998. }
  17999. handleItemSelect(event) {
  18000. this.updateSelectedItems();
  18001. event.stopPropagation();
  18002. this.calciteDropdownSelect.emit({
  18003. item: event.detail.requestedDropdownItem
  18004. });
  18005. if (!this.disableCloseOnSelect ||
  18006. event.detail.requestedDropdownGroup.selectionMode === "none") {
  18007. this.closeCalciteDropdown();
  18008. }
  18009. event.stopPropagation();
  18010. }
  18011. onBeforeOpen() {
  18012. this.calciteDropdownBeforeOpen.emit();
  18013. }
  18014. onOpen() {
  18015. this.calciteDropdownOpen.emit();
  18016. }
  18017. onBeforeClose() {
  18018. this.calciteDropdownBeforeClose.emit();
  18019. }
  18020. onClose() {
  18021. this.calciteDropdownClose.emit();
  18022. }
  18023. updateSelectedItems() {
  18024. this.selectedItems = this.items.filter((item) => item.selected);
  18025. }
  18026. getMaxScrollerHeight() {
  18027. const { maxItems, items } = this;
  18028. let itemsToProcess = 0;
  18029. let maxScrollerHeight = 0;
  18030. let groupHeaderHeight;
  18031. this.groups.forEach((group) => {
  18032. if (maxItems > 0 && itemsToProcess < maxItems) {
  18033. Array.from(group.children).forEach((item, index) => {
  18034. if (index === 0) {
  18035. if (isNaN(groupHeaderHeight)) {
  18036. groupHeaderHeight = item.offsetTop;
  18037. }
  18038. maxScrollerHeight += groupHeaderHeight;
  18039. }
  18040. if (itemsToProcess < maxItems) {
  18041. maxScrollerHeight += item.offsetHeight;
  18042. itemsToProcess += 1;
  18043. }
  18044. });
  18045. }
  18046. });
  18047. return items.length > maxItems ? maxScrollerHeight : 0;
  18048. }
  18049. closeCalciteDropdown(focusTrigger = true) {
  18050. this.open = false;
  18051. if (focusTrigger) {
  18052. focusElement(this.triggers[0]);
  18053. }
  18054. }
  18055. focusFirstItem() {
  18056. const firstItem = this.items[0];
  18057. this.getFocusableElement(firstItem);
  18058. }
  18059. focusLastItem() {
  18060. const lastItem = this.items[this.items.length - 1];
  18061. this.getFocusableElement(lastItem);
  18062. }
  18063. focusNextItem(el) {
  18064. const index = this.itemIndex(el);
  18065. const nextItem = this.items[index + 1] || this.items[0];
  18066. this.getFocusableElement(nextItem);
  18067. }
  18068. focusPrevItem(el) {
  18069. const index = this.itemIndex(el);
  18070. const prevItem = this.items[index - 1] || this.items[this.items.length - 1];
  18071. this.getFocusableElement(prevItem);
  18072. }
  18073. itemIndex(el) {
  18074. return this.items.indexOf(el);
  18075. }
  18076. getFocusableElement(item) {
  18077. if (!item) {
  18078. return;
  18079. }
  18080. const target = item.attributes.isLink
  18081. ? item.shadowRoot.querySelector("a")
  18082. : item;
  18083. focusElement(target);
  18084. }
  18085. get el() { return getElement(this); }
  18086. static get watchers() { return {
  18087. "active": ["activeHandler"],
  18088. "open": ["openHandler"],
  18089. "disabled": ["handleDisabledChange"],
  18090. "flipPlacements": ["flipPlacementsHandler"],
  18091. "maxItems": ["maxItemsHandler"],
  18092. "overlayPositioning": ["overlayPositioningHandler"],
  18093. "placement": ["placementHandler"]
  18094. }; }
  18095. static get style() { return dropdownCss; }
  18096. static get cmpMeta() { return {
  18097. "$flags$": 9,
  18098. "$tagName$": "calcite-dropdown",
  18099. "$members$": {
  18100. "active": [1540],
  18101. "open": [1540],
  18102. "disableCloseOnSelect": [516, "disable-close-on-select"],
  18103. "disabled": [516],
  18104. "flipPlacements": [16],
  18105. "maxItems": [514, "max-items"],
  18106. "overlayPositioning": [513, "overlay-positioning"],
  18107. "placement": [513],
  18108. "scale": [513],
  18109. "selectedItems": [1040],
  18110. "type": [513],
  18111. "width": [513],
  18112. "reposition": [64]
  18113. },
  18114. "$listeners$": [[9, "pointerdown", "closeCalciteDropdownOnClick"], [0, "calciteInternalDropdownCloseRequest", "closeCalciteDropdownOnEvent"], [8, "calciteDropdownOpen", "closeCalciteDropdownOnOpenEvent"], [1, "pointerenter", "mouseEnterHandler"], [1, "pointerleave", "mouseLeaveHandler"], [0, "calciteInternalDropdownItemKeyEvent", "calciteInternalDropdownItemKeyEvent"], [0, "calciteInternalDropdownItemSelect", "handleItemSelect"]],
  18115. "$lazyBundleId$": "-",
  18116. "$attrsToReflect$": [["active", "active"], ["open", "open"], ["disableCloseOnSelect", "disable-close-on-select"], ["disabled", "disabled"], ["maxItems", "max-items"], ["overlayPositioning", "overlay-positioning"], ["placement", "placement"], ["scale", "scale"], ["type", "type"], ["width", "width"]]
  18117. }; }
  18118. }
  18119. const CSS$F = {
  18120. containerSmall: "container--s",
  18121. containerMedium: "container--m",
  18122. containerLarge: "container--l"
  18123. };
  18124. const dropdownGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-dropdown-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-dropdown-group{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-dropdown-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-dropdown-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-dropdown-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-dropdown-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-dropdown-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-dropdown-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-dropdown-group-h{display:none}/*!@:host*/.sc-calcite-dropdown-group-h{display:block}/*!@.container*/.container.sc-calcite-dropdown-group{text-align:start}/*!@.container--s*/.container--s.sc-calcite-dropdown-group{font-size:var(--calcite-font-size--2);line-height:1rem}/*!@.container--s .dropdown-title*/.container--s.sc-calcite-dropdown-group .dropdown-title.sc-calcite-dropdown-group{padding:0.5rem}/*!@.container--m*/.container--m.sc-calcite-dropdown-group{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@.container--m .dropdown-title*/.container--m.sc-calcite-dropdown-group .dropdown-title.sc-calcite-dropdown-group{padding:0.75rem}/*!@.container--l*/.container--l.sc-calcite-dropdown-group{font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@.container--l .dropdown-title*/.container--l.sc-calcite-dropdown-group .dropdown-title.sc-calcite-dropdown-group{padding:1rem}/*!@.dropdown-title*/.dropdown-title.sc-calcite-dropdown-group{margin-block-end:-1px;display:block;cursor:default;overflow-wrap:break-word;border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-2)}/*!@.dropdown-separator*/.dropdown-separator.sc-calcite-dropdown-group{display:block;block-size:1px;background-color:var(--calcite-ui-border-3)}";
  18125. /**
  18126. * @slot - A slot for adding `calcite-dropdown-item` components.
  18127. */
  18128. class DropdownGroup {
  18129. constructor(hostRef) {
  18130. registerInstance(this, hostRef);
  18131. this.calciteInternalDropdownItemChange = createEvent(this, "calciteInternalDropdownItemChange", 6);
  18132. /**
  18133. specify the selection mode - multi (allow any number of (or no) active items), single (allow and require one active item),
  18134. none (no active items), defaults to single
  18135. */
  18136. this.selectionMode = "single";
  18137. }
  18138. //--------------------------------------------------------------------------
  18139. //
  18140. // Lifecycle
  18141. //
  18142. //--------------------------------------------------------------------------
  18143. componentWillLoad() {
  18144. this.groupPosition = this.getGroupPosition();
  18145. }
  18146. render() {
  18147. const scale = this.scale || getElementProp(this.el, "scale", "m");
  18148. const groupTitle = this.groupTitle ? (hAsync("span", { "aria-hidden": "true", class: "dropdown-title" }, this.groupTitle)) : null;
  18149. const dropdownSeparator = this.groupPosition > 0 ? hAsync("div", { class: "dropdown-separator", role: "separator" }) : null;
  18150. return (hAsync(Host, { "aria-label": this.groupTitle, role: "group" }, hAsync("div", { class: {
  18151. container: true,
  18152. [CSS$F.containerSmall]: scale === "s",
  18153. [CSS$F.containerMedium]: scale === "m",
  18154. [CSS$F.containerLarge]: scale === "l"
  18155. }, title: this.groupTitle }, dropdownSeparator, groupTitle, hAsync("slot", null))));
  18156. }
  18157. //--------------------------------------------------------------------------
  18158. //
  18159. // Event Listeners
  18160. //
  18161. //--------------------------------------------------------------------------
  18162. updateActiveItemOnChange(event) {
  18163. this.requestedDropdownGroup = event.detail.requestedDropdownGroup;
  18164. this.requestedDropdownItem = event.detail.requestedDropdownItem;
  18165. this.calciteInternalDropdownItemChange.emit({
  18166. requestedDropdownGroup: this.requestedDropdownGroup,
  18167. requestedDropdownItem: this.requestedDropdownItem
  18168. });
  18169. }
  18170. //--------------------------------------------------------------------------
  18171. //
  18172. // Private Methods
  18173. //
  18174. //--------------------------------------------------------------------------
  18175. getGroupPosition() {
  18176. return Array.prototype.indexOf.call(this.el.parentElement.querySelectorAll("calcite-dropdown-group"), this.el);
  18177. }
  18178. get el() { return getElement(this); }
  18179. static get style() { return dropdownGroupCss; }
  18180. static get cmpMeta() { return {
  18181. "$flags$": 9,
  18182. "$tagName$": "calcite-dropdown-group",
  18183. "$members$": {
  18184. "groupTitle": [513, "group-title"],
  18185. "selectionMode": [513, "selection-mode"],
  18186. "scale": [513]
  18187. },
  18188. "$listeners$": [[0, "calciteInternalDropdownItemSelect", "updateActiveItemOnChange"]],
  18189. "$lazyBundleId$": "-",
  18190. "$attrsToReflect$": [["groupTitle", "group-title"], ["selectionMode", "selection-mode"], ["scale", "scale"]]
  18191. }; }
  18192. }
  18193. const CSS$E = {
  18194. containerLink: "container--link",
  18195. containerSmall: "container--s",
  18196. containerMedium: "container--m",
  18197. containerLarge: "container--l",
  18198. containerMulti: "container--multi-selection",
  18199. containerSingle: "container--single-selection",
  18200. containerNone: "container--none-selection"
  18201. };
  18202. const dropdownItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-dropdown-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-dropdown-item{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-dropdown-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-dropdown-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-dropdown-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-dropdown-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-dropdown-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-dropdown-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-dropdown-item-h{display:none}/*!@.container--s*/.container--s.sc-calcite-dropdown-item{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;padding-inline-end:0.5rem;padding-inline-start:1.5rem}/*!@.container--m*/.container--m.sc-calcite-dropdown-item{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;padding-inline-end:0.75rem;padding-inline-start:2rem}/*!@.container--l*/.container--l.sc-calcite-dropdown-item{padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;padding-inline-end:1rem;padding-inline-start:2.5rem}/*!@.container--s.container--none-selection*/.container--s.container--none-selection.sc-calcite-dropdown-item{padding-inline-start:0.25rem}/*!@.container--s.container--none-selection .dropdown-link*/.container--s.container--none-selection.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{padding-inline-start:0px}/*!@.container--m.container--none-selection*/.container--m.container--none-selection.sc-calcite-dropdown-item{padding-inline-start:0.5rem}/*!@.container--m.container--none-selection .dropdown-link*/.container--m.container--none-selection.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{padding-inline-start:0px}/*!@.container--l.container--none-selection*/.container--l.container--none-selection.sc-calcite-dropdown-item{padding-inline-start:0.75rem}/*!@.container--l.container--none-selection .dropdown-link*/.container--l.container--none-selection.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{padding-inline-start:0px}/*!@:host*/.sc-calcite-dropdown-item-h{position:relative;display:flex;flex-grow:1;align-items:center}/*!@.container*/.container.sc-calcite-dropdown-item{position:relative;display:flex;flex-grow:1;cursor:pointer;align-items:center;color:var(--calcite-ui-text-3);text-decoration-line:none;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);text-align:start}/*!@.dropdown-item-content*/.dropdown-item-content.sc-calcite-dropdown-item{flex:1 1 auto;padding-inline-end:auto;padding-inline-start:0.25rem}/*!@:host, \n.container--link a*/.sc-calcite-dropdown-item-h,.container--link.sc-calcite-dropdown-item a.sc-calcite-dropdown-item{outline-color:transparent}/*!@:host(:focus)*/.sc-calcite-dropdown-item-h:focus{outline:2px solid transparent;outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.container--link*/.container--link.sc-calcite-dropdown-item{padding:0px}/*!@.container--link a*/.container--link.sc-calcite-dropdown-item a.sc-calcite-dropdown-item{position:relative;display:flex;flex-grow:1;cursor:pointer;align-items:center;color:var(--calcite-ui-text-3);text-decoration-line:none;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@.container--s .dropdown-link*/.container--s.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;padding-inline-end:0.5rem;padding-inline-start:1.5rem}/*!@.container--m .dropdown-link*/.container--m.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;padding-inline-end:0.75rem;padding-inline-start:2rem}/*!@.container--l .dropdown-link*/.container--l.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;padding-inline-end:1rem;padding-inline-start:2.5rem}/*!@:host(:hover) .container, \n:host(:active) .container*/.sc-calcite-dropdown-item-h:hover .container.sc-calcite-dropdown-item,.sc-calcite-dropdown-item-h:active .container.sc-calcite-dropdown-item{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1);text-decoration-line:none}/*!@:host(:hover) .container--link .dropdown-link, \n:host(:active) .container--link .dropdown-link*/.sc-calcite-dropdown-item-h:hover .container--link.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item,.sc-calcite-dropdown-item-h:active .container--link.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .container*/.sc-calcite-dropdown-item-h:focus .container.sc-calcite-dropdown-item{color:var(--calcite-ui-text-1);text-decoration-line:none}/*!@:host(:active) .container*/.sc-calcite-dropdown-item-h:active .container.sc-calcite-dropdown-item{background-color:var(--calcite-ui-foreground-3)}/*!@:host(:hover) .container:before, \n:host(:active) .container:before, \n:host(:focus) .container:before*/.sc-calcite-dropdown-item-h:hover .container.sc-calcite-dropdown-item:before,.sc-calcite-dropdown-item-h:active .container.sc-calcite-dropdown-item:before,.sc-calcite-dropdown-item-h:focus .container.sc-calcite-dropdown-item:before{opacity:1}/*!@:host([selected]) .container:not(.container--none-selection), \n:host([selected]) .container--link .dropdown-link*/[selected].sc-calcite-dropdown-item-h .container.sc-calcite-dropdown-item:not(.container--none-selection),[selected].sc-calcite-dropdown-item-h .container--link.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@:host([selected]) .container:not(.container--none-selection):before, \n:host([selected]) .container--link .dropdown-link:before*/[selected].sc-calcite-dropdown-item-h .container.sc-calcite-dropdown-item:not(.container--none-selection):before,[selected].sc-calcite-dropdown-item-h .container--link.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item:before{opacity:1;color:var(--calcite-ui-brand)}/*!@:host([selected]) .container:not(.container--none-selection) calcite-icon,\n:host([selected]) .container--link .dropdown-link calcite-icon*/[selected].sc-calcite-dropdown-item-h .container.sc-calcite-dropdown-item:not(.container--none-selection) calcite-icon.sc-calcite-dropdown-item,[selected].sc-calcite-dropdown-item-h .container--link.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item calcite-icon.sc-calcite-dropdown-item{color:var(--calcite-ui-brand)}/*!@.container--multi-selection:before, \n.container--none-selection:before*/.container--multi-selection.sc-calcite-dropdown-item:before,.container--none-selection.sc-calcite-dropdown-item:before{display:none}/*!@.container--s:before*/.container--s.sc-calcite-dropdown-item:before{inset-inline-start:0.5rem}/*!@.container--m:before*/.container--m.sc-calcite-dropdown-item:before{inset-inline-start:0.75rem}/*!@.container--l:before*/.container--l.sc-calcite-dropdown-item:before{inset-inline-start:1rem}/*!@.dropdown-item-icon*/.dropdown-item-icon.sc-calcite-dropdown-item{position:absolute;opacity:0;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:scale(0.9)}/*!@.container--s .dropdown-item-icon*/.container--s.sc-calcite-dropdown-item .dropdown-item-icon.sc-calcite-dropdown-item{inset-inline-start:0.25rem}/*!@.container--m .dropdown-item-icon*/.container--m.sc-calcite-dropdown-item .dropdown-item-icon.sc-calcite-dropdown-item{inset-inline-start:0.5rem}/*!@.container--l .dropdown-item-icon*/.container--l.sc-calcite-dropdown-item .dropdown-item-icon.sc-calcite-dropdown-item{inset-inline-start:0.75rem}/*!@:host(:hover) .dropdown-item-icon*/.sc-calcite-dropdown-item-h:hover .dropdown-item-icon.sc-calcite-dropdown-item{color:var(--calcite-ui-border-1);opacity:1}/*!@:host([active]) .dropdown-item-icon*/[active].sc-calcite-dropdown-item-h .dropdown-item-icon.sc-calcite-dropdown-item{color:var(--calcite-ui-brand);opacity:1}/*!@.container--s .dropdown-item-icon-start*/.container--s.sc-calcite-dropdown-item .dropdown-item-icon-start.sc-calcite-dropdown-item{margin-inline-end:0.5rem;margin-inline-start:0.25rem}/*!@.container--s .dropdown-item-icon-end*/.container--s.sc-calcite-dropdown-item .dropdown-item-icon-end.sc-calcite-dropdown-item{margin-inline-start:0.5rem}/*!@.container--m .dropdown-item-icon-start*/.container--m.sc-calcite-dropdown-item .dropdown-item-icon-start.sc-calcite-dropdown-item{margin-inline-end:0.75rem;margin-inline-start:0.25rem}/*!@.container--m .dropdown-item-icon-end*/.container--m.sc-calcite-dropdown-item .dropdown-item-icon-end.sc-calcite-dropdown-item{margin-inline-start:0.75rem}/*!@.container--l .dropdown-item-icon-start*/.container--l.sc-calcite-dropdown-item .dropdown-item-icon-start.sc-calcite-dropdown-item{margin-inline-end:1rem;margin-inline-start:0.25rem}/*!@.container--l .dropdown-item-icon-end*/.container--l.sc-calcite-dropdown-item .dropdown-item-icon-end.sc-calcite-dropdown-item{margin-inline-start:1rem}";
  18203. /**
  18204. * @slot - A slot for adding text.
  18205. */
  18206. class DropdownItem {
  18207. constructor(hostRef) {
  18208. registerInstance(this, hostRef);
  18209. this.calciteInternalDropdownItemSelect = createEvent(this, "calciteInternalDropdownItemSelect", 6);
  18210. this.calciteInternalDropdownItemKeyEvent = createEvent(this, "calciteInternalDropdownItemKeyEvent", 6);
  18211. this.calciteInternalDropdownCloseRequest = createEvent(this, "calciteInternalDropdownCloseRequest", 6);
  18212. //--------------------------------------------------------------------------
  18213. //
  18214. // Public Properties
  18215. //
  18216. //--------------------------------------------------------------------------
  18217. /**
  18218. * Indicates whether the item is active.
  18219. *
  18220. * @deprecated Use selected instead.
  18221. */
  18222. this.active = false;
  18223. /** When true, item is selected */
  18224. this.selected = false;
  18225. }
  18226. activeHandler(value) {
  18227. this.selected = value;
  18228. }
  18229. selectedHandler(value) {
  18230. this.active = value;
  18231. }
  18232. //--------------------------------------------------------------------------
  18233. //
  18234. // Public Methods
  18235. //
  18236. //--------------------------------------------------------------------------
  18237. /** Sets focus on the component. */
  18238. async setFocus() {
  18239. var _a;
  18240. (_a = this.el) === null || _a === void 0 ? void 0 : _a.focus();
  18241. }
  18242. //--------------------------------------------------------------------------
  18243. //
  18244. // Lifecycle
  18245. //
  18246. //--------------------------------------------------------------------------
  18247. componentWillLoad() {
  18248. this.initialize();
  18249. }
  18250. connectedCallback() {
  18251. const isSelected = this.selected || this.active;
  18252. if (isSelected) {
  18253. this.activeHandler(isSelected);
  18254. this.selectedHandler(isSelected);
  18255. }
  18256. this.initialize();
  18257. }
  18258. render() {
  18259. const scale = getElementProp(this.el, "scale", "m");
  18260. const iconStartEl = (hAsync("calcite-icon", { class: "dropdown-item-icon-start", flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
  18261. const contentNode = (hAsync("span", { class: "dropdown-item-content" }, hAsync("slot", null)));
  18262. const iconEndEl = (hAsync("calcite-icon", { class: "dropdown-item-icon-end", flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
  18263. const slottedContent = this.iconStart && this.iconEnd
  18264. ? [iconStartEl, contentNode, iconEndEl]
  18265. : this.iconStart
  18266. ? [iconStartEl, hAsync("slot", null)]
  18267. : this.iconEnd
  18268. ? [contentNode, iconEndEl]
  18269. : contentNode;
  18270. const contentEl = !this.href ? (slottedContent) : (hAsync("a", { "aria-label": this.label, class: "dropdown-link", href: this.href, ref: (el) => (this.childLink = el), rel: this.rel, target: this.target }, slottedContent));
  18271. const itemRole = this.href
  18272. ? null
  18273. : this.selectionMode === "single"
  18274. ? "menuitemradio"
  18275. : this.selectionMode === "multi"
  18276. ? "menuitemcheckbox"
  18277. : "menuitem";
  18278. const itemAria = this.selectionMode !== "none" ? toAriaBoolean(this.selected) : null;
  18279. return (hAsync(Host, { "aria-checked": itemAria, role: itemRole, tabindex: "0" }, hAsync("div", { class: {
  18280. container: true,
  18281. [CSS$E.containerLink]: !!this.href,
  18282. [CSS$E.containerSmall]: scale === "s",
  18283. [CSS$E.containerMedium]: scale === "m",
  18284. [CSS$E.containerLarge]: scale === "l",
  18285. [CSS$E.containerMulti]: this.selectionMode === "multi",
  18286. [CSS$E.containerSingle]: this.selectionMode === "single",
  18287. [CSS$E.containerNone]: this.selectionMode === "none"
  18288. } }, this.selectionMode !== "none" ? (hAsync("calcite-icon", { class: "dropdown-item-icon", icon: this.selectionMode === "multi" ? "check" : "bullet-point", scale: "s" })) : null, contentEl)));
  18289. }
  18290. //--------------------------------------------------------------------------
  18291. //
  18292. // Event Listeners
  18293. //
  18294. //--------------------------------------------------------------------------
  18295. onClick() {
  18296. this.emitRequestedItem();
  18297. }
  18298. keyDownHandler(event) {
  18299. switch (event.key) {
  18300. case " ":
  18301. case "Enter":
  18302. this.emitRequestedItem();
  18303. if (this.href) {
  18304. this.childLink.click();
  18305. }
  18306. event.preventDefault();
  18307. break;
  18308. case "Escape":
  18309. this.calciteInternalDropdownCloseRequest.emit();
  18310. event.preventDefault();
  18311. break;
  18312. case "Tab":
  18313. this.calciteInternalDropdownItemKeyEvent.emit({ keyboardEvent: event });
  18314. break;
  18315. case "ArrowUp":
  18316. case "ArrowDown":
  18317. case "Home":
  18318. case "End":
  18319. event.preventDefault();
  18320. this.calciteInternalDropdownItemKeyEvent.emit({ keyboardEvent: event });
  18321. break;
  18322. }
  18323. }
  18324. updateActiveItemOnChange(event) {
  18325. const parentEmittedChange = event.composedPath().includes(this.parentDropdownGroupEl);
  18326. if (parentEmittedChange) {
  18327. this.requestedDropdownGroup = event.detail.requestedDropdownGroup;
  18328. this.requestedDropdownItem = event.detail.requestedDropdownItem;
  18329. this.determineActiveItem();
  18330. }
  18331. event.stopPropagation();
  18332. }
  18333. //--------------------------------------------------------------------------
  18334. //
  18335. // Private Methods
  18336. //
  18337. //--------------------------------------------------------------------------
  18338. initialize() {
  18339. this.selectionMode = getElementProp(this.el, "selection-mode", "single");
  18340. this.parentDropdownGroupEl = this.el.closest("calcite-dropdown-group");
  18341. if (this.selectionMode === "none") {
  18342. this.selected = false;
  18343. }
  18344. }
  18345. determineActiveItem() {
  18346. switch (this.selectionMode) {
  18347. case "multi":
  18348. if (this.el === this.requestedDropdownItem) {
  18349. this.selected = !this.selected;
  18350. }
  18351. break;
  18352. case "single":
  18353. if (this.el === this.requestedDropdownItem) {
  18354. this.selected = true;
  18355. }
  18356. else if (this.requestedDropdownGroup === this.parentDropdownGroupEl) {
  18357. this.selected = false;
  18358. }
  18359. break;
  18360. case "none":
  18361. this.selected = false;
  18362. break;
  18363. }
  18364. }
  18365. emitRequestedItem() {
  18366. this.calciteInternalDropdownItemSelect.emit({
  18367. requestedDropdownItem: this.el,
  18368. requestedDropdownGroup: this.parentDropdownGroupEl
  18369. });
  18370. }
  18371. get el() { return getElement(this); }
  18372. static get watchers() { return {
  18373. "active": ["activeHandler"],
  18374. "selected": ["selectedHandler"]
  18375. }; }
  18376. static get style() { return dropdownItemCss; }
  18377. static get cmpMeta() { return {
  18378. "$flags$": 9,
  18379. "$tagName$": "calcite-dropdown-item",
  18380. "$members$": {
  18381. "active": [1540],
  18382. "selected": [1540],
  18383. "iconFlipRtl": [513, "icon-flip-rtl"],
  18384. "iconStart": [513, "icon-start"],
  18385. "iconEnd": [513, "icon-end"],
  18386. "href": [513],
  18387. "label": [1],
  18388. "rel": [513],
  18389. "target": [513],
  18390. "setFocus": [64]
  18391. },
  18392. "$listeners$": [[0, "click", "onClick"], [0, "keydown", "keyDownHandler"], [16, "calciteInternalDropdownItemChange", "updateActiveItemOnChange"]],
  18393. "$lazyBundleId$": "-",
  18394. "$attrsToReflect$": [["active", "active"], ["selected", "selected"], ["iconFlipRtl", "icon-flip-rtl"], ["iconStart", "icon-start"], ["iconEnd", "icon-end"], ["href", "href"], ["rel", "rel"], ["target", "target"]]
  18395. }; }
  18396. }
  18397. const CSS$D = {
  18398. button: "button"
  18399. };
  18400. const ICONS$a = {
  18401. plus: "plus"
  18402. };
  18403. const fabCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-fab:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-fab{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-fab{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-fab{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-fab{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-fab{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-fab:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-fab:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-fab-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-fab-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-fab-h{display:flex;background-color:transparent}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-fab-h[disabled] .sc-calcite-fab-s>[calcite-hydrated][disabled],[disabled].sc-calcite-fab-h [calcite-hydrated][disabled].sc-calcite-fab{opacity:1}/*!@calcite-button*/calcite-button.sc-calcite-fab{--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@calcite-button:hover*/calcite-button.sc-calcite-fab:hover{--tw-shadow:0 12px 32px -2px rgba(0, 0, 0, 0.1), 0 4px 20px 0 rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 12px 32px -2px var(--tw-shadow-color), 0 4px 20px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@calcite-button:active*/calcite-button.sc-calcite-fab:active{--tw-shadow:0 2px 12px -4px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.16);--tw-shadow-colored:0 2px 12px -4px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}";
  18404. class Fab {
  18405. constructor(hostRef) {
  18406. registerInstance(this, hostRef);
  18407. // --------------------------------------------------------------------------
  18408. //
  18409. // Properties
  18410. //
  18411. // --------------------------------------------------------------------------
  18412. /**
  18413. * Used to set the button's appearance. Default is outline.
  18414. */
  18415. this.appearance = "outline";
  18416. /**
  18417. * Used to set the button's color. Default is light.
  18418. */
  18419. this.color = "neutral";
  18420. /**
  18421. * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
  18422. */
  18423. this.disabled = false;
  18424. /**
  18425. * Specifies an icon to display.
  18426. *
  18427. * @default "plus"
  18428. */
  18429. this.icon = ICONS$a.plus;
  18430. /**
  18431. * When true, content is waiting to be loaded. This state shows a busy indicator.
  18432. */
  18433. this.loading = false;
  18434. /**
  18435. * Specifies the size of the fab.
  18436. */
  18437. this.scale = "m";
  18438. /**
  18439. * Indicates whether the text is displayed.
  18440. */
  18441. this.textEnabled = false;
  18442. }
  18443. //--------------------------------------------------------------------------
  18444. //
  18445. // Lifecycle
  18446. //
  18447. //--------------------------------------------------------------------------
  18448. componentDidRender() {
  18449. updateHostInteraction(this);
  18450. }
  18451. // --------------------------------------------------------------------------
  18452. //
  18453. // Methods
  18454. //
  18455. // --------------------------------------------------------------------------
  18456. /** Sets focus on the component. */
  18457. async setFocus() {
  18458. focusElement(this.buttonEl);
  18459. }
  18460. // --------------------------------------------------------------------------
  18461. //
  18462. // Render Methods
  18463. //
  18464. // --------------------------------------------------------------------------
  18465. render() {
  18466. const { appearance, color, disabled, loading, scale, textEnabled, icon, label, text } = this;
  18467. const title = !textEnabled ? label || text || null : null;
  18468. return (hAsync("calcite-button", { appearance: appearance === "solid" ? "solid" : "outline", class: CSS$D.button, color: color, disabled: disabled, iconStart: icon, label: label, loading: loading, ref: (buttonEl) => {
  18469. this.buttonEl = buttonEl;
  18470. }, round: true, scale: scale, title: title, type: "button", width: "auto" }, this.textEnabled ? this.text : null));
  18471. }
  18472. get el() { return getElement(this); }
  18473. static get style() { return fabCss; }
  18474. static get cmpMeta() { return {
  18475. "$flags$": 9,
  18476. "$tagName$": "calcite-fab",
  18477. "$members$": {
  18478. "appearance": [513],
  18479. "color": [513],
  18480. "disabled": [516],
  18481. "icon": [513],
  18482. "label": [1],
  18483. "loading": [516],
  18484. "scale": [513],
  18485. "text": [1],
  18486. "textEnabled": [516, "text-enabled"],
  18487. "setFocus": [64]
  18488. },
  18489. "$listeners$": undefined,
  18490. "$lazyBundleId$": "-",
  18491. "$attrsToReflect$": [["appearance", "appearance"], ["color", "color"], ["disabled", "disabled"], ["icon", "icon"], ["loading", "loading"], ["scale", "scale"], ["textEnabled", "text-enabled"]]
  18492. }; }
  18493. }
  18494. const CSS$C = {
  18495. container: "container",
  18496. searchIcon: "search-icon"
  18497. };
  18498. const TEXT$h = {
  18499. filterLabel: "Filter",
  18500. clear: "Clear filter"
  18501. };
  18502. const ICONS$9 = {
  18503. search: "search",
  18504. close: "x"
  18505. };
  18506. const DEBOUNCE_TIMEOUT = 250;
  18507. const filterCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-filter:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-filter{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-filter{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-filter{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-filter{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-filter{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-filter:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-filter-h{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-filter-h *.sc-calcite-filter{box-sizing:border-box}/*!@:root*/.sc-calcite-filter:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-filter-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-filter-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-filter-h{display:flex;inline-size:100%}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-filter-h[disabled] .sc-calcite-filter-s>[calcite-hydrated][disabled],[disabled].sc-calcite-filter-h [calcite-hydrated][disabled].sc-calcite-filter{opacity:1}/*!@.container*/.container.sc-calcite-filter{display:flex;inline-size:100%;padding:0.5rem}/*!@label*/label.sc-calcite-filter{position:relative;margin-inline:0.25rem;margin-block:0px;display:flex;inline-size:100%;align-items:center;overflow:hidden}/*!@input[type=text]*/input[type=text].sc-calcite-filter{margin-block-end:0.25rem;inline-size:100%;border-style:none;background-color:transparent;padding-block:0.25rem;font-family:inherit;font-size:var(--calcite-font-size--2);line-height:1rem;color:var(--calcite-ui-text-1);padding-inline-end:0.25rem;padding-inline-start:1.5rem;transition:padding var(--calcite-animation-timing), box-shadow var(--calcite-animation-timing)}/*!@input[type=text]::-ms-clear*/input[type=text].sc-calcite-filter::-ms-clear{display:none}/*!@calcite-input*/calcite-input.sc-calcite-filter{inline-size:100%}/*!@.search-icon*/.search-icon.sc-calcite-filter{position:absolute;display:flex;color:var(--calcite-ui-text-2);inset-inline-start:0;transition:inset-inline-start var(--calcite-animation-timing), inset-inline-end var(--calcite-animation-timing), opacity var(--calcite-animation-timing)}/*!@input[type=text]:focus*/input[type=text].sc-calcite-filter:focus{border-color:var(--calcite-ui-brand);outline:2px solid transparent;outline-offset:2px;padding-inline:0.25rem}/*!@input[type=text]:focus ~ .search-icon*/input[type=text].sc-calcite-filter:focus~.search-icon.sc-calcite-filter{inset-inline-start:calc(1rem * -1);opacity:0}/*!@.clear-button*/.clear-button.sc-calcite-filter{display:flex;cursor:pointer;align-items:center;border-width:0px;background-color:transparent;color:var(--calcite-ui-text-2)}/*!@.clear-button:hover, .clear-button:focus*/.clear-button.sc-calcite-filter:hover,.clear-button.sc-calcite-filter:focus{color:var(--calcite-ui-text-1)}";
  18508. class Filter {
  18509. constructor(hostRef) {
  18510. registerInstance(this, hostRef);
  18511. this.calciteFilterChange = createEvent(this, "calciteFilterChange", 6);
  18512. // --------------------------------------------------------------------------
  18513. //
  18514. // Properties
  18515. //
  18516. // --------------------------------------------------------------------------
  18517. /**
  18518. * The items to filter through. The filter uses this as the starting point, and returns items
  18519. * that contain the string entered in the input, using a partial match and recursive search.
  18520. *
  18521. * This property is required.
  18522. */
  18523. this.items = [];
  18524. /**
  18525. * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
  18526. */
  18527. this.disabled = false;
  18528. /**
  18529. * The resulting items after filtering.
  18530. *
  18531. * @readonly
  18532. */
  18533. this.filteredItems = [];
  18534. /** specify the scale of filter, defaults to m */
  18535. this.scale = "m";
  18536. /**
  18537. * Filter value.
  18538. */
  18539. this.value = "";
  18540. // --------------------------------------------------------------------------
  18541. //
  18542. // Private Methods
  18543. //
  18544. // --------------------------------------------------------------------------
  18545. this.filter = debounce((value, emit = false) => this.updateFiltered(filter(this.items, value), emit), DEBOUNCE_TIMEOUT);
  18546. this.inputHandler = (event) => {
  18547. const target = event.target;
  18548. this.value = target.value;
  18549. this.filter(target.value, true);
  18550. };
  18551. this.keyDownHandler = (event) => {
  18552. if (event.key === "Escape") {
  18553. this.clear();
  18554. event.preventDefault();
  18555. }
  18556. if (event.key === "Enter") {
  18557. event.preventDefault();
  18558. }
  18559. };
  18560. this.clear = () => {
  18561. this.value = "";
  18562. this.filter("", true);
  18563. this.setFocus();
  18564. };
  18565. }
  18566. watchItemsHandler() {
  18567. this.filter(this.value);
  18568. }
  18569. valueHandler(value) {
  18570. this.filter(value);
  18571. }
  18572. //--------------------------------------------------------------------------
  18573. //
  18574. // Lifecycle
  18575. //
  18576. //--------------------------------------------------------------------------
  18577. componentDidRender() {
  18578. updateHostInteraction(this);
  18579. }
  18580. //--------------------------------------------------------------------------
  18581. //
  18582. // Lifecycle
  18583. //
  18584. //--------------------------------------------------------------------------
  18585. componentWillLoad() {
  18586. this.filter(this.value);
  18587. }
  18588. // --------------------------------------------------------------------------
  18589. //
  18590. // Public Methods
  18591. //
  18592. // --------------------------------------------------------------------------
  18593. /** Sets focus on the component. */
  18594. async setFocus() {
  18595. focusElement(this.textInput);
  18596. }
  18597. updateFiltered(filtered, emit = false) {
  18598. this.filteredItems.length = 0;
  18599. this.filteredItems = this.filteredItems.concat(filtered);
  18600. if (emit) {
  18601. this.calciteFilterChange.emit();
  18602. }
  18603. }
  18604. // --------------------------------------------------------------------------
  18605. //
  18606. // Render Methods
  18607. //
  18608. // --------------------------------------------------------------------------
  18609. render() {
  18610. const { disabled, scale } = this;
  18611. return (hAsync(Fragment, null, hAsync("div", { class: CSS$C.container }, hAsync("label", null, hAsync("calcite-input", { "aria-label": this.intlLabel || TEXT$h.filterLabel, clearable: true, disabled: disabled, icon: ICONS$9.search, intlClear: this.intlClear || TEXT$h.clear, onCalciteInputInput: this.inputHandler, onKeyDown: this.keyDownHandler, placeholder: this.placeholder, ref: (el) => {
  18612. this.textInput = el;
  18613. }, scale: scale, type: "text", value: this.value })))));
  18614. }
  18615. get el() { return getElement(this); }
  18616. static get watchers() { return {
  18617. "items": ["watchItemsHandler"],
  18618. "value": ["valueHandler"]
  18619. }; }
  18620. static get style() { return filterCss; }
  18621. static get cmpMeta() { return {
  18622. "$flags$": 9,
  18623. "$tagName$": "calcite-filter",
  18624. "$members$": {
  18625. "items": [1040],
  18626. "disabled": [516],
  18627. "filteredItems": [1040],
  18628. "intlClear": [1, "intl-clear"],
  18629. "intlLabel": [1, "intl-label"],
  18630. "placeholder": [1],
  18631. "scale": [513],
  18632. "value": [1025],
  18633. "setFocus": [64]
  18634. },
  18635. "$listeners$": undefined,
  18636. "$lazyBundleId$": "-",
  18637. "$attrsToReflect$": [["disabled", "disabled"], ["scale", "scale"]]
  18638. }; }
  18639. }
  18640. const CSS$B = {
  18641. frame: "frame",
  18642. frameAdvancing: "frame--advancing",
  18643. frameRetreating: "frame--retreating"
  18644. };
  18645. const flowCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-flow:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-flow{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-flow{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-flow{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-flow{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-flow{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-flow:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-flow-h{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-flow-h *.sc-calcite-flow{box-sizing:border-box}/*!@:root*/.sc-calcite-flow:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-flow-h{display:none}/*!@:host*/.sc-calcite-flow-h{position:relative;display:flex;inline-size:100%;flex:1 1 auto;align-items:stretch;overflow:hidden;background-color:transparent}/*!@:host .frame*/.sc-calcite-flow-h .frame.sc-calcite-flow{position:relative;margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;padding:0px}/*!@:host ::slotted(calcite-flow-item), \n:host ::slotted(calcite-panel)*/.sc-calcite-flow-h .sc-calcite-flow-s>calcite-flow-item,.sc-calcite-flow-h .sc-calcite-flow-s>calcite-panel{block-size:100%}/*!@:host ::slotted(.calcite-match-height:last-child)*/.sc-calcite-flow-h .sc-calcite-flow-s>.calcite-match-height:last-child{display:flex;flex:1 1 auto;overflow:hidden}/*!@:host .frame--advancing*/.sc-calcite-flow-h .frame--advancing.sc-calcite-flow{animation:calcite-frame-advance var(--calcite-animation-timing)}/*!@:host .frame--retreating*/.sc-calcite-flow-h .frame--retreating.sc-calcite-flow{animation:calcite-frame-retreat var(--calcite-animation-timing)}@keyframes calcite-frame-advance{0%{--tw-bg-opacity:0.5;transform:translate3d(50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}@keyframes calcite-frame-retreat{0%{--tw-bg-opacity:0.5;transform:translate3d(-50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}";
  18646. /**
  18647. * @slot - A slot for adding `calcite-flow-item` or `calcite-panel`s (deprecated) to the flow.
  18648. */
  18649. class Flow {
  18650. constructor(hostRef) {
  18651. registerInstance(this, hostRef);
  18652. this.flowDirection = null;
  18653. this.itemCount = 0;
  18654. this.items = [];
  18655. this.itemMutationObserver = createObserver();
  18656. this.getFlowDirection = (oldFlowItemCount, newFlowItemCount) => {
  18657. const allowRetreatingDirection = oldFlowItemCount > 1;
  18658. const allowAdvancingDirection = oldFlowItemCount && newFlowItemCount > 1;
  18659. if (!allowAdvancingDirection && !allowRetreatingDirection) {
  18660. return null;
  18661. }
  18662. return newFlowItemCount < oldFlowItemCount ? "retreating" : "advancing";
  18663. };
  18664. this.updateFlowProps = () => {
  18665. const { el, items } = this;
  18666. const newItems = Array.from(el.querySelectorAll("calcite-flow-item, calcite-panel")).filter((flowItem) => !flowItem.matches("calcite-flow-item calcite-flow-item, calcite-panel calcite-panel"));
  18667. const oldItemCount = items.length;
  18668. const newItemCount = newItems.length;
  18669. const activeItem = newItems[newItemCount - 1];
  18670. const previousItem = newItems[newItemCount - 2];
  18671. if (newItemCount && activeItem) {
  18672. newItems.forEach((itemNode) => {
  18673. itemNode.showBackButton = itemNode === activeItem && newItemCount > 1;
  18674. itemNode.hidden = itemNode !== activeItem;
  18675. });
  18676. }
  18677. if (previousItem) {
  18678. previousItem.menuOpen = false;
  18679. }
  18680. this.items = newItems;
  18681. if (oldItemCount !== newItemCount) {
  18682. const flowDirection = this.getFlowDirection(oldItemCount, newItemCount);
  18683. this.itemCount = newItemCount;
  18684. this.flowDirection = flowDirection;
  18685. }
  18686. };
  18687. }
  18688. // --------------------------------------------------------------------------
  18689. //
  18690. // Public Methods
  18691. //
  18692. // --------------------------------------------------------------------------
  18693. /**
  18694. * Removes the currently active `calcite-flow-item` or `calcite-panel`.
  18695. */
  18696. async back() {
  18697. const { items } = this;
  18698. const lastItem = items[items.length - 1];
  18699. if (!lastItem) {
  18700. return;
  18701. }
  18702. const beforeBack = lastItem.beforeBack
  18703. ? lastItem.beforeBack
  18704. : () => Promise.resolve();
  18705. return beforeBack.call(lastItem).then(() => {
  18706. lastItem.remove();
  18707. return lastItem;
  18708. });
  18709. }
  18710. // --------------------------------------------------------------------------
  18711. //
  18712. // Lifecycle
  18713. //
  18714. // --------------------------------------------------------------------------
  18715. connectedCallback() {
  18716. var _a;
  18717. (_a = this.itemMutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  18718. this.updateFlowProps();
  18719. }
  18720. disconnectedCallback() {
  18721. var _a;
  18722. (_a = this.itemMutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  18723. }
  18724. // --------------------------------------------------------------------------
  18725. //
  18726. // Private Methods
  18727. //
  18728. // --------------------------------------------------------------------------
  18729. handleItemBackClick() {
  18730. this.back();
  18731. }
  18732. // --------------------------------------------------------------------------
  18733. //
  18734. // Render Methods
  18735. //
  18736. // --------------------------------------------------------------------------
  18737. render() {
  18738. const { flowDirection } = this;
  18739. const frameDirectionClasses = {
  18740. [CSS$B.frame]: true,
  18741. [CSS$B.frameAdvancing]: flowDirection === "advancing",
  18742. [CSS$B.frameRetreating]: flowDirection === "retreating"
  18743. };
  18744. return (hAsync("div", { class: frameDirectionClasses }, hAsync("slot", null)));
  18745. }
  18746. get el() { return getElement(this); }
  18747. static get style() { return flowCss; }
  18748. static get cmpMeta() { return {
  18749. "$flags$": 9,
  18750. "$tagName$": "calcite-flow",
  18751. "$members$": {
  18752. "flowDirection": [32],
  18753. "itemCount": [32],
  18754. "items": [32],
  18755. "back": [64]
  18756. },
  18757. "$listeners$": [[0, "calciteFlowItemBackClick", "handleItemBackClick"], [0, "calcitePanelBackClick", "handleItemBackClick"]],
  18758. "$lazyBundleId$": "-",
  18759. "$attrsToReflect$": []
  18760. }; }
  18761. }
  18762. const CSS$A = {
  18763. backButton: "back-button"
  18764. };
  18765. const ICONS$8 = {
  18766. backLeft: "chevron-left",
  18767. backRight: "chevron-right"
  18768. };
  18769. const TEXT$g = {
  18770. back: "Back"
  18771. };
  18772. const SLOTS$j = {
  18773. headerActionsStart: "header-actions-start",
  18774. headerActionsEnd: "header-actions-end",
  18775. headerMenuActions: "header-menu-actions",
  18776. headerContent: "header-content",
  18777. fab: "fab",
  18778. footer: "footer",
  18779. footerActions: "footer-actions"
  18780. };
  18781. const CSS$z = {
  18782. backButton: "back-button",
  18783. container: "container",
  18784. header: "header",
  18785. heading: "heading",
  18786. summary: "summary",
  18787. description: "description",
  18788. headerContent: "header-content",
  18789. headerActions: "header-actions",
  18790. headerActionsEnd: "header-actions--end",
  18791. headerActionsStart: "header-actions--start",
  18792. contentWrapper: "content-wrapper",
  18793. contentContainer: "content-container",
  18794. contentHeight: "content-height",
  18795. fabContainer: "fab-container",
  18796. footer: "footer"
  18797. };
  18798. const ICONS$7 = {
  18799. close: "x",
  18800. menu: "ellipsis",
  18801. backLeft: "chevron-left",
  18802. backRight: "chevron-right"
  18803. };
  18804. const SLOTS$i = {
  18805. headerActionsStart: "header-actions-start",
  18806. headerActionsEnd: "header-actions-end",
  18807. headerMenuActions: "header-menu-actions",
  18808. headerContent: "header-content",
  18809. fab: "fab",
  18810. footer: "footer",
  18811. footerActions: "footer-actions"
  18812. };
  18813. const TEXT$f = {
  18814. back: "Back",
  18815. close: "Close",
  18816. open: "Open",
  18817. options: "Options"
  18818. };
  18819. const HEADING_LEVEL$5 = 3;
  18820. const flowItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-flow-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-flow-item{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-flow-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-flow-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-flow-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-flow-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-flow-item:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-flow-item-h{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-flow-item-h *.sc-calcite-flow-item{box-sizing:border-box}/*!@:root*/.sc-calcite-flow-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-flow-item-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-flow-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-flow-item-h{position:relative;display:flex;inline-size:100%;flex:1 1 auto;overflow:hidden}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-flow-item-h[disabled] .sc-calcite-flow-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-flow-item-h [calcite-hydrated][disabled].sc-calcite-flow-item{opacity:1}/*!@.back-button*/.back-button.sc-calcite-flow-item{border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);border-inline-end-width:1px}";
  18821. /**
  18822. * @slot - A slot for adding custom content.
  18823. * @slot header-actions-start - A slot for adding actions or content to the start side of the header.
  18824. * @slot header-actions-end - A slot for adding actions or content to the end side of the header.
  18825. * @slot header-content - A slot for adding custom content to the header.
  18826. * @slot header-menu-actions - A slot for adding an overflow menu with actions inside a `calcite-dropdown`.
  18827. * @slot fab - A slot for adding a `calcite-fab` (floating action button) to perform an action.
  18828. * @slot footer-actions - A slot for adding buttons to the footer.
  18829. * @slot footer - A slot for adding custom content to the footer.
  18830. */
  18831. class FlowItem {
  18832. constructor(hostRef) {
  18833. registerInstance(this, hostRef);
  18834. this.calciteFlowItemBack = createEvent(this, "calciteFlowItemBack", 6);
  18835. this.calciteFlowItemBackClick = createEvent(this, "calciteFlowItemBackClick", 6);
  18836. this.calciteFlowItemScroll = createEvent(this, "calciteFlowItemScroll", 6);
  18837. this.calciteFlowItemClose = createEvent(this, "calciteFlowItemClose", 6);
  18838. // --------------------------------------------------------------------------
  18839. //
  18840. // Properties
  18841. //
  18842. // --------------------------------------------------------------------------
  18843. /** When true, displays a close button in the trailing side of the header */
  18844. this.closable = false;
  18845. /** When true, flow-item will be hidden */
  18846. this.closed = false;
  18847. /**
  18848. * When true, interaction is prevented and the component is displayed with lower opacity.
  18849. */
  18850. this.disabled = false;
  18851. /**
  18852. * When true, a busy indicator is displayed.
  18853. */
  18854. this.loading = false;
  18855. /**
  18856. * When true, the action menu items in the `header-menu-actions` slot are open.
  18857. */
  18858. this.menuOpen = false;
  18859. /**
  18860. * When true, displays a back button in the header.
  18861. */
  18862. this.showBackButton = false;
  18863. // --------------------------------------------------------------------------
  18864. //
  18865. // Private Methods
  18866. //
  18867. // --------------------------------------------------------------------------
  18868. this.handlePanelScroll = (event) => {
  18869. event.stopPropagation();
  18870. this.calciteFlowItemScroll.emit();
  18871. };
  18872. this.handlePanelClose = (event) => {
  18873. event.stopPropagation();
  18874. this.calciteFlowItemClose.emit();
  18875. };
  18876. this.backButtonClick = () => {
  18877. this.calciteFlowItemBackClick.emit();
  18878. this.calciteFlowItemBack.emit();
  18879. };
  18880. this.setBackRef = (node) => {
  18881. this.backButtonEl = node;
  18882. };
  18883. this.setContainerRef = (node) => {
  18884. this.containerEl = node;
  18885. };
  18886. this.getBackLabel = () => {
  18887. return this.intlBack || TEXT$g.back;
  18888. };
  18889. }
  18890. //--------------------------------------------------------------------------
  18891. //
  18892. // Lifecycle
  18893. //
  18894. //--------------------------------------------------------------------------
  18895. componentDidRender() {
  18896. updateHostInteraction(this);
  18897. }
  18898. // --------------------------------------------------------------------------
  18899. //
  18900. // Methods
  18901. //
  18902. // --------------------------------------------------------------------------
  18903. /**
  18904. * Sets focus on the component.
  18905. */
  18906. async setFocus() {
  18907. const { backButtonEl, containerEl } = this;
  18908. if (backButtonEl) {
  18909. backButtonEl.setFocus();
  18910. return;
  18911. }
  18912. containerEl === null || containerEl === void 0 ? void 0 : containerEl.setFocus();
  18913. }
  18914. /**
  18915. * Scrolls the component's content to a specified set of coordinates.
  18916. *
  18917. * @example
  18918. * myCalciteFlowItem.scrollContentTo({
  18919. * left: 0, // Specifies the number of pixels along the X axis to scroll the window or element.
  18920. * top: 0, // Specifies the number of pixels along the Y axis to scroll the window or element
  18921. * behavior: "auto" // Specifies whether the scrolling should animate smoothly (smooth), or happen instantly in a single jump (auto, the default value).
  18922. * });
  18923. * @param options
  18924. */
  18925. async scrollContentTo(options) {
  18926. var _a;
  18927. await ((_a = this.containerEl) === null || _a === void 0 ? void 0 : _a.scrollContentTo(options));
  18928. }
  18929. // --------------------------------------------------------------------------
  18930. //
  18931. // Render Methods
  18932. //
  18933. // --------------------------------------------------------------------------
  18934. renderBackButton() {
  18935. const { el } = this;
  18936. const rtl = getElementDir(el) === "rtl";
  18937. const { showBackButton, backButtonClick } = this;
  18938. const label = this.getBackLabel();
  18939. const icon = rtl ? ICONS$8.backRight : ICONS$8.backLeft;
  18940. return showBackButton ? (hAsync("calcite-action", { "aria-label": label, class: CSS$A.backButton, icon: icon, key: "flow-back-button", onClick: backButtonClick, ref: this.setBackRef, scale: "s", slot: "header-actions-start", text: label })) : null;
  18941. }
  18942. render() {
  18943. const { closable, closed, description, disabled, heading, headingLevel, heightScale, intlBack, intlClose, intlOptions, loading, menuOpen, widthScale, backButtonEl } = this;
  18944. const label = this.getBackLabel();
  18945. return (hAsync(Host, null, hAsync("calcite-panel", { closable: closable, closed: closed, description: description, disabled: disabled, heading: heading, headingLevel: headingLevel, heightScale: heightScale, intlBack: intlBack, intlClose: intlClose, intlOptions: intlOptions, loading: loading, menuOpen: menuOpen, onCalcitePanelClose: this.handlePanelClose, onCalcitePanelScroll: this.handlePanelScroll, ref: this.setContainerRef, widthScale: widthScale }, this.renderBackButton(), hAsync("slot", { name: SLOTS$j.headerActionsStart, slot: SLOTS$i.headerActionsStart }), hAsync("slot", { name: SLOTS$j.headerActionsEnd, slot: SLOTS$i.headerActionsEnd }), hAsync("slot", { name: SLOTS$j.headerContent, slot: SLOTS$i.headerContent }), hAsync("slot", { name: SLOTS$j.headerMenuActions, slot: SLOTS$i.headerMenuActions }), hAsync("slot", { name: SLOTS$j.fab, slot: SLOTS$i.fab }), hAsync("slot", { name: SLOTS$j.footerActions, slot: SLOTS$i.footerActions }), hAsync("slot", { name: SLOTS$j.footer, slot: SLOTS$i.footer }), hAsync("slot", null)), backButtonEl ? (hAsync("calcite-tooltip", { label: label, placement: "auto", referenceElement: backButtonEl }, label)) : null));
  18946. }
  18947. get el() { return getElement(this); }
  18948. static get style() { return flowItemCss; }
  18949. static get cmpMeta() { return {
  18950. "$flags$": 9,
  18951. "$tagName$": "calcite-flow-item",
  18952. "$members$": {
  18953. "closable": [1540],
  18954. "closed": [1540],
  18955. "beforeBack": [16],
  18956. "description": [1],
  18957. "disabled": [516],
  18958. "heading": [1],
  18959. "headingLevel": [514, "heading-level"],
  18960. "heightScale": [513, "height-scale"],
  18961. "intlBack": [1, "intl-back"],
  18962. "intlClose": [1, "intl-close"],
  18963. "intlOptions": [1, "intl-options"],
  18964. "loading": [516],
  18965. "menuOpen": [516, "menu-open"],
  18966. "showBackButton": [516, "show-back-button"],
  18967. "widthScale": [513, "width-scale"],
  18968. "backButtonEl": [32],
  18969. "setFocus": [64],
  18970. "scrollContentTo": [64]
  18971. },
  18972. "$listeners$": undefined,
  18973. "$lazyBundleId$": "-",
  18974. "$attrsToReflect$": [["closable", "closable"], ["closed", "closed"], ["disabled", "disabled"], ["headingLevel", "heading-level"], ["heightScale", "height-scale"], ["loading", "loading"], ["menuOpen", "menu-open"], ["showBackButton", "show-back-button"], ["widthScale", "width-scale"]]
  18975. }; }
  18976. }
  18977. /**
  18978. * Calculate slope of the tangents
  18979. * uses Steffen interpolation as it's monotonic
  18980. * http://jrwalsh1.github.io/posts/interpolations/
  18981. *
  18982. * @param p0
  18983. * @param p1
  18984. * @param p2
  18985. */
  18986. function slope(p0, p1, p2) {
  18987. const dx = p1[0] - p0[0];
  18988. const dx1 = p2[0] - p1[0];
  18989. const dy = p1[1] - p0[1];
  18990. const dy1 = p2[1] - p1[1];
  18991. const m = dy / (dx || (dx1 < 0 && 0));
  18992. const m1 = dy1 / (dx1 || (dx < 0 && 0));
  18993. const p = (m * dx1 + m1 * dx) / (dx + dx1);
  18994. return (Math.sign(m) + Math.sign(m1)) * Math.min(Math.abs(m), Math.abs(m1), 0.5 * Math.abs(p)) || 0;
  18995. }
  18996. /**
  18997. * Calculate slope for just one tangent (single-sided)
  18998. *
  18999. * @param p0
  19000. * @param p1
  19001. * @param m
  19002. */
  19003. function slopeSingle(p0, p1, m) {
  19004. const dx = p1[0] - p0[0];
  19005. const dy = p1[1] - p0[1];
  19006. return dx ? ((3 * dy) / dx - m) / 2 : m;
  19007. }
  19008. /**
  19009. * Given two points and their tangent slopes,
  19010. * calculate the bezier handle coordinates and return draw command.
  19011. *
  19012. * Translates Hermite Spline to Beziér curve:
  19013. * stackoverflow.com/questions/42574940/
  19014. *
  19015. * @param p0
  19016. * @param p1
  19017. * @param m0
  19018. * @param m1
  19019. * @param t
  19020. */
  19021. function bezier(p0, p1, m0, m1, t) {
  19022. const [x0, y0] = p0;
  19023. const [x1, y1] = p1;
  19024. const dx = (x1 - x0) / 3;
  19025. const h1 = t([x0 + dx, y0 + dx * m0]).join(",");
  19026. const h2 = t([x1 - dx, y1 - dx * m1]).join(",");
  19027. const p = t([x1, y1]).join(",");
  19028. return `C ${h1} ${h2} ${p}`;
  19029. }
  19030. /**
  19031. * Generate a function which will translate a point
  19032. * from the data coordinate space to svg viewbox oriented pixels
  19033. *
  19034. * @param root0
  19035. * @param root0.width
  19036. * @param root0.height
  19037. * @param root0.min
  19038. * @param root0.max
  19039. */
  19040. function translate({ width, height, min, max }) {
  19041. const rangeX = max[0] - min[0];
  19042. const rangeY = max[1] - min[1];
  19043. return (point) => {
  19044. const x = ((point[0] - min[0]) / rangeX) * width;
  19045. const y = height - (point[1] / rangeY) * height;
  19046. return [x, y];
  19047. };
  19048. }
  19049. /**
  19050. * Get the min and max values from the dataset
  19051. *
  19052. * @param data
  19053. */
  19054. function range(data) {
  19055. const [startX, startY] = data[0];
  19056. const min = [startX, startY];
  19057. const max = [startX, startY];
  19058. return data.reduce(({ min, max }, [x, y]) => ({
  19059. min: [Math.min(min[0], x), Math.min(min[1], y)],
  19060. max: [Math.max(max[0], x), Math.max(max[1], y)]
  19061. }), { min, max });
  19062. }
  19063. /**
  19064. * Generate drawing commands for an area graph
  19065. * returns a string can can be passed directly to a path element's `d` attribute
  19066. *
  19067. * @param root0
  19068. * @param root0.data
  19069. * @param root0.min
  19070. * @param root0.max
  19071. * @param root0.t
  19072. */
  19073. function area({ data, min, max, t }) {
  19074. if (data.length === 0) {
  19075. return "";
  19076. }
  19077. // important points for beginning and ending the path
  19078. const [startX, startY] = t(data[0]);
  19079. const [minX, minY] = t(min);
  19080. const [maxX] = t(max);
  19081. // keep track of previous slope/points
  19082. let m;
  19083. let p0;
  19084. let p1;
  19085. // iterate over data points, calculating command for each
  19086. const commands = data.reduce((acc, point, i) => {
  19087. p0 = data[i - 2];
  19088. p1 = data[i - 1];
  19089. if (i > 1) {
  19090. const m1 = slope(p0, p1, point);
  19091. const m0 = m === undefined ? slopeSingle(p0, p1, m1) : m;
  19092. const command = bezier(p0, p1, m0, m1, t);
  19093. m = m1;
  19094. return `${acc} ${command}`;
  19095. }
  19096. return acc;
  19097. }, `M ${minX},${minY} L ${minX},${startY} L ${startX},${startY}`);
  19098. // close the path
  19099. const last = data[data.length - 1];
  19100. const end = bezier(p1, last, m, slopeSingle(p1, last, m), t);
  19101. return `${commands} ${end} L ${maxX},${minY} Z`;
  19102. }
  19103. const graphCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-graph:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-graph{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-graph{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-graph{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-graph{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-graph{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-graph:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-graph:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-graph-h{display:none}/*!@:host*/.sc-calcite-graph-h{display:block;block-size:100%}/*!@.svg*/.svg.sc-calcite-graph{fill:currentColor;stroke:transparent;margin:0px;display:block;block-size:100%;inline-size:100%;padding:0px}/*!@.svg .graph-path--highlight*/.svg.sc-calcite-graph .graph-path--highlight.sc-calcite-graph{fill:var(--calcite-ui-brand);opacity:0.5}";
  19104. class Graph {
  19105. constructor(hostRef) {
  19106. registerInstance(this, hostRef);
  19107. //--------------------------------------------------------------------------
  19108. //
  19109. // Properties
  19110. //
  19111. //--------------------------------------------------------------------------
  19112. /**
  19113. * Array of tuples describing a single data point ([x, y])
  19114. * These data points should be sorted by x-axis value
  19115. */
  19116. this.data = [];
  19117. //--------------------------------------------------------------------------
  19118. //
  19119. // Private State/Props
  19120. //
  19121. //--------------------------------------------------------------------------
  19122. this.graphId = `calcite-graph-${guid()}`;
  19123. this.resizeObserver = createObserver();
  19124. }
  19125. //--------------------------------------------------------------------------
  19126. //
  19127. // Lifecycle
  19128. //
  19129. //--------------------------------------------------------------------------
  19130. connectedCallback() {
  19131. var _a;
  19132. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el);
  19133. }
  19134. disconnectedCallback() {
  19135. var _a;
  19136. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  19137. }
  19138. render() {
  19139. const { data, colorStops, el, highlightMax, highlightMin, min, max } = this;
  19140. const id = this.graphId;
  19141. const { clientHeight: height, clientWidth: width } = el;
  19142. // if we have no data, return empty svg
  19143. if (!data || data.length === 0) {
  19144. return (hAsync("svg", { class: "svg", height: height, preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, width: width }));
  19145. }
  19146. const { min: rangeMin, max: rangeMax } = range(data);
  19147. let currentMin = rangeMin;
  19148. let currentMax = rangeMax;
  19149. if (min < rangeMin[0] || min > rangeMin[0]) {
  19150. currentMin = [min, 0];
  19151. }
  19152. if (max > rangeMax[0] || max < rangeMax[0]) {
  19153. currentMax = [max, rangeMax[1]];
  19154. }
  19155. const t = translate({ min: currentMin, max: currentMax, width, height });
  19156. const [hMinX] = t([highlightMin, currentMax[1]]);
  19157. const [hMaxX] = t([highlightMax, currentMax[1]]);
  19158. const areaPath = area({ data, min: rangeMin, max: rangeMax, t });
  19159. const fill = colorStops ? `url(#linear-gradient-${id})` : undefined;
  19160. return (hAsync("svg", { class: "svg", height: height, preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, width: width }, colorStops ? (hAsync("defs", null, hAsync("linearGradient", { id: `linear-gradient-${id}`, x1: "0", x2: "1", y1: "0", y2: "0" }, colorStops.map(({ offset, color, opacity }) => (hAsync("stop", { offset: `${offset * 100}%`, "stop-color": color, "stop-opacity": opacity })))))) : null, highlightMin !== undefined ? ([
  19161. hAsync("mask", { height: "100%", id: `${id}1`, width: "100%", x: "0%", y: "0%" }, hAsync("path", { d: `
  19162. M 0,0
  19163. L ${hMinX - 1},0
  19164. L ${hMinX - 1},${height}
  19165. L 0,${height}
  19166. Z
  19167. `, fill: "white" })),
  19168. hAsync("mask", { height: "100%", id: `${id}2`, width: "100%", x: "0%", y: "0%" }, hAsync("path", { d: `
  19169. M ${hMinX + 1},0
  19170. L ${hMaxX - 1},0
  19171. L ${hMaxX - 1},${height}
  19172. L ${hMinX + 1}, ${height}
  19173. Z
  19174. `, fill: "white" })),
  19175. hAsync("mask", { height: "100%", id: `${id}3`, width: "100%", x: "0%", y: "0%" }, hAsync("path", { d: `
  19176. M ${hMaxX + 1},0
  19177. L ${width},0
  19178. L ${width},${height}
  19179. L ${hMaxX + 1}, ${height}
  19180. Z
  19181. `, fill: "white" })),
  19182. hAsync("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}1)` }),
  19183. hAsync("path", { class: "graph-path--highlight", d: areaPath, fill: fill, mask: `url(#${id}2)` }),
  19184. hAsync("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}3)` })
  19185. ]) : (hAsync("path", { class: "graph-path", d: areaPath, fill: fill }))));
  19186. }
  19187. get el() { return getElement(this); }
  19188. static get style() { return graphCss; }
  19189. static get cmpMeta() { return {
  19190. "$flags$": 9,
  19191. "$tagName$": "calcite-graph",
  19192. "$members$": {
  19193. "data": [16],
  19194. "colorStops": [16],
  19195. "highlightMin": [2, "highlight-min"],
  19196. "highlightMax": [2, "highlight-max"],
  19197. "min": [514],
  19198. "max": [514]
  19199. },
  19200. "$listeners$": undefined,
  19201. "$lazyBundleId$": "-",
  19202. "$attrsToReflect$": [["min", "min"], ["max", "max"]]
  19203. }; }
  19204. }
  19205. const CSS$y = {
  19206. handle: "handle",
  19207. handleActivated: "handle--activated"
  19208. };
  19209. const ICONS$6 = {
  19210. drag: "drag"
  19211. };
  19212. const handleCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-handle:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-handle{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-handle{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-handle{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-handle{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-handle{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-handle:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-handle:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-handle-h{display:none}/*!@:host*/.sc-calcite-handle-h{display:flex}/*!@.handle*/.handle.sc-calcite-handle{display:flex;cursor:move;align-items:center;justify-content:center;align-self:stretch;border-style:none;background-color:transparent;outline-color:transparent;color:var(--calcite-ui-border-input);padding-block:0.75rem;padding-inline:0.25rem;line-height:0}/*!@.handle:hover*/.handle.sc-calcite-handle:hover{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@.handle:focus*/.handle.sc-calcite-handle:focus{color:var(--calcite-ui-text-1);outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.handle--activated*/.handle--activated.sc-calcite-handle{background-color:var(--calcite-ui-foreground-3);color:var(--calcite-ui-text-1)}/*!@.handle calcite-icon*/.handle.sc-calcite-handle calcite-icon.sc-calcite-handle{color:inherit}";
  19213. class Handle {
  19214. constructor(hostRef) {
  19215. registerInstance(this, hostRef);
  19216. this.calciteHandleNudge = createEvent(this, "calciteHandleNudge", 6);
  19217. // --------------------------------------------------------------------------
  19218. //
  19219. // Properties
  19220. //
  19221. // --------------------------------------------------------------------------
  19222. /**
  19223. * @internal
  19224. */
  19225. this.activated = false;
  19226. /**
  19227. * Value for the button title attribute
  19228. */
  19229. this.textTitle = "handle";
  19230. // --------------------------------------------------------------------------
  19231. //
  19232. // Private Methods
  19233. //
  19234. // --------------------------------------------------------------------------
  19235. this.handleKeyDown = (event) => {
  19236. switch (event.key) {
  19237. case " ":
  19238. this.activated = !this.activated;
  19239. event.preventDefault();
  19240. break;
  19241. case "ArrowUp":
  19242. case "ArrowDown":
  19243. if (!this.activated) {
  19244. return;
  19245. }
  19246. event.preventDefault();
  19247. const direction = event.key.toLowerCase().replace("arrow", "");
  19248. this.calciteHandleNudge.emit({ handle: this.el, direction });
  19249. break;
  19250. }
  19251. };
  19252. this.handleBlur = () => {
  19253. this.activated = false;
  19254. };
  19255. }
  19256. // --------------------------------------------------------------------------
  19257. //
  19258. // Methods
  19259. //
  19260. // --------------------------------------------------------------------------
  19261. /** Sets focus on the component. */
  19262. async setFocus() {
  19263. var _a;
  19264. (_a = this.handleButton) === null || _a === void 0 ? void 0 : _a.focus();
  19265. }
  19266. // --------------------------------------------------------------------------
  19267. //
  19268. // Render Methods
  19269. //
  19270. // --------------------------------------------------------------------------
  19271. render() {
  19272. return (
  19273. // Needs to be a span because of https://github.com/SortableJS/Sortable/issues/1486
  19274. hAsync("span", { "aria-pressed": toAriaBoolean(this.activated), class: { [CSS$y.handle]: true, [CSS$y.handleActivated]: this.activated }, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
  19275. this.handleButton = el;
  19276. }, role: "button", tabindex: "0", title: this.textTitle }, hAsync("calcite-icon", { icon: ICONS$6.drag, scale: "s" })));
  19277. }
  19278. get el() { return getElement(this); }
  19279. static get style() { return handleCss; }
  19280. static get cmpMeta() { return {
  19281. "$flags$": 9,
  19282. "$tagName$": "calcite-handle",
  19283. "$members$": {
  19284. "activated": [1540],
  19285. "textTitle": [513, "text-title"],
  19286. "setFocus": [64]
  19287. },
  19288. "$listeners$": undefined,
  19289. "$lazyBundleId$": "-",
  19290. "$attrsToReflect$": [["activated", "activated"], ["textTitle", "text-title"]]
  19291. }; }
  19292. }
  19293. const CSS$x = {
  19294. icon: "icon",
  19295. flipRtl: "flip-rtl"
  19296. };
  19297. const scaleToPx = {
  19298. s: 16,
  19299. m: 24,
  19300. l: 32
  19301. };
  19302. const iconCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-icon:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-icon{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-icon{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-icon{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-icon{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-icon{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-icon:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-icon:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-icon-h{display:none}/*!@:host*/.sc-calcite-icon-h{display:inline-flex;color:var(--calcite-ui-icon-color)}/*!@:host([scale=s])*/[scale=s].sc-calcite-icon-h{block-size:1rem;inline-size:1rem;min-inline-size:1rem;min-block-size:1rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-icon-h{block-size:1.5rem;inline-size:1.5rem;min-inline-size:1.5rem;min-block-size:1.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-icon-h{block-size:2rem;inline-size:2rem;min-inline-size:2rem;min-block-size:2rem}/*!@.flip-rtl*/.flip-rtl.sc-calcite-icon{transform:scaleX(-1)}/*!@.svg*/.svg.sc-calcite-icon{display:block}";
  19303. class Icon {
  19304. constructor(hostRef) {
  19305. registerInstance(this, hostRef);
  19306. //--------------------------------------------------------------------------
  19307. //
  19308. // Properties
  19309. //
  19310. //--------------------------------------------------------------------------
  19311. /**
  19312. * The name of the icon to display. The value of this property must match the icon name from https://esri.github.io/calcite-ui-icons/.
  19313. */
  19314. this.icon = null;
  19315. /**
  19316. * When true, the icon will be flipped when the element direction is 'rtl'.
  19317. */
  19318. this.flipRtl = false;
  19319. /**
  19320. * Icon scale.
  19321. */
  19322. this.scale = "m";
  19323. this.visible = false;
  19324. }
  19325. //--------------------------------------------------------------------------
  19326. //
  19327. // Lifecycle
  19328. //
  19329. //--------------------------------------------------------------------------
  19330. connectedCallback() {
  19331. this.waitUntilVisible(() => {
  19332. this.visible = true;
  19333. this.loadIconPathData();
  19334. });
  19335. }
  19336. disconnectedCallback() {
  19337. var _a;
  19338. (_a = this.intersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  19339. this.intersectionObserver = null;
  19340. }
  19341. async componentWillLoad() {
  19342. this.loadIconPathData();
  19343. }
  19344. render() {
  19345. const { el, flipRtl, pathData, scale, textLabel } = this;
  19346. const dir = getElementDir(el);
  19347. const size = scaleToPx[scale];
  19348. const semantic = !!textLabel;
  19349. const paths = [].concat(pathData || "");
  19350. return (hAsync(Host, { "aria-hidden": toAriaBoolean(!semantic), "aria-label": semantic ? textLabel : null, role: semantic ? "img" : null }, hAsync("svg", { class: {
  19351. [CSS$x.flipRtl]: dir === "rtl" && flipRtl,
  19352. svg: true
  19353. }, fill: "currentColor", height: "100%", viewBox: `0 0 ${size} ${size}`, width: "100%", xmlns: "http://www.w3.org/2000/svg" }, paths.map((path) => typeof path === "string" ? (hAsync("path", { d: path })) : (hAsync("path", { d: path.d, opacity: "opacity" in path ? path.opacity : 1 }))))));
  19354. }
  19355. //--------------------------------------------------------------------------
  19356. //
  19357. // Private Methods
  19358. //
  19359. //--------------------------------------------------------------------------
  19360. async loadIconPathData() {
  19361. {
  19362. return;
  19363. }
  19364. }
  19365. waitUntilVisible(callback) {
  19366. this.intersectionObserver = createObserver();
  19367. if (!this.intersectionObserver) {
  19368. callback();
  19369. return;
  19370. }
  19371. this.intersectionObserver.observe(this.el);
  19372. }
  19373. static get assetsDirs() { return ["assets"]; }
  19374. get el() { return getElement(this); }
  19375. static get watchers() { return {
  19376. "icon": ["loadIconPathData"],
  19377. "scale": ["loadIconPathData"]
  19378. }; }
  19379. static get style() { return iconCss; }
  19380. static get cmpMeta() { return {
  19381. "$flags$": 9,
  19382. "$tagName$": "calcite-icon",
  19383. "$members$": {
  19384. "icon": [513],
  19385. "flipRtl": [516, "flip-rtl"],
  19386. "scale": [513],
  19387. "textLabel": [1, "text-label"],
  19388. "pathData": [32],
  19389. "visible": [32]
  19390. },
  19391. "$listeners$": undefined,
  19392. "$lazyBundleId$": "-",
  19393. "$attrsToReflect$": [["icon", "icon"], ["flipRtl", "flip-rtl"], ["scale", "scale"]]
  19394. }; }
  19395. }
  19396. const CSS$w = {
  19397. wrapper: "wrapper",
  19398. confirmChangesButton: "confirm-changes-button",
  19399. cancelEditingButton: "cancel-editing-button",
  19400. inputWrapper: "input-wrapper",
  19401. cancelEditingButtonWrapper: "cancel-editing-button-wrapper",
  19402. enableEditingButton: "enable-editing-button",
  19403. controlsWrapper: "controls-wrapper"
  19404. };
  19405. const TEXT$e = {
  19406. intlEnablingEditing: "Click to edit",
  19407. intlCancelEditing: "Cancel",
  19408. intlConfirmChanges: "Save"
  19409. };
  19410. const inlineEditableCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-inline-editable:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-inline-editable{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-inline-editable{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-inline-editable{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-inline-editable{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-inline-editable{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-inline-editable:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-inline-editable:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-inline-editable-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-inline-editable-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-inline-editable-h{display:block}/*!@:host([scale=s]) .controls-wrapper*/[scale=s].sc-calcite-inline-editable-h .controls-wrapper.sc-calcite-inline-editable{block-size:1.5rem}/*!@:host([scale=m]) .controls-wrapper*/[scale=m].sc-calcite-inline-editable-h .controls-wrapper.sc-calcite-inline-editable{block-size:2rem}/*!@:host([scale=l]) .controls-wrapper*/[scale=l].sc-calcite-inline-editable-h .controls-wrapper.sc-calcite-inline-editable{block-size:2.75rem}/*!@:host(:not([editing-enabled]):not([disabled])) .wrapper:hover*/.sc-calcite-inline-editable-h:not([editing-enabled]):not([disabled]) .wrapper.sc-calcite-inline-editable:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.wrapper*/.wrapper.sc-calcite-inline-editable{box-sizing:border-box;display:flex;justify-content:space-between;background-color:var(--calcite-ui-foreground-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.wrapper .input-wrapper*/.wrapper.sc-calcite-inline-editable .input-wrapper.sc-calcite-inline-editable{flex:1 1 0%}/*!@.controls-wrapper*/.controls-wrapper.sc-calcite-inline-editable{display:flex}/*!@:host([disabled]) .cancel-editing-button-wrapper*/[disabled].sc-calcite-inline-editable-h .cancel-editing-button-wrapper.sc-calcite-inline-editable{border-color:var(--calcite-ui-border-2)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-inline-editable-h[disabled] .sc-calcite-inline-editable-s>[calcite-hydrated][disabled],[disabled].sc-calcite-inline-editable-h [calcite-hydrated][disabled].sc-calcite-inline-editable{opacity:1}";
  19411. /**
  19412. * @slot - A slot for adding a `calcite-input`.
  19413. */
  19414. class InlineEditable {
  19415. constructor(hostRef) {
  19416. registerInstance(this, hostRef);
  19417. this.calciteInlineEditableEditCancel = createEvent(this, "calciteInlineEditableEditCancel", 6);
  19418. this.calciteInlineEditableEditConfirm = createEvent(this, "calciteInlineEditableEditConfirm", 6);
  19419. this.calciteInternalInlineEditableEnableEditingChange = createEvent(this, "calciteInternalInlineEditableEnableEditingChange", 6);
  19420. //--------------------------------------------------------------------------
  19421. //
  19422. // Props
  19423. //
  19424. //--------------------------------------------------------------------------
  19425. /** specify whether editing can be enabled */
  19426. this.disabled = false;
  19427. /** specify whether the wrapped input element is editable, defaults to false */
  19428. this.editingEnabled = false;
  19429. /** specify whether the confirm button should display a loading state, defaults to false */
  19430. this.loading = false;
  19431. /** specify whether save/cancel controls should be displayed when editingEnabled is true, defaults to false */
  19432. this.controls = false;
  19433. /**
  19434. * specify text to be user for the enable editing button's aria-label, defaults to `Click to edit`
  19435. *
  19436. * @default "Click to edit"
  19437. */
  19438. this.intlEnableEditing = TEXT$e.intlEnablingEditing;
  19439. /**
  19440. * specify text to be user for the cancel editing button's aria-label, defaults to `Cancel`
  19441. *
  19442. * @default "Cancel"
  19443. */
  19444. this.intlCancelEditing = TEXT$e.intlCancelEditing;
  19445. /**
  19446. * specify text to be user for the confirm changes button's aria-label, defaults to `Save`
  19447. *
  19448. * @default "Save"
  19449. */
  19450. this.intlConfirmChanges = TEXT$e.intlConfirmChanges;
  19451. this.mutationObserver = createObserver();
  19452. this.enableEditing = () => {
  19453. var _a, _b;
  19454. this.valuePriorToEditing = (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.value;
  19455. this.editingEnabled = true;
  19456. (_b = this.inputElement) === null || _b === void 0 ? void 0 : _b.setFocus();
  19457. this.calciteInternalInlineEditableEnableEditingChange.emit();
  19458. };
  19459. this.disableEditing = () => {
  19460. this.editingEnabled = false;
  19461. };
  19462. this.cancelEditing = () => {
  19463. if (this.inputElement) {
  19464. this.inputElement.value = this.valuePriorToEditing;
  19465. }
  19466. this.disableEditing();
  19467. this.enableEditingButton.setFocus();
  19468. if (!this.editingEnabled && !!this.shouldEmitCancel) {
  19469. this.calciteInlineEditableEditCancel.emit();
  19470. }
  19471. };
  19472. this.escapeKeyHandler = async (event) => {
  19473. var _a;
  19474. if (event.defaultPrevented) {
  19475. return;
  19476. }
  19477. if (event.key === "Escape") {
  19478. event.preventDefault();
  19479. this.cancelEditing();
  19480. }
  19481. if (event.key === "Tab" && this.shouldShowControls) {
  19482. if (!event.shiftKey && event.target === this.inputElement) {
  19483. event.preventDefault();
  19484. this.cancelEditingButton.setFocus();
  19485. }
  19486. if (!!event.shiftKey && event.target === this.cancelEditingButton) {
  19487. event.preventDefault();
  19488. (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.setFocus();
  19489. }
  19490. }
  19491. };
  19492. this.cancelEditingHandler = async (event) => {
  19493. event.preventDefault();
  19494. this.cancelEditing();
  19495. };
  19496. this.enableEditingHandler = async (event) => {
  19497. if (this.disabled ||
  19498. event.target === this.cancelEditingButton ||
  19499. event.target === this.confirmEditingButton) {
  19500. return;
  19501. }
  19502. event.preventDefault();
  19503. if (!this.editingEnabled) {
  19504. this.enableEditing();
  19505. }
  19506. };
  19507. this.confirmChangesHandler = async (event) => {
  19508. event.preventDefault();
  19509. this.calciteInlineEditableEditConfirm.emit();
  19510. try {
  19511. if (this.afterConfirm) {
  19512. this.loading = true;
  19513. await this.afterConfirm();
  19514. this.disableEditing();
  19515. this.enableEditingButton.setFocus();
  19516. }
  19517. }
  19518. catch (error) {
  19519. }
  19520. finally {
  19521. this.loading = false;
  19522. }
  19523. };
  19524. }
  19525. disabledWatcher(disabled) {
  19526. if (this.inputElement) {
  19527. this.inputElement.disabled = disabled;
  19528. }
  19529. }
  19530. editingEnabledWatcher(newValue, oldValue) {
  19531. if (this.inputElement) {
  19532. this.inputElement.editingEnabled = newValue;
  19533. }
  19534. if (!newValue && !!oldValue) {
  19535. this.shouldEmitCancel = true;
  19536. }
  19537. }
  19538. //--------------------------------------------------------------------------
  19539. //
  19540. // Lifecycle
  19541. //
  19542. //--------------------------------------------------------------------------
  19543. connectedCallback() {
  19544. var _a;
  19545. connectLabel(this);
  19546. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
  19547. this.mutationObserverCallback();
  19548. }
  19549. disconnectedCallback() {
  19550. var _a;
  19551. disconnectLabel(this);
  19552. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  19553. }
  19554. componentDidRender() {
  19555. updateHostInteraction(this);
  19556. }
  19557. render() {
  19558. return (hAsync("div", { class: CSS$w.wrapper, onClick: this.enableEditingHandler, onKeyDown: this.escapeKeyHandler }, hAsync("div", { class: CSS$w.inputWrapper }, hAsync("slot", null)), hAsync("div", { class: CSS$w.controlsWrapper }, hAsync("calcite-button", { appearance: "transparent", class: CSS$w.enableEditingButton, color: "neutral", disabled: this.disabled, iconStart: "pencil", label: this.intlEnableEditing, onClick: this.enableEditingHandler, ref: (el) => (this.enableEditingButton = el), scale: this.scale, style: {
  19559. opacity: this.editingEnabled ? "0" : "1",
  19560. width: this.editingEnabled ? "0" : "inherit"
  19561. }, type: "button" }), this.shouldShowControls && [
  19562. hAsync("div", { class: CSS$w.cancelEditingButtonWrapper }, hAsync("calcite-button", { appearance: "transparent", class: CSS$w.cancelEditingButton, color: "neutral", disabled: this.disabled, iconStart: "x", label: this.intlCancelEditing, onClick: this.cancelEditingHandler, ref: (el) => (this.cancelEditingButton = el), scale: this.scale, type: "button" })),
  19563. hAsync("calcite-button", { appearance: "solid", class: CSS$w.confirmChangesButton, color: "blue", disabled: this.disabled, iconStart: "check", label: this.intlConfirmChanges, loading: this.loading, onClick: this.confirmChangesHandler, ref: (el) => (this.confirmEditingButton = el), scale: this.scale, type: "button" })
  19564. ])));
  19565. }
  19566. //--------------------------------------------------------------------------
  19567. //
  19568. // Event Listeners
  19569. //
  19570. //--------------------------------------------------------------------------
  19571. blurHandler() {
  19572. if (!this.controls) {
  19573. this.disableEditing();
  19574. }
  19575. }
  19576. //--------------------------------------------------------------------------
  19577. //
  19578. // Public Methods
  19579. //
  19580. //--------------------------------------------------------------------------
  19581. async setFocus() {
  19582. var _a, _b;
  19583. if (this.editingEnabled) {
  19584. (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.setFocus();
  19585. }
  19586. else {
  19587. (_b = this.enableEditingButton) === null || _b === void 0 ? void 0 : _b.setFocus();
  19588. }
  19589. }
  19590. //--------------------------------------------------------------------------
  19591. //
  19592. // Private Methods
  19593. //
  19594. //--------------------------------------------------------------------------
  19595. mutationObserverCallback() {
  19596. var _a;
  19597. this.updateSlottedInput();
  19598. this.scale =
  19599. this.scale || ((_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.scale) || getElementProp(this.el, "scale", undefined);
  19600. }
  19601. onLabelClick() {
  19602. this.setFocus();
  19603. }
  19604. updateSlottedInput() {
  19605. const inputElement = getSlotted(this.el, {
  19606. matches: "calcite-input"
  19607. });
  19608. this.inputElement = inputElement;
  19609. if (!inputElement) {
  19610. return;
  19611. }
  19612. this.inputElement.disabled = this.disabled;
  19613. this.inputElement.label = this.inputElement.label || getLabelText(this);
  19614. }
  19615. get shouldShowControls() {
  19616. return this.editingEnabled && this.controls;
  19617. }
  19618. get el() { return getElement(this); }
  19619. static get watchers() { return {
  19620. "disabled": ["disabledWatcher"],
  19621. "editingEnabled": ["editingEnabledWatcher"]
  19622. }; }
  19623. static get style() { return inlineEditableCss; }
  19624. static get cmpMeta() { return {
  19625. "$flags$": 9,
  19626. "$tagName$": "calcite-inline-editable",
  19627. "$members$": {
  19628. "disabled": [516],
  19629. "editingEnabled": [1540, "editing-enabled"],
  19630. "loading": [1540],
  19631. "controls": [516],
  19632. "intlEnableEditing": [513, "intl-enable-editing"],
  19633. "intlCancelEditing": [513, "intl-cancel-editing"],
  19634. "intlConfirmChanges": [513, "intl-confirm-changes"],
  19635. "scale": [1537],
  19636. "afterConfirm": [16],
  19637. "setFocus": [64]
  19638. },
  19639. "$listeners$": [[0, "calciteInternalInputBlur", "blurHandler"]],
  19640. "$lazyBundleId$": "-",
  19641. "$attrsToReflect$": [["disabled", "disabled"], ["editingEnabled", "editing-enabled"], ["loading", "loading"], ["controls", "controls"], ["intlEnableEditing", "intl-enable-editing"], ["intlCancelEditing", "intl-cancel-editing"], ["intlConfirmChanges", "intl-confirm-changes"], ["scale", "scale"]]
  19642. }; }
  19643. }
  19644. const CSS$v = {
  19645. loader: "loader",
  19646. clearButton: "clear-button",
  19647. editingEnabled: "editing-enabled",
  19648. inlineChild: "inline-child",
  19649. inputIcon: "icon",
  19650. prefix: "prefix",
  19651. suffix: "suffix",
  19652. numberButtonWrapper: "number-button-wrapper",
  19653. buttonItemHorizontal: "number-button-item--horizontal",
  19654. wrapper: "element-wrapper",
  19655. inputWrapper: "wrapper",
  19656. actionWrapper: "action-wrapper",
  19657. resizeIconWrapper: "resize-icon-wrapper",
  19658. numberButtonItem: "number-button-item"
  19659. };
  19660. const INPUT_TYPE_ICONS = {
  19661. tel: "phone",
  19662. password: "lock",
  19663. email: "email-address",
  19664. date: "calendar",
  19665. time: "clock",
  19666. search: "search"
  19667. };
  19668. const SLOTS$h = {
  19669. action: "action"
  19670. };
  19671. const TEXT$d = {
  19672. clear: "Clear value"
  19673. };
  19674. const inputCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-input:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-input{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-input:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-input:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-input-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-input-h{display:block}/*!@:host([scale=s]) input, :host([scale=s]) .prefix, :host([scale=s]) .suffix*/[scale=s].sc-calcite-input-h input.sc-calcite-input,[scale=s].sc-calcite-input-h .prefix.sc-calcite-input,[scale=s].sc-calcite-input-h .suffix.sc-calcite-input{block-size:1.5rem;padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=s]) textarea*/[scale=s].sc-calcite-input-h textarea.sc-calcite-input{block-size:1.5rem;min-block-size:1.5rem}/*!@:host([scale=s]) .number-button-wrapper, :host([scale=s]) .action-wrapper calcite-button, :host([scale=s]) .action-wrapper calcite-button button*/[scale=s].sc-calcite-input-h .number-button-wrapper.sc-calcite-input,[scale=s].sc-calcite-input-h .action-wrapper.sc-calcite-input calcite-button.sc-calcite-input,[scale=s].sc-calcite-input-h .action-wrapper.sc-calcite-input calcite-button.sc-calcite-input button.sc-calcite-input{block-size:1.5rem}/*!@:host([scale=s]) input[type=file]*/[scale=s].sc-calcite-input-h input[type=file].sc-calcite-input{block-size:1.5rem}/*!@:host([scale=s]) .clear-button*/[scale=s].sc-calcite-input-h .clear-button.sc-calcite-input{min-block-size:1.5rem;min-inline-size:1.5rem}/*!@:host([scale=s]) textarea*/[scale=s].sc-calcite-input-h textarea.sc-calcite-input{block-size:auto;padding-block:0.25rem;padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m]) input, :host([scale=m]) .prefix, :host([scale=m]) .suffix*/[scale=m].sc-calcite-input-h input.sc-calcite-input,[scale=m].sc-calcite-input-h .prefix.sc-calcite-input,[scale=m].sc-calcite-input-h .suffix.sc-calcite-input{block-size:2rem;padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=m]) textarea*/[scale=m].sc-calcite-input-h textarea.sc-calcite-input{min-block-size:2rem}/*!@:host([scale=m]) .number-button-wrapper, :host([scale=m]) .action-wrapper calcite-button, :host([scale=m]) .action-wrapper calcite-button button*/[scale=m].sc-calcite-input-h .number-button-wrapper.sc-calcite-input,[scale=m].sc-calcite-input-h .action-wrapper.sc-calcite-input calcite-button.sc-calcite-input,[scale=m].sc-calcite-input-h .action-wrapper.sc-calcite-input calcite-button.sc-calcite-input button.sc-calcite-input{block-size:2rem}/*!@:host([scale=m]) input[type=file]*/[scale=m].sc-calcite-input-h input[type=file].sc-calcite-input{block-size:2rem}/*!@:host([scale=m]) .clear-button*/[scale=m].sc-calcite-input-h .clear-button.sc-calcite-input{min-block-size:2rem;min-inline-size:2rem}/*!@:host([scale=m]) textarea*/[scale=m].sc-calcite-input-h textarea.sc-calcite-input{block-size:auto;padding-block:0.5rem;padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l]) input, :host([scale=l]) .prefix, :host([scale=l]) .suffix*/[scale=l].sc-calcite-input-h input.sc-calcite-input,[scale=l].sc-calcite-input-h .prefix.sc-calcite-input,[scale=l].sc-calcite-input-h .suffix.sc-calcite-input{block-size:2.75rem;padding-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l]) textarea*/[scale=l].sc-calcite-input-h textarea.sc-calcite-input{min-block-size:2.75rem}/*!@:host([scale=l]) .number-button-wrapper, :host([scale=l]) .action-wrapper calcite-button, :host([scale=l]) .action-wrapper calcite-button button*/[scale=l].sc-calcite-input-h .number-button-wrapper.sc-calcite-input,[scale=l].sc-calcite-input-h .action-wrapper.sc-calcite-input calcite-button.sc-calcite-input,[scale=l].sc-calcite-input-h .action-wrapper.sc-calcite-input calcite-button.sc-calcite-input button.sc-calcite-input{block-size:2.75rem}/*!@:host([scale=l]) input[type=file]*/[scale=l].sc-calcite-input-h input[type=file].sc-calcite-input{block-size:2.75rem}/*!@:host([scale=l]) .clear-button*/[scale=l].sc-calcite-input-h .clear-button.sc-calcite-input{min-block-size:2.75rem;min-inline-size:2.75rem}/*!@:host([scale=l]) textarea*/[scale=l].sc-calcite-input-h textarea.sc-calcite-input{block-size:auto;padding-block:0.75rem;padding-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([disabled]) textarea*/[disabled].sc-calcite-input-h textarea.sc-calcite-input{resize:none}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-input-h[disabled] .sc-calcite-input-s>[calcite-hydrated][disabled],[disabled].sc-calcite-input-h [calcite-hydrated][disabled].sc-calcite-input{opacity:1}/*!@:host textarea,\n:host input*/.sc-calcite-input-h textarea.sc-calcite-input,.sc-calcite-input-h input.sc-calcite-input{transition:var(--calcite-animation-timing), block-size 0, outline-offset 0s;-webkit-appearance:none;position:relative;margin:0px;box-sizing:border-box;display:flex;max-block-size:100%;inline-size:100%;max-inline-size:100%;flex:1 1 0%;border-radius:0px;background-color:var(--calcite-ui-foreground-1);font-family:inherit;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-1)}/*!@:host input[type=search]::-webkit-search-decoration*/.sc-calcite-input-h input[type=search].sc-calcite-input::-webkit-search-decoration{-webkit-appearance:none}/*!@:host input, :host textarea*/.sc-calcite-input-h input.sc-calcite-input,.sc-calcite-input-h textarea.sc-calcite-input{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);color:var(--calcite-ui-text-1)}/*!@:host input::placeholder, :host input:-ms-input-placeholder, :host input::-ms-input-placeholder, :host textarea::placeholder, :host textarea:-ms-input-placeholder, :host textarea::-ms-input-placeholder*/.sc-calcite-input-h input.sc-calcite-input::placeholder,.sc-calcite-input-h input.sc-calcite-input:-ms-input-placeholder,.sc-calcite-input-h input.sc-calcite-input::-ms-input-placeholder,.sc-calcite-input-h textarea.sc-calcite-input::placeholder,.sc-calcite-input-h textarea.sc-calcite-input:-ms-input-placeholder,.sc-calcite-input-h textarea.sc-calcite-input::-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}/*!@:host input:focus, :host textarea:focus*/.sc-calcite-input-h input.sc-calcite-input:focus,.sc-calcite-input-h textarea.sc-calcite-input:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-1)}/*!@:host input[readonly], :host textarea[readonly]*/.sc-calcite-input-h input[readonly].sc-calcite-input,.sc-calcite-input-h textarea[readonly].sc-calcite-input{background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium)}/*!@:host input[readonly]:focus, :host textarea[readonly]:focus*/.sc-calcite-input-h input[readonly].sc-calcite-input:focus,.sc-calcite-input-h textarea[readonly].sc-calcite-input:focus{color:var(--calcite-ui-text-1)}/*!@:host calcite-icon*/.sc-calcite-input-h calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-3)}/*!@:host textarea, \n:host input*/.sc-calcite-input-h textarea.sc-calcite-input,.sc-calcite-input-h input.sc-calcite-input{outline-color:transparent}/*!@:host textarea:focus, \n:host input:focus*/.sc-calcite-input-h textarea.sc-calcite-input:focus,.sc-calcite-input-h input.sc-calcite-input:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host([status=invalid]) input, :host([status=invalid]) textarea*/[status=invalid].sc-calcite-input-h input.sc-calcite-input,[status=invalid].sc-calcite-input-h textarea.sc-calcite-input{border-color:var(--calcite-ui-danger)}/*!@:host([status=invalid]) input:focus, :host([status=invalid]) textarea:focus*/[status=invalid].sc-calcite-input-h input.sc-calcite-input:focus,[status=invalid].sc-calcite-input-h textarea.sc-calcite-input:focus{outline:2px solid var(--calcite-ui-danger);outline-offset:-2px}/*!@:host([scale=s]) .icon*/[scale=s].sc-calcite-input-h .icon.sc-calcite-input{inset-inline-start:0.5rem}/*!@:host([scale=m]) .icon*/[scale=m].sc-calcite-input-h .icon.sc-calcite-input{inset-inline-start:0.75rem}/*!@:host([scale=l]) .icon*/[scale=l].sc-calcite-input-h .icon.sc-calcite-input{inset-inline-start:1rem}/*!@:host([icon][scale=s]) input*/[icon][scale=s].sc-calcite-input-h input.sc-calcite-input{padding-inline-start:2rem}/*!@:host([icon][scale=m]) input*/[icon][scale=m].sc-calcite-input-h input.sc-calcite-input{padding-inline-start:2.5rem}/*!@:host([icon][scale=l]) input*/[icon][scale=l].sc-calcite-input-h input.sc-calcite-input{padding-inline-start:3rem}/*!@.element-wrapper*/.element-wrapper.sc-calcite-input{position:relative;order:3;display:inline-flex;flex:1 1 0%;align-items:center}/*!@.icon*/.icon.sc-calcite-input{pointer-events:none;position:absolute;display:block;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.icon, \n.resize-icon-wrapper*/.icon.sc-calcite-input,.resize-icon-wrapper.sc-calcite-input{z-index:1}/*!@input[type=text]::-ms-clear, \ninput[type=text]::-ms-reveal*/input[type=text].sc-calcite-input::-ms-clear,input[type=text].sc-calcite-input::-ms-reveal{display:none;block-size:0px;inline-size:0px}/*!@input[type=search]::-webkit-search-decoration, \ninput[type=search]::-webkit-search-cancel-button, \ninput[type=search]::-webkit-search-results-button, \ninput[type=search]::-webkit-search-results-decoration, \ninput[type=date]::-webkit-clear-button, \ninput[type=time]::-webkit-clear-button*/input[type=search].sc-calcite-input::-webkit-search-decoration,input[type=search].sc-calcite-input::-webkit-search-cancel-button,input[type=search].sc-calcite-input::-webkit-search-results-button,input[type=search].sc-calcite-input::-webkit-search-results-decoration,input[type=date].sc-calcite-input::-webkit-clear-button,input[type=time].sc-calcite-input::-webkit-clear-button{display:none}/*!@.clear-button*/.clear-button.sc-calcite-input{pointer-events:initial;order:4;margin:0px;box-sizing:border-box;display:flex;min-block-size:100%;cursor:pointer;align-items:center;justify-content:center;align-self:stretch;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);outline-color:transparent;border-inline-start-width:0px}/*!@.clear-button:hover*/.clear-button.sc-calcite-input:hover{background-color:var(--calcite-ui-foreground-2);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button:hover calcite-icon*/.clear-button.sc-calcite-input:hover calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button:active*/.clear-button.sc-calcite-input:active{background-color:var(--calcite-ui-foreground-3)}/*!@.clear-button:active calcite-icon*/.clear-button.sc-calcite-input:active calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1)}/*!@.clear-button:focus*/.clear-button.sc-calcite-input:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.clear-button:disabled*/.clear-button.sc-calcite-input:disabled{opacity:var(--calcite-ui-opacity-disabled)}/*!@.loader*/.loader.sc-calcite-input{inset-block-start:1px;inset-inline:1px;pointer-events:none;position:absolute;display:block}/*!@.action-wrapper*/.action-wrapper.sc-calcite-input{order:7;display:flex}/*!@.prefix, \n.suffix*/.prefix.sc-calcite-input,.suffix.sc-calcite-input{box-sizing:border-box;display:flex;block-size:auto;min-block-size:100%;-webkit-user-select:none;user-select:none;align-content:center;align-items:center;overflow-wrap:break-word;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium);line-height:1;color:var(--calcite-ui-text-2)}/*!@.prefix*/.prefix.sc-calcite-input{order:2;border-inline-end-width:0px}/*!@.suffix*/.suffix.sc-calcite-input{order:5;border-inline-start-width:0px}/*!@:host([alignment=start]) textarea, :host([alignment=start]) input*/[alignment=start].sc-calcite-input-h textarea.sc-calcite-input,[alignment=start].sc-calcite-input-h input.sc-calcite-input{text-align:start}/*!@:host([alignment=end]) textarea, :host([alignment=end]) input*/[alignment=end].sc-calcite-input-h textarea.sc-calcite-input,[alignment=end].sc-calcite-input-h input.sc-calcite-input{text-align:end}/*!@:host input[type=number]*/.sc-calcite-input-h input[type=number].sc-calcite-input{-moz-appearance:textfield}/*!@:host input[type=number]::-webkit-inner-spin-button, :host input[type=number]::-webkit-outer-spin-button*/.sc-calcite-input-h input[type=number].sc-calcite-input::-webkit-inner-spin-button,.sc-calcite-input-h input[type=number].sc-calcite-input::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:textfield;margin:0px}/*!@.number-button-wrapper*/.number-button-wrapper.sc-calcite-input{pointer-events:none;order:6;box-sizing:border-box;display:flex;flex-direction:column;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@:host([number-button-type=vertical]) .wrapper*/[number-button-type=vertical].sc-calcite-input-h .wrapper.sc-calcite-input{flex-direction:row;display:flex}/*!@:host([number-button-type=vertical]) input, \n:host([number-button-type=vertical]) textarea*/[number-button-type=vertical].sc-calcite-input-h input.sc-calcite-input,[number-button-type=vertical].sc-calcite-input-h textarea.sc-calcite-input{order:2}/*!@:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=down] calcite-icon*/[number-button-type=horizontal].sc-calcite-input-h .calcite--rtl.sc-calcite-input .number-button-item[data-adjustment=down].sc-calcite-input calcite-icon.sc-calcite-input{transform:rotate(-90deg)}/*!@:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=up] calcite-icon*/[number-button-type=horizontal].sc-calcite-input-h .calcite--rtl.sc-calcite-input .number-button-item[data-adjustment=up].sc-calcite-input calcite-icon.sc-calcite-input{transform:rotate(-90deg)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down], .number-button-item.number-button-item--horizontal[data-adjustment=up]*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input,.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input{order:1;max-block-size:100%;min-block-size:100%;align-self:stretch}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down] calcite-icon, .number-button-item.number-button-item--horizontal[data-adjustment=up] calcite-icon*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input calcite-icon.sc-calcite-input,.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input calcite-icon.sc-calcite-input{transform:rotate(90deg)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down]*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);border-inline-end-width:0px}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover calcite-icon*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input:hover calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=up]*/.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input{order:5}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover*/.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover calcite-icon*/.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input:hover calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover*/[number-button-type=vertical].sc-calcite-input-h .number-button-item[data-adjustment=down].sc-calcite-input:hover{background-color:var(--calcite-ui-foreground-2)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover calcite-icon*/[number-button-type=vertical].sc-calcite-input-h .number-button-item[data-adjustment=down].sc-calcite-input:hover calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover*/[number-button-type=vertical].sc-calcite-input-h .number-button-item[data-adjustment=up].sc-calcite-input:hover{background-color:var(--calcite-ui-foreground-2)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover calcite-icon*/[number-button-type=vertical].sc-calcite-input-h .number-button-item[data-adjustment=up].sc-calcite-input:hover calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]*/[number-button-type=vertical].sc-calcite-input-h .number-button-item[data-adjustment=down].sc-calcite-input{border-block-start-width:0px}/*!@.number-button-item*/.number-button-item.sc-calcite-input{max-block-size:50%;min-block-size:50%;pointer-events:initial;margin:0px;box-sizing:border-box;display:flex;cursor:pointer;align-items:center;align-self:center;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);padding-block:0px;padding-inline:0.5rem;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-inline-start-width:0px}/*!@.number-button-item calcite-icon*/.number-button-item.sc-calcite-input calcite-icon.sc-calcite-input{pointer-events:none;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.number-button-item:focus*/.number-button-item.sc-calcite-input:focus{background-color:var(--calcite-ui-foreground-2)}/*!@.number-button-item:focus calcite-icon*/.number-button-item.sc-calcite-input:focus calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1)}/*!@.number-button-item:active*/.number-button-item.sc-calcite-input:active{background-color:var(--calcite-ui-foreground-3)}/*!@.number-button-item:disabled*/.number-button-item.sc-calcite-input:disabled{pointer-events:none}/*!@.wrapper*/.wrapper.sc-calcite-input{position:relative;display:flex;flex-direction:row;align-items:center}/*!@:host input::-webkit-calendar-picker-indicator*/.sc-calcite-input-h input.sc-calcite-input::-webkit-calendar-picker-indicator{display:none}/*!@:host input[type=date]::-webkit-input-placeholder*/.sc-calcite-input-h input[type=date].sc-calcite-input::-webkit-input-placeholder{visibility:hidden !important}/*!@:host textarea::-webkit-resizer*/.sc-calcite-input-h textarea.sc-calcite-input::-webkit-resizer{position:absolute;inset-block-end:0px;box-sizing:border-box;padding-block:0px;padding-inline:0.25rem;inset-inline-end:0}/*!@.resize-icon-wrapper*/.resize-icon-wrapper.sc-calcite-input{inset-block-end:2px;inset-inline-end:2px;pointer-events:none;position:absolute;block-size:0.75rem;inline-size:0.75rem;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-3)}/*!@.resize-icon-wrapper calcite-icon*/.resize-icon-wrapper.sc-calcite-input calcite-icon.sc-calcite-input{inset-block-end:0.25rem;inset-inline-end:0.25rem;transform:rotate(-45deg)}/*!@.calcite--rtl .resize-icon-wrapper calcite-icon*/.calcite--rtl.sc-calcite-input .resize-icon-wrapper.sc-calcite-input calcite-icon.sc-calcite-input{transform:rotate(45deg)}/*!@:host([type=color]) input*/[type=color].sc-calcite-input-h input.sc-calcite-input{padding:0.25rem}/*!@:host([type=file]) input*/[type=file].sc-calcite-input-h input.sc-calcite-input{cursor:pointer;border-width:1px;border-style:dashed;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);text-align:center}/*!@:host([type=file][scale=s]) input*/[type=file][scale=s].sc-calcite-input-h input.sc-calcite-input{padding-block:1px;padding-inline:0.5rem}/*!@:host([type=file][scale=m]) input*/[type=file][scale=m].sc-calcite-input-h input.sc-calcite-input{padding-block:0.25rem;padding-inline:0.75rem}/*!@:host([type=file][scale=l]) input*/[type=file][scale=l].sc-calcite-input-h input.sc-calcite-input{padding-block:0.5rem;padding-inline:1rem}/*!@:host(.no-bottom-border) input*/.no-bottom-border.sc-calcite-input-h input.sc-calcite-input{border-block-end-width:0px}/*!@:host(.border-top-color-one) input*/.border-top-color-one.sc-calcite-input-h input.sc-calcite-input{border-block-start-color:var(--calcite-ui-border-1)}/*!@:host .inline-child*/.sc-calcite-input-h .inline-child.sc-calcite-input{background-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@:host .inline-child .editing-enabled*/.sc-calcite-input-h .inline-child.sc-calcite-input .editing-enabled.sc-calcite-input{background-color:inherit}/*!@:host .inline-child:not(.editing-enabled)*/.sc-calcite-input-h .inline-child.sc-calcite-input:not(.editing-enabled){display:flex;cursor:pointer;border-color:transparent;padding-inline-start:0}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-input-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  19675. /**
  19676. * @slot action - A slot for positioning a `calcite-button` next to the component.
  19677. */
  19678. class Input {
  19679. constructor(hostRef) {
  19680. registerInstance(this, hostRef);
  19681. this.calciteInternalInputFocus = createEvent(this, "calciteInternalInputFocus", 6);
  19682. this.calciteInternalInputBlur = createEvent(this, "calciteInternalInputBlur", 6);
  19683. this.calciteInputInput = createEvent(this, "calciteInputInput", 7);
  19684. this.calciteInputChange = createEvent(this, "calciteInputChange", 6);
  19685. //--------------------------------------------------------------------------
  19686. //
  19687. // Properties
  19688. //
  19689. //--------------------------------------------------------------------------
  19690. /** Specifies the text alignment of the component's value. */
  19691. this.alignment = "start";
  19692. /**
  19693. * When `true`, the component is focused on page load.
  19694. *
  19695. * @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
  19696. */
  19697. this.autofocus = false;
  19698. /**
  19699. * When `true`, a clear button is displayed when the component has a value. The clear button shows by default for `"search"`, `"time"`, and `"date"` types, and will not display for the `"textarea"` type.
  19700. */
  19701. this.clearable = false;
  19702. /**
  19703. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  19704. *
  19705. * @mdn [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled)
  19706. */
  19707. this.disabled = false;
  19708. /**
  19709. * When `true`, number values are displayed with a group separator corresponding to the language and country format.
  19710. */
  19711. this.groupSeparator = false;
  19712. /**
  19713. * When `true`, the component will not be visible.
  19714. *
  19715. * @mdn [hidden](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden)
  19716. */
  19717. this.hidden = false;
  19718. /**
  19719. * Accessible name when the component is loading.
  19720. *
  19721. * @default "Loading"
  19722. */
  19723. this.intlLoading = TEXT$v.loading;
  19724. /** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
  19725. this.iconFlipRtl = false;
  19726. /** When `true`, a busy indicator is displayed. */
  19727. this.loading = false;
  19728. /**
  19729. * When `true`, uses locale formatting for numbers.
  19730. *
  19731. * @internal
  19732. */
  19733. this.localeFormat = false;
  19734. /** Specifies the placement of the buttons for `type="number"`. */
  19735. this.numberButtonType = "vertical";
  19736. /**
  19737. * When `true`, the component's value can be read, but cannot be modified.
  19738. *
  19739. * @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
  19740. */
  19741. this.readOnly = false;
  19742. /** When `true`, the component must have a value in order for the form to submit. */
  19743. this.required = false;
  19744. /** Specifies the size of the component. */
  19745. this.scale = "m";
  19746. /** Specifies the status of the input field, which determines message and icons. */
  19747. this.status = "idle";
  19748. /**
  19749. * @internal
  19750. */
  19751. this.editingEnabled = false;
  19752. /**
  19753. * Specifies the component type.
  19754. *
  19755. * Note that the following `type`s add type-specific icons by default: `"date"`, `"email"`, `"password"`, `"search"`, `"tel"`, `"time"`.
  19756. */
  19757. this.type = "text";
  19758. /** The component's value. */
  19759. this.value = "";
  19760. /** keep track of the rendered child type */
  19761. this.childElType = "input";
  19762. this.previousValueOrigin = "initial";
  19763. this.mutationObserver = createObserver();
  19764. this.userChangedValue = false;
  19765. //--------------------------------------------------------------------------
  19766. //
  19767. // State
  19768. //
  19769. //--------------------------------------------------------------------------
  19770. this.effectiveLocale = "";
  19771. //--------------------------------------------------------------------------
  19772. //
  19773. // Private Methods
  19774. //
  19775. //--------------------------------------------------------------------------
  19776. this.keyDownHandler = (event) => {
  19777. if (this.readOnly || this.disabled) {
  19778. return;
  19779. }
  19780. if (this.isClearable && event.key === "Escape") {
  19781. this.clearInputValue(event);
  19782. event.preventDefault();
  19783. }
  19784. if (event.key === "Enter" && !event.defaultPrevented) {
  19785. if (submitForm(this)) {
  19786. event.preventDefault();
  19787. }
  19788. }
  19789. };
  19790. this.clearInputValue = (nativeEvent) => {
  19791. this.setValue({
  19792. committing: true,
  19793. nativeEvent,
  19794. origin: "user",
  19795. value: ""
  19796. });
  19797. };
  19798. this.emitChangeIfUserModified = () => {
  19799. if (this.previousValueOrigin === "user" && this.value !== this.previousEmittedValue) {
  19800. this.calciteInputChange.emit();
  19801. }
  19802. this.previousEmittedValue = this.value;
  19803. };
  19804. this.inputBlurHandler = () => {
  19805. this.calciteInternalInputBlur.emit();
  19806. this.emitChangeIfUserModified();
  19807. };
  19808. this.inputFocusHandler = (event) => {
  19809. const slottedActionEl = getSlotted(this.el, "action");
  19810. if (event.target !== slottedActionEl) {
  19811. this.setFocus();
  19812. }
  19813. this.calciteInternalInputFocus.emit();
  19814. };
  19815. this.inputInputHandler = (nativeEvent) => {
  19816. if (this.disabled || this.readOnly) {
  19817. return;
  19818. }
  19819. this.setValue({
  19820. nativeEvent,
  19821. origin: "user",
  19822. value: nativeEvent.target.value
  19823. });
  19824. };
  19825. this.inputKeyDownHandler = (event) => {
  19826. if (this.disabled || this.readOnly) {
  19827. return;
  19828. }
  19829. if (event.key === "Enter") {
  19830. this.emitChangeIfUserModified();
  19831. }
  19832. };
  19833. this.inputNumberInputHandler = (nativeEvent) => {
  19834. if (this.disabled || this.readOnly) {
  19835. return;
  19836. }
  19837. const value = nativeEvent.target.value;
  19838. numberStringFormatter.numberFormatOptions = {
  19839. locale: this.effectiveLocale,
  19840. numberingSystem: this.numberingSystem,
  19841. useGrouping: this.groupSeparator
  19842. };
  19843. const delocalizedValue = numberStringFormatter.delocalize(value);
  19844. if (nativeEvent.inputType === "insertFromPaste") {
  19845. if (!isValidNumber(delocalizedValue)) {
  19846. nativeEvent.preventDefault();
  19847. }
  19848. this.setValue({
  19849. nativeEvent,
  19850. origin: "user",
  19851. value: parseNumberString(delocalizedValue)
  19852. });
  19853. this.childNumberEl.value = this.localizedValue;
  19854. }
  19855. else {
  19856. this.setValue({
  19857. nativeEvent,
  19858. origin: "user",
  19859. value: delocalizedValue
  19860. });
  19861. }
  19862. };
  19863. this.inputNumberKeyDownHandler = (event) => {
  19864. if (this.type !== "number" || this.disabled || this.readOnly) {
  19865. return;
  19866. }
  19867. if (event.key === "ArrowUp") {
  19868. /* prevent default behavior of moving cursor to the beginning of the input when holding down ArrowUp */
  19869. event.preventDefault();
  19870. this.nudgeNumberValue("up", event);
  19871. return;
  19872. }
  19873. if (event.key === "ArrowDown") {
  19874. this.nudgeNumberValue("down", event);
  19875. return;
  19876. }
  19877. const supportedKeys = [
  19878. ...numberKeys,
  19879. "ArrowLeft",
  19880. "ArrowRight",
  19881. "Backspace",
  19882. "Delete",
  19883. "Enter",
  19884. "Escape",
  19885. "Tab"
  19886. ];
  19887. if (event.altKey || event.ctrlKey || event.metaKey) {
  19888. return;
  19889. }
  19890. const isShiftTabEvent = event.shiftKey && event.key === "Tab";
  19891. if (supportedKeys.includes(event.key) && (!event.shiftKey || isShiftTabEvent)) {
  19892. if (event.key === "Enter") {
  19893. this.emitChangeIfUserModified();
  19894. }
  19895. return;
  19896. }
  19897. numberStringFormatter.numberFormatOptions = {
  19898. locale: this.effectiveLocale,
  19899. numberingSystem: this.numberingSystem,
  19900. useGrouping: this.groupSeparator
  19901. };
  19902. if (event.key === numberStringFormatter.decimal) {
  19903. if (!this.value && !this.childNumberEl.value) {
  19904. return;
  19905. }
  19906. if (this.value && this.childNumberEl.value.indexOf(numberStringFormatter.decimal) === -1) {
  19907. return;
  19908. }
  19909. }
  19910. if (/[eE]/.test(event.key)) {
  19911. if (!this.value && !this.childNumberEl.value) {
  19912. return;
  19913. }
  19914. if (this.value && !/[eE]/.test(this.childNumberEl.value)) {
  19915. return;
  19916. }
  19917. }
  19918. if (event.key === "-") {
  19919. if (!this.value && !this.childNumberEl.value) {
  19920. return;
  19921. }
  19922. if (this.value && this.childNumberEl.value.split("-").length <= 2) {
  19923. return;
  19924. }
  19925. }
  19926. event.preventDefault();
  19927. };
  19928. this.nudgeNumberValue = (direction, nativeEvent) => {
  19929. if ((nativeEvent instanceof KeyboardEvent && nativeEvent.repeat) || this.type !== "number") {
  19930. return;
  19931. }
  19932. const inputMax = this.maxString ? parseFloat(this.maxString) : null;
  19933. const inputMin = this.minString ? parseFloat(this.minString) : null;
  19934. const valueNudgeDelayInMs = 100;
  19935. this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
  19936. if (this.nudgeNumberValueIntervalId) {
  19937. window.clearInterval(this.nudgeNumberValueIntervalId);
  19938. }
  19939. let firstValueNudge = true;
  19940. this.nudgeNumberValueIntervalId = window.setInterval(() => {
  19941. if (firstValueNudge) {
  19942. firstValueNudge = false;
  19943. return;
  19944. }
  19945. this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
  19946. }, valueNudgeDelayInMs);
  19947. };
  19948. this.numberButtonPointerUpAndOutHandler = () => {
  19949. window.clearInterval(this.nudgeNumberValueIntervalId);
  19950. };
  19951. this.numberButtonPointerDownHandler = (event) => {
  19952. if (!isPrimaryPointerButton(event)) {
  19953. return;
  19954. }
  19955. event.preventDefault();
  19956. const direction = event.target.dataset.adjustment;
  19957. if (!this.disabled) {
  19958. this.nudgeNumberValue(direction, event);
  19959. }
  19960. };
  19961. this.hiddenInputChangeHandler = (event) => {
  19962. if (event.target.name === this.name) {
  19963. const hiddenInputValue = event.target.value;
  19964. const value = this.type === "number"
  19965. ? isValidNumber(hiddenInputValue)
  19966. ? hiddenInputValue
  19967. : ""
  19968. : hiddenInputValue;
  19969. this.setValue({
  19970. value,
  19971. origin: "direct"
  19972. });
  19973. }
  19974. event.stopPropagation();
  19975. };
  19976. this.setChildElRef = (el) => {
  19977. this.childEl = el;
  19978. };
  19979. this.setChildNumberElRef = (el) => {
  19980. this.childNumberEl = el;
  19981. };
  19982. this.setInputValue = (newInputValue) => {
  19983. if (this.type === "text" && !this.childEl) {
  19984. return;
  19985. }
  19986. if (this.type === "number" && !this.childNumberEl) {
  19987. return;
  19988. }
  19989. this[`child${this.type === "number" ? "Number" : ""}El`].value = newInputValue;
  19990. };
  19991. this.setPreviousEmittedValue = (newPreviousEmittedValue) => {
  19992. this.previousEmittedValue =
  19993. this.type === "number"
  19994. ? isValidNumber(newPreviousEmittedValue)
  19995. ? newPreviousEmittedValue
  19996. : ""
  19997. : newPreviousEmittedValue;
  19998. };
  19999. this.setPreviousValue = (newPreviousValue) => {
  20000. this.previousValue =
  20001. this.type === "number"
  20002. ? isValidNumber(newPreviousValue)
  20003. ? newPreviousValue
  20004. : ""
  20005. : newPreviousValue;
  20006. };
  20007. this.setValue = ({ committing = false, nativeEvent, origin, previousValue, value }) => {
  20008. numberStringFormatter.numberFormatOptions = {
  20009. locale: this.effectiveLocale,
  20010. numberingSystem: this.numberingSystem,
  20011. useGrouping: this.groupSeparator
  20012. };
  20013. if (this.type === "number") {
  20014. const delocalizedValue = (this.numberingSystem && this.numberingSystem !== "latn") ||
  20015. defaultNumberingSystem !== "latn"
  20016. ? numberStringFormatter.delocalize(value)
  20017. : value;
  20018. const sanitizedValue = sanitizeNumberString(delocalizedValue);
  20019. const newValue = (value && !sanitizedValue) || [".", "-"].includes(sanitizedValue)
  20020. ? isValidNumber(this.previousValue)
  20021. ? this.previousValue
  20022. : ""
  20023. : sanitizedValue;
  20024. const newLocalizedValue = numberStringFormatter.localize(newValue);
  20025. this.localizedValue = newLocalizedValue;
  20026. this.userChangedValue = origin === "user" && this.value !== newValue;
  20027. this.value = newValue;
  20028. origin === "direct" && this.setInputValue(newLocalizedValue);
  20029. }
  20030. else {
  20031. this.userChangedValue = origin === "user" && this.value !== value;
  20032. this.value = value;
  20033. origin === "direct" && this.setInputValue(value);
  20034. }
  20035. this.setPreviousValue(previousValue || this.value);
  20036. this.previousValueOrigin = origin;
  20037. if (nativeEvent) {
  20038. const calciteInputInputEvent = this.calciteInputInput.emit({
  20039. element: this.childEl,
  20040. nativeEvent,
  20041. value: this.value
  20042. });
  20043. if (calciteInputInputEvent.defaultPrevented) {
  20044. this.value = this.previousValue;
  20045. this.localizedValue =
  20046. this.type === "number"
  20047. ? numberStringFormatter.localize(this.previousValue)
  20048. : this.previousValue;
  20049. }
  20050. else if (committing) {
  20051. this.emitChangeIfUserModified();
  20052. }
  20053. }
  20054. };
  20055. this.inputKeyUpHandler = () => {
  20056. window.clearInterval(this.nudgeNumberValueIntervalId);
  20057. };
  20058. }
  20059. disabledWatcher() {
  20060. this.setDisabledAction();
  20061. }
  20062. localeChanged() {
  20063. updateEffectiveLocale(this);
  20064. }
  20065. /** watcher to update number-to-string for max */
  20066. maxWatcher() {
  20067. var _a;
  20068. this.maxString = ((_a = this.max) === null || _a === void 0 ? void 0 : _a.toString()) || null;
  20069. }
  20070. /** watcher to update number-to-string for min */
  20071. minWatcher() {
  20072. var _a;
  20073. this.minString = ((_a = this.min) === null || _a === void 0 ? void 0 : _a.toString()) || null;
  20074. }
  20075. valueWatcher(newValue, previousValue) {
  20076. if (!this.userChangedValue) {
  20077. this.setValue({
  20078. origin: "direct",
  20079. previousValue,
  20080. value: newValue == null || newValue == ""
  20081. ? ""
  20082. : this.type === "number"
  20083. ? isValidNumber(newValue)
  20084. ? newValue
  20085. : this.previousValue || ""
  20086. : newValue
  20087. });
  20088. this.warnAboutInvalidNumberValue(newValue);
  20089. }
  20090. this.userChangedValue = false;
  20091. }
  20092. updateRequestedIcon() {
  20093. this.requestedIcon = setRequestedIcon(INPUT_TYPE_ICONS, this.icon, this.type);
  20094. }
  20095. get isClearable() {
  20096. return !this.isTextarea && (this.clearable || this.type === "search") && this.value.length > 0;
  20097. }
  20098. get isTextarea() {
  20099. return this.childElType === "textarea";
  20100. }
  20101. //--------------------------------------------------------------------------
  20102. //
  20103. // Lifecycle
  20104. //
  20105. //--------------------------------------------------------------------------
  20106. connectedCallback() {
  20107. var _a;
  20108. connectLocalized(this);
  20109. this.scale = getElementProp(this.el, "scale", this.scale);
  20110. this.status = getElementProp(this.el, "status", this.status);
  20111. this.inlineEditableEl = this.el.closest("calcite-inline-editable");
  20112. if (this.inlineEditableEl) {
  20113. this.editingEnabled = this.inlineEditableEl.editingEnabled || false;
  20114. }
  20115. connectLabel(this);
  20116. connectForm(this);
  20117. this.setPreviousEmittedValue(this.value);
  20118. this.setPreviousValue(this.value);
  20119. if (this.type === "number") {
  20120. this.warnAboutInvalidNumberValue(this.value);
  20121. this.setValue({
  20122. origin: "connected",
  20123. value: isValidNumber(this.value) ? this.value : ""
  20124. });
  20125. }
  20126. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
  20127. this.setDisabledAction();
  20128. this.el.addEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
  20129. }
  20130. disconnectedCallback() {
  20131. var _a;
  20132. disconnectLabel(this);
  20133. disconnectForm(this);
  20134. disconnectLocalized(this);
  20135. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  20136. this.el.removeEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
  20137. }
  20138. componentWillLoad() {
  20139. var _a, _b;
  20140. this.childElType = this.type === "textarea" ? "textarea" : "input";
  20141. this.maxString = (_a = this.max) === null || _a === void 0 ? void 0 : _a.toString();
  20142. this.minString = (_b = this.min) === null || _b === void 0 ? void 0 : _b.toString();
  20143. this.requestedIcon = setRequestedIcon(INPUT_TYPE_ICONS, this.icon, this.type);
  20144. }
  20145. componentShouldUpdate(newValue, oldValue, property) {
  20146. if (this.type === "number" && property === "value" && newValue && !isValidNumber(newValue)) {
  20147. this.setValue({
  20148. origin: "reset",
  20149. value: oldValue
  20150. });
  20151. return false;
  20152. }
  20153. return true;
  20154. }
  20155. componentDidRender() {
  20156. updateHostInteraction(this);
  20157. }
  20158. //--------------------------------------------------------------------------
  20159. //
  20160. // Public Methods
  20161. //
  20162. //--------------------------------------------------------------------------
  20163. /** Sets focus on the component. */
  20164. async setFocus() {
  20165. var _a, _b;
  20166. if (this.type === "number") {
  20167. (_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.focus();
  20168. }
  20169. else {
  20170. (_b = this.childEl) === null || _b === void 0 ? void 0 : _b.focus();
  20171. }
  20172. }
  20173. /** Selects all text of the component's `value`. */
  20174. async selectText() {
  20175. var _a, _b;
  20176. if (this.type === "number") {
  20177. (_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.select();
  20178. }
  20179. else {
  20180. (_b = this.childEl) === null || _b === void 0 ? void 0 : _b.select();
  20181. }
  20182. }
  20183. onLabelClick() {
  20184. this.setFocus();
  20185. }
  20186. incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent) {
  20187. const { value } = this;
  20188. const inputStep = this.step === "any" ? 1 : Math.abs(this.step || 1);
  20189. const inputVal = value && value !== "" ? parseFloat(value) : 0;
  20190. const adjustment = direction === "up" ? 1 : -1;
  20191. const nudgedValue = inputVal + inputStep * adjustment;
  20192. const finalValue = (typeof inputMin === "number" && !isNaN(inputMin) && nudgedValue < inputMin) ||
  20193. (typeof inputMax === "number" && !isNaN(inputMax) && nudgedValue > inputMax)
  20194. ? inputVal
  20195. : nudgedValue;
  20196. const inputValPlaces = decimalPlaces(inputVal);
  20197. const inputStepPlaces = decimalPlaces(inputStep);
  20198. this.setValue({
  20199. committing: true,
  20200. nativeEvent,
  20201. origin: "user",
  20202. value: finalValue.toFixed(Math.max(inputValPlaces, inputStepPlaces))
  20203. });
  20204. }
  20205. onFormReset() {
  20206. this.setValue({
  20207. origin: "reset",
  20208. value: this.defaultValue
  20209. });
  20210. }
  20211. syncHiddenFormInput(input) {
  20212. var _a, _b, _c, _d;
  20213. if (this.type === "number") {
  20214. input.type = "number";
  20215. input.min = (_b = (_a = this.min) === null || _a === void 0 ? void 0 : _a.toString(10)) !== null && _b !== void 0 ? _b : "";
  20216. input.max = (_d = (_c = this.max) === null || _c === void 0 ? void 0 : _c.toString(10)) !== null && _d !== void 0 ? _d : "";
  20217. }
  20218. else if (this.type === "text") {
  20219. input.type = "text";
  20220. if (this.minLength != null) {
  20221. input.minLength = this.minLength;
  20222. }
  20223. if (this.maxLength != null) {
  20224. input.maxLength = this.maxLength;
  20225. }
  20226. }
  20227. else if (this.type === "password") {
  20228. input.type = "password";
  20229. }
  20230. }
  20231. setDisabledAction() {
  20232. const slottedActionEl = getSlotted(this.el, "action");
  20233. if (!slottedActionEl) {
  20234. return;
  20235. }
  20236. this.disabled
  20237. ? slottedActionEl.setAttribute("disabled", "")
  20238. : slottedActionEl.removeAttribute("disabled");
  20239. }
  20240. warnAboutInvalidNumberValue(value) {
  20241. if (this.type === "number" && value && !isValidNumber(value)) {
  20242. console.warn(`The specified value "${value}" cannot be parsed, or is out of range.`);
  20243. }
  20244. }
  20245. // --------------------------------------------------------------------------
  20246. //
  20247. // Render Methods
  20248. //
  20249. // --------------------------------------------------------------------------
  20250. render() {
  20251. const dir = getElementDir(this.el);
  20252. const loader = (hAsync("div", { class: CSS$v.loader }, hAsync("calcite-progress", { label: this.intlLoading, type: "indeterminate" })));
  20253. const inputClearButton = (hAsync("button", { "aria-label": this.intlClear || TEXT$d.clear, class: CSS$v.clearButton, disabled: this.disabled || this.readOnly, onClick: this.clearInputValue, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "x", scale: "s" })));
  20254. const iconEl = (hAsync("calcite-icon", { class: CSS$v.inputIcon, flipRtl: this.iconFlipRtl, icon: this.requestedIcon, scale: "s" }));
  20255. const isHorizontalNumberButton = this.numberButtonType === "horizontal";
  20256. const numberButtonsHorizontalUp = (hAsync("button", { "aria-hidden": "true", class: {
  20257. [CSS$v.numberButtonItem]: true,
  20258. [CSS$v.buttonItemHorizontal]: isHorizontalNumberButton
  20259. }, "data-adjustment": "up", disabled: this.disabled || this.readOnly, onPointerDown: this.numberButtonPointerDownHandler, onPointerOut: this.numberButtonPointerUpAndOutHandler, onPointerUp: this.numberButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "chevron-up", scale: "s" })));
  20260. const numberButtonsHorizontalDown = (hAsync("button", { "aria-hidden": "true", class: {
  20261. [CSS$v.numberButtonItem]: true,
  20262. [CSS$v.buttonItemHorizontal]: isHorizontalNumberButton
  20263. }, "data-adjustment": "down", disabled: this.disabled || this.readOnly, onPointerDown: this.numberButtonPointerDownHandler, onPointerOut: this.numberButtonPointerUpAndOutHandler, onPointerUp: this.numberButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "chevron-down", scale: "s" })));
  20264. const numberButtonsVertical = (hAsync("div", { class: CSS$v.numberButtonWrapper }, numberButtonsHorizontalUp, numberButtonsHorizontalDown));
  20265. const prefixText = hAsync("div", { class: CSS$v.prefix }, this.prefixText);
  20266. const suffixText = hAsync("div", { class: CSS$v.suffix }, this.suffixText);
  20267. const localeNumberInput = this.type === "number" ? (hAsync("input", { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, key: "localized-input", maxLength: this.maxLength, minLength: this.minLength, name: undefined, onBlur: this.inputBlurHandler, onFocus: this.inputFocusHandler, onInput: this.inputNumberInputHandler, onKeyDown: this.inputNumberKeyDownHandler, onKeyUp: this.inputKeyUpHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildNumberElRef, type: "text", value: this.localizedValue })) : null;
  20268. const childEl = this.type !== "number"
  20269. ? [
  20270. hAsync(this.childElType, { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, class: {
  20271. [CSS$v.editingEnabled]: this.editingEnabled,
  20272. [CSS$v.inlineChild]: !!this.inlineEditableEl
  20273. }, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, max: this.maxString, maxLength: this.maxLength, min: this.minString, minLength: this.minLength, name: this.name, onBlur: this.inputBlurHandler, onFocus: this.inputFocusHandler, onInput: this.inputInputHandler, onKeyDown: this.inputKeyDownHandler, onKeyUp: this.inputKeyUpHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildElRef, required: this.required ? true : null, step: this.step, tabIndex: this.disabled || (this.inlineEditableEl && !this.editingEnabled) ? -1 : null, type: this.type, value: this.value }),
  20274. this.isTextarea ? (hAsync("div", { class: CSS$v.resizeIconWrapper }, hAsync("calcite-icon", { icon: "chevron-down", scale: "s" }))) : null
  20275. ]
  20276. : null;
  20277. return (hAsync(Host, { onClick: this.inputFocusHandler, onKeyDown: this.keyDownHandler }, hAsync("div", { class: { [CSS$v.inputWrapper]: true, [CSS_UTILITY.rtl]: dir === "rtl" } }, this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly
  20278. ? numberButtonsHorizontalDown
  20279. : null, this.prefixText ? prefixText : null, hAsync("div", { class: CSS$v.wrapper }, localeNumberInput, childEl, this.isClearable ? inputClearButton : null, this.requestedIcon ? iconEl : null, this.loading ? loader : null), hAsync("div", { class: CSS$v.actionWrapper }, hAsync("slot", { name: SLOTS$h.action })), this.type === "number" && this.numberButtonType === "vertical" && !this.readOnly
  20280. ? numberButtonsVertical
  20281. : null, this.suffixText ? suffixText : null, this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly
  20282. ? numberButtonsHorizontalUp
  20283. : null, hAsync(HiddenFormInputSlot, { component: this }))));
  20284. }
  20285. get el() { return getElement(this); }
  20286. static get watchers() { return {
  20287. "disabled": ["disabledWatcher"],
  20288. "locale": ["localeChanged"],
  20289. "max": ["maxWatcher"],
  20290. "min": ["minWatcher"],
  20291. "value": ["valueWatcher"],
  20292. "icon": ["updateRequestedIcon"],
  20293. "type": ["updateRequestedIcon"]
  20294. }; }
  20295. static get style() { return inputCss; }
  20296. static get cmpMeta() { return {
  20297. "$flags$": 9,
  20298. "$tagName$": "calcite-input",
  20299. "$members$": {
  20300. "alignment": [513],
  20301. "autofocus": [516],
  20302. "clearable": [516],
  20303. "disabled": [516],
  20304. "groupSeparator": [516, "group-separator"],
  20305. "hidden": [516],
  20306. "icon": [520],
  20307. "intlClear": [1, "intl-clear"],
  20308. "intlLoading": [1, "intl-loading"],
  20309. "iconFlipRtl": [516, "icon-flip-rtl"],
  20310. "label": [1],
  20311. "loading": [516],
  20312. "locale": [1],
  20313. "numberingSystem": [513, "numbering-system"],
  20314. "localeFormat": [4, "locale-format"],
  20315. "max": [514],
  20316. "min": [514],
  20317. "maxlength": [514],
  20318. "maxLength": [514, "max-length"],
  20319. "minLength": [514, "min-length"],
  20320. "name": [513],
  20321. "numberButtonType": [513, "number-button-type"],
  20322. "placeholder": [1],
  20323. "prefixText": [1, "prefix-text"],
  20324. "readOnly": [516, "read-only"],
  20325. "required": [516],
  20326. "scale": [1537],
  20327. "status": [1537],
  20328. "step": [520],
  20329. "suffixText": [1, "suffix-text"],
  20330. "editingEnabled": [1540, "editing-enabled"],
  20331. "type": [513],
  20332. "value": [1025],
  20333. "effectiveLocale": [32],
  20334. "localizedValue": [32],
  20335. "setFocus": [64],
  20336. "selectText": [64]
  20337. },
  20338. "$listeners$": undefined,
  20339. "$lazyBundleId$": "-",
  20340. "$attrsToReflect$": [["alignment", "alignment"], ["autofocus", "autofocus"], ["clearable", "clearable"], ["disabled", "disabled"], ["groupSeparator", "group-separator"], ["hidden", "hidden"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["loading", "loading"], ["numberingSystem", "numbering-system"], ["max", "max"], ["min", "min"], ["maxlength", "maxlength"], ["maxLength", "max-length"], ["minLength", "min-length"], ["name", "name"], ["numberButtonType", "number-button-type"], ["readOnly", "read-only"], ["required", "required"], ["scale", "scale"], ["status", "status"], ["step", "step"], ["editingEnabled", "editing-enabled"], ["type", "type"]]
  20341. }; }
  20342. }
  20343. const CSS$u = {
  20344. menu: "menu-container",
  20345. menuActive: "menu-container--active"
  20346. };
  20347. const inputDatePickerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-input-date-picker:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-input-date-picker{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-date-picker{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-date-picker{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-date-picker{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-date-picker{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-input-date-picker:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-input-date-picker-h{--calcite-icon-size:1rem;--calcite-spacing-eighth:0.125rem;--calcite-spacing-quarter:0.25rem;--calcite-spacing-half:0.5rem;--calcite-spacing-three-quarters:0.75rem;--calcite-spacing:1rem;--calcite-spacing-plus-quarter:1.25rem;--calcite-spacing-plus-half:1.5rem;--calcite-spacing-double:2rem;--calcite-menu-min-width:10rem;--calcite-header-min-height:3rem;--calcite-footer-min-height:3rem}/*!@:root*/.sc-calcite-input-date-picker:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-date-picker-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-input-date-picker-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-input-date-picker-h{position:relative;display:inline-block;inline-size:100%;overflow:visible;vertical-align:top;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host .menu-container .calcite-floating-ui-anim*/.sc-calcite-input-date-picker-h .menu-container.sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}/*!@:host .menu-container[data-placement^=bottom] .calcite-floating-ui-anim*/.sc-calcite-input-date-picker-h .menu-container[data-placement^=bottom].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateY(-5px)}/*!@:host .menu-container[data-placement^=top] .calcite-floating-ui-anim*/.sc-calcite-input-date-picker-h .menu-container[data-placement^=top].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateY(5px)}/*!@:host .menu-container[data-placement^=left] .calcite-floating-ui-anim*/.sc-calcite-input-date-picker-h .menu-container[data-placement^=left].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateX(5px)}/*!@:host .menu-container[data-placement^=right] .calcite-floating-ui-anim*/.sc-calcite-input-date-picker-h .menu-container[data-placement^=right].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateX(-5px)}/*!@:host .menu-container[data-placement] .calcite-floating-ui-anim--active*/.sc-calcite-input-date-picker-h .menu-container[data-placement].sc-calcite-input-date-picker .calcite-floating-ui-anim--active.sc-calcite-input-date-picker{opacity:1;visibility:visible;transform:translate(0)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-input-date-picker-h[disabled] .sc-calcite-input-date-picker-s>[calcite-hydrated][disabled],[disabled].sc-calcite-input-date-picker-h [calcite-hydrated][disabled].sc-calcite-input-date-picker{opacity:1}/*!@.calendar-picker-wrapper*/.calendar-picker-wrapper.sc-calcite-input-date-picker{position:static;inline-size:100%;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transform:translate3d(0, 0, 0)}/*!@.input-wrapper*/.input-wrapper.sc-calcite-input-date-picker{position:relative}/*!@:host([range]) .input-container*/[range].sc-calcite-input-date-picker-h .input-container.sc-calcite-input-date-picker{display:flex}/*!@:host([range]) .input-wrapper*/[range].sc-calcite-input-date-picker-h .input-wrapper.sc-calcite-input-date-picker{flex:1 1 auto}/*!@:host([range]) .horizontal-arrow-container*/[range].sc-calcite-input-date-picker-h .horizontal-arrow-container.sc-calcite-input-date-picker{display:flex;align-items:center;border-width:1px;border-inline-start-width:0px;border-inline-end-width:0px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);padding-block:0px;padding-inline:0.25rem}/*!@:host([range][layout=vertical]) .input-wrapper*/[range][layout=vertical].sc-calcite-input-date-picker-h .input-wrapper.sc-calcite-input-date-picker{inline-size:100%}/*!@:host([range][layout=vertical]) .input-container*/[range][layout=vertical].sc-calcite-input-date-picker-h .input-container.sc-calcite-input-date-picker{flex-direction:column;align-items:flex-start}/*!@:host([range][layout=vertical]) .calendar-picker-wrapper--end*/[range][layout=vertical].sc-calcite-input-date-picker-h .calendar-picker-wrapper--end.sc-calcite-input-date-picker{transform:translate3d(0, 0, 0)}/*!@:host([range][layout=vertical]) .vertical-arrow-container*/[range][layout=vertical].sc-calcite-input-date-picker-h .vertical-arrow-container.sc-calcite-input-date-picker{inset-block-start:1.5rem;position:absolute;z-index:1;margin-inline:1px;background-color:var(--calcite-ui-foreground-1);padding-inline:0.625rem;inset-inline-start:0}/*!@:host([scale=s][range]:not([layout=vertical])) .calendar-picker-wrapper*/[scale=s][range].sc-calcite-input-date-picker-h:not([layout=vertical]) .calendar-picker-wrapper.sc-calcite-input-date-picker{inline-size:216px}/*!@:host([scale=m][range]:not([layout=vertical])) .calendar-picker-wrapper*/[scale=m][range].sc-calcite-input-date-picker-h:not([layout=vertical]) .calendar-picker-wrapper.sc-calcite-input-date-picker{inline-size:286px}/*!@:host([scale=l][range]:not([layout=vertical])) .calendar-picker-wrapper*/[scale=l][range].sc-calcite-input-date-picker-h:not([layout=vertical]) .calendar-picker-wrapper.sc-calcite-input-date-picker{inline-size:398px}/*!@.menu-container*/.menu-container.sc-calcite-input-date-picker{display:block;position:absolute;z-index:900;inline-size:0;block-size:0;overflow:hidden;pointer-events:none;visibility:hidden}/*!@.menu-container .calcite-floating-ui-anim*/.menu-container.sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}/*!@.menu-container[data-placement^=bottom] .calcite-floating-ui-anim*/.menu-container[data-placement^=bottom].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateY(-5px)}/*!@.menu-container[data-placement^=top] .calcite-floating-ui-anim*/.menu-container[data-placement^=top].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateY(5px)}/*!@.menu-container[data-placement^=left] .calcite-floating-ui-anim*/.menu-container[data-placement^=left].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateX(5px)}/*!@.menu-container[data-placement^=right] .calcite-floating-ui-anim*/.menu-container[data-placement^=right].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateX(-5px)}/*!@.menu-container[data-placement] .calcite-floating-ui-anim--active*/.menu-container[data-placement].sc-calcite-input-date-picker .calcite-floating-ui-anim--active.sc-calcite-input-date-picker{opacity:1;visibility:visible;transform:translate(0)}/*!@:host([open]) .menu-container*/[open].sc-calcite-input-date-picker-h .menu-container.sc-calcite-input-date-picker{pointer-events:initial;visibility:visible;inline-size:unset;block-size:unset;overflow:unset}/*!@.menu-container--active*/.menu-container--active.sc-calcite-input-date-picker{pointer-events:initial;visibility:visible;inline-size:unset;block-size:unset;overflow:unset}/*!@.input .calcite-input__wrapper*/.input.sc-calcite-input-date-picker .calcite-input__wrapper.sc-calcite-input-date-picker{margin-block-start:0px}/*!@:host([range][layout=vertical][scale=m]) .vertical-arrow-container*/[range][layout=vertical][scale=m].sc-calcite-input-date-picker-h .vertical-arrow-container.sc-calcite-input-date-picker{inset-block-start:1.5rem;padding-inline-start:0.75rem}/*!@:host([range][layout=vertical][scale=m]) .vertical-arrow-container calcite-icon*/[range][layout=vertical][scale=m].sc-calcite-input-date-picker-h .vertical-arrow-container.sc-calcite-input-date-picker calcite-icon.sc-calcite-input-date-picker{block-size:0.75rem;inline-size:0.75rem;min-inline-size:0px}/*!@:host([range][layout=vertical][scale=l]) .vertical-arrow-container*/[range][layout=vertical][scale=l].sc-calcite-input-date-picker-h .vertical-arrow-container.sc-calcite-input-date-picker{inset-block-start:2.25rem;padding-inline:0.875rem}/*!@:host([range][layout=vertical][open]) .vertical-arrow-container*/[range][layout=vertical][open].sc-calcite-input-date-picker-h .vertical-arrow-container.sc-calcite-input-date-picker{display:none}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-input-date-picker-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  20348. class InputDatePicker {
  20349. constructor(hostRef) {
  20350. registerInstance(this, hostRef);
  20351. this.calciteDatePickerChange = createEvent(this, "calciteDatePickerChange", 6);
  20352. this.calciteDatePickerRangeChange = createEvent(this, "calciteDatePickerRangeChange", 6);
  20353. this.calciteInputDatePickerChange = createEvent(this, "calciteInputDatePickerChange", 6);
  20354. this.calciteInputDatePickerBeforeClose = createEvent(this, "calciteInputDatePickerBeforeClose", 6);
  20355. this.calciteInputDatePickerClose = createEvent(this, "calciteInputDatePickerClose", 6);
  20356. this.calciteInputDatePickerBeforeOpen = createEvent(this, "calciteInputDatePickerBeforeOpen", 6);
  20357. this.calciteInputDatePickerOpen = createEvent(this, "calciteInputDatePickerOpen", 6);
  20358. //--------------------------------------------------------------------------
  20359. //
  20360. // Public Properties
  20361. //
  20362. //--------------------------------------------------------------------------
  20363. /**
  20364. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  20365. */
  20366. this.disabled = false;
  20367. /**
  20368. * When `true`, the component's value can be read, but controls are not accessible and the value cannot be modified.
  20369. *
  20370. * @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
  20371. */
  20372. this.readOnly = false;
  20373. /**
  20374. * When `true`, the component is active.
  20375. *
  20376. * @deprecated use `open` instead.
  20377. */
  20378. this.active = false;
  20379. /** When `true`, displays the `calcite-date-picker` component. */
  20380. this.open = false;
  20381. /**
  20382. * Accessible name for the component's previous month button.
  20383. *
  20384. * @default "Previous month"
  20385. */
  20386. this.intlPrevMonth = TEXT$i.prevMonth;
  20387. /**
  20388. * Accessible name for the component's next month button.
  20389. *
  20390. * @default "Next month"
  20391. */
  20392. this.intlNextMonth = TEXT$i.nextMonth;
  20393. /**
  20394. * Accessible name for the component's year input.
  20395. *
  20396. * @default "Year"
  20397. */
  20398. this.intlYear = TEXT$i.year;
  20399. /** Specifies the size of the component. */
  20400. this.scale = "m";
  20401. /**
  20402. * Specifies the placement of the `calcite-date-picker` relative to the component.
  20403. *
  20404. * @default "bottom-start"
  20405. */
  20406. this.placement = defaultMenuPlacement;
  20407. /** When `true`, activates a range for the component. */
  20408. this.range = false;
  20409. /**
  20410. * When `true`, the component must have a value in order for the form to submit.
  20411. *
  20412. * @internal
  20413. */
  20414. this.required = false;
  20415. /**
  20416. * Determines the type of positioning to use for the overlaid content.
  20417. *
  20418. * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
  20419. *
  20420. * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
  20421. *
  20422. */
  20423. this.overlayPositioning = "absolute";
  20424. /**
  20425. * When `true`, disables the default behavior on the third click of narrowing or extending the range.
  20426. * Instead starts a new range.
  20427. */
  20428. this.proximitySelectionDisabled = false;
  20429. /** Defines the layout of the component. */
  20430. this.layout = "horizontal";
  20431. this.effectiveLocale = "";
  20432. this.focusedInput = "start";
  20433. this.globalAttributes = {};
  20434. this.openTransitionProp = "opacity";
  20435. //--------------------------------------------------------------------------
  20436. //
  20437. // Private Methods
  20438. //
  20439. //--------------------------------------------------------------------------
  20440. this.setFilteredPlacements = () => {
  20441. const { el, flipPlacements } = this;
  20442. this.filteredFlipPlacements = flipPlacements
  20443. ? filterComputedPlacements(flipPlacements, el)
  20444. : null;
  20445. };
  20446. this.setTransitionEl = (el) => {
  20447. this.transitionEl = el;
  20448. connectOpenCloseComponent(this);
  20449. };
  20450. this.setStartInput = (el) => {
  20451. this.startInput = el;
  20452. };
  20453. this.setEndInput = (el) => {
  20454. this.endInput = el;
  20455. };
  20456. this.deactivate = () => {
  20457. this.open = false;
  20458. };
  20459. this.keyDownHandler = (event) => {
  20460. const { defaultPrevented, key } = event;
  20461. if (key === "Enter" && !defaultPrevented) {
  20462. if (submitForm(this)) {
  20463. event.preventDefault();
  20464. }
  20465. }
  20466. else if (key === "Escape" && !defaultPrevented) {
  20467. this.active = false;
  20468. this.open = false;
  20469. event.preventDefault();
  20470. }
  20471. };
  20472. this.inputBlur = (event) => {
  20473. this.blur(event.currentTarget);
  20474. };
  20475. this.startInputFocus = () => {
  20476. if (!this.readOnly) {
  20477. this.open = true;
  20478. }
  20479. this.focusedInput = "start";
  20480. };
  20481. this.endInputFocus = () => {
  20482. if (!this.readOnly) {
  20483. this.open = true;
  20484. }
  20485. this.focusedInput = "end";
  20486. };
  20487. this.startInputInput = () => {
  20488. const parsedValue = this.parseNumerals(this.startInput.value);
  20489. const formattedValue = this.formatNumerals(parsedValue);
  20490. this.startInput.value = formattedValue;
  20491. this.input(parsedValue);
  20492. };
  20493. this.endInputInput = () => {
  20494. const parsedValue = this.parseNumerals(this.endInput.value);
  20495. const formattedValue = this.formatNumerals(parsedValue);
  20496. this.endInput.value = formattedValue;
  20497. this.input(parsedValue);
  20498. };
  20499. this.setFloatingEl = (el) => {
  20500. if (el) {
  20501. this.floatingEl = el;
  20502. connectFloatingUI(this, this.referenceEl, this.floatingEl);
  20503. }
  20504. };
  20505. this.setStartWrapper = (el) => {
  20506. this.startWrapper = el;
  20507. this.setReferenceEl();
  20508. };
  20509. this.setEndWrapper = (el) => {
  20510. this.endWrapper = el;
  20511. this.setReferenceEl();
  20512. };
  20513. /**
  20514. * Event handler for when the selected date changes
  20515. *
  20516. * @param event
  20517. */
  20518. this.handleDateChange = (event) => {
  20519. if (this.range) {
  20520. return;
  20521. }
  20522. this.value = dateToISO(event.detail);
  20523. };
  20524. this.handleDateRangeChange = (event) => {
  20525. var _a, _b;
  20526. if (!this.range || !event.detail) {
  20527. return;
  20528. }
  20529. const { startDate, endDate } = event.detail;
  20530. this.start = dateToISO(startDate);
  20531. this.end = dateToISO(endDate);
  20532. this.value = [this.start, this.end];
  20533. if (this.shouldFocusRangeEnd()) {
  20534. (_a = this.endInput) === null || _a === void 0 ? void 0 : _a.setFocus();
  20535. }
  20536. else if (this.shouldFocusRangeStart()) {
  20537. (_b = this.startInput) === null || _b === void 0 ? void 0 : _b.setFocus();
  20538. }
  20539. };
  20540. this.commonDateSeparators = [".", "-", "/"];
  20541. this.formatNumerals = (value) => value
  20542. ? value
  20543. .split("")
  20544. .map((char) =>
  20545. // convert common separators to the locale's
  20546. this.commonDateSeparators.includes(char)
  20547. ? this.localeData.separator
  20548. : numberKeys.includes(char)
  20549. ? numberStringFormatter.numberFormatter.format(Number(char))
  20550. : char)
  20551. .join("")
  20552. : "";
  20553. this.parseNumerals = (value) => value
  20554. ? value
  20555. .split("")
  20556. .map((char) => numberKeys.includes(char) ? numberStringFormatter.delocalize(char) : char)
  20557. .join("")
  20558. : "";
  20559. }
  20560. handleDisabledAndReadOnlyChange(value) {
  20561. if (!value) {
  20562. this.open = false;
  20563. }
  20564. }
  20565. valueHandler(value) {
  20566. if (Array.isArray(value)) {
  20567. this.valueAsDate = getValueAsDateRange(value);
  20568. this.start = value[0];
  20569. this.end = value[1];
  20570. }
  20571. else if (value) {
  20572. this.valueAsDate = dateFromISO(value);
  20573. this.start = "";
  20574. this.end = "";
  20575. }
  20576. else {
  20577. this.valueAsDate = undefined;
  20578. this.start = undefined;
  20579. this.end = undefined;
  20580. }
  20581. }
  20582. flipPlacementsHandler() {
  20583. this.setFilteredPlacements();
  20584. this.reposition(true);
  20585. }
  20586. onMinChanged(min) {
  20587. if (min) {
  20588. this.minAsDate = dateFromISO(min);
  20589. }
  20590. }
  20591. onMaxChanged(max) {
  20592. if (max) {
  20593. this.maxAsDate = dateFromISO(max);
  20594. }
  20595. }
  20596. activeHandler(value) {
  20597. this.open = value;
  20598. }
  20599. openHandler(value) {
  20600. this.active = value;
  20601. if (this.disabled || this.readOnly) {
  20602. if (!value) {
  20603. updateAfterClose(this.floatingEl);
  20604. }
  20605. this.open = false;
  20606. return;
  20607. }
  20608. if (value) {
  20609. this.reposition(true);
  20610. }
  20611. else {
  20612. updateAfterClose(this.floatingEl);
  20613. }
  20614. }
  20615. overlayPositioningHandler() {
  20616. this.reposition(true);
  20617. }
  20618. //--------------------------------------------------------------------------
  20619. //
  20620. // Event Listeners
  20621. //
  20622. //--------------------------------------------------------------------------
  20623. handleDateOrRangeChange() {
  20624. this.calciteInputDatePickerChange.emit();
  20625. }
  20626. calciteDaySelectHandler() {
  20627. if (this.shouldFocusRangeStart() || this.shouldFocusRangeEnd()) {
  20628. return;
  20629. }
  20630. this.open = false;
  20631. }
  20632. // --------------------------------------------------------------------------
  20633. //
  20634. // Public Methods
  20635. //
  20636. // --------------------------------------------------------------------------
  20637. /** Sets focus on the component. */
  20638. async setFocus() {
  20639. var _a;
  20640. (_a = this.startInput) === null || _a === void 0 ? void 0 : _a.setFocus();
  20641. }
  20642. /**
  20643. * Updates the position of the component.
  20644. *
  20645. * @param delayed
  20646. */
  20647. async reposition(delayed = false) {
  20648. const { floatingEl, referenceEl, placement, overlayPositioning, filteredFlipPlacements } = this;
  20649. return reposition(this, {
  20650. floatingEl,
  20651. referenceEl,
  20652. overlayPositioning,
  20653. placement,
  20654. flipPlacements: filteredFlipPlacements,
  20655. type: "menu"
  20656. }, delayed);
  20657. }
  20658. // --------------------------------------------------------------------------
  20659. //
  20660. // Lifecycle
  20661. //
  20662. // --------------------------------------------------------------------------
  20663. connectedCallback() {
  20664. connectLocalized(this);
  20665. const isOpen = this.active || this.open;
  20666. isOpen && this.activeHandler(isOpen);
  20667. isOpen && this.openHandler(isOpen);
  20668. if (Array.isArray(this.value)) {
  20669. this.valueAsDate = getValueAsDateRange(this.value);
  20670. this.start = this.value[0];
  20671. this.end = this.value[1];
  20672. }
  20673. else if (this.value) {
  20674. this.valueAsDate = dateFromISO(this.value);
  20675. this.start = "";
  20676. this.end = "";
  20677. }
  20678. if (this.start) {
  20679. this.startAsDate = dateFromISO(this.start);
  20680. }
  20681. if (this.end) {
  20682. this.endAsDate = setEndOfDay(dateFromISO(this.end));
  20683. }
  20684. if (this.min) {
  20685. this.minAsDate = dateFromISO(this.min);
  20686. }
  20687. if (this.max) {
  20688. this.maxAsDate = dateFromISO(this.max);
  20689. }
  20690. connectLabel(this);
  20691. connectForm(this);
  20692. connectOpenCloseComponent(this);
  20693. this.setFilteredPlacements();
  20694. this.reposition(true);
  20695. numberStringFormatter.numberFormatOptions = {
  20696. numberingSystem: this.numberingSystem,
  20697. locale: this.effectiveLocale,
  20698. useGrouping: false
  20699. };
  20700. }
  20701. async componentWillLoad() {
  20702. await this.loadLocaleData();
  20703. this.onMinChanged(this.min);
  20704. this.onMaxChanged(this.max);
  20705. }
  20706. componentDidLoad() {
  20707. this.reposition(true);
  20708. }
  20709. disconnectedCallback() {
  20710. disconnectLabel(this);
  20711. disconnectForm(this);
  20712. disconnectFloatingUI(this, this.referenceEl, this.floatingEl);
  20713. disconnectOpenCloseComponent(this);
  20714. disconnectLocalized(this);
  20715. }
  20716. componentDidRender() {
  20717. updateHostInteraction(this);
  20718. }
  20719. render() {
  20720. var _a, _b;
  20721. const { disabled, readOnly, numberingSystem, effectiveLocale } = this;
  20722. numberStringFormatter.numberFormatOptions = {
  20723. numberingSystem,
  20724. locale: effectiveLocale,
  20725. useGrouping: false
  20726. };
  20727. const date = dateFromRange(this.range ? this.startAsDate : this.valueAsDate, this.minAsDate, this.maxAsDate);
  20728. const endDate = this.range
  20729. ? dateFromRange(this.endAsDate, this.minAsDate, this.maxAsDate)
  20730. : null;
  20731. const formattedEndDate = endDate
  20732. ? this.formatNumerals(endDate.toLocaleDateString(effectiveLocale))
  20733. : "";
  20734. const formattedDate = date ? this.formatNumerals(date.toLocaleDateString(effectiveLocale)) : "";
  20735. return (hAsync(Host, { onBlur: this.deactivate, onKeyDown: this.keyDownHandler, role: "application" }, this.localeData && (hAsync("div", { "aria-expanded": toAriaBoolean(this.open), class: "input-container", role: "application" }, hAsync("div", { class: "input-wrapper", ref: this.setStartWrapper }, hAsync("calcite-input", { class: `input ${this.layout === "vertical" && this.range ? `no-bottom-border` : ``}`, disabled: disabled, icon: "calendar", label: getLabelText(this), lang: effectiveLocale, "number-button-type": "none", numberingSystem: numberingSystem, onCalciteInputInput: this.startInputInput, onCalciteInternalInputBlur: this.inputBlur, onCalciteInternalInputFocus: this.startInputFocus, placeholder: (_a = this.localeData) === null || _a === void 0 ? void 0 : _a.placeholder, readOnly: readOnly, ref: this.setStartInput, scale: this.scale, type: "text", value: formattedDate })), hAsync("div", { "aria-hidden": toAriaBoolean(!this.open), class: {
  20736. [CSS$u.menu]: true,
  20737. [CSS$u.menuActive]: this.open
  20738. }, ref: this.setFloatingEl }, hAsync("div", { class: {
  20739. ["calendar-picker-wrapper"]: true,
  20740. ["calendar-picker-wrapper--end"]: this.focusedInput === "end",
  20741. [FloatingCSS.animation]: true,
  20742. [FloatingCSS.animationActive]: this.open
  20743. }, ref: this.setTransitionEl }, hAsync("calcite-date-picker", { activeRange: this.focusedInput, endAsDate: this.endAsDate, headingLevel: this.headingLevel, intlNextMonth: this.intlNextMonth, intlPrevMonth: this.intlPrevMonth, intlYear: this.intlYear, lang: effectiveLocale, max: this.max, maxAsDate: this.maxAsDate, min: this.min, minAsDate: this.minAsDate, numberingSystem: numberingSystem, onCalciteDatePickerChange: this.handleDateChange, onCalciteDatePickerRangeChange: this.handleDateRangeChange, proximitySelectionDisabled: this.proximitySelectionDisabled, range: this.range, scale: this.scale, startAsDate: this.startAsDate, tabIndex: 0, valueAsDate: this.valueAsDate }))), this.range && this.layout === "horizontal" && (hAsync("div", { class: "horizontal-arrow-container" }, hAsync("calcite-icon", { flipRtl: true, icon: "arrow-right", scale: "s" }))), this.range && this.layout === "vertical" && this.scale !== "s" && (hAsync("div", { class: "vertical-arrow-container" }, hAsync("calcite-icon", { icon: "arrow-down", scale: "s" }))), this.range && (hAsync("div", { class: "input-wrapper", ref: this.setEndWrapper }, hAsync("calcite-input", { class: {
  20744. input: true,
  20745. "border-top-color-one": this.layout === "vertical" && this.range
  20746. }, disabled: disabled, icon: "calendar", lang: effectiveLocale, "number-button-type": "none", numberingSystem: numberingSystem, onCalciteInputInput: this.endInputInput, onCalciteInternalInputBlur: this.inputBlur, onCalciteInternalInputFocus: this.endInputFocus, placeholder: (_b = this.localeData) === null || _b === void 0 ? void 0 : _b.placeholder, readOnly: readOnly, ref: this.setEndInput, scale: this.scale, type: "text", value: formattedEndDate }))))), hAsync(HiddenFormInputSlot, { component: this })));
  20747. }
  20748. setReferenceEl() {
  20749. const { focusedInput, layout, endWrapper, startWrapper } = this;
  20750. this.referenceEl =
  20751. focusedInput === "end" || layout === "vertical"
  20752. ? endWrapper || startWrapper
  20753. : startWrapper || endWrapper;
  20754. connectFloatingUI(this, this.referenceEl, this.floatingEl);
  20755. }
  20756. onLabelClick() {
  20757. this.setFocus();
  20758. }
  20759. onBeforeOpen() {
  20760. this.calciteInputDatePickerBeforeOpen.emit();
  20761. }
  20762. onOpen() {
  20763. this.calciteInputDatePickerOpen.emit();
  20764. }
  20765. onBeforeClose() {
  20766. this.calciteInputDatePickerBeforeClose.emit();
  20767. }
  20768. onClose() {
  20769. this.calciteInputDatePickerClose.emit();
  20770. }
  20771. startWatcher(start) {
  20772. this.startAsDate = dateFromISO(start);
  20773. }
  20774. endWatcher(end) {
  20775. this.endAsDate = end ? setEndOfDay(dateFromISO(end)) : dateFromISO(end);
  20776. }
  20777. async loadLocaleData() {
  20778. {
  20779. return;
  20780. }
  20781. }
  20782. clearCurrentValue() {
  20783. if (!this.range) {
  20784. if (typeof this.value === "string" && this.value) {
  20785. this.calciteDatePickerChange.emit();
  20786. }
  20787. this.value = "";
  20788. return;
  20789. }
  20790. const { focusedInput } = this;
  20791. if (focusedInput === "start") {
  20792. if (this.start) {
  20793. this.calciteDatePickerRangeChange.emit();
  20794. }
  20795. this.value = Array.isArray(this.value) ? ["", this.value[1] || ""] : [""];
  20796. this.start = undefined;
  20797. }
  20798. else if (focusedInput === "end") {
  20799. if (this.end) {
  20800. this.calciteDatePickerRangeChange.emit();
  20801. }
  20802. this.value = Array.isArray(this.value) ? [this.value[0] || "", ""] : ["", ""];
  20803. this.end = undefined;
  20804. }
  20805. }
  20806. /**
  20807. * If inputted string is a valid date, update value/active
  20808. *
  20809. * @param value
  20810. */
  20811. input(value) {
  20812. const date = this.getDateFromInput(value);
  20813. if (!date) {
  20814. this.clearCurrentValue();
  20815. return;
  20816. }
  20817. if (!this.range) {
  20818. this.value = dateToISO(date);
  20819. this.calciteDatePickerChange.emit(date);
  20820. return;
  20821. }
  20822. const { focusedInput } = this;
  20823. if (focusedInput === "start") {
  20824. if (!this.startAsDate || !sameDate(date, this.startAsDate)) {
  20825. const startDateISO = dateToISO(date);
  20826. this.value = Array.isArray(this.value)
  20827. ? [startDateISO, this.value[1] || ""]
  20828. : [startDateISO];
  20829. this.start = startDateISO;
  20830. this.calciteDatePickerRangeChange.emit({
  20831. startDate: date,
  20832. endDate: this.endAsDate
  20833. });
  20834. }
  20835. }
  20836. else if (focusedInput === "end") {
  20837. if (!this.endAsDate || !sameDate(date, this.endAsDate)) {
  20838. const endDateISO = dateToISO(date);
  20839. this.value = Array.isArray(this.value)
  20840. ? [this.value[0] || "", endDateISO]
  20841. : ["", endDateISO];
  20842. this.end = endDateISO;
  20843. this.calciteDatePickerRangeChange.emit({
  20844. startDate: this.startAsDate,
  20845. endDate: setEndOfDay(date)
  20846. });
  20847. }
  20848. }
  20849. }
  20850. /**
  20851. * Clean up invalid date from input on blur
  20852. *
  20853. * @param target
  20854. */
  20855. blur(target) {
  20856. const { focusedInput, endAsDate, range, startAsDate, valueAsDate } = this;
  20857. const locale = this.effectiveLocale;
  20858. const date = this.getDateFromInput(target.value);
  20859. if (!date) {
  20860. if (!range && valueAsDate) {
  20861. target.value = this.formatNumerals(Array.isArray(valueAsDate)
  20862. ? valueAsDate[focusedInput === "end" ? 1 : 0].toLocaleDateString(locale)
  20863. : valueAsDate.toLocaleDateString(locale));
  20864. }
  20865. else if (focusedInput === "start" && startAsDate) {
  20866. target.value = this.formatNumerals(startAsDate.toLocaleDateString(locale));
  20867. }
  20868. else if (focusedInput === "end" && endAsDate) {
  20869. target.value = this.formatNumerals(endAsDate.toLocaleDateString(locale));
  20870. }
  20871. }
  20872. }
  20873. shouldFocusRangeStart() {
  20874. return !!(this.endAsDate &&
  20875. !this.startAsDate &&
  20876. this.focusedInput === "end" &&
  20877. this.startInput);
  20878. }
  20879. shouldFocusRangeEnd() {
  20880. return !!(this.startAsDate &&
  20881. !this.endAsDate &&
  20882. this.focusedInput === "start" &&
  20883. this.endInput);
  20884. }
  20885. /**
  20886. * Find a date from input string
  20887. * return false if date is invalid, or out of range
  20888. *
  20889. * @param value
  20890. */
  20891. getDateFromInput(value) {
  20892. if (!this.localeData) {
  20893. return false;
  20894. }
  20895. const { separator } = this.localeData;
  20896. const { day, month, year } = parseDateString(value, this.localeData);
  20897. const validDay = day > 0;
  20898. const validMonth = month > -1;
  20899. const date = new Date(year, month, day);
  20900. date.setFullYear(year);
  20901. const validDate = !isNaN(date.getTime());
  20902. const validLength = value.split(separator).filter((c) => c).length > 2;
  20903. const validYear = year.toString().length > 0;
  20904. if (validDay &&
  20905. validMonth &&
  20906. validDate &&
  20907. validLength &&
  20908. validYear &&
  20909. inRange(date, this.min, this.max)) {
  20910. return date;
  20911. }
  20912. return false;
  20913. }
  20914. get el() { return getElement(this); }
  20915. static get watchers() { return {
  20916. "disabled": ["handleDisabledAndReadOnlyChange"],
  20917. "readOnly": ["handleDisabledAndReadOnlyChange"],
  20918. "value": ["valueHandler"],
  20919. "flipPlacements": ["flipPlacementsHandler"],
  20920. "min": ["onMinChanged"],
  20921. "max": ["onMaxChanged"],
  20922. "active": ["activeHandler"],
  20923. "open": ["openHandler"],
  20924. "overlayPositioning": ["overlayPositioningHandler"],
  20925. "layout": ["setReferenceEl"],
  20926. "focusedInput": ["setReferenceEl"],
  20927. "start": ["startWatcher"],
  20928. "end": ["endWatcher"],
  20929. "effectiveLocale": ["loadLocaleData"]
  20930. }; }
  20931. static get style() { return inputDatePickerCss; }
  20932. static get cmpMeta() { return {
  20933. "$flags$": 9,
  20934. "$tagName$": "calcite-input-date-picker",
  20935. "$members$": {
  20936. "disabled": [516],
  20937. "readOnly": [516, "read-only"],
  20938. "value": [1025],
  20939. "flipPlacements": [16],
  20940. "headingLevel": [514, "heading-level"],
  20941. "valueAsDate": [1040],
  20942. "startAsDate": [1040],
  20943. "endAsDate": [1040],
  20944. "minAsDate": [1040],
  20945. "maxAsDate": [1040],
  20946. "min": [1025],
  20947. "max": [1025],
  20948. "active": [1540],
  20949. "open": [1540],
  20950. "name": [513],
  20951. "intlPrevMonth": [1, "intl-prev-month"],
  20952. "intlNextMonth": [1, "intl-next-month"],
  20953. "intlYear": [1, "intl-year"],
  20954. "locale": [1],
  20955. "numberingSystem": [513, "numbering-system"],
  20956. "scale": [513],
  20957. "placement": [513],
  20958. "range": [516],
  20959. "required": [516],
  20960. "start": [1537],
  20961. "end": [1537],
  20962. "overlayPositioning": [513, "overlay-positioning"],
  20963. "proximitySelectionDisabled": [4, "proximity-selection-disabled"],
  20964. "layout": [513],
  20965. "effectiveLocale": [32],
  20966. "focusedInput": [32],
  20967. "globalAttributes": [32],
  20968. "localeData": [32],
  20969. "setFocus": [64],
  20970. "reposition": [64]
  20971. },
  20972. "$listeners$": [[0, "calciteDatePickerChange", "handleDateOrRangeChange"], [0, "calciteDatePickerRangeChange", "handleDateOrRangeChange"], [0, "calciteDaySelect", "calciteDaySelectHandler"]],
  20973. "$lazyBundleId$": "-",
  20974. "$attrsToReflect$": [["disabled", "disabled"], ["readOnly", "read-only"], ["headingLevel", "heading-level"], ["active", "active"], ["open", "open"], ["name", "name"], ["numberingSystem", "numbering-system"], ["scale", "scale"], ["placement", "placement"], ["range", "range"], ["required", "required"], ["start", "start"], ["end", "end"], ["overlayPositioning", "overlay-positioning"], ["layout", "layout"]]
  20975. }; }
  20976. }
  20977. var StatusIconDefaults;
  20978. (function (StatusIconDefaults) {
  20979. StatusIconDefaults["valid"] = "check-circle";
  20980. StatusIconDefaults["invalid"] = "exclamation-mark-triangle";
  20981. StatusIconDefaults["idle"] = "information";
  20982. })(StatusIconDefaults || (StatusIconDefaults = {}));
  20983. const inputMessageCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-input-message:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-input-message{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-message{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-message{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-message{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-message{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-input-message:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-input-message:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-message-h{display:none}/*!@:host([active][scale=m]),\n:host([active][scale=l])*/[active][scale=m].sc-calcite-input-message-h,[active][scale=l].sc-calcite-input-message-h{--calcite-input-message-spacing-value:0.25rem}/*!@:host*/.sc-calcite-input-message-h{visibility:hidden;box-sizing:border-box;display:flex;block-size:0px;inline-size:100%;align-items:center;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@:host([active])*/[active].sc-calcite-input-message-h{visibility:visible;block-size:auto;opacity:1;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@:host([active][scale=m]),\n:host([active][scale=l])*/[active][scale=m].sc-calcite-input-message-h,[active][scale=l].sc-calcite-input-message-h{margin-block-start:var(--calcite-input-message-spacing-value)}/*!@:host([calcite-hydrated-hidden])*/[calcite-hydrated-hidden].sc-calcite-input-message-h{visibility:hidden !important;pointer-events:none}/*!@.calcite-input-message-icon*/.calcite-input-message-icon.sc-calcite-input-message{pointer-events:none;display:inline-flex;flex-shrink:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;margin-inline-end:0.5rem}/*!@:host([status=invalid]) .calcite-input-message-icon*/[status=invalid].sc-calcite-input-message-h .calcite-input-message-icon.sc-calcite-input-message{color:var(--calcite-ui-danger)}/*!@:host([status=warning]) .calcite-input-message-icon*/[status=warning].sc-calcite-input-message-h .calcite-input-message-icon.sc-calcite-input-message{color:var(--calcite-ui-warning)}/*!@:host([status=valid]) .calcite-input-message-icon*/[status=valid].sc-calcite-input-message-h .calcite-input-message-icon.sc-calcite-input-message{color:var(--calcite-ui-success)}/*!@:host([status=idle]) .calcite-input-message-icon*/[status=idle].sc-calcite-input-message-h .calcite-input-message-icon.sc-calcite-input-message{color:var(--calcite-ui-brand)}/*!@:host([status][active])*/[status][active].sc-calcite-input-message-h{color:var(--calcite-ui-text-1)}/*!@:host([status][scale=s])*/[status][scale=s].sc-calcite-input-message-h{font-size:var(--calcite-font-size--3);line-height:0.75rem}/*!@:host([status][scale=m])*/[status][scale=m].sc-calcite-input-message-h{margin-block-start:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([status][scale=l])*/[status][scale=l].sc-calcite-input-message-h{margin-block-start:0.25rem;font-size:var(--calcite-font-size--1);line-height:1rem}";
  20984. /**
  20985. * @slot - A slot for adding text.
  20986. */
  20987. class InputMessage {
  20988. constructor(hostRef) {
  20989. registerInstance(this, hostRef);
  20990. //--------------------------------------------------------------------------
  20991. //
  20992. // Properties
  20993. //
  20994. //--------------------------------------------------------------------------
  20995. /** When `true`, the component is active. */
  20996. this.active = false;
  20997. /** Specifies the size of the component. */
  20998. this.scale = "m";
  20999. /** Specifies the status of the input field, which determines message and icons. */
  21000. this.status = "idle";
  21001. }
  21002. handleIconEl() {
  21003. this.requestedIcon = setRequestedIcon(StatusIconDefaults, this.icon, this.status);
  21004. }
  21005. //--------------------------------------------------------------------------
  21006. //
  21007. // Lifecycle
  21008. //
  21009. //--------------------------------------------------------------------------
  21010. connectedCallback() {
  21011. this.status = getElementProp(this.el, "status", this.status);
  21012. this.scale = getElementProp(this.el, "scale", this.scale);
  21013. this.requestedIcon = setRequestedIcon(StatusIconDefaults, this.icon, this.status);
  21014. }
  21015. render() {
  21016. const hidden = !this.active;
  21017. return (hAsync(Host, { "calcite-hydrated-hidden": hidden }, this.renderIcon(this.requestedIcon), hAsync("slot", null)));
  21018. }
  21019. //--------------------------------------------------------------------------
  21020. //
  21021. // Private Methods
  21022. //
  21023. //--------------------------------------------------------------------------
  21024. renderIcon(iconName) {
  21025. if (iconName) {
  21026. return hAsync("calcite-icon", { class: "calcite-input-message-icon", icon: iconName, scale: "s" });
  21027. }
  21028. }
  21029. get el() { return getElement(this); }
  21030. static get watchers() { return {
  21031. "status": ["handleIconEl"],
  21032. "icon": ["handleIconEl"]
  21033. }; }
  21034. static get style() { return inputMessageCss; }
  21035. static get cmpMeta() { return {
  21036. "$flags$": 9,
  21037. "$tagName$": "calcite-input-message",
  21038. "$members$": {
  21039. "active": [516],
  21040. "icon": [520],
  21041. "scale": [1537],
  21042. "status": [1537],
  21043. "type": [513]
  21044. },
  21045. "$listeners$": undefined,
  21046. "$lazyBundleId$": "-",
  21047. "$attrsToReflect$": [["active", "active"], ["icon", "icon"], ["scale", "scale"], ["status", "status"], ["type", "type"]]
  21048. }; }
  21049. }
  21050. const CSS$t = {
  21051. loader: "loader",
  21052. clearButton: "clear-button",
  21053. editingEnabled: "editing-enabled",
  21054. inlineChild: "inline-child",
  21055. inputIcon: "icon",
  21056. prefix: "prefix",
  21057. suffix: "suffix",
  21058. numberButtonWrapper: "number-button-wrapper",
  21059. buttonItemHorizontal: "number-button-item--horizontal",
  21060. wrapper: "element-wrapper",
  21061. inputWrapper: "wrapper",
  21062. actionWrapper: "action-wrapper",
  21063. resizeIconWrapper: "resize-icon-wrapper",
  21064. numberButtonItem: "number-button-item"
  21065. };
  21066. const SLOTS$g = {
  21067. action: "action"
  21068. };
  21069. const TEXT$c = {
  21070. clear: "Clear value"
  21071. };
  21072. const inputNumberCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-input-number:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-input-number{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-number{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-number{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-number{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-number{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-input-number:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-input-number:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-number-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-input-number-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-input-number-h{display:block}/*!@:host([scale=s]) input, :host([scale=s]) .prefix, :host([scale=s]) .suffix*/[scale=s].sc-calcite-input-number-h input.sc-calcite-input-number,[scale=s].sc-calcite-input-number-h .prefix.sc-calcite-input-number,[scale=s].sc-calcite-input-number-h .suffix.sc-calcite-input-number{block-size:1.5rem;padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=s]) .number-button-wrapper, :host([scale=s]) .action-wrapper calcite-button, :host([scale=s]) .action-wrapper calcite-button button*/[scale=s].sc-calcite-input-number-h .number-button-wrapper.sc-calcite-input-number,[scale=s].sc-calcite-input-number-h .action-wrapper.sc-calcite-input-number calcite-button.sc-calcite-input-number,[scale=s].sc-calcite-input-number-h .action-wrapper.sc-calcite-input-number calcite-button.sc-calcite-input-number button.sc-calcite-input-number{block-size:1.5rem}/*!@:host([scale=s]) .clear-button*/[scale=s].sc-calcite-input-number-h .clear-button.sc-calcite-input-number{min-block-size:1.5rem;min-inline-size:1.5rem}/*!@:host([scale=m]) input, :host([scale=m]) .prefix, :host([scale=m]) .suffix*/[scale=m].sc-calcite-input-number-h input.sc-calcite-input-number,[scale=m].sc-calcite-input-number-h .prefix.sc-calcite-input-number,[scale=m].sc-calcite-input-number-h .suffix.sc-calcite-input-number{block-size:2rem;padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=m]) .number-button-wrapper, :host([scale=m]) .action-wrapper calcite-button, :host([scale=m]) .action-wrapper calcite-button button*/[scale=m].sc-calcite-input-number-h .number-button-wrapper.sc-calcite-input-number,[scale=m].sc-calcite-input-number-h .action-wrapper.sc-calcite-input-number calcite-button.sc-calcite-input-number,[scale=m].sc-calcite-input-number-h .action-wrapper.sc-calcite-input-number calcite-button.sc-calcite-input-number button.sc-calcite-input-number{block-size:2rem}/*!@:host([scale=m]) .clear-button*/[scale=m].sc-calcite-input-number-h .clear-button.sc-calcite-input-number{min-block-size:2rem;min-inline-size:2rem}/*!@:host([scale=l]) input, :host([scale=l]) .prefix, :host([scale=l]) .suffix*/[scale=l].sc-calcite-input-number-h input.sc-calcite-input-number,[scale=l].sc-calcite-input-number-h .prefix.sc-calcite-input-number,[scale=l].sc-calcite-input-number-h .suffix.sc-calcite-input-number{block-size:2.75rem;padding-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l]) .number-button-wrapper, :host([scale=l]) .action-wrapper calcite-button, :host([scale=l]) .action-wrapper calcite-button button*/[scale=l].sc-calcite-input-number-h .number-button-wrapper.sc-calcite-input-number,[scale=l].sc-calcite-input-number-h .action-wrapper.sc-calcite-input-number calcite-button.sc-calcite-input-number,[scale=l].sc-calcite-input-number-h .action-wrapper.sc-calcite-input-number calcite-button.sc-calcite-input-number button.sc-calcite-input-number{block-size:2.75rem}/*!@:host([scale=l]) .clear-button*/[scale=l].sc-calcite-input-number-h .clear-button.sc-calcite-input-number{min-block-size:2.75rem;min-inline-size:2.75rem}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-input-number-h[disabled] .sc-calcite-input-number-s>[calcite-hydrated][disabled],[disabled].sc-calcite-input-number-h [calcite-hydrated][disabled].sc-calcite-input-number{opacity:1}/*!@:host input*/.sc-calcite-input-number-h input.sc-calcite-input-number{transition:var(--calcite-animation-timing), block-size 0, outline-offset 0s;-webkit-appearance:none;position:relative;margin:0px;box-sizing:border-box;display:flex;max-block-size:100%;inline-size:100%;max-inline-size:100%;flex:1 1 0%;border-radius:0px;background-color:var(--calcite-ui-foreground-1);font-family:inherit;font-weight:var(--calcite-font-weight-normal);border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);color:var(--calcite-ui-text-1)}/*!@:host input::placeholder, :host input:-ms-input-placeholder, :host input::-ms-input-placeholder*/.sc-calcite-input-number-h input.sc-calcite-input-number::placeholder,.sc-calcite-input-number-h input.sc-calcite-input-number:-ms-input-placeholder,.sc-calcite-input-number-h input.sc-calcite-input-number::-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}/*!@:host input:focus*/.sc-calcite-input-number-h input.sc-calcite-input-number:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-1)}/*!@:host input[readonly]*/.sc-calcite-input-number-h input[readonly].sc-calcite-input-number{background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium)}/*!@:host input[readonly]:focus*/.sc-calcite-input-number-h input[readonly].sc-calcite-input-number:focus{color:var(--calcite-ui-text-1)}/*!@:host calcite-icon*/.sc-calcite-input-number-h calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-3)}/*!@:host input*/.sc-calcite-input-number-h input.sc-calcite-input-number{outline-color:transparent}/*!@:host input:focus*/.sc-calcite-input-number-h input.sc-calcite-input-number:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host([status=invalid]) input*/[status=invalid].sc-calcite-input-number-h input.sc-calcite-input-number{border-color:var(--calcite-ui-danger)}/*!@:host([status=invalid]) input:focus*/[status=invalid].sc-calcite-input-number-h input.sc-calcite-input-number:focus{outline:2px solid var(--calcite-ui-danger);outline-offset:-2px}/*!@:host([scale=s]) .icon*/[scale=s].sc-calcite-input-number-h .icon.sc-calcite-input-number{inset-inline-start:0.5rem}/*!@:host([scale=m]) .icon*/[scale=m].sc-calcite-input-number-h .icon.sc-calcite-input-number{inset-inline-start:0.75rem}/*!@:host([scale=l]) .icon*/[scale=l].sc-calcite-input-number-h .icon.sc-calcite-input-number{inset-inline-start:1rem}/*!@:host([icon][scale=s]) input*/[icon][scale=s].sc-calcite-input-number-h input.sc-calcite-input-number{padding-inline-start:2rem}/*!@:host([icon][scale=m]) input*/[icon][scale=m].sc-calcite-input-number-h input.sc-calcite-input-number{padding-inline-start:2.5rem}/*!@:host([icon][scale=l]) input*/[icon][scale=l].sc-calcite-input-number-h input.sc-calcite-input-number{padding-inline-start:3rem}/*!@.element-wrapper*/.element-wrapper.sc-calcite-input-number{position:relative;order:3;display:inline-flex;flex:1 1 0%;align-items:center}/*!@.icon*/.icon.sc-calcite-input-number{pointer-events:none;position:absolute;z-index:1;display:block;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button*/.clear-button.sc-calcite-input-number{pointer-events:initial;order:4;margin:0px;box-sizing:border-box;display:flex;min-block-size:100%;cursor:pointer;align-items:center;justify-content:center;align-self:stretch;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);outline-color:transparent;border-inline-start-width:0px}/*!@.clear-button:hover*/.clear-button.sc-calcite-input-number:hover{background-color:var(--calcite-ui-foreground-2);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button:hover calcite-icon*/.clear-button.sc-calcite-input-number:hover calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button:active*/.clear-button.sc-calcite-input-number:active{background-color:var(--calcite-ui-foreground-3)}/*!@.clear-button:active calcite-icon*/.clear-button.sc-calcite-input-number:active calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-1)}/*!@.clear-button:focus*/.clear-button.sc-calcite-input-number:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.clear-button:disabled*/.clear-button.sc-calcite-input-number:disabled{opacity:var(--calcite-ui-opacity-disabled)}/*!@.loader*/.loader.sc-calcite-input-number{inset-block-start:1px;inset-inline:1px;pointer-events:none;position:absolute;display:block}/*!@.action-wrapper*/.action-wrapper.sc-calcite-input-number{order:7;display:flex}/*!@.prefix, \n.suffix*/.prefix.sc-calcite-input-number,.suffix.sc-calcite-input-number{box-sizing:border-box;display:flex;block-size:auto;min-block-size:100%;-webkit-user-select:none;user-select:none;align-content:center;align-items:center;overflow-wrap:break-word;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium);line-height:1;color:var(--calcite-ui-text-2)}/*!@.prefix*/.prefix.sc-calcite-input-number{order:2;border-inline-end-width:0px}/*!@.suffix*/.suffix.sc-calcite-input-number{order:5;border-inline-start-width:0px}/*!@:host([alignment=start]) input*/[alignment=start].sc-calcite-input-number-h input.sc-calcite-input-number{text-align:start}/*!@:host([alignment=end]) input*/[alignment=end].sc-calcite-input-number-h input.sc-calcite-input-number{text-align:end}/*!@.number-button-wrapper*/.number-button-wrapper.sc-calcite-input-number{pointer-events:none;order:6;box-sizing:border-box;display:flex;flex-direction:column;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@:host([number-button-type=vertical]) .wrapper*/[number-button-type=vertical].sc-calcite-input-number-h .wrapper.sc-calcite-input-number{flex-direction:row;display:flex}/*!@:host([number-button-type=vertical]) input*/[number-button-type=vertical].sc-calcite-input-number-h input.sc-calcite-input-number{order:2}/*!@:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=down] calcite-icon*/[number-button-type=horizontal].sc-calcite-input-number-h .calcite--rtl.sc-calcite-input-number .number-button-item[data-adjustment=down].sc-calcite-input-number calcite-icon.sc-calcite-input-number{transform:rotate(-90deg)}/*!@:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=up] calcite-icon*/[number-button-type=horizontal].sc-calcite-input-number-h .calcite--rtl.sc-calcite-input-number .number-button-item[data-adjustment=up].sc-calcite-input-number calcite-icon.sc-calcite-input-number{transform:rotate(-90deg)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down], .number-button-item.number-button-item--horizontal[data-adjustment=up]*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input-number,.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input-number{order:1;max-block-size:100%;min-block-size:100%;align-self:stretch}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down] calcite-icon, .number-button-item.number-button-item--horizontal[data-adjustment=up] calcite-icon*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input-number calcite-icon.sc-calcite-input-number,.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input-number calcite-icon.sc-calcite-input-number{transform:rotate(90deg)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down]*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input-number{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);border-inline-end-width:0px}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input-number:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover calcite-icon*/.number-button-item.number-button-item--horizontal[data-adjustment=down].sc-calcite-input-number:hover calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-1)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=up]*/.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input-number{order:5}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover*/.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input-number:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover calcite-icon*/.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input-number:hover calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-1)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover*/[number-button-type=vertical].sc-calcite-input-number-h .number-button-item[data-adjustment=down].sc-calcite-input-number:hover{background-color:var(--calcite-ui-foreground-2)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover calcite-icon*/[number-button-type=vertical].sc-calcite-input-number-h .number-button-item[data-adjustment=down].sc-calcite-input-number:hover calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-1)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover*/[number-button-type=vertical].sc-calcite-input-number-h .number-button-item[data-adjustment=up].sc-calcite-input-number:hover{background-color:var(--calcite-ui-foreground-2)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover calcite-icon*/[number-button-type=vertical].sc-calcite-input-number-h .number-button-item[data-adjustment=up].sc-calcite-input-number:hover calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-1)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]*/[number-button-type=vertical].sc-calcite-input-number-h .number-button-item[data-adjustment=down].sc-calcite-input-number{border-block-start-width:0px}/*!@.number-button-item*/.number-button-item.sc-calcite-input-number{max-block-size:50%;min-block-size:50%;pointer-events:initial;margin:0px;box-sizing:border-box;display:flex;cursor:pointer;align-items:center;align-self:center;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);padding-block:0px;padding-inline:0.5rem;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-inline-start-width:0px}/*!@.number-button-item calcite-icon*/.number-button-item.sc-calcite-input-number calcite-icon.sc-calcite-input-number{pointer-events:none;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.number-button-item:focus*/.number-button-item.sc-calcite-input-number:focus{background-color:var(--calcite-ui-foreground-2)}/*!@.number-button-item:focus calcite-icon*/.number-button-item.sc-calcite-input-number:focus calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-1)}/*!@.number-button-item:active*/.number-button-item.sc-calcite-input-number:active{background-color:var(--calcite-ui-foreground-3)}/*!@.number-button-item:disabled*/.number-button-item.sc-calcite-input-number:disabled{pointer-events:none}/*!@.wrapper*/.wrapper.sc-calcite-input-number{position:relative;display:flex;flex-direction:row;align-items:center}/*!@:host(.no-bottom-border) input*/.no-bottom-border.sc-calcite-input-number-h input.sc-calcite-input-number{border-block-end-width:0px}/*!@:host(.border-top-color-one) input*/.border-top-color-one.sc-calcite-input-number-h input.sc-calcite-input-number{border-block-start-color:var(--calcite-ui-border-1)}/*!@:host .inline-child*/.sc-calcite-input-number-h .inline-child.sc-calcite-input-number{background-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@:host .inline-child .editing-enabled*/.sc-calcite-input-number-h .inline-child.sc-calcite-input-number .editing-enabled.sc-calcite-input-number{background-color:inherit}/*!@:host .inline-child:not(.editing-enabled)*/.sc-calcite-input-number-h .inline-child.sc-calcite-input-number:not(.editing-enabled){display:flex;cursor:pointer;border-color:transparent;padding-inline-start:0}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-input-number-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  21073. /**
  21074. * @slot action - A slot for positioning a button next to the component.
  21075. */
  21076. class InputNumber {
  21077. constructor(hostRef) {
  21078. registerInstance(this, hostRef);
  21079. this.calciteInternalInputNumberFocus = createEvent(this, "calciteInternalInputNumberFocus", 6);
  21080. this.calciteInternalInputNumberBlur = createEvent(this, "calciteInternalInputNumberBlur", 6);
  21081. this.calciteInputNumberInput = createEvent(this, "calciteInputNumberInput", 7);
  21082. this.calciteInputNumberChange = createEvent(this, "calciteInputNumberChange", 6);
  21083. //--------------------------------------------------------------------------
  21084. //
  21085. // Properties
  21086. //
  21087. //--------------------------------------------------------------------------
  21088. /** Specifies the text alignment of the component's value. */
  21089. this.alignment = "start";
  21090. /**
  21091. * When `true`, the component is focused on page load.
  21092. *
  21093. * @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
  21094. */
  21095. this.autofocus = false;
  21096. /**
  21097. * When `true`, a clear button is displayed when the component has a value.
  21098. */
  21099. this.clearable = false;
  21100. /**
  21101. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  21102. *
  21103. * @mdn [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled)
  21104. */
  21105. this.disabled = false;
  21106. /**
  21107. * When `true`, number values are displayed with a group separator corresponding to the language and country format.
  21108. */
  21109. this.groupSeparator = false;
  21110. /**
  21111. * When `true`, the component will not be visible.
  21112. *
  21113. * @mdn [hidden](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden)
  21114. */
  21115. this.hidden = false;
  21116. /**
  21117. * Accessible name that will appear while loading.
  21118. *
  21119. * @default "Loading"
  21120. */
  21121. this.intlLoading = TEXT$v.loading;
  21122. /** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
  21123. this.iconFlipRtl = false;
  21124. /** When `true`, the component is in the loading state and `calcite-progress` is displayed. */
  21125. this.loading = false;
  21126. /**
  21127. * Toggles locale formatting for numbers.
  21128. *
  21129. * @internal
  21130. */
  21131. this.localeFormat = false;
  21132. /** Specifies the placement of the buttons. */
  21133. this.numberButtonType = "vertical";
  21134. /**
  21135. * When `true`, the component's value can be read, but cannot be modified.
  21136. *
  21137. * @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
  21138. */
  21139. this.readOnly = false;
  21140. /** When `true`, the component must have a value in order for the form to submit. */
  21141. this.required = false;
  21142. /** Specifies the size of the component. */
  21143. this.scale = "m";
  21144. /** Specifies the status of the input field, which determines message and icons. */
  21145. this.status = "idle";
  21146. /**
  21147. * @internal
  21148. */
  21149. this.editingEnabled = false;
  21150. /** The component's value. */
  21151. this.value = "";
  21152. this.previousValueOrigin = "initial";
  21153. this.mutationObserver = createObserver();
  21154. this.userChangedValue = false;
  21155. //--------------------------------------------------------------------------
  21156. //
  21157. // State
  21158. //
  21159. //--------------------------------------------------------------------------
  21160. this.effectiveLocale = "";
  21161. //--------------------------------------------------------------------------
  21162. //
  21163. // Private Methods
  21164. //
  21165. //--------------------------------------------------------------------------
  21166. this.keyDownHandler = (event) => {
  21167. if (this.readOnly || this.disabled) {
  21168. return;
  21169. }
  21170. if (this.isClearable && event.key === "Escape") {
  21171. this.clearInputValue(event);
  21172. event.preventDefault();
  21173. }
  21174. if (event.key === "Enter" && !event.defaultPrevented) {
  21175. if (submitForm(this)) {
  21176. event.preventDefault();
  21177. }
  21178. }
  21179. };
  21180. this.clearInputValue = (nativeEvent) => {
  21181. this.setNumberValue({
  21182. committing: true,
  21183. nativeEvent,
  21184. origin: "user",
  21185. value: ""
  21186. });
  21187. };
  21188. this.emitChangeIfUserModified = () => {
  21189. if (this.previousValueOrigin === "user" && this.value !== this.previousEmittedValue) {
  21190. this.calciteInputNumberChange.emit();
  21191. }
  21192. this.previousEmittedValue = this.value;
  21193. };
  21194. this.inputNumberBlurHandler = () => {
  21195. this.calciteInternalInputNumberBlur.emit();
  21196. this.emitChangeIfUserModified();
  21197. };
  21198. this.inputNumberFocusHandler = (event) => {
  21199. const slottedActionEl = getSlotted(this.el, "action");
  21200. if (event.target !== slottedActionEl) {
  21201. this.setFocus();
  21202. }
  21203. this.calciteInternalInputNumberFocus.emit();
  21204. };
  21205. this.inputNumberInputHandler = (nativeEvent) => {
  21206. if (this.disabled || this.readOnly) {
  21207. return;
  21208. }
  21209. const value = nativeEvent.target.value;
  21210. numberStringFormatter.numberFormatOptions = {
  21211. locale: this.effectiveLocale,
  21212. numberingSystem: this.numberingSystem,
  21213. useGrouping: this.groupSeparator
  21214. };
  21215. const delocalizedValue = numberStringFormatter.delocalize(value);
  21216. if (nativeEvent.inputType === "insertFromPaste") {
  21217. if (!isValidNumber(delocalizedValue)) {
  21218. nativeEvent.preventDefault();
  21219. }
  21220. this.setNumberValue({
  21221. nativeEvent,
  21222. origin: "user",
  21223. value: parseNumberString(delocalizedValue)
  21224. });
  21225. this.childNumberEl.value = this.localizedValue;
  21226. }
  21227. else {
  21228. this.setNumberValue({
  21229. nativeEvent,
  21230. origin: "user",
  21231. value: delocalizedValue
  21232. });
  21233. }
  21234. };
  21235. this.inputNumberKeyDownHandler = (event) => {
  21236. if (this.disabled || this.readOnly) {
  21237. return;
  21238. }
  21239. if (event.key === "ArrowUp") {
  21240. /* prevent default behavior of moving cursor to the beginning of the input when holding down ArrowUp */
  21241. event.preventDefault();
  21242. this.nudgeNumberValue("up", event);
  21243. return;
  21244. }
  21245. if (event.key === "ArrowDown") {
  21246. this.nudgeNumberValue("down", event);
  21247. return;
  21248. }
  21249. const supportedKeys = [
  21250. ...numberKeys,
  21251. "ArrowLeft",
  21252. "ArrowRight",
  21253. "Backspace",
  21254. "Delete",
  21255. "Enter",
  21256. "Escape",
  21257. "Tab"
  21258. ];
  21259. if (event.altKey || event.ctrlKey || event.metaKey) {
  21260. return;
  21261. }
  21262. const isShiftTabEvent = event.shiftKey && event.key === "Tab";
  21263. if (supportedKeys.includes(event.key) && (!event.shiftKey || isShiftTabEvent)) {
  21264. if (event.key === "Enter") {
  21265. this.emitChangeIfUserModified();
  21266. }
  21267. return;
  21268. }
  21269. numberStringFormatter.numberFormatOptions = {
  21270. locale: this.effectiveLocale,
  21271. numberingSystem: this.numberingSystem,
  21272. useGrouping: this.groupSeparator
  21273. };
  21274. if (event.key === numberStringFormatter.decimal) {
  21275. if (!this.value && !this.childNumberEl.value) {
  21276. return;
  21277. }
  21278. if (this.value && this.childNumberEl.value.indexOf(numberStringFormatter.decimal) === -1) {
  21279. return;
  21280. }
  21281. }
  21282. if (/[eE]/.test(event.key)) {
  21283. if (!this.value && !this.childNumberEl.value) {
  21284. return;
  21285. }
  21286. if (this.value && !/[eE]/.test(this.childNumberEl.value)) {
  21287. return;
  21288. }
  21289. }
  21290. if (event.key === "-") {
  21291. if (!this.value && !this.childNumberEl.value) {
  21292. return;
  21293. }
  21294. if (this.value && this.childNumberEl.value.split("-").length <= 2) {
  21295. return;
  21296. }
  21297. }
  21298. event.preventDefault();
  21299. };
  21300. this.nudgeNumberValue = (direction, nativeEvent) => {
  21301. if (nativeEvent instanceof KeyboardEvent && nativeEvent.repeat) {
  21302. return;
  21303. }
  21304. const inputMax = this.maxString ? parseFloat(this.maxString) : null;
  21305. const inputMin = this.minString ? parseFloat(this.minString) : null;
  21306. const valueNudgeDelayInMs = 100;
  21307. this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
  21308. if (this.nudgeNumberValueIntervalId) {
  21309. window.clearInterval(this.nudgeNumberValueIntervalId);
  21310. }
  21311. let firstValueNudge = true;
  21312. this.nudgeNumberValueIntervalId = window.setInterval(() => {
  21313. if (firstValueNudge) {
  21314. firstValueNudge = false;
  21315. return;
  21316. }
  21317. this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
  21318. }, valueNudgeDelayInMs);
  21319. };
  21320. this.nudgeButtonPointerUpAndOutHandler = (event) => {
  21321. if (!isPrimaryPointerButton(event)) {
  21322. return;
  21323. }
  21324. window.clearInterval(this.nudgeNumberValueIntervalId);
  21325. };
  21326. this.nudgeButtonPointerDownHandler = (event) => {
  21327. if (!isPrimaryPointerButton(event)) {
  21328. return;
  21329. }
  21330. event.preventDefault();
  21331. const direction = event.target.dataset.adjustment;
  21332. if (!this.disabled) {
  21333. this.nudgeNumberValue(direction, event);
  21334. }
  21335. };
  21336. this.hiddenInputChangeHandler = (event) => {
  21337. if (event.target.name === this.name) {
  21338. this.setNumberValue({
  21339. value: event.target.value,
  21340. origin: "direct"
  21341. });
  21342. }
  21343. event.stopPropagation();
  21344. };
  21345. this.setChildNumberElRef = (el) => {
  21346. this.childNumberEl = el;
  21347. };
  21348. this.setInputNumberValue = (newInputValue) => {
  21349. if (!this.childNumberEl) {
  21350. return;
  21351. }
  21352. this.childNumberEl.value = newInputValue;
  21353. };
  21354. this.setPreviousEmittedNumberValue = (newPreviousEmittedValue) => {
  21355. this.previousEmittedValue = isValidNumber(newPreviousEmittedValue)
  21356. ? newPreviousEmittedValue
  21357. : "";
  21358. };
  21359. this.setPreviousNumberValue = (newPreviousValue) => {
  21360. this.previousValue = isValidNumber(newPreviousValue) ? newPreviousValue : "";
  21361. };
  21362. this.setNumberValue = ({ committing = false, nativeEvent, origin, previousValue, value }) => {
  21363. numberStringFormatter.numberFormatOptions = {
  21364. locale: this.effectiveLocale,
  21365. numberingSystem: this.numberingSystem,
  21366. useGrouping: this.groupSeparator
  21367. };
  21368. const sanitizedValue = sanitizeNumberString((this.numberingSystem && this.numberingSystem !== "latn") || defaultNumberingSystem !== "latn"
  21369. ? numberStringFormatter.delocalize(value)
  21370. : value);
  21371. const newValue = value && !sanitizedValue
  21372. ? isValidNumber(this.previousValue)
  21373. ? this.previousValue
  21374. : ""
  21375. : sanitizedValue;
  21376. const newLocalizedValue = numberStringFormatter.localize(newValue);
  21377. this.setPreviousNumberValue(previousValue || this.value);
  21378. this.previousValueOrigin = origin;
  21379. this.userChangedValue = origin === "user" && this.value !== newValue;
  21380. this.value = newValue;
  21381. this.localizedValue = newLocalizedValue;
  21382. if (origin === "direct") {
  21383. this.setInputNumberValue(newLocalizedValue);
  21384. }
  21385. if (nativeEvent) {
  21386. const calciteInputNumberInputEvent = this.calciteInputNumberInput.emit({
  21387. element: this.childNumberEl,
  21388. nativeEvent,
  21389. value: this.value
  21390. });
  21391. if (calciteInputNumberInputEvent.defaultPrevented) {
  21392. const previousLocalizedValue = numberStringFormatter.localize(this.previousValue);
  21393. this.value = this.previousValue;
  21394. this.localizedValue = previousLocalizedValue;
  21395. }
  21396. else if (committing) {
  21397. this.emitChangeIfUserModified();
  21398. }
  21399. }
  21400. };
  21401. this.inputNumberKeyUpHandler = () => {
  21402. window.clearInterval(this.nudgeNumberValueIntervalId);
  21403. };
  21404. }
  21405. disabledWatcher() {
  21406. this.setDisabledAction();
  21407. }
  21408. localeChanged() {
  21409. updateEffectiveLocale(this);
  21410. }
  21411. /** watcher to update number-to-string for max */
  21412. maxWatcher() {
  21413. var _a;
  21414. this.maxString = ((_a = this.max) === null || _a === void 0 ? void 0 : _a.toString()) || null;
  21415. }
  21416. /** watcher to update number-to-string for min */
  21417. minWatcher() {
  21418. var _a;
  21419. this.minString = ((_a = this.min) === null || _a === void 0 ? void 0 : _a.toString()) || null;
  21420. }
  21421. valueWatcher(newValue, previousValue) {
  21422. if (!this.userChangedValue) {
  21423. this.setNumberValue({
  21424. origin: "direct",
  21425. previousValue,
  21426. value: newValue == null || newValue == ""
  21427. ? ""
  21428. : isValidNumber(newValue)
  21429. ? newValue
  21430. : this.previousValue || ""
  21431. });
  21432. this.warnAboutInvalidNumberValue(newValue);
  21433. }
  21434. this.userChangedValue = false;
  21435. }
  21436. updateRequestedIcon() {
  21437. this.requestedIcon = setRequestedIcon({}, this.icon, "number");
  21438. }
  21439. get isClearable() {
  21440. return this.clearable && this.value.length > 0;
  21441. }
  21442. //--------------------------------------------------------------------------
  21443. //
  21444. // Lifecycle
  21445. //
  21446. //--------------------------------------------------------------------------
  21447. connectedCallback() {
  21448. var _a;
  21449. connectLocalized(this);
  21450. this.scale = getElementProp(this.el, "scale", this.scale);
  21451. this.status = getElementProp(this.el, "status", this.status);
  21452. this.inlineEditableEl = this.el.closest("calcite-inline-editable");
  21453. if (this.inlineEditableEl) {
  21454. this.editingEnabled = this.inlineEditableEl.editingEnabled || false;
  21455. }
  21456. connectLabel(this);
  21457. connectForm(this);
  21458. this.setPreviousEmittedNumberValue(this.value);
  21459. this.setPreviousNumberValue(this.value);
  21460. this.warnAboutInvalidNumberValue(this.value);
  21461. this.setNumberValue({
  21462. origin: "connected",
  21463. value: isValidNumber(this.value) ? this.value : ""
  21464. });
  21465. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
  21466. this.setDisabledAction();
  21467. this.el.addEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
  21468. }
  21469. disconnectedCallback() {
  21470. var _a;
  21471. disconnectLabel(this);
  21472. disconnectForm(this);
  21473. disconnectLocalized(this);
  21474. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  21475. this.el.removeEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
  21476. }
  21477. componentWillLoad() {
  21478. var _a, _b;
  21479. this.maxString = (_a = this.max) === null || _a === void 0 ? void 0 : _a.toString();
  21480. this.minString = (_b = this.min) === null || _b === void 0 ? void 0 : _b.toString();
  21481. this.requestedIcon = setRequestedIcon({}, this.icon, "number");
  21482. }
  21483. componentShouldUpdate(newValue, oldValue, property) {
  21484. if (property === "value" && newValue && !isValidNumber(newValue)) {
  21485. this.setNumberValue({
  21486. origin: "reset",
  21487. value: oldValue
  21488. });
  21489. return false;
  21490. }
  21491. return true;
  21492. }
  21493. componentDidRender() {
  21494. updateHostInteraction(this);
  21495. }
  21496. //--------------------------------------------------------------------------
  21497. //
  21498. // Public Methods
  21499. //
  21500. //--------------------------------------------------------------------------
  21501. /** Sets focus on the component. */
  21502. async setFocus() {
  21503. var _a;
  21504. (_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.focus();
  21505. }
  21506. /** Selects all text of the component's `value`. */
  21507. async selectText() {
  21508. var _a;
  21509. (_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.select();
  21510. }
  21511. onLabelClick() {
  21512. this.setFocus();
  21513. }
  21514. incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent) {
  21515. const { value } = this;
  21516. const inputStep = this.step === "any" ? 1 : Math.abs(this.step || 1);
  21517. const inputVal = value && value !== "" ? parseFloat(value) : 0;
  21518. const adjustment = direction === "up" ? 1 : -1;
  21519. const nudgedValue = inputVal + inputStep * adjustment;
  21520. const finalValue = (typeof inputMin === "number" && !isNaN(inputMin) && nudgedValue < inputMin) ||
  21521. (typeof inputMax === "number" && !isNaN(inputMax) && nudgedValue > inputMax)
  21522. ? inputVal
  21523. : nudgedValue;
  21524. const inputValPlaces = decimalPlaces(inputVal);
  21525. const inputStepPlaces = decimalPlaces(inputStep);
  21526. this.setNumberValue({
  21527. committing: true,
  21528. nativeEvent,
  21529. origin: "user",
  21530. value: finalValue.toFixed(Math.max(inputValPlaces, inputStepPlaces))
  21531. });
  21532. }
  21533. onFormReset() {
  21534. this.setNumberValue({
  21535. origin: "reset",
  21536. value: this.defaultValue
  21537. });
  21538. }
  21539. syncHiddenFormInput(input) {
  21540. var _a, _b, _c, _d;
  21541. input.type = "number";
  21542. input.min = (_b = (_a = this.min) === null || _a === void 0 ? void 0 : _a.toString(10)) !== null && _b !== void 0 ? _b : "";
  21543. input.max = (_d = (_c = this.max) === null || _c === void 0 ? void 0 : _c.toString(10)) !== null && _d !== void 0 ? _d : "";
  21544. }
  21545. setDisabledAction() {
  21546. const slottedActionEl = getSlotted(this.el, "action");
  21547. if (!slottedActionEl) {
  21548. return;
  21549. }
  21550. this.disabled
  21551. ? slottedActionEl.setAttribute("disabled", "")
  21552. : slottedActionEl.removeAttribute("disabled");
  21553. }
  21554. warnAboutInvalidNumberValue(value) {
  21555. if (value && !isValidNumber(value)) {
  21556. console.warn(`The specified value "${value}" cannot be parsed, or is out of range.`);
  21557. }
  21558. }
  21559. // --------------------------------------------------------------------------
  21560. //
  21561. // Render Methods
  21562. //
  21563. // --------------------------------------------------------------------------
  21564. render() {
  21565. const dir = getElementDir(this.el);
  21566. const loader = (hAsync("div", { class: CSS$t.loader }, hAsync("calcite-progress", { label: this.intlLoading, type: "indeterminate" })));
  21567. const inputClearButton = (hAsync("button", { "aria-label": this.intlClear || TEXT$c.clear, class: CSS$t.clearButton, disabled: this.disabled || this.readOnly, onClick: this.clearInputValue, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "x", scale: "s" })));
  21568. const iconEl = (hAsync("calcite-icon", { class: CSS$t.inputIcon, flipRtl: this.iconFlipRtl, icon: this.requestedIcon, scale: "s" }));
  21569. const isHorizontalNumberButton = this.numberButtonType === "horizontal";
  21570. const numberButtonsHorizontalUp = (hAsync("button", { "aria-hidden": "true", class: {
  21571. [CSS$t.numberButtonItem]: true,
  21572. [CSS$t.buttonItemHorizontal]: isHorizontalNumberButton
  21573. }, "data-adjustment": "up", disabled: this.disabled || this.readOnly, onPointerDown: this.nudgeButtonPointerDownHandler, onPointerOut: this.nudgeButtonPointerUpAndOutHandler, onPointerUp: this.nudgeButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "chevron-up", scale: "s" })));
  21574. const numberButtonsHorizontalDown = (hAsync("button", { "aria-hidden": "true", class: {
  21575. [CSS$t.numberButtonItem]: true,
  21576. [CSS$t.buttonItemHorizontal]: isHorizontalNumberButton
  21577. }, "data-adjustment": "down", disabled: this.disabled || this.readOnly, onPointerDown: this.nudgeButtonPointerDownHandler, onPointerOut: this.nudgeButtonPointerUpAndOutHandler, onPointerUp: this.nudgeButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "chevron-down", scale: "s" })));
  21578. const numberButtonsVertical = (hAsync("div", { class: CSS$t.numberButtonWrapper }, numberButtonsHorizontalUp, numberButtonsHorizontalDown));
  21579. const prefixText = hAsync("div", { class: CSS$t.prefix }, this.prefixText);
  21580. const suffixText = hAsync("div", { class: CSS$t.suffix }, this.suffixText);
  21581. const childEl = (hAsync("input", { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, key: "localized-input", maxLength: this.maxLength, minLength: this.minLength, name: undefined, onBlur: this.inputNumberBlurHandler, onFocus: this.inputNumberFocusHandler, onInput: this.inputNumberInputHandler, onKeyDown: this.inputNumberKeyDownHandler, onKeyUp: this.inputNumberKeyUpHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildNumberElRef, type: "text", value: this.localizedValue }));
  21582. return (hAsync(Host, { onClick: this.inputNumberFocusHandler, onKeyDown: this.keyDownHandler }, hAsync("div", { class: { [CSS$t.inputWrapper]: true, [CSS_UTILITY.rtl]: dir === "rtl" } }, this.numberButtonType === "horizontal" && !this.readOnly
  21583. ? numberButtonsHorizontalDown
  21584. : null, this.prefixText ? prefixText : null, hAsync("div", { class: CSS$t.wrapper }, childEl, this.isClearable ? inputClearButton : null, this.requestedIcon ? iconEl : null, this.loading ? loader : null), hAsync("div", { class: CSS$t.actionWrapper }, hAsync("slot", { name: SLOTS$g.action })), this.numberButtonType === "vertical" && !this.readOnly ? numberButtonsVertical : null, this.suffixText ? suffixText : null, this.numberButtonType === "horizontal" && !this.readOnly
  21585. ? numberButtonsHorizontalUp
  21586. : null, hAsync(HiddenFormInputSlot, { component: this }))));
  21587. }
  21588. get el() { return getElement(this); }
  21589. static get watchers() { return {
  21590. "disabled": ["disabledWatcher"],
  21591. "locale": ["localeChanged"],
  21592. "max": ["maxWatcher"],
  21593. "min": ["minWatcher"],
  21594. "value": ["valueWatcher"],
  21595. "icon": ["updateRequestedIcon"]
  21596. }; }
  21597. static get style() { return inputNumberCss; }
  21598. static get cmpMeta() { return {
  21599. "$flags$": 9,
  21600. "$tagName$": "calcite-input-number",
  21601. "$members$": {
  21602. "alignment": [513],
  21603. "autofocus": [516],
  21604. "clearable": [516],
  21605. "disabled": [516],
  21606. "groupSeparator": [516, "group-separator"],
  21607. "hidden": [516],
  21608. "icon": [520],
  21609. "intlClear": [1, "intl-clear"],
  21610. "intlLoading": [1, "intl-loading"],
  21611. "iconFlipRtl": [516, "icon-flip-rtl"],
  21612. "label": [1],
  21613. "loading": [516],
  21614. "locale": [1],
  21615. "numberingSystem": [513, "numbering-system"],
  21616. "localeFormat": [4, "locale-format"],
  21617. "max": [514],
  21618. "min": [514],
  21619. "maxLength": [514, "max-length"],
  21620. "minLength": [514, "min-length"],
  21621. "name": [513],
  21622. "numberButtonType": [513, "number-button-type"],
  21623. "placeholder": [1],
  21624. "prefixText": [1, "prefix-text"],
  21625. "readOnly": [516, "read-only"],
  21626. "required": [516],
  21627. "scale": [1537],
  21628. "status": [1537],
  21629. "step": [520],
  21630. "suffixText": [1, "suffix-text"],
  21631. "editingEnabled": [1540, "editing-enabled"],
  21632. "value": [1025],
  21633. "effectiveLocale": [32],
  21634. "localizedValue": [32],
  21635. "setFocus": [64],
  21636. "selectText": [64]
  21637. },
  21638. "$listeners$": undefined,
  21639. "$lazyBundleId$": "-",
  21640. "$attrsToReflect$": [["alignment", "alignment"], ["autofocus", "autofocus"], ["clearable", "clearable"], ["disabled", "disabled"], ["groupSeparator", "group-separator"], ["hidden", "hidden"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["loading", "loading"], ["numberingSystem", "numbering-system"], ["max", "max"], ["min", "min"], ["maxLength", "max-length"], ["minLength", "min-length"], ["name", "name"], ["numberButtonType", "number-button-type"], ["readOnly", "read-only"], ["required", "required"], ["scale", "scale"], ["status", "status"], ["step", "step"], ["editingEnabled", "editing-enabled"]]
  21641. }; }
  21642. }
  21643. const CSS$s = {
  21644. loader: "loader",
  21645. clearButton: "clear-button",
  21646. editingEnabled: "editing-enabled",
  21647. inlineChild: "inline-child",
  21648. inputIcon: "icon",
  21649. prefix: "prefix",
  21650. suffix: "suffix",
  21651. wrapper: "element-wrapper",
  21652. inputWrapper: "wrapper",
  21653. actionWrapper: "action-wrapper",
  21654. resizeIconWrapper: "resize-icon-wrapper"
  21655. };
  21656. const SLOTS$f = {
  21657. action: "action"
  21658. };
  21659. const TEXT$b = {
  21660. clear: "Clear value"
  21661. };
  21662. const inputTextCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-input-text:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-input-text{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-text{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-text{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-text{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-text{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-input-text:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-input-text:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-text-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-input-text-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-input-text-h{display:block}/*!@:host([scale=s]) input, :host([scale=s]) .prefix, :host([scale=s]) .suffix*/[scale=s].sc-calcite-input-text-h input.sc-calcite-input-text,[scale=s].sc-calcite-input-text-h .prefix.sc-calcite-input-text,[scale=s].sc-calcite-input-text-h .suffix.sc-calcite-input-text{block-size:1.5rem;padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=s]) .action-wrapper calcite-button, :host([scale=s]) .action-wrapper calcite-button button*/[scale=s].sc-calcite-input-text-h .action-wrapper.sc-calcite-input-text calcite-button.sc-calcite-input-text,[scale=s].sc-calcite-input-text-h .action-wrapper.sc-calcite-input-text calcite-button.sc-calcite-input-text button.sc-calcite-input-text{block-size:1.5rem}/*!@:host([scale=s]) .clear-button*/[scale=s].sc-calcite-input-text-h .clear-button.sc-calcite-input-text{min-block-size:1.5rem;min-inline-size:1.5rem}/*!@:host([scale=m]) input, :host([scale=m]) .prefix, :host([scale=m]) .suffix*/[scale=m].sc-calcite-input-text-h input.sc-calcite-input-text,[scale=m].sc-calcite-input-text-h .prefix.sc-calcite-input-text,[scale=m].sc-calcite-input-text-h .suffix.sc-calcite-input-text{block-size:2rem;padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=m]) .action-wrapper calcite-button, :host([scale=m]) .action-wrapper calcite-button button*/[scale=m].sc-calcite-input-text-h .action-wrapper.sc-calcite-input-text calcite-button.sc-calcite-input-text,[scale=m].sc-calcite-input-text-h .action-wrapper.sc-calcite-input-text calcite-button.sc-calcite-input-text button.sc-calcite-input-text{block-size:2rem}/*!@:host([scale=m]) .clear-button*/[scale=m].sc-calcite-input-text-h .clear-button.sc-calcite-input-text{min-block-size:2rem;min-inline-size:2rem}/*!@:host([scale=l]) input, :host([scale=l]) .prefix, :host([scale=l]) .suffix*/[scale=l].sc-calcite-input-text-h input.sc-calcite-input-text,[scale=l].sc-calcite-input-text-h .prefix.sc-calcite-input-text,[scale=l].sc-calcite-input-text-h .suffix.sc-calcite-input-text{block-size:2.75rem;padding-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l]) .action-wrapper calcite-button, :host([scale=l]) .action-wrapper calcite-button button*/[scale=l].sc-calcite-input-text-h .action-wrapper.sc-calcite-input-text calcite-button.sc-calcite-input-text,[scale=l].sc-calcite-input-text-h .action-wrapper.sc-calcite-input-text calcite-button.sc-calcite-input-text button.sc-calcite-input-text{block-size:2.75rem}/*!@:host([scale=l]) .clear-button*/[scale=l].sc-calcite-input-text-h .clear-button.sc-calcite-input-text{min-block-size:2.75rem;min-inline-size:2.75rem}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-input-text-h[disabled] .sc-calcite-input-text-s>[calcite-hydrated][disabled],[disabled].sc-calcite-input-text-h [calcite-hydrated][disabled].sc-calcite-input-text{opacity:1}/*!@input*/input.sc-calcite-input-text{transition:var(--calcite-animation-timing), block-size 0, outline-offset 0s;-webkit-appearance:none;position:relative;margin:0px;box-sizing:border-box;display:flex;max-block-size:100%;inline-size:100%;max-inline-size:100%;flex:1 1 0%;border-radius:0px;background-color:var(--calcite-ui-foreground-1);font-family:inherit;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-1)}/*!@:host input*/.sc-calcite-input-text-h input.sc-calcite-input-text{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);color:var(--calcite-ui-text-1)}/*!@:host input::placeholder, :host input:-ms-input-placeholder, :host input::-ms-input-placeholder*/.sc-calcite-input-text-h input.sc-calcite-input-text::placeholder,.sc-calcite-input-text-h input.sc-calcite-input-text:-ms-input-placeholder,.sc-calcite-input-text-h input.sc-calcite-input-text::-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}/*!@:host input:focus*/.sc-calcite-input-text-h input.sc-calcite-input-text:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-1)}/*!@:host input[readonly]*/.sc-calcite-input-text-h input[readonly].sc-calcite-input-text{background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium)}/*!@:host input[readonly]:focus*/.sc-calcite-input-text-h input[readonly].sc-calcite-input-text:focus{color:var(--calcite-ui-text-1)}/*!@:host calcite-icon*/.sc-calcite-input-text-h calcite-icon.sc-calcite-input-text{color:var(--calcite-ui-text-3)}/*!@input*/input.sc-calcite-input-text{outline-color:transparent}/*!@input:focus*/input.sc-calcite-input-text:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host([status=invalid]) input*/[status=invalid].sc-calcite-input-text-h input.sc-calcite-input-text{border-color:var(--calcite-ui-danger)}/*!@:host([status=invalid]) input:focus*/[status=invalid].sc-calcite-input-text-h input.sc-calcite-input-text:focus{outline:2px solid var(--calcite-ui-danger);outline-offset:-2px}/*!@:host([scale=s]) .icon*/[scale=s].sc-calcite-input-text-h .icon.sc-calcite-input-text{inset-inline-start:0.5rem}/*!@:host([scale=m]) .icon*/[scale=m].sc-calcite-input-text-h .icon.sc-calcite-input-text{inset-inline-start:0.75rem}/*!@:host([scale=l]) .icon*/[scale=l].sc-calcite-input-text-h .icon.sc-calcite-input-text{inset-inline-start:1rem}/*!@:host([icon][scale=s]) input*/[icon][scale=s].sc-calcite-input-text-h input.sc-calcite-input-text{padding-inline-start:2rem}/*!@:host([icon][scale=m]) input*/[icon][scale=m].sc-calcite-input-text-h input.sc-calcite-input-text{padding-inline-start:2.5rem}/*!@:host([icon][scale=l]) input*/[icon][scale=l].sc-calcite-input-text-h input.sc-calcite-input-text{padding-inline-start:3rem}/*!@.element-wrapper*/.element-wrapper.sc-calcite-input-text{position:relative;order:3;display:inline-flex;flex:1 1 0%;align-items:center}/*!@.icon*/.icon.sc-calcite-input-text{pointer-events:none;position:absolute;z-index:1;display:block;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@input[type=text]::-ms-clear, \ninput[type=text]::-ms-reveal*/input[type=text].sc-calcite-input-text::-ms-clear,input[type=text].sc-calcite-input-text::-ms-reveal{display:none;block-size:0px;inline-size:0px}/*!@.clear-button*/.clear-button.sc-calcite-input-text{pointer-events:initial;order:4;margin:0px;box-sizing:border-box;display:flex;min-block-size:100%;cursor:pointer;align-items:center;justify-content:center;align-self:stretch;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);outline-color:transparent;border-inline-start-width:0px}/*!@.clear-button:hover*/.clear-button.sc-calcite-input-text:hover{background-color:var(--calcite-ui-foreground-2);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button:hover calcite-icon*/.clear-button.sc-calcite-input-text:hover calcite-icon.sc-calcite-input-text{color:var(--calcite-ui-text-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button:active*/.clear-button.sc-calcite-input-text:active{background-color:var(--calcite-ui-foreground-3)}/*!@.clear-button:active calcite-icon*/.clear-button.sc-calcite-input-text:active calcite-icon.sc-calcite-input-text{color:var(--calcite-ui-text-1)}/*!@.clear-button:focus*/.clear-button.sc-calcite-input-text:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.clear-button:disabled*/.clear-button.sc-calcite-input-text:disabled{opacity:var(--calcite-ui-opacity-disabled)}/*!@.loader*/.loader.sc-calcite-input-text{inset-block-start:1px;inset-inline:1px;pointer-events:none;position:absolute;display:block}/*!@.action-wrapper*/.action-wrapper.sc-calcite-input-text{order:7;display:flex}/*!@.prefix, \n.suffix*/.prefix.sc-calcite-input-text,.suffix.sc-calcite-input-text{box-sizing:border-box;display:flex;block-size:auto;min-block-size:100%;-webkit-user-select:none;user-select:none;align-content:center;align-items:center;overflow-wrap:break-word;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium);line-height:1;color:var(--calcite-ui-text-2)}/*!@.prefix*/.prefix.sc-calcite-input-text{order:2;border-inline-end-width:0px}/*!@.suffix*/.suffix.sc-calcite-input-text{order:5;border-inline-start-width:0px}/*!@:host([alignment=start]) input*/[alignment=start].sc-calcite-input-text-h input.sc-calcite-input-text{text-align:start}/*!@:host([alignment=end]) input*/[alignment=end].sc-calcite-input-text-h input.sc-calcite-input-text{text-align:end}/*!@.wrapper*/.wrapper.sc-calcite-input-text{position:relative;display:flex;flex-direction:row;align-items:center}/*!@:host(.no-bottom-border) input*/.no-bottom-border.sc-calcite-input-text-h input.sc-calcite-input-text{border-block-end-width:0px}/*!@:host(.border-top-color-one) input*/.border-top-color-one.sc-calcite-input-text-h input.sc-calcite-input-text{border-block-start-color:var(--calcite-ui-border-1)}/*!@.inline-child*/.inline-child.sc-calcite-input-text{background-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.inline-child .editing-enabled*/.inline-child.sc-calcite-input-text .editing-enabled.sc-calcite-input-text{background-color:inherit}/*!@.inline-child:not(.editing-enabled)*/.inline-child.sc-calcite-input-text:not(.editing-enabled){display:flex;cursor:pointer;border-color:transparent;padding-inline-start:0}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-input-text-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  21663. /**
  21664. * @slot action - A slot for positioning a button next to the component.
  21665. */
  21666. class InputText {
  21667. constructor(hostRef) {
  21668. registerInstance(this, hostRef);
  21669. this.calciteInternalInputTextFocus = createEvent(this, "calciteInternalInputTextFocus", 7);
  21670. this.calciteInternalInputTextBlur = createEvent(this, "calciteInternalInputTextBlur", 7);
  21671. this.calciteInputTextInput = createEvent(this, "calciteInputTextInput", 7);
  21672. this.calciteInputTextChange = createEvent(this, "calciteInputTextChange", 7);
  21673. //--------------------------------------------------------------------------
  21674. //
  21675. // Properties
  21676. //
  21677. //--------------------------------------------------------------------------
  21678. /** Specifies the text alignment of the component's value. */
  21679. this.alignment = "start";
  21680. /**
  21681. * When `true`, the component is focused on page load.
  21682. *
  21683. * @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
  21684. */
  21685. this.autofocus = false;
  21686. /**
  21687. * When `true`, a clear button is displayed when the component has a value.
  21688. */
  21689. this.clearable = false;
  21690. /**
  21691. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  21692. *
  21693. * @mdn [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled)
  21694. */
  21695. this.disabled = false;
  21696. /**
  21697. * When `true`, the component will not be visible.
  21698. *
  21699. * @mdn [hidden](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden)
  21700. */
  21701. this.hidden = false;
  21702. /**
  21703. * Accessible name that will appear while loading.
  21704. *
  21705. * @default "Loading"
  21706. */
  21707. this.intlLoading = TEXT$v.loading;
  21708. /** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
  21709. this.iconFlipRtl = false;
  21710. /** When `true`, the component is in the loading state and `calcite-progress` is displayed. */
  21711. this.loading = false;
  21712. /**
  21713. * When `true`, the component's value can be read, but cannot be modified.
  21714. *
  21715. * @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
  21716. */
  21717. this.readOnly = false;
  21718. /** When `true`, the component must have a value in order for the form to submit. */
  21719. this.required = false;
  21720. /** Specifies the size of the component. */
  21721. this.scale = "m";
  21722. /** Specifies the status of the input field, which determines message and icons. */
  21723. this.status = "idle";
  21724. /**
  21725. * @internal
  21726. */
  21727. this.editingEnabled = false;
  21728. /** The component's value. */
  21729. this.value = "";
  21730. this.previousValueOrigin = "initial";
  21731. this.mutationObserver = createObserver();
  21732. this.userChangedValue = false;
  21733. //--------------------------------------------------------------------------
  21734. //
  21735. // Private Methods
  21736. //
  21737. //--------------------------------------------------------------------------
  21738. this.keyDownHandler = (event) => {
  21739. if (this.readOnly || this.disabled) {
  21740. return;
  21741. }
  21742. if (this.isClearable && event.key === "Escape") {
  21743. this.clearInputTextValue(event);
  21744. event.preventDefault();
  21745. }
  21746. if (event.key === "Enter" && !event.defaultPrevented) {
  21747. if (submitForm(this)) {
  21748. event.preventDefault();
  21749. }
  21750. }
  21751. };
  21752. this.clearInputTextValue = (nativeEvent) => {
  21753. this.setValue({
  21754. committing: true,
  21755. nativeEvent,
  21756. origin: "user",
  21757. value: ""
  21758. });
  21759. };
  21760. this.emitChangeIfUserModified = () => {
  21761. if (this.previousValueOrigin === "user" && this.value !== this.previousEmittedValue) {
  21762. this.calciteInputTextChange.emit();
  21763. }
  21764. this.previousEmittedValue = this.value;
  21765. };
  21766. this.inputTextBlurHandler = () => {
  21767. this.calciteInternalInputTextBlur.emit({
  21768. element: this.childEl,
  21769. value: this.value
  21770. });
  21771. this.emitChangeIfUserModified();
  21772. };
  21773. this.inputTextFocusHandler = (event) => {
  21774. const slottedActionEl = getSlotted(this.el, "action");
  21775. if (event.target !== slottedActionEl) {
  21776. this.setFocus();
  21777. }
  21778. this.calciteInternalInputTextFocus.emit({
  21779. element: this.childEl,
  21780. value: this.value
  21781. });
  21782. };
  21783. this.inputTextInputHandler = (nativeEvent) => {
  21784. if (this.disabled || this.readOnly) {
  21785. return;
  21786. }
  21787. this.setValue({
  21788. nativeEvent,
  21789. origin: "user",
  21790. value: nativeEvent.target.value
  21791. });
  21792. };
  21793. this.inputTextKeyDownHandler = (event) => {
  21794. if (this.disabled || this.readOnly) {
  21795. return;
  21796. }
  21797. if (event.key === "Enter") {
  21798. this.emitChangeIfUserModified();
  21799. }
  21800. };
  21801. this.hiddenInputChangeHandler = (event) => {
  21802. if (event.target.name === this.name) {
  21803. this.setValue({
  21804. value: event.target.value,
  21805. origin: "direct"
  21806. });
  21807. }
  21808. event.stopPropagation();
  21809. };
  21810. this.setChildElRef = (el) => {
  21811. this.childEl = el;
  21812. };
  21813. this.setInputValue = (newInputValue) => {
  21814. if (!this.childEl) {
  21815. return;
  21816. }
  21817. this.childEl.value = newInputValue;
  21818. };
  21819. this.setPreviousEmittedValue = (newPreviousEmittedValue) => {
  21820. this.previousEmittedValue = newPreviousEmittedValue;
  21821. };
  21822. this.setPreviousValue = (newPreviousValue) => {
  21823. this.previousValue = newPreviousValue;
  21824. };
  21825. this.setValue = ({ committing = false, nativeEvent, origin, previousValue, value }) => {
  21826. this.setPreviousValue(previousValue || this.value);
  21827. this.previousValueOrigin = origin;
  21828. this.userChangedValue = origin === "user" && value !== this.value;
  21829. this.value = value;
  21830. if (origin === "direct") {
  21831. this.setInputValue(value);
  21832. }
  21833. if (nativeEvent) {
  21834. const calciteInputTextInputEvent = this.calciteInputTextInput.emit({
  21835. element: this.childEl,
  21836. nativeEvent,
  21837. value: this.value
  21838. });
  21839. if (calciteInputTextInputEvent.defaultPrevented) {
  21840. this.value = this.previousValue;
  21841. }
  21842. else if (committing) {
  21843. this.emitChangeIfUserModified();
  21844. }
  21845. }
  21846. };
  21847. }
  21848. disabledWatcher() {
  21849. this.setDisabledAction();
  21850. }
  21851. valueWatcher(newValue, previousValue) {
  21852. if (!this.userChangedValue) {
  21853. this.setValue({
  21854. origin: "direct",
  21855. previousValue,
  21856. value: !newValue ? "" : newValue
  21857. });
  21858. }
  21859. this.userChangedValue = false;
  21860. }
  21861. updateRequestedIcon() {
  21862. this.requestedIcon = setRequestedIcon({}, this.icon, "text");
  21863. }
  21864. get isClearable() {
  21865. return this.clearable && this.value.length > 0;
  21866. }
  21867. //--------------------------------------------------------------------------
  21868. //
  21869. // Lifecycle
  21870. //
  21871. //--------------------------------------------------------------------------
  21872. connectedCallback() {
  21873. var _a;
  21874. this.scale = getElementProp(this.el, "scale", this.scale);
  21875. this.status = getElementProp(this.el, "status", this.status);
  21876. this.inlineEditableEl = this.el.closest("calcite-inline-editable");
  21877. if (this.inlineEditableEl) {
  21878. this.editingEnabled = this.inlineEditableEl.editingEnabled || false;
  21879. }
  21880. this.setPreviousEmittedValue(this.value);
  21881. this.setPreviousValue(this.value);
  21882. connectLabel(this);
  21883. connectForm(this);
  21884. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
  21885. this.setDisabledAction();
  21886. this.el.addEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
  21887. }
  21888. disconnectedCallback() {
  21889. var _a;
  21890. disconnectLabel(this);
  21891. disconnectForm(this);
  21892. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  21893. this.el.removeEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
  21894. }
  21895. componentWillLoad() {
  21896. this.requestedIcon = setRequestedIcon({}, this.icon, "text");
  21897. }
  21898. componentDidRender() {
  21899. updateHostInteraction(this);
  21900. }
  21901. //--------------------------------------------------------------------------
  21902. //
  21903. // Public Methods
  21904. //
  21905. //--------------------------------------------------------------------------
  21906. /** Sets focus on the component. */
  21907. async setFocus() {
  21908. var _a;
  21909. (_a = this.childEl) === null || _a === void 0 ? void 0 : _a.focus();
  21910. }
  21911. /** Selects all text of the component's `value`. */
  21912. async selectText() {
  21913. var _a;
  21914. (_a = this.childEl) === null || _a === void 0 ? void 0 : _a.select();
  21915. }
  21916. onLabelClick() {
  21917. this.setFocus();
  21918. }
  21919. onFormReset() {
  21920. this.setValue({
  21921. origin: "reset",
  21922. value: this.defaultValue
  21923. });
  21924. }
  21925. syncHiddenFormInput(input) {
  21926. if (this.minLength != null) {
  21927. input.minLength = this.minLength;
  21928. }
  21929. if (this.maxLength != null) {
  21930. input.maxLength = this.maxLength;
  21931. }
  21932. }
  21933. setDisabledAction() {
  21934. const slottedActionEl = getSlotted(this.el, "action");
  21935. if (!slottedActionEl) {
  21936. return;
  21937. }
  21938. this.disabled
  21939. ? slottedActionEl.setAttribute("disabled", "")
  21940. : slottedActionEl.removeAttribute("disabled");
  21941. }
  21942. // --------------------------------------------------------------------------
  21943. //
  21944. // Render Methods
  21945. //
  21946. // --------------------------------------------------------------------------
  21947. render() {
  21948. const dir = getElementDir(this.el);
  21949. const loader = (hAsync("div", { class: CSS$s.loader }, hAsync("calcite-progress", { label: this.intlLoading, type: "indeterminate" })));
  21950. const inputClearButton = (hAsync("button", { "aria-label": this.intlClear || TEXT$b.clear, class: CSS$s.clearButton, disabled: this.disabled || this.readOnly, onClick: this.clearInputTextValue, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "x", scale: "s" })));
  21951. const iconEl = (hAsync("calcite-icon", { class: CSS$s.inputIcon, flipRtl: this.iconFlipRtl, icon: this.requestedIcon, scale: "s" }));
  21952. const prefixText = hAsync("div", { class: CSS$s.prefix }, this.prefixText);
  21953. const suffixText = hAsync("div", { class: CSS$s.suffix }, this.suffixText);
  21954. const childEl = (hAsync("input", { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, class: {
  21955. [CSS$s.editingEnabled]: this.editingEnabled,
  21956. [CSS$s.inlineChild]: !!this.inlineEditableEl
  21957. }, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, maxLength: this.maxLength, minLength: this.minLength, name: this.name, onBlur: this.inputTextBlurHandler, onFocus: this.inputTextFocusHandler, onInput: this.inputTextInputHandler, onKeyDown: this.inputTextKeyDownHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildElRef, required: this.required ? true : null, tabIndex: this.disabled || (this.inlineEditableEl && !this.editingEnabled) ? -1 : null, type: "text", value: this.value }));
  21958. return (hAsync(Host, { onClick: this.inputTextFocusHandler, onKeyDown: this.keyDownHandler }, hAsync("div", { class: { [CSS$s.inputWrapper]: true, [CSS_UTILITY.rtl]: dir === "rtl" } }, this.prefixText ? prefixText : null, hAsync("div", { class: CSS$s.wrapper }, childEl, this.isClearable ? inputClearButton : null, this.requestedIcon ? iconEl : null, this.loading ? loader : null), hAsync("div", { class: CSS$s.actionWrapper }, hAsync("slot", { name: SLOTS$f.action })), this.suffixText ? suffixText : null, hAsync(HiddenFormInputSlot, { component: this }))));
  21959. }
  21960. get el() { return getElement(this); }
  21961. static get watchers() { return {
  21962. "disabled": ["disabledWatcher"],
  21963. "value": ["valueWatcher"],
  21964. "icon": ["updateRequestedIcon"]
  21965. }; }
  21966. static get style() { return inputTextCss; }
  21967. static get cmpMeta() { return {
  21968. "$flags$": 9,
  21969. "$tagName$": "calcite-input-text",
  21970. "$members$": {
  21971. "alignment": [513],
  21972. "autofocus": [516],
  21973. "clearable": [516],
  21974. "disabled": [516],
  21975. "hidden": [516],
  21976. "icon": [520],
  21977. "intlClear": [1, "intl-clear"],
  21978. "intlLoading": [1, "intl-loading"],
  21979. "iconFlipRtl": [516, "icon-flip-rtl"],
  21980. "label": [1],
  21981. "loading": [516],
  21982. "maxLength": [514, "max-length"],
  21983. "minLength": [514, "min-length"],
  21984. "name": [513],
  21985. "placeholder": [1],
  21986. "prefixText": [1, "prefix-text"],
  21987. "readOnly": [516, "read-only"],
  21988. "required": [516],
  21989. "scale": [1537],
  21990. "status": [1537],
  21991. "suffixText": [1, "suffix-text"],
  21992. "editingEnabled": [1540, "editing-enabled"],
  21993. "value": [1025],
  21994. "setFocus": [64],
  21995. "selectText": [64]
  21996. },
  21997. "$listeners$": undefined,
  21998. "$lazyBundleId$": "-",
  21999. "$attrsToReflect$": [["alignment", "alignment"], ["autofocus", "autofocus"], ["clearable", "clearable"], ["disabled", "disabled"], ["hidden", "hidden"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["loading", "loading"], ["maxLength", "max-length"], ["minLength", "min-length"], ["name", "name"], ["readOnly", "read-only"], ["required", "required"], ["scale", "scale"], ["status", "status"], ["editingEnabled", "editing-enabled"]]
  22000. }; }
  22001. }
  22002. const maxTenthForMinuteAndSecond = 5;
  22003. function createLocaleDateTimeFormatter(locale, numberingSystem, includeSeconds = true) {
  22004. try {
  22005. const options = {
  22006. hour: "2-digit",
  22007. minute: "2-digit",
  22008. timeZone: "UTC",
  22009. numberingSystem: getSupportedNumberingSystem(numberingSystem)
  22010. };
  22011. if (includeSeconds) {
  22012. options.second = "2-digit";
  22013. }
  22014. return new Intl.DateTimeFormat(getSupportedLocale(locale), options);
  22015. }
  22016. catch (error) {
  22017. throw new Error(`Invalid locale supplied while attempting to create a DateTime formatter: ${locale}`);
  22018. }
  22019. }
  22020. function formatTimePart(number) {
  22021. const numberAsString = number.toString();
  22022. return number >= 0 && number <= 9 ? numberAsString.padStart(2, "0") : numberAsString;
  22023. }
  22024. function formatTimeString(value) {
  22025. if (!isValidTime(value)) {
  22026. return null;
  22027. }
  22028. const [hourString, minuteString, secondString] = value.split(":");
  22029. const hour = formatTimePart(parseInt(hourString));
  22030. const minute = formatTimePart(parseInt(minuteString));
  22031. if (secondString) {
  22032. const second = formatTimePart(parseInt(secondString));
  22033. return `${hour}:${minute}:${second}`;
  22034. }
  22035. return `${hour}:${minute}`;
  22036. }
  22037. function getLocaleHourCycle(locale, numberingSystem) {
  22038. const formatter = createLocaleDateTimeFormatter(locale, numberingSystem);
  22039. const parts = formatter.formatToParts(new Date(Date.UTC(0, 0, 0, 0, 0, 0)));
  22040. return getLocalizedTimePart("meridiem", parts) ? "12" : "24";
  22041. }
  22042. function getLocalizedTimePart(part, parts) {
  22043. var _a, _b, _c, _d;
  22044. if (!part || !parts) {
  22045. return null;
  22046. }
  22047. if (part === "hourSuffix") {
  22048. const hourIndex = parts.indexOf(parts.find(({ type }) => type === "hour"));
  22049. const minuteIndex = parts.indexOf(parts.find(({ type }) => type === "minute"));
  22050. const hourSuffix = parts[hourIndex + 1];
  22051. return hourSuffix && hourSuffix.type === "literal" && minuteIndex - hourIndex === 2
  22052. ? ((_a = hourSuffix.value) === null || _a === void 0 ? void 0 : _a.trim()) || null
  22053. : null;
  22054. }
  22055. if (part === "minuteSuffix") {
  22056. const minuteIndex = parts.indexOf(parts.find(({ type }) => type === "minute"));
  22057. const secondIndex = parts.indexOf(parts.find(({ type }) => type === "second"));
  22058. const minuteSuffix = parts[minuteIndex + 1];
  22059. return minuteSuffix && minuteSuffix.type === "literal" && secondIndex - minuteIndex === 2
  22060. ? ((_b = minuteSuffix.value) === null || _b === void 0 ? void 0 : _b.trim()) || null
  22061. : null;
  22062. }
  22063. if (part === "secondSuffix") {
  22064. const secondIndex = parts.indexOf(parts.find(({ type }) => type === "second"));
  22065. const secondSuffix = parts[secondIndex + 1];
  22066. return secondSuffix && secondSuffix.type === "literal" ? ((_c = secondSuffix.value) === null || _c === void 0 ? void 0 : _c.trim()) || null : null;
  22067. }
  22068. return ((_d = parts.find(({ type }) => (part == "meridiem" ? type === "dayPeriod" : type === part))) === null || _d === void 0 ? void 0 : _d.value) || null;
  22069. }
  22070. function getMeridiem(hour) {
  22071. if (!isValidNumber(hour)) {
  22072. return null;
  22073. }
  22074. const hourAsNumber = parseInt(hour);
  22075. return hourAsNumber >= 0 && hourAsNumber <= 11 ? "AM" : "PM";
  22076. }
  22077. function isValidTime(value) {
  22078. if (!value || value.startsWith(":") || value.endsWith(":")) {
  22079. return false;
  22080. }
  22081. const splitValue = value.split(":");
  22082. const validLength = splitValue.length > 1 && splitValue.length < 4;
  22083. if (!validLength) {
  22084. return false;
  22085. }
  22086. const [hour, minute, second] = splitValue;
  22087. const hourAsNumber = parseInt(splitValue[0]);
  22088. const minuteAsNumber = parseInt(splitValue[1]);
  22089. const secondAsNumber = parseInt(splitValue[2]);
  22090. const hourValid = isValidNumber(hour) && hourAsNumber >= 0 && hourAsNumber < 24;
  22091. const minuteValid = isValidNumber(minute) && minuteAsNumber >= 0 && minuteAsNumber < 60;
  22092. const secondValid = isValidNumber(second) && secondAsNumber >= 0 && secondAsNumber < 60;
  22093. if ((hourValid && minuteValid && !second) || (hourValid && minuteValid && secondValid)) {
  22094. return true;
  22095. }
  22096. }
  22097. function isValidTimePart(value, part) {
  22098. if (part === "meridiem") {
  22099. return value === "AM" || value === "PM";
  22100. }
  22101. if (!isValidNumber(value)) {
  22102. return false;
  22103. }
  22104. const valueAsNumber = Number(value);
  22105. return part === "hour" ? valueAsNumber >= 0 && valueAsNumber < 24 : valueAsNumber >= 0 && valueAsNumber < 60;
  22106. }
  22107. function localizeTimePart({ value, part, locale, numberingSystem }) {
  22108. if (!isValidTimePart(value, part)) {
  22109. return;
  22110. }
  22111. const valueAsNumber = parseInt(value);
  22112. const date = new Date(Date.UTC(0, 0, 0, part === "hour" ? valueAsNumber : part === "meridiem" ? (value === "AM" ? 0 : 12) : 0, part === "minute" ? valueAsNumber : 0, part === "second" ? valueAsNumber : 0));
  22113. if (!date) {
  22114. return;
  22115. }
  22116. const formatter = createLocaleDateTimeFormatter(locale, numberingSystem);
  22117. const parts = formatter.formatToParts(date);
  22118. return getLocalizedTimePart(part, parts);
  22119. }
  22120. function localizeTimeString({ value, locale, numberingSystem, includeSeconds = true }) {
  22121. if (!isValidTime(value)) {
  22122. return null;
  22123. }
  22124. const { hour, minute, second = "0" } = parseTimeString(value);
  22125. const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
  22126. const formatter = createLocaleDateTimeFormatter(locale, numberingSystem, includeSeconds);
  22127. return (formatter === null || formatter === void 0 ? void 0 : formatter.format(dateFromTimeString)) || null;
  22128. }
  22129. function localizeTimeStringToParts({ value, locale, numberingSystem }) {
  22130. if (!isValidTime(value)) {
  22131. return null;
  22132. }
  22133. const { hour, minute, second = "0" } = parseTimeString(value);
  22134. const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
  22135. if (dateFromTimeString) {
  22136. const formatter = createLocaleDateTimeFormatter(locale, numberingSystem);
  22137. const parts = formatter.formatToParts(dateFromTimeString);
  22138. return {
  22139. localizedHour: getLocalizedTimePart("hour", parts),
  22140. localizedHourSuffix: getLocalizedTimePart("hourSuffix", parts),
  22141. localizedMinute: getLocalizedTimePart("minute", parts),
  22142. localizedMinuteSuffix: getLocalizedTimePart("minuteSuffix", parts),
  22143. localizedSecond: getLocalizedTimePart("second", parts),
  22144. localizedSecondSuffix: getLocalizedTimePart("secondSuffix", parts),
  22145. localizedMeridiem: getLocalizedTimePart("meridiem", parts)
  22146. };
  22147. }
  22148. return null;
  22149. }
  22150. function getTimeParts({ value, locale, numberingSystem }) {
  22151. if (!isValidTime(value)) {
  22152. return null;
  22153. }
  22154. const { hour, minute, second = "0" } = parseTimeString(value);
  22155. const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
  22156. if (dateFromTimeString) {
  22157. const formatter = createLocaleDateTimeFormatter(locale, numberingSystem);
  22158. const parts = formatter.formatToParts(dateFromTimeString);
  22159. return parts;
  22160. }
  22161. return null;
  22162. }
  22163. function parseTimeString(value) {
  22164. if (isValidTime(value)) {
  22165. const [hour, minute, second] = value.split(":");
  22166. return {
  22167. hour,
  22168. minute,
  22169. second
  22170. };
  22171. }
  22172. return {
  22173. hour: null,
  22174. minute: null,
  22175. second: null
  22176. };
  22177. }
  22178. const inputTimePickerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-input-time-picker:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-input-time-picker{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-time-picker{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-time-picker{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-time-picker{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-time-picker{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-input-time-picker:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-input-time-picker:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-time-picker-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-input-time-picker-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-input-time-picker-h{display:inline-block;-webkit-user-select:none;user-select:none}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-input-time-picker-h[disabled] .sc-calcite-input-time-picker-s>[calcite-hydrated][disabled],[disabled].sc-calcite-input-time-picker-h [calcite-hydrated][disabled].sc-calcite-input-time-picker{opacity:1}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-input-time-picker-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  22179. class InputTimePicker {
  22180. constructor(hostRef) {
  22181. registerInstance(this, hostRef);
  22182. this.calciteInputTimePickerChange = createEvent(this, "calciteInputTimePickerChange", 7);
  22183. //--------------------------------------------------------------------------
  22184. //
  22185. // Properties
  22186. //
  22187. //--------------------------------------------------------------------------
  22188. /**
  22189. * When `true`, the component is active.
  22190. *
  22191. * @deprecated Use `open` instead.
  22192. */
  22193. this.active = false;
  22194. /** When `true`, displays the `calcite-time-picker` component. */
  22195. this.open = false;
  22196. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  22197. this.disabled = false;
  22198. /**
  22199. * When `true`, the component's value can be read, but controls are not accessible and the value cannot be modified.
  22200. *
  22201. * @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
  22202. */
  22203. this.readOnly = false;
  22204. /**
  22205. * When `true`, the component must have a value in order for the form to submit.
  22206. *
  22207. * @internal
  22208. */
  22209. this.required = false;
  22210. /** Specifies the size of the component. */
  22211. this.scale = "m";
  22212. /**
  22213. * Determines the type of positioning to use for the overlaid content.
  22214. *
  22215. * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
  22216. *
  22217. * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
  22218. *
  22219. */
  22220. this.overlayPositioning = "absolute";
  22221. /**
  22222. * Determines where the popover will be positioned relative to the input.
  22223. *
  22224. * @see [LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)
  22225. */
  22226. this.placement = "auto";
  22227. /** Specifies the granularity the component's `value` must adhere to (in seconds). */
  22228. this.step = 60;
  22229. /** The component's value in UTC (always 24-hour format). */
  22230. this.value = null;
  22231. /** whether the value of the input was changed as a result of user typing or not */
  22232. this.internalValueChange = false;
  22233. this.previousValidValue = null;
  22234. this.referenceElementId = `input-time-picker-${guid()}`;
  22235. //--------------------------------------------------------------------------
  22236. //
  22237. // State
  22238. //
  22239. //--------------------------------------------------------------------------
  22240. this.effectiveLocale = "";
  22241. //--------------------------------------------------------------------------
  22242. //
  22243. // Event Listeners
  22244. //
  22245. //--------------------------------------------------------------------------
  22246. this.calciteInternalInputBlurHandler = () => {
  22247. this.open = false;
  22248. const shouldIncludeSeconds = this.shouldIncludeSeconds();
  22249. const { effectiveLocale: locale, numberingSystem, value, calciteInputEl } = this;
  22250. numberStringFormatter.numberFormatOptions = {
  22251. locale,
  22252. numberingSystem,
  22253. useGrouping: false
  22254. };
  22255. const delocalizedValue = numberStringFormatter.delocalize(calciteInputEl.value);
  22256. const localizedInputValue = localizeTimeString({
  22257. value: delocalizedValue,
  22258. includeSeconds: shouldIncludeSeconds,
  22259. locale,
  22260. numberingSystem
  22261. });
  22262. this.setInputValue(localizedInputValue ||
  22263. localizeTimeString({ value, locale, numberingSystem, includeSeconds: shouldIncludeSeconds }));
  22264. };
  22265. this.calciteInternalInputFocusHandler = (event) => {
  22266. if (!this.readOnly) {
  22267. this.open = true;
  22268. event.stopPropagation();
  22269. }
  22270. };
  22271. this.calciteInputInputHandler = (event) => {
  22272. const target = event.target;
  22273. numberStringFormatter.numberFormatOptions = {
  22274. locale: this.effectiveLocale,
  22275. numberingSystem: this.numberingSystem,
  22276. useGrouping: false
  22277. };
  22278. const delocalizedValue = numberStringFormatter.delocalize(target.value);
  22279. this.setValue({ value: delocalizedValue });
  22280. // only translate the numerals until blur
  22281. const localizedValue = delocalizedValue
  22282. .split("")
  22283. .map((char) => numberKeys.includes(char)
  22284. ? numberStringFormatter.numberFormatter.format(Number(char))
  22285. : char)
  22286. .join("");
  22287. this.setInputValue(localizedValue);
  22288. };
  22289. this.timePickerChangeHandler = (event) => {
  22290. event.stopPropagation();
  22291. const target = event.target;
  22292. const value = target.value;
  22293. this.setValue({ value, origin: "time-picker" });
  22294. };
  22295. // --------------------------------------------------------------------------
  22296. //
  22297. // Private Methods
  22298. //
  22299. // --------------------------------------------------------------------------
  22300. this.keyDownHandler = (event) => {
  22301. const { defaultPrevented, key } = event;
  22302. if (defaultPrevented) {
  22303. return;
  22304. }
  22305. if (key === "Enter") {
  22306. if (submitForm(this)) {
  22307. event.preventDefault();
  22308. }
  22309. }
  22310. if (key === "Escape" && this.open) {
  22311. this.open = false;
  22312. event.preventDefault();
  22313. }
  22314. };
  22315. this.setCalcitePopoverEl = (el) => {
  22316. this.popoverEl = el;
  22317. };
  22318. this.setCalciteInputEl = (el) => {
  22319. this.calciteInputEl = el;
  22320. };
  22321. this.setCalciteTimePickerEl = (el) => {
  22322. this.calciteTimePickerEl = el;
  22323. };
  22324. this.setInputValue = (newInputValue) => {
  22325. if (!this.calciteInputEl) {
  22326. return;
  22327. }
  22328. this.calciteInputEl.value = newInputValue;
  22329. };
  22330. this.setValue = ({ value, origin = "input" }) => {
  22331. const previousValue = this.value;
  22332. const newValue = formatTimeString(value);
  22333. const newLocalizedValue = localizeTimeString({
  22334. value: newValue,
  22335. locale: this.effectiveLocale,
  22336. numberingSystem: this.numberingSystem,
  22337. includeSeconds: this.shouldIncludeSeconds()
  22338. });
  22339. this.internalValueChange = origin !== "external" && origin !== "loading";
  22340. const shouldEmit = origin !== "loading" &&
  22341. origin !== "external" &&
  22342. ((value !== this.previousValidValue && !value) ||
  22343. !!(!this.previousValidValue && newValue) ||
  22344. (newValue !== this.previousValidValue && newValue));
  22345. if (value) {
  22346. if (shouldEmit) {
  22347. this.previousValidValue = newValue;
  22348. }
  22349. if (newValue && newValue !== this.value) {
  22350. this.value = newValue;
  22351. }
  22352. this.localizedValue = newLocalizedValue;
  22353. }
  22354. else {
  22355. this.value = value;
  22356. this.localizedValue = null;
  22357. }
  22358. if (origin === "time-picker" || origin === "external") {
  22359. this.setInputValue(newLocalizedValue);
  22360. }
  22361. if (shouldEmit) {
  22362. const changeEvent = this.calciteInputTimePickerChange.emit();
  22363. if (changeEvent.defaultPrevented) {
  22364. this.internalValueChange = false;
  22365. this.value = previousValue;
  22366. this.setInputValue(previousValue);
  22367. this.previousValidValue = previousValue;
  22368. }
  22369. else {
  22370. this.previousValidValue = newValue;
  22371. }
  22372. }
  22373. };
  22374. }
  22375. activeHandler(value) {
  22376. this.open = value;
  22377. }
  22378. openHandler(value) {
  22379. this.active = value;
  22380. if (this.disabled || this.readOnly) {
  22381. this.open = false;
  22382. return;
  22383. }
  22384. if (value) {
  22385. this.reposition(true);
  22386. }
  22387. }
  22388. handleDisabledAndReadOnlyChange(value) {
  22389. if (!value) {
  22390. this.open = false;
  22391. }
  22392. }
  22393. localeChanged() {
  22394. updateEffectiveLocale(this);
  22395. }
  22396. valueWatcher(newValue) {
  22397. if (!this.internalValueChange) {
  22398. this.setValue({ value: newValue, origin: "external" });
  22399. }
  22400. this.internalValueChange = false;
  22401. }
  22402. effectiveLocaleWatcher() {
  22403. this.setInputValue(localizeTimeString({
  22404. value: this.value,
  22405. locale: this.effectiveLocale,
  22406. numberingSystem: this.numberingSystem,
  22407. includeSeconds: this.shouldIncludeSeconds()
  22408. }));
  22409. }
  22410. clickHandler(event) {
  22411. if (event.composedPath().includes(this.calciteTimePickerEl)) {
  22412. return;
  22413. }
  22414. this.setFocus();
  22415. }
  22416. timePickerBlurHandler(event) {
  22417. event.preventDefault();
  22418. event.stopPropagation();
  22419. this.open = false;
  22420. }
  22421. timePickerFocusHandler(event) {
  22422. event.preventDefault();
  22423. event.stopPropagation();
  22424. if (!this.readOnly) {
  22425. this.open = true;
  22426. }
  22427. }
  22428. // --------------------------------------------------------------------------
  22429. //
  22430. // Public Methods
  22431. //
  22432. // --------------------------------------------------------------------------
  22433. /** Sets focus on the component. */
  22434. async setFocus() {
  22435. var _a;
  22436. (_a = this.calciteInputEl) === null || _a === void 0 ? void 0 : _a.setFocus();
  22437. }
  22438. /**
  22439. * Updates the position of the component.
  22440. *
  22441. * @param delayed
  22442. */
  22443. async reposition(delayed = false) {
  22444. var _a;
  22445. (_a = this.popoverEl) === null || _a === void 0 ? void 0 : _a.reposition(delayed);
  22446. }
  22447. onLabelClick() {
  22448. this.setFocus();
  22449. }
  22450. shouldIncludeSeconds() {
  22451. return this.step < 60;
  22452. }
  22453. //--------------------------------------------------------------------------
  22454. //
  22455. // Lifecycle
  22456. //
  22457. //--------------------------------------------------------------------------
  22458. connectedCallback() {
  22459. connectLocalized(this);
  22460. const { active, open } = this;
  22461. if (this.value) {
  22462. this.setValue({ value: isValidTime(this.value) ? this.value : undefined, origin: "loading" });
  22463. }
  22464. connectLabel(this);
  22465. connectForm(this);
  22466. if (open) {
  22467. this.active = open;
  22468. }
  22469. else if (active) {
  22470. this.open = active;
  22471. }
  22472. }
  22473. componentDidLoad() {
  22474. this.setInputValue(this.localizedValue);
  22475. }
  22476. disconnectedCallback() {
  22477. disconnectLabel(this);
  22478. disconnectForm(this);
  22479. disconnectLocalized(this);
  22480. }
  22481. componentDidRender() {
  22482. updateHostInteraction(this);
  22483. }
  22484. // --------------------------------------------------------------------------
  22485. //
  22486. // Render Methods
  22487. //
  22488. // --------------------------------------------------------------------------
  22489. render() {
  22490. const popoverId = `${this.referenceElementId}-popover`;
  22491. return (hAsync(Host, { onKeyDown: this.keyDownHandler }, hAsync("div", { "aria-controls": popoverId, "aria-haspopup": "dialog", "aria-label": this.name, "aria-owns": popoverId, id: this.referenceElementId, role: "combobox" }, hAsync("calcite-input", { disabled: this.disabled, icon: "clock", label: getLabelText(this), onCalciteInputInput: this.calciteInputInputHandler, onCalciteInternalInputBlur: this.calciteInternalInputBlurHandler, onCalciteInternalInputFocus: this.calciteInternalInputFocusHandler, readOnly: this.readOnly, ref: this.setCalciteInputEl, scale: this.scale, step: this.step })), hAsync("calcite-popover", { id: popoverId, label: "Time Picker", open: this.open, overlayPositioning: this.overlayPositioning, placement: this.placement, ref: this.setCalcitePopoverEl, referenceElement: this.referenceElementId, triggerDisabled: true }, hAsync("calcite-time-picker", { intlHour: this.intlHour, intlHourDown: this.intlHourDown, intlHourUp: this.intlHourUp, intlMeridiem: this.intlMeridiem, intlMeridiemDown: this.intlMeridiemDown, intlMeridiemUp: this.intlMeridiemUp, intlMinute: this.intlMinute, intlMinuteDown: this.intlMinuteDown, intlMinuteUp: this.intlMinuteUp, intlSecond: this.intlSecond, intlSecondDown: this.intlSecondDown, intlSecondUp: this.intlSecondUp, lang: this.effectiveLocale, numberingSystem: this.numberingSystem, onCalciteInternalTimePickerChange: this.timePickerChangeHandler, ref: this.setCalciteTimePickerEl, scale: this.scale, step: this.step, value: this.value })), hAsync(HiddenFormInputSlot, { component: this })));
  22492. }
  22493. get el() { return getElement(this); }
  22494. static get watchers() { return {
  22495. "active": ["activeHandler"],
  22496. "open": ["openHandler"],
  22497. "disabled": ["handleDisabledAndReadOnlyChange"],
  22498. "readOnly": ["handleDisabledAndReadOnlyChange"],
  22499. "locale": ["localeChanged"],
  22500. "value": ["valueWatcher"],
  22501. "effectiveLocale": ["effectiveLocaleWatcher"]
  22502. }; }
  22503. static get style() { return inputTimePickerCss; }
  22504. static get cmpMeta() { return {
  22505. "$flags$": 9,
  22506. "$tagName$": "calcite-input-time-picker",
  22507. "$members$": {
  22508. "active": [1540],
  22509. "open": [1540],
  22510. "disabled": [516],
  22511. "readOnly": [516, "read-only"],
  22512. "intlHour": [1, "intl-hour"],
  22513. "intlHourDown": [1, "intl-hour-down"],
  22514. "intlHourUp": [1, "intl-hour-up"],
  22515. "intlMeridiem": [1, "intl-meridiem"],
  22516. "intlMeridiemDown": [1, "intl-meridiem-down"],
  22517. "intlMeridiemUp": [1, "intl-meridiem-up"],
  22518. "intlMinute": [1, "intl-minute"],
  22519. "intlMinuteDown": [1, "intl-minute-down"],
  22520. "intlMinuteUp": [1, "intl-minute-up"],
  22521. "intlSecond": [1, "intl-second"],
  22522. "intlSecondDown": [1, "intl-second-down"],
  22523. "intlSecondUp": [1, "intl-second-up"],
  22524. "locale": [1025],
  22525. "name": [1],
  22526. "numberingSystem": [1, "numbering-system"],
  22527. "required": [516],
  22528. "scale": [513],
  22529. "overlayPositioning": [1, "overlay-positioning"],
  22530. "placement": [513],
  22531. "step": [2],
  22532. "value": [1025],
  22533. "effectiveLocale": [32],
  22534. "localizedValue": [32],
  22535. "setFocus": [64],
  22536. "reposition": [64]
  22537. },
  22538. "$listeners$": [[0, "click", "clickHandler"], [0, "calciteInternalTimePickerBlur", "timePickerBlurHandler"], [0, "calciteInternalTimePickerFocus", "timePickerFocusHandler"]],
  22539. "$lazyBundleId$": "-",
  22540. "$attrsToReflect$": [["active", "active"], ["open", "open"], ["disabled", "disabled"], ["readOnly", "read-only"], ["required", "required"], ["scale", "scale"], ["placement", "placement"]]
  22541. }; }
  22542. }
  22543. const CSS$r = {
  22544. container: "container"
  22545. };
  22546. const labelCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-label:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-label{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-label{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-label{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-label{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-label{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-label:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-label:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-label-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-label-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-label-h{display:inline}/*!@:host([alignment=start])*/[alignment=start].sc-calcite-label-h{text-align:start}/*!@:host([alignment=end])*/[alignment=end].sc-calcite-label-h{text-align:end}/*!@:host([alignment=center])*/[alignment=center].sc-calcite-label-h{text-align:center}/*!@:host([scale=s]) .container*/[scale=s].sc-calcite-label-h .container.sc-calcite-label{gap:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host(:not([disable-spacing])[scale=s]) .container*/.sc-calcite-label-h:not([disable-spacing])[scale=s] .container.sc-calcite-label{margin-block-end:var(--calcite-label-margin-bottom, 0.5rem)}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-label-h .container.sc-calcite-label{gap:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host(:not([disable-spacing])[scale=m]) .container*/.sc-calcite-label-h:not([disable-spacing])[scale=m] .container.sc-calcite-label{margin-block-end:var(--calcite-label-margin-bottom, 0.75rem)}/*!@:host([scale=l]) .container*/[scale=l].sc-calcite-label-h .container.sc-calcite-label{gap:0.5rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host(:not([disable-spacing])[scale=l]) .container*/.sc-calcite-label-h:not([disable-spacing])[scale=l] .container.sc-calcite-label{margin-block-end:var(--calcite-label-margin-bottom, 1rem)}/*!@:host .container*/.sc-calcite-label-h .container.sc-calcite-label{margin-inline:0px;margin-block-start:0px;inline-size:100%;line-height:1.375;color:var(--calcite-ui-text-1)}/*!@:host([layout=default]) .container*/[layout=default].sc-calcite-label-h .container.sc-calcite-label{display:flex;flex-direction:column}/*!@:host([layout=inline]) .container, \n:host([layout=inline-space-between]) .container*/[layout=inline].sc-calcite-label-h .container.sc-calcite-label,[layout=inline-space-between].sc-calcite-label-h .container.sc-calcite-label{display:flex;flex-direction:row;align-items:center;gap:0.5rem}/*!@:host([layout=inline][scale=l]) .container*/[layout=inline][scale=l].sc-calcite-label-h .container.sc-calcite-label{gap:0.75rem}/*!@:host([layout=inline-space-between]) .container*/[layout=inline-space-between].sc-calcite-label-h .container.sc-calcite-label{justify-content:space-between}/*!@:host([disabled]) > .container*/[disabled].sc-calcite-label-h>.container.sc-calcite-label{pointer-events:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted(*)*/.sc-calcite-label-h[disabled] .sc-calcite-label-s>*{pointer-events:none}/*!@:host([disabled]) ::slotted(*[disabled]), \n:host([disabled]) ::slotted(*[disabled] *)*/.sc-calcite-label-h[disabled] .sc-calcite-label-s>*[disabled],.sc-calcite-label-h[disabled] .sc-calcite-label-s>*[disabled] *{--tw-bg-opacity:1}/*!@:host([disabled]) ::slotted(calcite-input-message:not([active]))*/.sc-calcite-label-h[disabled] .sc-calcite-label-s>calcite-input-message:not([active]){--tw-bg-opacity:0}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-label-h[disabled] .sc-calcite-label-s>[calcite-hydrated][disabled],[disabled].sc-calcite-label-h [calcite-hydrated][disabled].sc-calcite-label{opacity:1}/*!@:host([disable-spacing]) .container*/[disable-spacing].sc-calcite-label-h .container.sc-calcite-label{margin:0px;gap:0px}";
  22547. /**
  22548. * @slot - A slot for adding text and a component that can be labeled.
  22549. */
  22550. class Label {
  22551. constructor(hostRef) {
  22552. registerInstance(this, hostRef);
  22553. this.calciteInternalLabelClick = createEvent(this, "calciteInternalLabelClick", 2);
  22554. //--------------------------------------------------------------------------
  22555. //
  22556. // Properties
  22557. //
  22558. //--------------------------------------------------------------------------
  22559. /** Specifies the text alignment of the component. */
  22560. this.alignment = "start";
  22561. /**
  22562. * Specifies the status of the component and any child input, or input messages.
  22563. *
  22564. * @deprecated Set directly on the component the label is bound to instead.
  22565. */
  22566. this.status = "idle";
  22567. /** Specifies the size of the component. */
  22568. this.scale = "m";
  22569. /** Defines the layout of the label in relation to the component. Use `"inline"` positions to wrap the label and component on the same line. */
  22570. this.layout = "default";
  22571. /**
  22572. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  22573. *
  22574. * @deprecated Use the `disabled` property on the component the label is bound to instead.
  22575. */
  22576. this.disabled = false;
  22577. /**
  22578. * When `true`, disables the component's spacing.
  22579. *
  22580. * @deprecated Set the `--calcite-label-margin-bottom` css variable to `0` instead.
  22581. */
  22582. this.disableSpacing = false;
  22583. //--------------------------------------------------------------------------
  22584. //
  22585. // Private Methods
  22586. //
  22587. //--------------------------------------------------------------------------
  22588. this.labelClickHandler = (event) => {
  22589. this.calciteInternalLabelClick.emit({
  22590. sourceEvent: event
  22591. });
  22592. };
  22593. }
  22594. //--------------------------------------------------------------------------
  22595. //
  22596. // Lifecycle
  22597. //
  22598. //--------------------------------------------------------------------------
  22599. connectedCallback() {
  22600. document.dispatchEvent(new CustomEvent(labelConnectedEvent));
  22601. }
  22602. disconnectedCallback() {
  22603. document.dispatchEvent(new CustomEvent(labelDisconnectedEvent));
  22604. }
  22605. render() {
  22606. return (hAsync(Host, { onClick: this.labelClickHandler }, hAsync("div", { class: CSS$r.container }, hAsync("slot", null))));
  22607. }
  22608. get el() { return getElement(this); }
  22609. static get style() { return labelCss; }
  22610. static get cmpMeta() { return {
  22611. "$flags$": 9,
  22612. "$tagName$": "calcite-label",
  22613. "$members$": {
  22614. "alignment": [513],
  22615. "status": [513],
  22616. "for": [513],
  22617. "scale": [513],
  22618. "layout": [513],
  22619. "disabled": [516],
  22620. "disableSpacing": [516, "disable-spacing"]
  22621. },
  22622. "$listeners$": undefined,
  22623. "$lazyBundleId$": "-",
  22624. "$attrsToReflect$": [["alignment", "alignment"], ["status", "status"], ["for", "for"], ["scale", "scale"], ["layout", "layout"], ["disabled", "disabled"], ["disableSpacing", "disable-spacing"]]
  22625. }; }
  22626. }
  22627. const linkCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-link:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-link{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-link{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-link{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-link{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-link{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-link:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-link:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-link-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-link-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-link-h{display:inline}/*!@:host a, \n:host span*/.sc-calcite-link-h a.sc-calcite-link,.sc-calcite-link-h span.sc-calcite-link{position:relative;display:flex;cursor:pointer;align-items:center;justify-content:center;border-radius:0px;border-style:none;font-family:inherit;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;text-decoration:none;line-height:inherit;font-size:inherit;-webkit-appearance:none}/*!@:host a:hover,\n:host span:hover*/.sc-calcite-link-h a.sc-calcite-link:hover,.sc-calcite-link-h span.sc-calcite-link:hover{text-decoration:none}/*!@:host a, \n:host span*/.sc-calcite-link-h a.sc-calcite-link,.sc-calcite-link-h span.sc-calcite-link{outline-color:transparent}/*!@:host a:focus, \n:host span:focus*/.sc-calcite-link-h a.sc-calcite-link:focus,.sc-calcite-link-h span.sc-calcite-link:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@calcite-icon*/calcite-icon.sc-calcite-link{inline-size:1em;block-size:1em;min-inline-size:unset;min-block-size:unset}/*!@.calcite-link--icon*/.calcite-link--icon.sc-calcite-link{vertical-align:text-top;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;margin-block-start:0.125rem}/*!@:host .calcite-link--icon.icon-start*/.sc-calcite-link-h .calcite-link--icon.icon-start.sc-calcite-link{margin-inline-end:0.5rem}/*!@:host .calcite-link--icon.icon-end*/.sc-calcite-link-h .calcite-link--icon.icon-end.sc-calcite-link{margin-inline-start:0.5rem}/*!@:host span, \n:host a*/.sc-calcite-link-h span.sc-calcite-link,.sc-calcite-link-h a.sc-calcite-link{position:relative;display:inline;border-style:none;background-color:transparent;padding:0px;color:var(--calcite-ui-text-link);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;line-height:inherit;white-space:initial;background-image:linear-gradient(currentColor, currentColor), linear-gradient(var(--calcite-link-blue-underline), var(--calcite-link-blue-underline));background-position:0% 100%, 100% 100%;background-repeat:no-repeat, no-repeat;background-size:0% 1px, 100% 1px}/*!@:host span:hover, :host span:focus,\n:host a:hover,\n:host a:focus*/.sc-calcite-link-h span.sc-calcite-link:hover,.sc-calcite-link-h span.sc-calcite-link:focus,.sc-calcite-link-h a.sc-calcite-link:hover,.sc-calcite-link-h a.sc-calcite-link:focus{background-size:100% 1px, 100% 1px}/*!@:host span:active,\n:host a:active*/.sc-calcite-link-h span.sc-calcite-link:active,.sc-calcite-link-h a.sc-calcite-link:active{background-size:100% 2px, 100% 2px}/*!@:host span.calcite--rtl,\n:host a.calcite--rtl*/.sc-calcite-link-h span.calcite--rtl.sc-calcite-link,.sc-calcite-link-h a.calcite--rtl.sc-calcite-link{background-position:100% 100%, 100% 100%}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-link-h[disabled] .sc-calcite-link-s>[calcite-hydrated][disabled],[disabled].sc-calcite-link-h [calcite-hydrated][disabled].sc-calcite-link{opacity:1}";
  22628. /** Any attributes placed on <calcite-link> component will propagate to the rendered child */
  22629. /** Passing a 'href' will render an anchor link, instead of a span. Role will be set to link, or link, depending on this. */
  22630. /** It is the consumers responsibility to add aria information, rel, target, for links, and any link attributes for form submission */
  22631. /** @slot - A slot for adding text. */
  22632. class Link {
  22633. constructor(hostRef) {
  22634. registerInstance(this, hostRef);
  22635. //--------------------------------------------------------------------------
  22636. //
  22637. // Properties
  22638. //
  22639. //--------------------------------------------------------------------------
  22640. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  22641. this.disabled = false;
  22642. /**
  22643. * Prompts the user to save the linked URL instead of navigating to it. Can be used with or without a value:
  22644. * Without a value, the browser will suggest a filename/extension
  22645. * See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download.
  22646. */
  22647. this.download = false;
  22648. this.childElClickHandler = (event) => {
  22649. if (!event.isTrusted) {
  22650. // click was invoked internally, we stop it here
  22651. event.stopPropagation();
  22652. }
  22653. };
  22654. //--------------------------------------------------------------------------
  22655. //
  22656. // Private Methods
  22657. //
  22658. //--------------------------------------------------------------------------
  22659. this.storeTagRef = (el) => {
  22660. this.childEl = el;
  22661. };
  22662. }
  22663. //--------------------------------------------------------------------------
  22664. //
  22665. // Lifecycle
  22666. //
  22667. //--------------------------------------------------------------------------
  22668. componentDidRender() {
  22669. updateHostInteraction(this);
  22670. }
  22671. render() {
  22672. const { download, el } = this;
  22673. const dir = getElementDir(el);
  22674. const childElType = this.href ? "a" : "span";
  22675. const iconStartEl = (hAsync("calcite-icon", { class: "calcite-link--icon icon-start", flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
  22676. const iconEndEl = (hAsync("calcite-icon", { class: "calcite-link--icon icon-end", flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
  22677. const Tag = childElType;
  22678. const role = childElType === "span" ? "link" : null;
  22679. const tabIndex = childElType === "span" ? 0 : null;
  22680. return (hAsync(Host, { role: "presentation" }, hAsync(Tag, { class: { [CSS_UTILITY.rtl]: dir === "rtl" },
  22681. /*
  22682. When the 'download' property of type 'boolean | string' is set to true, the value is "".
  22683. This works around that issue for now.
  22684. */
  22685. download: Tag === "a" && (download === "" || download) ? download : null, href: Tag === "a" && this.href, onClick: this.childElClickHandler, ref: this.storeTagRef, rel: Tag === "a" && this.rel, role: role, tabIndex: tabIndex, target: Tag === "a" && this.target }, this.iconStart ? iconStartEl : null, hAsync("slot", null), this.iconEnd ? iconEndEl : null)));
  22686. }
  22687. //--------------------------------------------------------------------------
  22688. //
  22689. // Events
  22690. //
  22691. //--------------------------------------------------------------------------
  22692. clickHandler(event) {
  22693. // forwards the click() to the internal link for non user-initiated events
  22694. if (!event.isTrusted) {
  22695. this.childEl.click();
  22696. }
  22697. }
  22698. //--------------------------------------------------------------------------
  22699. //
  22700. // Public Methods
  22701. //
  22702. //--------------------------------------------------------------------------
  22703. /** Sets focus on the component. */
  22704. async setFocus() {
  22705. focusElement(this.childEl);
  22706. }
  22707. get el() { return getElement(this); }
  22708. static get style() { return linkCss; }
  22709. static get cmpMeta() { return {
  22710. "$flags$": 9,
  22711. "$tagName$": "calcite-link",
  22712. "$members$": {
  22713. "disabled": [516],
  22714. "download": [520],
  22715. "href": [513],
  22716. "iconEnd": [513, "icon-end"],
  22717. "iconFlipRtl": [513, "icon-flip-rtl"],
  22718. "iconStart": [513, "icon-start"],
  22719. "rel": [1],
  22720. "target": [1],
  22721. "setFocus": [64]
  22722. },
  22723. "$listeners$": [[0, "click", "clickHandler"]],
  22724. "$lazyBundleId$": "-",
  22725. "$attrsToReflect$": [["disabled", "disabled"], ["download", "download"], ["href", "href"], ["iconEnd", "icon-end"], ["iconFlipRtl", "icon-flip-rtl"], ["iconStart", "icon-start"]]
  22726. }; }
  22727. }
  22728. const CSS$q = {
  22729. container: "container"
  22730. };
  22731. const listCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-list:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-list{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-list{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-list{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-list{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-list{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-list:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-list:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-list-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-list-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-list-h{display:block}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-list-h[disabled] .sc-calcite-list-s>[calcite-hydrated][disabled],[disabled].sc-calcite-list-h [calcite-hydrated][disabled].sc-calcite-list{opacity:1}/*!@.container*/.container.sc-calcite-list{box-sizing:border-box;display:flex;inline-size:100%;flex-direction:column;background-color:transparent}/*!@.container **/.container.sc-calcite-list *.sc-calcite-list{box-sizing:border-box}/*!@::slotted(calcite-list-item)*/.sc-calcite-list-s>calcite-list-item{margin-block-end:1px;--tw-shadow:0 1px 0 var(--calcite-ui-border-3);--tw-shadow-colored:0 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@::slotted(calcite-list-item:last-child)*/.sc-calcite-list-s>calcite-list-item:last-child{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}";
  22732. /**
  22733. * A general purpose list that enables users to construct list items that conform to Calcite styling.
  22734. *
  22735. * @slot - A slot for adding `calcite-list-item` elements.
  22736. */
  22737. class List$1 {
  22738. constructor(hostRef) {
  22739. registerInstance(this, hostRef);
  22740. // --------------------------------------------------------------------------
  22741. //
  22742. // Properties
  22743. //
  22744. // --------------------------------------------------------------------------
  22745. /**
  22746. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  22747. */
  22748. this.disabled = false;
  22749. }
  22750. //--------------------------------------------------------------------------
  22751. //
  22752. // Lifecycle
  22753. //
  22754. //--------------------------------------------------------------------------
  22755. componentDidRender() {
  22756. updateHostInteraction(this);
  22757. }
  22758. // --------------------------------------------------------------------------
  22759. //
  22760. // Public Methods
  22761. //
  22762. // --------------------------------------------------------------------------
  22763. /** Sets focus on the component. */
  22764. async setFocus() {
  22765. const firstListItem = this.el.querySelector(`calcite-list-item:not([non-interactive])`);
  22766. firstListItem === null || firstListItem === void 0 ? void 0 : firstListItem.setFocus();
  22767. }
  22768. // --------------------------------------------------------------------------
  22769. //
  22770. // Render Methods
  22771. //
  22772. // --------------------------------------------------------------------------
  22773. render() {
  22774. return (hAsync(Host, { role: "list" }, hAsync("div", { class: CSS$q.container }, hAsync("slot", null))));
  22775. }
  22776. get el() { return getElement(this); }
  22777. static get style() { return listCss; }
  22778. static get cmpMeta() { return {
  22779. "$flags$": 9,
  22780. "$tagName$": "calcite-list",
  22781. "$members$": {
  22782. "disabled": [516],
  22783. "headingLevel": [514, "heading-level"],
  22784. "setFocus": [64]
  22785. },
  22786. "$listeners$": undefined,
  22787. "$lazyBundleId$": "-",
  22788. "$attrsToReflect$": [["disabled", "disabled"], ["headingLevel", "heading-level"]]
  22789. }; }
  22790. }
  22791. const CSS$p = {
  22792. container: "container",
  22793. contentContainer: "content-container",
  22794. nestedContainer: "nested-container",
  22795. contentContainerButton: "content-container--button",
  22796. content: "content",
  22797. actionsStart: "actions-start",
  22798. contentStart: "content-start",
  22799. label: "label",
  22800. description: "description",
  22801. contentEnd: "content-end",
  22802. actionsEnd: "actions-end",
  22803. hasCenterContent: "has-center-content"
  22804. };
  22805. const SLOTS$e = {
  22806. actionsStart: "actions-start",
  22807. contentStart: "content-start",
  22808. contentEnd: "content-end",
  22809. actionsEnd: "actions-end"
  22810. };
  22811. const listItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-list-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-list-item{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-list-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-list-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-list-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-list-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-list-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-list-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-list-item-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-list-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-list-item-h{display:flex;flex-direction:column}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-list-item-h[disabled] .sc-calcite-list-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-list-item-h [calcite-hydrated][disabled].sc-calcite-list-item{opacity:1}/*!@.container*/.container.sc-calcite-list-item{box-sizing:border-box;display:flex;flex:1 1 0%;background-color:var(--calcite-ui-foreground-1);font-family:var(--calcite-sans-family)}/*!@.container **/.container.sc-calcite-list-item *.sc-calcite-list-item{box-sizing:border-box}/*!@.nested-container*/.nested-container.sc-calcite-list-item{display:flex;flex-direction:column;background-color:var(--calcite-ui-foreground-1)}/*!@.content-container*/.content-container.sc-calcite-list-item{display:flex;flex:1 1 auto;align-items:stretch;padding:0px;font-family:var(--calcite-sans-family);font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);outline-color:transparent}/*!@.content-container--button*/.content-container--button.sc-calcite-list-item{cursor:pointer;border-style:none;background-color:var(--calcite-ui-foreground-1);outline-color:transparent;text-align:initial}/*!@.content-container--button:hover*/.content-container--button.sc-calcite-list-item:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.content-container--button:hover .label, \n.content-container--button:hover .description*/.content-container--button.sc-calcite-list-item:hover .label.sc-calcite-list-item,.content-container--button.sc-calcite-list-item:hover .description.sc-calcite-list-item{color:var(--calcite-ui-text-1)}/*!@.content-container--button:focus*/.content-container--button.sc-calcite-list-item:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.content-container--button .content-start, \n.content-container--button .content-end*/.content-container--button.sc-calcite-list-item .content-start.sc-calcite-list-item,.content-container--button.sc-calcite-list-item .content-end.sc-calcite-list-item{pointer-events:none}/*!@.content*/.content.sc-calcite-list-item{display:flex;flex:1 1 auto;flex-direction:column;justify-content:center;padding-inline:0.75rem;padding-block:0.5rem;font-size:var(--calcite-font-size--2);line-height:1.375}/*!@.label, \n.description*/.label.sc-calcite-list-item,.description.sc-calcite-list-item{font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal);word-wrap:break-word;word-break:break-word}/*!@.label:only-child, \n.description:only-child*/.label.sc-calcite-list-item:only-child,.description.sc-calcite-list-item:only-child{margin:0px;padding-block:0.25rem}/*!@.label*/.label.sc-calcite-list-item{color:var(--calcite-ui-text-1)}/*!@.description*/.description.sc-calcite-list-item{margin-block-start:0.125rem;color:var(--calcite-ui-text-3)}/*!@.content-start*/.content-start.sc-calcite-list-item{justify-content:flex-start}/*!@.content-end*/.content-end.sc-calcite-list-item{justify-content:flex-end}/*!@.content-start, \n.content-end*/.content-start.sc-calcite-list-item,.content-end.sc-calcite-list-item{flex:1 1 auto}/*!@.has-center-content .content-start, \n.has-center-content .content-end*/.has-center-content.sc-calcite-list-item .content-start.sc-calcite-list-item,.has-center-content.sc-calcite-list-item .content-end.sc-calcite-list-item{flex:0 1 auto}/*!@.actions-start, \n.actions-end, \n.content-start, \n.content-end*/.actions-start.sc-calcite-list-item,.actions-end.sc-calcite-list-item,.content-start.sc-calcite-list-item,.content-end.sc-calcite-list-item{display:flex;align-items:center}/*!@.content-start ::slotted(calcite-icon), \n.content-end ::slotted(calcite-icon)*/.content-start .sc-calcite-list-item-s>calcite-icon,.content-end .sc-calcite-list-item-s>calcite-icon{margin-inline:0.75rem;align-self:center}/*!@.actions-start ::slotted(calcite-action), \n.actions-end ::slotted(calcite-action)*/.actions-start .sc-calcite-list-item-s>calcite-action,.actions-end .sc-calcite-list-item-s>calcite-action{align-self:stretch;color:inherit}/*!@::slotted(calcite-list-item-group),\n::slotted(calcite-list-item)*/.sc-calcite-list-item-s>calcite-list-item-group,.sc-calcite-list-item-s>calcite-list-item{padding-inline-start:0.5rem}";
  22812. /**
  22813. * @slot - A slot for adding `calcite-list-item` and `calcite-list-item-group` elements.
  22814. * @slot actions-start - A slot for adding actionable `calcite-action` elements before the content of the component.
  22815. * @slot content-start - A slot for adding non-actionable elements before the label and description of the component.
  22816. * @slot content-end - A slot for adding non-actionable elements after the label and description of the component.
  22817. * @slot actions-end - A slot for adding actionable `calcite-action` elements after the content of the component.
  22818. */
  22819. class ListItem {
  22820. constructor(hostRef) {
  22821. registerInstance(this, hostRef);
  22822. // --------------------------------------------------------------------------
  22823. //
  22824. // Properties
  22825. //
  22826. // --------------------------------------------------------------------------
  22827. /**
  22828. * When `true`, prevents the content of the component from user interaction.
  22829. */
  22830. this.nonInteractive = false;
  22831. /**
  22832. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  22833. */
  22834. this.disabled = false;
  22835. }
  22836. //--------------------------------------------------------------------------
  22837. //
  22838. // Lifecycle
  22839. //
  22840. //--------------------------------------------------------------------------
  22841. componentDidRender() {
  22842. updateHostInteraction(this);
  22843. }
  22844. // --------------------------------------------------------------------------
  22845. //
  22846. // Lifecycle
  22847. //
  22848. // --------------------------------------------------------------------------
  22849. connectedCallback() {
  22850. connectConditionalSlotComponent(this);
  22851. }
  22852. disconnectedCallback() {
  22853. disconnectConditionalSlotComponent(this);
  22854. }
  22855. // --------------------------------------------------------------------------
  22856. //
  22857. // Public Methods
  22858. //
  22859. // --------------------------------------------------------------------------
  22860. /** Sets focus on the component. */
  22861. async setFocus() {
  22862. var _a;
  22863. (_a = this.focusEl) === null || _a === void 0 ? void 0 : _a.focus();
  22864. }
  22865. // --------------------------------------------------------------------------
  22866. //
  22867. // Render Methods
  22868. //
  22869. // --------------------------------------------------------------------------
  22870. renderActionsStart() {
  22871. const { el } = this;
  22872. return getSlotted(el, SLOTS$e.actionsStart) ? (hAsync("div", { class: CSS$p.actionsStart }, hAsync("slot", { name: SLOTS$e.actionsStart }))) : null;
  22873. }
  22874. renderActionsEnd() {
  22875. const { el } = this;
  22876. return getSlotted(el, SLOTS$e.actionsEnd) ? (hAsync("div", { class: CSS$p.actionsEnd }, hAsync("slot", { name: SLOTS$e.actionsEnd }))) : null;
  22877. }
  22878. renderContentStart() {
  22879. const { el } = this;
  22880. return getSlotted(el, SLOTS$e.contentStart) ? (hAsync("div", { class: CSS$p.contentStart }, hAsync("slot", { name: SLOTS$e.contentStart }))) : null;
  22881. }
  22882. renderContentEnd() {
  22883. const { el } = this;
  22884. return getSlotted(el, SLOTS$e.contentEnd) ? (hAsync("div", { class: CSS$p.contentEnd }, hAsync("slot", { name: SLOTS$e.contentEnd }))) : null;
  22885. }
  22886. renderContent() {
  22887. const { label, description } = this;
  22888. return !!label || !!description ? (hAsync("div", { class: CSS$p.content }, label ? hAsync("div", { class: CSS$p.label }, label) : null, description ? hAsync("div", { class: CSS$p.description }, description) : null)) : null;
  22889. }
  22890. renderContentContainer() {
  22891. const { description, disabled, label, nonInteractive } = this;
  22892. const hasCenterContent = !!label || !!description;
  22893. const content = [this.renderContentStart(), this.renderContent(), this.renderContentEnd()];
  22894. return !nonInteractive ? (hAsync("button", { class: {
  22895. [CSS$p.contentContainer]: true,
  22896. [CSS$p.contentContainerButton]: true,
  22897. [CSS$p.hasCenterContent]: hasCenterContent
  22898. }, disabled: disabled, ref: (focusEl) => (this.focusEl = focusEl) }, content)) : (hAsync("div", { class: { [CSS$p.contentContainer]: true, [CSS$p.hasCenterContent]: hasCenterContent }, ref: () => (this.focusEl = null) }, content));
  22899. }
  22900. render() {
  22901. return (hAsync(Host, { role: "listitem" }, hAsync("div", { class: CSS$p.container }, this.renderActionsStart(), this.renderContentContainer(), this.renderActionsEnd()), hAsync("div", { class: CSS$p.nestedContainer }, hAsync("slot", null))));
  22902. }
  22903. get el() { return getElement(this); }
  22904. static get style() { return listItemCss; }
  22905. static get cmpMeta() { return {
  22906. "$flags$": 9,
  22907. "$tagName$": "calcite-list-item",
  22908. "$members$": {
  22909. "nonInteractive": [516, "non-interactive"],
  22910. "description": [1],
  22911. "disabled": [516],
  22912. "label": [1],
  22913. "setFocus": [64]
  22914. },
  22915. "$listeners$": undefined,
  22916. "$lazyBundleId$": "-",
  22917. "$attrsToReflect$": [["nonInteractive", "non-interactive"], ["disabled", "disabled"]]
  22918. }; }
  22919. }
  22920. const CSS$o = {
  22921. heading: "heading",
  22922. container: "container"
  22923. };
  22924. const HEADING_LEVEL$4 = 3;
  22925. const listItemGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-list-item-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-list-item-group{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-list-item-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-list-item-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-list-item-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-list-item-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-list-item-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-list-item-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-list-item-group-h{display:none}/*!@:host*/.sc-calcite-list-item-group-h{display:flex;flex-direction:column}/*!@.heading*/.heading.sc-calcite-list-item-group{margin:0px;display:flex;flex:1 1 0%;background-color:var(--calcite-ui-foreground-2);padding:0.75rem;font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-2)}/*!@.container*/.container.sc-calcite-list-item-group{display:flex;inline-size:100%;flex-direction:column;background-color:var(--calcite-ui-foreground-1)}/*!@::slotted(calcite-list-item-group)*/.sc-calcite-list-item-group-s>calcite-list-item-group{padding-inline-start:0.5rem}";
  22926. /**
  22927. * @slot - A slot for adding `calcite-list-item` and `calcite-list-item-group` elements.
  22928. */
  22929. class ListItemGroup {
  22930. constructor(hostRef) {
  22931. registerInstance(this, hostRef);
  22932. }
  22933. // --------------------------------------------------------------------------
  22934. //
  22935. // Render Methods
  22936. //
  22937. // --------------------------------------------------------------------------
  22938. render() {
  22939. var _a;
  22940. const { el, heading, headingLevel } = this;
  22941. const parentLevel = (_a = el.closest("calcite-list, calcite-list-item-group")) === null || _a === void 0 ? void 0 : _a.headingLevel;
  22942. const relativeLevel = parentLevel ? constrainHeadingLevel(parentLevel + 1) : null;
  22943. const level = headingLevel || relativeLevel || HEADING_LEVEL$4;
  22944. return (hAsync(Host, null, heading ? (hAsync(Heading, { class: CSS$o.heading, level: level }, heading)) : null, hAsync("div", { class: CSS$o.container, role: "group" }, hAsync("slot", null))));
  22945. }
  22946. get el() { return getElement(this); }
  22947. static get style() { return listItemGroupCss; }
  22948. static get cmpMeta() { return {
  22949. "$flags$": 9,
  22950. "$tagName$": "calcite-list-item-group",
  22951. "$members$": {
  22952. "heading": [513],
  22953. "headingLevel": [514, "heading-level"]
  22954. },
  22955. "$listeners$": undefined,
  22956. "$lazyBundleId$": "-",
  22957. "$attrsToReflect$": [["heading", "heading"], ["headingLevel", "heading-level"]]
  22958. }; }
  22959. }
  22960. const loaderCss = "@charset \"UTF-8\";@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-loader:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-loader{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-loader{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-loader{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-loader{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-loader{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-loader:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-loader:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-loader-h{display:none}/*!@:host*/.sc-calcite-loader-h{position:relative;margin-inline:auto;display:none;align-items:center;justify-content:center;opacity:1;min-block-size:var(--calcite-loader-size);font-size:var(--calcite-loader-font-size);stroke:var(--calcite-ui-brand);stroke-width:3;fill:none;transform:scale(1, 1);animation:loader-color-shift calc(var(--calcite-internal-animation-timing-slow) * 2) alternate-reverse infinite linear;padding-block:var(--calcite-loader-padding, 4rem)}/*!@:host([scale=s])*/[scale=s].sc-calcite-loader-h{--calcite-loader-font-size:var(--calcite-font-size--2);--calcite-loader-size:2rem;--calcite-loader-size-inline:0.75rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-loader-h{--calcite-loader-font-size:var(--calcite-font-size-0);--calcite-loader-size:4rem;--calcite-loader-size-inline:1rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-loader-h{--calcite-loader-font-size:var(--calcite-font-size-2);--calcite-loader-size:6rem;--calcite-loader-size-inline:1.5rem}/*!@:host([no-padding])*/[no-padding].sc-calcite-loader-h{padding-block:0px}/*!@:host*/.sc-calcite-loader-h{display:none}/*!@:host([active])*/[active].sc-calcite-loader-h{display:flex}/*!@.loader__text*/.loader__text.sc-calcite-loader{display:block;text-align:center;font-size:var(--calcite-font-size--2);line-height:1rem;color:var(--calcite-ui-text-1);margin-block-start:calc(var(--calcite-loader-size) + 1.5rem)}/*!@.loader__percentage*/.loader__percentage.sc-calcite-loader{position:absolute;display:block;text-align:center;color:var(--calcite-ui-text-1);font-size:var(--calcite-loader-font-size);inline-size:var(--calcite-loader-size);inset-inline-start:50%;margin-inline-start:calc(var(--calcite-loader-size) / 2 * -1);line-height:0.25;transform:scale(1, 1)}/*!@.loader__svgs*/.loader__svgs.sc-calcite-loader{position:absolute;overflow:visible;opacity:1;inline-size:var(--calcite-loader-size);block-size:var(--calcite-loader-size);inset-inline-start:50%;margin-inline-start:calc(var(--calcite-loader-size) / 2 * -1);transform:scale(1, 1)}/*!@.loader__svg*/.loader__svg.sc-calcite-loader{position:absolute;inset-block-start:0px;transform-origin:center;overflow:visible;inset-inline-start:0;inline-size:var(--calcite-loader-size);block-size:var(--calcite-loader-size);animation-iteration-count:infinite;animation-timing-function:linear;animation-name:loader-clockwise}@supports (display: grid){/*!@.loader__svg--1*/.loader__svg--1.sc-calcite-loader{animation-name:loader-offset-1}/*!@.loader__svg--2*/.loader__svg--2.sc-calcite-loader{animation-name:loader-offset-2}/*!@.loader__svg--3*/.loader__svg--3.sc-calcite-loader{animation-name:loader-offset-3}}/*!@:host([type=determinate])*/[type=determinate].sc-calcite-loader-h{animation:none;stroke:var(--calcite-ui-border-3)}/*!@:host([type=determinate]) .loader__svg--3*/[type=determinate].sc-calcite-loader-h .loader__svg--3.sc-calcite-loader{animation:none;stroke:var(--calcite-ui-brand);stroke-dasharray:150.79632;transform:rotate(-90deg);transition:all var(--calcite-internal-animation-timing-fast) linear}/*!@:host([inline])*/[inline].sc-calcite-loader-h{position:relative;margin:0px;animation:none;stroke:currentColor;stroke-width:2;padding-block:0px;block-size:var(--calcite-loader-size-inline);min-block-size:var(--calcite-loader-size-inline);inline-size:var(--calcite-loader-size-inline);margin-inline-end:calc(var(--calcite-loader-size-inline) * 0.5);vertical-align:calc(var(--calcite-loader-size-inline) * -1 * 0.2)}/*!@:host([active][inline])*/[active][inline].sc-calcite-loader-h{display:inline-block}/*!@:host([inline]) .loader__svgs*/[inline].sc-calcite-loader-h .loader__svgs.sc-calcite-loader{inset-block-start:0px;margin:0px;inset-inline-start:0;inline-size:var(--calcite-loader-size-inline);block-size:var(--calcite-loader-size-inline)}/*!@:host([inline]) .loader__svg*/[inline].sc-calcite-loader-h .loader__svg.sc-calcite-loader{inline-size:var(--calcite-loader-size-inline);block-size:var(--calcite-loader-size-inline)}/*!@:host([complete])*/[complete].sc-calcite-loader-h{opacity:0;transform:scale(0.75, 0.75);transform-origin:center;transition:opacity var(--calcite-internal-animation-timing-medium) linear 1000ms, transform var(--calcite-internal-animation-timing-medium) linear 1000ms}/*!@:host([complete]) .loader__svgs*/[complete].sc-calcite-loader-h .loader__svgs.sc-calcite-loader{opacity:0;transform:scale(0.75, 0.75);transform-origin:center;transition:opacity calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms, transform calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms}/*!@:host([complete]) .loader__percentage*/[complete].sc-calcite-loader-h .loader__percentage.sc-calcite-loader{color:var(--calcite-ui-brand);transform:scale(1.05, 1.05);transform-origin:center;transition:color var(--calcite-internal-animation-timing-medium) linear, transform var(--calcite-internal-animation-timing-medium) linear}/*!@.loader__svg--1*/.loader__svg--1.sc-calcite-loader{stroke-dasharray:27.9252444444% 139.6262222222%;animation-duration:calc(var(--calcite-internal-animation-timing-slow) * 2.4)}@keyframes loader-offset-1{0%{stroke-dasharray:27.9252444444% 251.3272%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-83.7757333333%}100%{stroke-dasharray:27.9252444444% 251.3272%;stroke-dashoffset:-279.2524444444%}}/*!@.loader__svg--2*/.loader__svg--2.sc-calcite-loader{stroke-dasharray:55.8504888889% 139.6262222222%;animation-duration:calc(var(--calcite-internal-animation-timing-slow) * 3.2)}@keyframes loader-offset-2{0%{stroke-dasharray:55.8504888889% 223.4019555556%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-97.7383555556%}100%{stroke-dasharray:55.8504888889% 223.4019555556%;stroke-dashoffset:-279.2524444444%}}/*!@.loader__svg--3*/.loader__svg--3.sc-calcite-loader{stroke-dasharray:13.9626222222% 139.6262222222%;animation-duration:calc(var(--calcite-internal-animation-timing-slow) * 3.867)}@keyframes loader-offset-3{0%{stroke-dasharray:13.9626222222% 265.2898222222%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-76.7944222222%}100%{stroke-dasharray:13.9626222222% 265.2898222222%;stroke-dashoffset:-279.2524444444%}}@keyframes loader-color-shift{0%{stroke:var(--calcite-ui-brand)}33%{stroke:var(--calcite-ui-brand-press)}66%{stroke:var(--calcite-ui-brand-hover)}100%{stroke:var(--calcite-ui-brand)}}@keyframes loader-clockwise{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
  22961. class Loader {
  22962. constructor(hostRef) {
  22963. registerInstance(this, hostRef);
  22964. //--------------------------------------------------------------------------
  22965. //
  22966. // Properties
  22967. //
  22968. //--------------------------------------------------------------------------
  22969. /** When `true`, the component is active. */
  22970. this.active = false;
  22971. /** When `true`, displays smaller and appears to the left of the text. */
  22972. this.inline = false;
  22973. /** Specifies the size of the component. */
  22974. this.scale = "m";
  22975. /** The component's value. Valid only for `"determinate"` indicators. Percent complete of 100. */
  22976. this.value = 0;
  22977. /** Text that displays under the component's indicator. */
  22978. this.text = "";
  22979. /**
  22980. * Disables spacing around the component.
  22981. *
  22982. * @deprecated Use `--calcite-loader-padding` CSS variable instead.
  22983. */
  22984. this.noPadding = false;
  22985. }
  22986. //--------------------------------------------------------------------------
  22987. //
  22988. // Lifecycle
  22989. //
  22990. //--------------------------------------------------------------------------
  22991. render() {
  22992. const { el, inline, label, scale, text, type, value } = this;
  22993. const id = el.id || guid();
  22994. const radiusRatio = 0.45;
  22995. const size = inline ? this.getInlineSize(scale) : this.getSize(scale);
  22996. const radius = size * radiusRatio;
  22997. const viewbox = `0 0 ${size} ${size}`;
  22998. const isDeterminate = type === "determinate";
  22999. const circumference = 2 * radius * Math.PI;
  23000. const progress = (value / 100) * circumference;
  23001. const remaining = circumference - progress;
  23002. const valueNow = Math.floor(value);
  23003. const hostAttributes = {
  23004. "aria-valuenow": valueNow,
  23005. "aria-valuemin": 0,
  23006. "aria-valuemax": 100,
  23007. complete: valueNow === 100
  23008. };
  23009. const svgAttributes = { r: radius, cx: size / 2, cy: size / 2 };
  23010. const determinateStyle = { "stroke-dasharray": `${progress} ${remaining}` };
  23011. return (hAsync(Host, { "aria-label": label, id: id, role: "progressbar", ...(isDeterminate ? hostAttributes : {}) }, hAsync("div", { class: "loader__svgs" }, hAsync("svg", { class: "loader__svg loader__svg--1", viewBox: viewbox }, hAsync("circle", { ...svgAttributes })), hAsync("svg", { class: "loader__svg loader__svg--2", viewBox: viewbox }, hAsync("circle", { ...svgAttributes })), hAsync("svg", { class: "loader__svg loader__svg--3", viewBox: viewbox, ...(isDeterminate ? { style: determinateStyle } : {}) }, hAsync("circle", { ...svgAttributes }))), text && hAsync("div", { class: "loader__text" }, text), isDeterminate && hAsync("div", { class: "loader__percentage" }, value)));
  23012. }
  23013. //--------------------------------------------------------------------------
  23014. //
  23015. // Private Methods
  23016. //
  23017. //--------------------------------------------------------------------------
  23018. /**
  23019. * Return the proper sizes based on the scale property
  23020. *
  23021. * @param scale
  23022. */
  23023. getSize(scale) {
  23024. return {
  23025. s: 32,
  23026. m: 56,
  23027. l: 80
  23028. }[scale];
  23029. }
  23030. getInlineSize(scale) {
  23031. return {
  23032. s: 12,
  23033. m: 16,
  23034. l: 20
  23035. }[scale];
  23036. }
  23037. get el() { return getElement(this); }
  23038. static get style() { return loaderCss; }
  23039. static get cmpMeta() { return {
  23040. "$flags$": 9,
  23041. "$tagName$": "calcite-loader",
  23042. "$members$": {
  23043. "active": [516],
  23044. "inline": [516],
  23045. "label": [1],
  23046. "scale": [513],
  23047. "type": [513],
  23048. "value": [2],
  23049. "text": [1],
  23050. "noPadding": [516, "no-padding"]
  23051. },
  23052. "$listeners$": undefined,
  23053. "$lazyBundleId$": "-",
  23054. "$attrsToReflect$": [["active", "active"], ["inline", "inline"], ["scale", "scale"], ["type", "type"], ["noPadding", "no-padding"]]
  23055. }; }
  23056. }
  23057. /**
  23058. * Traverses the slots of the open shadowroots and returns all children matching the query.
  23059. * @param {ShadowRoot | HTMLElement} root
  23060. * @param skipNode
  23061. * @param isMatch
  23062. * @param {number} maxDepth
  23063. * @param {number} depth
  23064. * @returns {HTMLElement[]}
  23065. */
  23066. function queryShadowRoot(root, skipNode, isMatch, maxDepth = 20, depth = 0) {
  23067. let matches = [];
  23068. // If the depth is above the max depth, abort the searching here.
  23069. if (depth >= maxDepth) {
  23070. return matches;
  23071. }
  23072. // Traverses a slot element
  23073. const traverseSlot = ($slot) => {
  23074. // Only check nodes that are of the type Node.ELEMENT_NODE
  23075. // Read more here https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
  23076. const assignedNodes = $slot.assignedNodes().filter(node => node.nodeType === 1);
  23077. if (assignedNodes.length > 0) {
  23078. return queryShadowRoot(assignedNodes[0].parentElement, skipNode, isMatch, maxDepth, depth + 1);
  23079. }
  23080. return [];
  23081. };
  23082. // Go through each child and continue the traversing if necessary
  23083. // Even though the typing says that children can't be undefined, Edge 15 sometimes gives an undefined value.
  23084. // Therefore we fallback to an empty array if it is undefined.
  23085. const children = Array.from(root.children || []);
  23086. for (const $child of children) {
  23087. // Check if the node and its descendants should be skipped
  23088. if (skipNode($child)) {
  23089. continue;
  23090. }
  23091. // If the child matches we always add it
  23092. if (isMatch($child)) {
  23093. matches.push($child);
  23094. }
  23095. if ($child.shadowRoot != null) {
  23096. matches.push(...queryShadowRoot($child.shadowRoot, skipNode, isMatch, maxDepth, depth + 1));
  23097. }
  23098. else if ($child.tagName === "SLOT") {
  23099. matches.push(...traverseSlot($child));
  23100. }
  23101. else {
  23102. matches.push(...queryShadowRoot($child, skipNode, isMatch, maxDepth, depth + 1));
  23103. }
  23104. }
  23105. return matches;
  23106. }
  23107. /**
  23108. * Returns whether the element is hidden.
  23109. * @param $elem
  23110. */
  23111. function isHidden($elem) {
  23112. return $elem.hasAttribute("hidden")
  23113. || ($elem.hasAttribute("aria-hidden") && $elem.getAttribute("aria-hidden") !== "false")
  23114. // A quick and dirty way to check whether the element is hidden.
  23115. // For a more fine-grained check we could use "window.getComputedStyle" but we don't because of bad performance.
  23116. // If the element has visibility set to "hidden" or "collapse", display set to "none" or opacity set to "0" through CSS
  23117. // we won't be able to catch it here. We accept it due to the huge performance benefits.
  23118. || $elem.style.display === `none`
  23119. || $elem.style.opacity === `0`
  23120. || $elem.style.visibility === `hidden`
  23121. || $elem.style.visibility === `collapse`;
  23122. // If offsetParent is null we can assume that the element is hidden
  23123. // https://stackoverflow.com/questions/306305/what-would-make-offsetparent-null
  23124. //|| $elem.offsetParent == null;
  23125. }
  23126. /**
  23127. * Returns whether the element is disabled.
  23128. * @param $elem
  23129. */
  23130. function isDisabled($elem) {
  23131. return $elem.hasAttribute("disabled")
  23132. || ($elem.hasAttribute("aria-disabled") && $elem.getAttribute("aria-disabled") !== "false");
  23133. }
  23134. /**
  23135. * Determines whether an element is focusable.
  23136. * Read more here: https://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus/1600194#1600194
  23137. * Or here: https://stackoverflow.com/questions/18261595/how-to-check-if-a-dom-element-is-focusable
  23138. * @param $elem
  23139. */
  23140. function isFocusable($elem) {
  23141. // Discard elements that are removed from the tab order.
  23142. if ($elem.getAttribute("tabindex") === "-1" || isHidden($elem) || isDisabled($elem)) {
  23143. return false;
  23144. }
  23145. return (
  23146. // At this point we know that the element can have focus (eg. won't be -1) if the tabindex attribute exists
  23147. $elem.hasAttribute("tabindex")
  23148. // Anchor tags or area tags with a href set
  23149. || ($elem instanceof HTMLAnchorElement || $elem instanceof HTMLAreaElement) && $elem.hasAttribute("href")
  23150. // Form elements which are not disabled
  23151. || ($elem instanceof HTMLButtonElement
  23152. || $elem instanceof HTMLInputElement
  23153. || $elem instanceof HTMLTextAreaElement
  23154. || $elem instanceof HTMLSelectElement)
  23155. // IFrames
  23156. || $elem instanceof HTMLIFrameElement);
  23157. }
  23158. const CSS$n = {
  23159. modal: "modal",
  23160. modalOpen: "modal--open",
  23161. title: "title",
  23162. header: "header",
  23163. footer: "footer",
  23164. scrim: "scrim",
  23165. back: "back",
  23166. close: "close",
  23167. secondary: "secondary",
  23168. primary: "primary",
  23169. overflowHidden: "overflow-hidden",
  23170. // these classes help apply the animation in phases to only set transform on open/close
  23171. // this helps avoid a positioning issue for any floating-ui-owning children
  23172. openingIdle: "modal--opening-idle",
  23173. openingActive: "modal--opening-active",
  23174. closingIdle: "modal--closing-idle",
  23175. closingActive: "modal--closing-active"
  23176. };
  23177. const ICONS$5 = {
  23178. close: "x"
  23179. };
  23180. const SLOTS$d = {
  23181. content: "content",
  23182. header: "header",
  23183. back: "back",
  23184. secondary: "secondary",
  23185. primary: "primary"
  23186. };
  23187. const TEXT$a = {
  23188. close: "Close"
  23189. };
  23190. const modalCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-modal:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-modal{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-modal{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-modal{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-modal{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-modal{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-modal:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-modal:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-modal-h{display:none}/*!@:host*/.sc-calcite-modal-h{position:fixed;inset:0px;z-index:700;display:flex;align-items:center;justify-content:center;overflow-y:hidden;color:var(--calcite-ui-text-2);opacity:0;visibility:hidden !important;transition:visibility 0ms linear var(--calcite-internal-animation-timing-slow), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88)}/*!@:host([scale=s])*/[scale=s].sc-calcite-modal-h{--calcite-modal-padding:0.75rem;--calcite-modal-padding-large:1rem;--calcite-modal-title-text:var(--calcite-font-size-1);--calcite-modal-content-text:var(--calcite-font-size--1);--calcite-modal-padding-internal:0.75rem;--calcite-modal-padding-large-internal:1rem;--calcite-modal-title-text-internal:var(--calcite-font-size-1);--calcite-modal-content-text-internal:var(--calcite-font-size--1)}/*!@:host([scale=m])*/[scale=m].sc-calcite-modal-h{--calcite-modal-padding:1rem;--calcite-modal-padding-large:1.25rem;--calcite-modal-title-text:var(--calcite-font-size-2);--calcite-modal-content-text:var(--calcite-font-size-0);--calcite-modal-padding-internal:1rem;--calcite-modal-padding-large-internal:1.25rem;--calcite-modal-title-text-internal:var(--calcite-font-size-2);--calcite-modal-content-text-internal:var(--calcite-font-size-0)}/*!@:host([scale=l])*/[scale=l].sc-calcite-modal-h{--calcite-modal-padding:1.25rem;--calcite-modal-padding-large:1.5rem;--calcite-modal-title-text:var(--calcite-font-size-3);--calcite-modal-content-text:var(--calcite-font-size-1);--calcite-modal-padding-internal:1.25rem;--calcite-modal-padding-large-internal:1.5rem;--calcite-modal-title-text-internal:var(--calcite-font-size-3);--calcite-modal-content-text-internal:var(--calcite-font-size-1)}/*!@.scrim*/.scrim.sc-calcite-modal{--calcite-scrim-background:rgba(0, 0, 0, 0.75);position:fixed;inset:0px;display:flex;overflow-y:hidden}/*!@.modal*/.modal.sc-calcite-modal{pointer-events:none;z-index:800;float:none;margin:1.5rem;box-sizing:border-box;display:flex;inline-size:100%;flex-direction:column;overflow:hidden;border-radius:0.25rem;background-color:var(--calcite-ui-foreground-1);opacity:0;--tw-shadow:0 2px 12px -4px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.16);--tw-shadow-colored:0 2px 12px -4px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);-webkit-overflow-scrolling:touch;visibility:hidden;transition:transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear var(--calcite-internal-animation-timing-slow), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);--calcite-modal-hidden-position:translate3d(0, 20px, 0);--calcite-modal-shown-position:translate3d(0, 0, 0)}/*!@.modal--opening-idle*/.modal--opening-idle.sc-calcite-modal{transform:var(--calcite-modal-hidden-position)}/*!@.modal--opening-active*/.modal--opening-active.sc-calcite-modal{transform:var(--calcite-modal-shown-position)}/*!@.modal--closing-idle*/.modal--closing-idle.sc-calcite-modal{transform:var(--calcite-modal-shown-position)}/*!@.modal--closing-active*/.modal--closing-active.sc-calcite-modal{transform:var(--calcite-modal-hidden-position)}/*!@:host([open])*/[open].sc-calcite-modal-h{opacity:1;visibility:visible !important;transition-delay:0ms}/*!@:host([open]) .modal--open*/[open].sc-calcite-modal-h .modal--open.sc-calcite-modal{pointer-events:auto;visibility:visible;opacity:1;transition:transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear, opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-inline-size var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-block-size var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);transition-delay:0ms}/*!@.header*/.header.sc-calcite-modal{z-index:400;display:flex;min-inline-size:0px;max-inline-size:100%;border-start-start-radius:0.25rem;border-start-end-radius:0.25rem;border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1);flex:0 0 auto}/*!@.close*/.close.sc-calcite-modal{order:2;margin:0px;cursor:pointer;-webkit-appearance:none;appearance:none;border-style:none;background-color:transparent;color:var(--calcite-ui-text-3);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-start-end-radius:0.25rem;padding-block:var(--calcite-modal-padding, var(--calcite-modal-padding-internal));padding-inline:var(--calcite-modal-padding, var(--calcite-modal-padding-internal));flex:0 0 auto}/*!@.close calcite-icon*/.close.sc-calcite-modal calcite-icon.sc-calcite-modal{pointer-events:none;vertical-align:-2px}/*!@.close:focus*/.close.sc-calcite-modal:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.close:hover, .close:focus, .close:active*/.close.sc-calcite-modal:hover,.close.sc-calcite-modal:focus,.close.sc-calcite-modal:active{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@.title*/.title.sc-calcite-modal{order:1;display:flex;min-inline-size:0px;align-items:center;flex:1 1 auto;padding-block:var(--calcite-modal-padding, var(--calcite-model-padding-internal));padding-inline:var(--calcite-modal-padding-large, var(--calcite-modal-padding-large-internal))}/*!@slot[name=header]::slotted(*), \n*::slotted([slot=header])*/slot[name=header].sc-calcite-modal-s>*,*.sc-calcite-modal-s>[slot=header]{margin:0px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-1);font-size:var(--calcite-modal-title-text, var(--calcite-modal-title-text-internal))}/*!@.content*/.content.sc-calcite-modal{position:relative;box-sizing:border-box;display:block;block-size:100%;overflow:auto;background-color:var(--calcite-ui-foreground-1);padding:0px;max-block-size:calc(100vh - 12rem)}/*!@.content--spaced*/.content--spaced.sc-calcite-modal{padding:var(--calcite-modal-padding)}/*!@.content--no-footer*/.content--no-footer.sc-calcite-modal{border-end-end-radius:0.25rem;border-end-start-radius:0.25rem}/*!@slot[name=content]::slotted(*),\n*::slotted([slot=content])*/slot[name=content].sc-calcite-modal-s>*,*.sc-calcite-modal-s>[slot=content]{font-size:var(--calcite-modal-content-text, var(--calcite-modal-context-text-internal))}/*!@:host([background-color=grey]) .content*/[background-color=grey].sc-calcite-modal-h .content.sc-calcite-modal{background-color:var(--calcite-ui-background)}/*!@.footer*/.footer.sc-calcite-modal{z-index:400;margin-block-start:auto;box-sizing:border-box;display:flex;inline-size:100%;justify-content:space-between;border-end-end-radius:0.25rem;border-end-start-radius:0.25rem;border-width:0px;border-block-start-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1);flex:0 0 auto;padding-block:var(--calcite-modal-padding, var(--calcite-modal-padding-internal));padding-inline:var(--calcite-modal-padding-large, var(--calcite-modal-padding-large-internal))}/*!@.footer--hide-back .back, \n.footer--hide-secondary .secondary*/.footer--hide-back.sc-calcite-modal .back.sc-calcite-modal,.footer--hide-secondary.sc-calcite-modal .secondary.sc-calcite-modal{display:none}/*!@.back*/.back.sc-calcite-modal{display:block;margin-inline-end:auto}/*!@.secondary*/.secondary.sc-calcite-modal{margin-inline:0.25rem;display:block}/*!@slot[name=primary]*/slot[name=primary].sc-calcite-modal{display:block}/*!@:host([width=small]) .modal*/[width=small].sc-calcite-modal-h .modal.sc-calcite-modal{inline-size:auto}/*!@:host([width=s]) .modal*/[width=s].sc-calcite-modal-h .modal.sc-calcite-modal{max-inline-size:32rem}@media screen and (max-width: 35rem){/*!@:host([width=s]) .modal*/[width=s].sc-calcite-modal-h .modal.sc-calcite-modal{margin:0px;block-size:100%;max-block-size:100%;inline-size:100%;max-inline-size:100%;border-radius:0px}/*!@:host([width=s]) .content*/[width=s].sc-calcite-modal-h .content.sc-calcite-modal{flex:1 1 auto;max-block-size:unset}/*!@:host([width=s][docked])*/[width=s][docked].sc-calcite-modal-h{align-items:flex-end}}/*!@:host([width=m]) .modal*/[width=m].sc-calcite-modal-h .modal.sc-calcite-modal{max-inline-size:48rem}@media screen and (max-width: 51rem){/*!@:host([width=m]) .modal*/[width=m].sc-calcite-modal-h .modal.sc-calcite-modal{margin:0px;block-size:100%;max-block-size:100%;inline-size:100%;max-inline-size:100%;border-radius:0px}/*!@:host([width=m]) .content*/[width=m].sc-calcite-modal-h .content.sc-calcite-modal{flex:1 1 auto;max-block-size:unset}/*!@:host([width=m][docked])*/[width=m][docked].sc-calcite-modal-h{align-items:flex-end}}/*!@:host([width=l]) .modal*/[width=l].sc-calcite-modal-h .modal.sc-calcite-modal{max-inline-size:94rem}@media screen and (max-width: 97rem){/*!@:host([width=l]) .modal*/[width=l].sc-calcite-modal-h .modal.sc-calcite-modal{margin:0px;block-size:100%;max-block-size:100%;inline-size:100%;max-inline-size:100%;border-radius:0px}/*!@:host([width=l]) .content*/[width=l].sc-calcite-modal-h .content.sc-calcite-modal{flex:1 1 auto;max-block-size:unset}/*!@:host([width=l][docked])*/[width=l][docked].sc-calcite-modal-h{align-items:flex-end}}/*!@:host([fullscreen])*/[fullscreen].sc-calcite-modal-h{background-color:transparent}/*!@:host([fullscreen]) .modal*/[fullscreen].sc-calcite-modal-h .modal.sc-calcite-modal{margin:0px;block-size:100%;max-block-size:100%;inline-size:100%;max-inline-size:100%;--calcite-modal-hidden-position:translate3D(0, 20px, 0) scale(0.95);--calcite-modal-shown-position:translate3D(0, 0, 0) scale(1)}/*!@:host([fullscreen]) .content*/[fullscreen].sc-calcite-modal-h .content.sc-calcite-modal{max-block-size:100%;flex:1 1 auto}/*!@:host([open][fullscreen]) .header*/[open][fullscreen].sc-calcite-modal-h .header.sc-calcite-modal{border-radius:0}/*!@:host([open][fullscreen]) .footer*/[open][fullscreen].sc-calcite-modal-h .footer.sc-calcite-modal{border-radius:0}/*!@:host([docked]) .modal*/[docked].sc-calcite-modal-h .modal.sc-calcite-modal{block-size:auto}/*!@:host([docked]) .content*/[docked].sc-calcite-modal-h .content.sc-calcite-modal{block-size:auto;flex:1 1 auto}@media screen and (max-width: 860px){/*!@:host([docked]) .modal*/[docked].sc-calcite-modal-h .modal.sc-calcite-modal{border-radius:var(--calcite-border-radius) var(--calcite-border-radius) 0 0}/*!@:host([docked]) .close*/[docked].sc-calcite-modal-h .close.sc-calcite-modal{border-start-end-radius:var(--calcite-border-radius)}}/*!@:host([color=red]) .modal*/[color=red].sc-calcite-modal-h .modal.sc-calcite-modal{border-color:var(--calcite-ui-danger)}/*!@:host([color=blue]) .modal*/[color=blue].sc-calcite-modal-h .modal.sc-calcite-modal{border-color:var(--calcite-ui-info)}/*!@:host([color=red]) .modal, \n:host([color=blue]) .modal*/[color=red].sc-calcite-modal-h .modal.sc-calcite-modal,[color=blue].sc-calcite-modal-h .modal.sc-calcite-modal{border-width:0px;border-block-start-width:4px;border-style:solid}/*!@:host([color=red]) .header, \n:host([color=blue]) .header*/[color=red].sc-calcite-modal-h .header.sc-calcite-modal,[color=blue].sc-calcite-modal-h .header.sc-calcite-modal{border-radius:0.25rem;border-end-end-radius:0px;border-end-start-radius:0px}@media screen and (max-width: 860px){/*!@slot[name=header]::slotted(*), \n*::slotted([slot=header])*/slot[name=header].sc-calcite-modal-s>*,*.sc-calcite-modal-s>[slot=header]{font-size:var(--calcite-font-size-1)}/*!@.footer*/.footer.sc-calcite-modal{position:sticky;inset-block-end:0px}}@media screen and (max-width: 480px){/*!@.footer*/.footer.sc-calcite-modal{flex-direction:column}/*!@.back, \n.secondary*/.back.sc-calcite-modal,.secondary.sc-calcite-modal{margin:0px;margin-block-end:0.25rem}}";
  23191. const isFocusableExtended = (el) => {
  23192. return isCalciteFocusable(el) || isFocusable(el);
  23193. };
  23194. const getFocusableElements = (el) => {
  23195. return queryShadowRoot(el, isHidden, isFocusableExtended);
  23196. };
  23197. /**
  23198. * @slot header - A slot for adding header text.
  23199. * @slot content - A slot for adding the component's content.
  23200. * @slot primary - A slot for adding a primary button.
  23201. * @slot secondary - A slot for adding a secondary button.
  23202. * @slot back - A slot for adding a back button.
  23203. */
  23204. class Modal {
  23205. constructor(hostRef) {
  23206. registerInstance(this, hostRef);
  23207. this.calciteModalBeforeClose = createEvent(this, "calciteModalBeforeClose", 6);
  23208. this.calciteModalClose = createEvent(this, "calciteModalClose", 6);
  23209. this.calciteModalBeforeOpen = createEvent(this, "calciteModalBeforeOpen", 6);
  23210. this.calciteModalOpen = createEvent(this, "calciteModalOpen", 6);
  23211. //--------------------------------------------------------------------------
  23212. //
  23213. // Properties
  23214. //
  23215. //--------------------------------------------------------------------------
  23216. /**
  23217. * When `true`, the component is active.
  23218. *
  23219. * @deprecated use `open` instead.
  23220. */
  23221. this.active = false;
  23222. /** When `true`, displays and positions the component. */
  23223. this.open = false;
  23224. /** Passes a function to run before the component closes. */
  23225. this.beforeClose = () => Promise.resolve();
  23226. /** When `true`, disables the component's close button. */
  23227. this.disableCloseButton = false;
  23228. /** When `true`, disables the closing of the component when clicked outside. */
  23229. this.disableOutsideClose = false;
  23230. /** Accessible name for the component's close button. */
  23231. this.intlClose = TEXT$a.close;
  23232. /** When `true`, disables the default close on escape behavior. */
  23233. this.disableEscape = false;
  23234. /** Specifies the size of the component. */
  23235. this.scale = "m";
  23236. /** Specifies the width of the component. Can use scale sizes or pass a number (displays in pixels). */
  23237. this.width = "m";
  23238. /** Sets the background color of the component's content. */
  23239. this.backgroundColor = "white";
  23240. /**
  23241. * When `true`, disables spacing to the content area slot.
  23242. *
  23243. * @deprecated Use `--calcite-modal-padding` CSS variable instead.
  23244. */
  23245. this.noPadding = false;
  23246. //--------------------------------------------------------------------------
  23247. //
  23248. // Variables
  23249. //
  23250. //--------------------------------------------------------------------------
  23251. this.hasFooter = true;
  23252. /**
  23253. * We use internal variable to make sure initially open modal can transition from closed state when rendered
  23254. *
  23255. * @private
  23256. */
  23257. this.isOpen = false;
  23258. this.mutationObserver = createObserver();
  23259. this.openTransitionProp = "opacity";
  23260. //--------------------------------------------------------------------------
  23261. //
  23262. // Private Methods
  23263. //
  23264. //--------------------------------------------------------------------------
  23265. this.setTransitionEl = (el) => {
  23266. this.transitionEl = el;
  23267. connectOpenCloseComponent(this);
  23268. };
  23269. this.openEnd = () => {
  23270. this.setFocus();
  23271. this.el.removeEventListener("calciteModalOpen", this.openEnd);
  23272. };
  23273. this.handleOutsideClose = () => {
  23274. if (this.disableOutsideClose) {
  23275. return;
  23276. }
  23277. this.close();
  23278. };
  23279. /** Close the modal, first running the `beforeClose` method */
  23280. this.close = () => {
  23281. return this.beforeClose(this.el).then(() => {
  23282. this.open = false;
  23283. this.isOpen = false;
  23284. focusElement(this.previousActiveElement);
  23285. this.removeOverflowHiddenClass();
  23286. });
  23287. };
  23288. this.focusFirstElement = () => {
  23289. focusElement(this.disableCloseButton ? getFocusableElements(this.el)[0] : this.closeButtonEl);
  23290. };
  23291. this.focusLastElement = () => {
  23292. const focusableElements = getFocusableElements(this.el).filter((el) => !el.getAttribute("data-focus-fence"));
  23293. if (focusableElements.length > 0) {
  23294. focusElement(focusableElements[focusableElements.length - 1]);
  23295. }
  23296. else {
  23297. focusElement(this.closeButtonEl);
  23298. }
  23299. };
  23300. this.updateFooterVisibility = () => {
  23301. this.hasFooter = !!getSlotted(this.el, [SLOTS$d.back, SLOTS$d.primary, SLOTS$d.secondary]);
  23302. };
  23303. }
  23304. //--------------------------------------------------------------------------
  23305. //
  23306. // Lifecycle
  23307. //
  23308. //--------------------------------------------------------------------------
  23309. componentWillLoad() {
  23310. // when modal initially renders, if active was set we need to open as watcher doesn't fire
  23311. if (this.open) {
  23312. requestAnimationFrame(() => this.openModal());
  23313. }
  23314. }
  23315. connectedCallback() {
  23316. var _a;
  23317. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  23318. this.updateFooterVisibility();
  23319. connectConditionalSlotComponent(this);
  23320. connectOpenCloseComponent(this);
  23321. if (this.open) {
  23322. this.active = this.open;
  23323. }
  23324. if (this.active) {
  23325. this.activeHandler(this.active);
  23326. }
  23327. }
  23328. disconnectedCallback() {
  23329. var _a;
  23330. this.removeOverflowHiddenClass();
  23331. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  23332. disconnectConditionalSlotComponent(this);
  23333. disconnectOpenCloseComponent(this);
  23334. }
  23335. render() {
  23336. return (hAsync(Host, { "aria-describedby": this.contentId, "aria-labelledby": this.titleId, "aria-modal": "true", role: "dialog" }, hAsync("calcite-scrim", { class: CSS$n.scrim, onClick: this.handleOutsideClose }), this.renderStyle(), hAsync("div", { class: {
  23337. [CSS$n.modal]: true,
  23338. [CSS$n.modalOpen]: this.isOpen
  23339. }, ref: this.setTransitionEl }, hAsync("div", { "data-focus-fence": true, onFocus: this.focusLastElement, tabindex: "0" }), hAsync("div", { class: CSS$n.header }, this.renderCloseButton(), hAsync("header", { class: CSS$n.title }, hAsync("slot", { name: CSS$n.header }))), hAsync("div", { class: {
  23340. content: true,
  23341. "content--spaced": !this.noPadding,
  23342. "content--no-footer": !this.hasFooter
  23343. }, ref: (el) => (this.modalContent = el) }, hAsync("slot", { name: SLOTS$d.content })), this.renderFooter(), hAsync("div", { "data-focus-fence": true, onFocus: this.focusFirstElement, tabindex: "0" }))));
  23344. }
  23345. renderFooter() {
  23346. return this.hasFooter ? (hAsync("div", { class: CSS$n.footer, key: "footer" }, hAsync("span", { class: CSS$n.back }, hAsync("slot", { name: SLOTS$d.back })), hAsync("span", { class: CSS$n.secondary }, hAsync("slot", { name: SLOTS$d.secondary })), hAsync("span", { class: CSS$n.primary }, hAsync("slot", { name: SLOTS$d.primary })))) : null;
  23347. }
  23348. renderCloseButton() {
  23349. return !this.disableCloseButton ? (hAsync("button", { "aria-label": this.intlClose, class: CSS$n.close, key: "button", onClick: this.close, ref: (el) => (this.closeButtonEl = el), title: this.intlClose }, hAsync("calcite-icon", { icon: ICONS$5.close, scale: this.scale === "s" ? "s" : this.scale === "m" ? "m" : this.scale === "l" ? "l" : null }))) : null;
  23350. }
  23351. renderStyle() {
  23352. const hasCustomWidth = !isNaN(parseInt(`${this.width}`));
  23353. return hasCustomWidth ? (hAsync("style", null, `
  23354. .${CSS$n.modal} {
  23355. max-width: ${this.width}px !important;
  23356. }
  23357. @media screen and (max-width: ${this.width}px) {
  23358. .${CSS$n.modal} {
  23359. height: 100% !important;
  23360. max-height: 100% !important;
  23361. width: 100% !important;
  23362. max-width: 100% !important;
  23363. margin: 0 !important;
  23364. border-radius: 0 !important;
  23365. }
  23366. .content {
  23367. flex: 1 1 auto !important;
  23368. max-height: unset !important;
  23369. }
  23370. }
  23371. `)) : null;
  23372. }
  23373. //--------------------------------------------------------------------------
  23374. //
  23375. // Event Listeners
  23376. //
  23377. //--------------------------------------------------------------------------
  23378. handleEscape(event) {
  23379. if (this.open && !this.disableEscape && event.key === "Escape" && !event.defaultPrevented) {
  23380. this.close();
  23381. event.preventDefault();
  23382. }
  23383. }
  23384. //--------------------------------------------------------------------------
  23385. //
  23386. // Public Methods
  23387. //
  23388. //--------------------------------------------------------------------------
  23389. /**
  23390. * Focus the first interactive element.
  23391. *
  23392. * @param el
  23393. * @deprecated use `setFocus` instead.
  23394. */
  23395. async focusElement(el) {
  23396. if (el) {
  23397. el.focus();
  23398. }
  23399. return this.setFocus();
  23400. }
  23401. /**
  23402. * Sets focus on the component.
  23403. *
  23404. * By default, tries to focus on focusable content. If there is none, it will focus on the close button.
  23405. * To focus on the close button, use the `close-button` focus ID.
  23406. *
  23407. * @param focusId
  23408. */
  23409. async setFocus(focusId) {
  23410. const closeButton = this.closeButtonEl;
  23411. return focusElement(focusId === "close-button" ? closeButton : getFocusableElements(this.el)[0] || closeButton);
  23412. }
  23413. /**
  23414. * Sets the scroll top of the component's content.
  23415. *
  23416. * @param top
  23417. * @param left
  23418. */
  23419. async scrollContent(top = 0, left = 0) {
  23420. if (this.modalContent) {
  23421. if (this.modalContent.scrollTo) {
  23422. this.modalContent.scrollTo({ top, left, behavior: "smooth" });
  23423. }
  23424. else {
  23425. this.modalContent.scrollTop = top;
  23426. this.modalContent.scrollLeft = left;
  23427. }
  23428. }
  23429. }
  23430. onBeforeOpen() {
  23431. this.transitionEl.classList.add(CSS$n.openingActive);
  23432. this.calciteModalBeforeOpen.emit();
  23433. }
  23434. onOpen() {
  23435. this.transitionEl.classList.remove(CSS$n.openingIdle, CSS$n.openingActive);
  23436. this.calciteModalOpen.emit();
  23437. }
  23438. onBeforeClose() {
  23439. this.transitionEl.classList.add(CSS$n.closingActive);
  23440. this.calciteModalBeforeClose.emit();
  23441. }
  23442. onClose() {
  23443. this.transitionEl.classList.remove(CSS$n.closingIdle, CSS$n.closingActive);
  23444. this.calciteModalClose.emit();
  23445. }
  23446. activeHandler(value) {
  23447. this.open = value;
  23448. }
  23449. async toggleModal(value) {
  23450. var _a, _b;
  23451. this.active = value;
  23452. if (value) {
  23453. (_a = this.transitionEl) === null || _a === void 0 ? void 0 : _a.classList.add(CSS$n.openingIdle);
  23454. this.openModal();
  23455. }
  23456. else {
  23457. (_b = this.transitionEl) === null || _b === void 0 ? void 0 : _b.classList.add(CSS$n.closingIdle);
  23458. this.close();
  23459. }
  23460. }
  23461. /** Open the modal */
  23462. openModal() {
  23463. this.previousActiveElement = document.activeElement;
  23464. this.el.addEventListener("calciteModalOpen", this.openEnd);
  23465. this.open = true;
  23466. this.isOpen = true;
  23467. const titleEl = getSlotted(this.el, SLOTS$d.header);
  23468. const contentEl = getSlotted(this.el, SLOTS$d.content);
  23469. this.titleId = ensureId(titleEl);
  23470. this.contentId = ensureId(contentEl);
  23471. document.documentElement.classList.add(CSS$n.overflowHidden);
  23472. }
  23473. removeOverflowHiddenClass() {
  23474. document.documentElement.classList.remove(CSS$n.overflowHidden);
  23475. }
  23476. get el() { return getElement(this); }
  23477. static get watchers() { return {
  23478. "active": ["activeHandler"],
  23479. "open": ["toggleModal"]
  23480. }; }
  23481. static get style() { return modalCss; }
  23482. static get cmpMeta() { return {
  23483. "$flags$": 9,
  23484. "$tagName$": "calcite-modal",
  23485. "$members$": {
  23486. "active": [1540],
  23487. "open": [1540],
  23488. "beforeClose": [16],
  23489. "disableCloseButton": [516, "disable-close-button"],
  23490. "disableOutsideClose": [516, "disable-outside-close"],
  23491. "intlClose": [1, "intl-close"],
  23492. "docked": [516],
  23493. "disableEscape": [516, "disable-escape"],
  23494. "scale": [513],
  23495. "width": [520],
  23496. "fullscreen": [516],
  23497. "color": [513],
  23498. "backgroundColor": [513, "background-color"],
  23499. "noPadding": [516, "no-padding"],
  23500. "hasFooter": [32],
  23501. "isOpen": [32],
  23502. "focusElement": [64],
  23503. "setFocus": [64],
  23504. "scrollContent": [64]
  23505. },
  23506. "$listeners$": [[8, "keydown", "handleEscape"]],
  23507. "$lazyBundleId$": "-",
  23508. "$attrsToReflect$": [["active", "active"], ["open", "open"], ["disableCloseButton", "disable-close-button"], ["disableOutsideClose", "disable-outside-close"], ["docked", "docked"], ["disableEscape", "disable-escape"], ["scale", "scale"], ["width", "width"], ["fullscreen", "fullscreen"], ["color", "color"], ["backgroundColor", "background-color"], ["noPadding", "no-padding"]]
  23509. }; }
  23510. }
  23511. const TEXT$9 = {
  23512. close: "Close"
  23513. };
  23514. const SLOTS$c = {
  23515. title: "title",
  23516. message: "message",
  23517. link: "link",
  23518. actionsEnd: "actions-end"
  23519. };
  23520. const CSS$m = {
  23521. actionsEnd: "actions-end",
  23522. close: "notice-close",
  23523. container: "container",
  23524. content: "notice-content",
  23525. icon: "notice-icon"
  23526. };
  23527. const noticeCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-notice:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-notice{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-notice{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-notice{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-notice{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-notice{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-notice:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-notice:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-notice-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-notice-h{--calcite-notice-spacing-token-small:0.5rem;--calcite-notice-spacing-token-large:0.75rem}/*!@:host([scale=s]) .container slot[name=title]::slotted(*), \n:host([scale=s]) .container *::slotted([slot=title])*/.sc-calcite-notice-h[scale=s] .container slot[name=title].sc-calcite-notice-s>*,.sc-calcite-notice-h[scale=s] .container *.sc-calcite-notice-s>[slot=title]{margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=s]) .container slot[name=message]::slotted(*), \n:host([scale=s]) .container *::slotted([slot=message])*/.sc-calcite-notice-h[scale=s] .container slot[name=message].sc-calcite-notice-s>*,.sc-calcite-notice-h[scale=s] .container *.sc-calcite-notice-s>[slot=message]{margin-block:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}/*!@:host([scale=s]) ::slotted(calcite-link)*/.sc-calcite-notice-h[scale=s] .sc-calcite-notice-s>calcite-link{margin-block:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}/*!@:host([scale=s]) .notice-close*/[scale=s].sc-calcite-notice-h .notice-close.sc-calcite-notice{padding:0.5rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-notice-h{--calcite-notice-spacing-token-small:0.75rem;--calcite-notice-spacing-token-large:1rem}/*!@:host([scale=m]) .container slot[name=title]::slotted(*), \n:host([scale=m]) .container *::slotted([slot=title])*/.sc-calcite-notice-h[scale=m] .container slot[name=title].sc-calcite-notice-s>*,.sc-calcite-notice-h[scale=m] .container *.sc-calcite-notice-s>[slot=title]{margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([scale=m]) .container slot[name=message]::slotted(*), \n:host([scale=m]) .container *::slotted([slot=message])*/.sc-calcite-notice-h[scale=m] .container slot[name=message].sc-calcite-notice-s>*,.sc-calcite-notice-h[scale=m] .container *.sc-calcite-notice-s>[slot=message]{margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=m]) ::slotted(calcite-link)*/.sc-calcite-notice-h[scale=m] .sc-calcite-notice-s>calcite-link{margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=l])*/[scale=l].sc-calcite-notice-h{--calcite-notice-spacing-token-small:1rem;--calcite-notice-spacing-token-large:1.25rem}/*!@:host([scale=l]) .container slot[name=title]::slotted(*), \n:host([scale=l]) .container *::slotted([slot=title])*/.sc-calcite-notice-h[scale=l] .container slot[name=title].sc-calcite-notice-s>*,.sc-calcite-notice-h[scale=l] .container *.sc-calcite-notice-s>[slot=title]{margin-block:0.125rem;font-size:var(--calcite-font-size-1);line-height:1.375}/*!@:host([scale=l]) .container slot[name=message]::slotted(*), \n:host([scale=l]) .container *::slotted([slot=message])*/.sc-calcite-notice-h[scale=l] .container slot[name=message].sc-calcite-notice-s>*,.sc-calcite-notice-h[scale=l] .container *.sc-calcite-notice-s>[slot=message]{margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([scale=l]) ::slotted(calcite-link)*/.sc-calcite-notice-h[scale=l] .sc-calcite-notice-s>calcite-link{margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([width=auto])*/[width=auto].sc-calcite-notice-h{--calcite-notice-width:auto}/*!@:host([width=half])*/[width=half].sc-calcite-notice-h{--calcite-notice-width:50%}/*!@:host([width=full])*/[width=full].sc-calcite-notice-h{--calcite-notice-width:100%}/*!@:host*/.sc-calcite-notice-h{margin-inline:auto;display:none;max-inline-size:100%;align-items:center;inline-size:var(--calcite-notice-width)}/*!@.container*/.container.sc-calcite-notice{pointer-events:none;margin-block:0px;box-sizing:border-box;display:none;inline-size:100%;background-color:var(--calcite-ui-foreground-1);opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;max-block-size:0;text-align:start;border-inline-start:0px solid;box-shadow:0 0 0 0 transparent}/*!@.notice-close*/.notice-close.sc-calcite-notice{outline-color:transparent}/*!@.notice-close:focus*/.notice-close.sc-calcite-notice:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host*/.sc-calcite-notice-h{display:flex}/*!@:host([open]) .container*/[open].sc-calcite-notice-h .container.sc-calcite-notice{pointer-events:auto;display:flex;max-block-size:100%;align-items:center;border-width:2px;opacity:1;--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@.container slot[name=title]::slotted(*), \n.container *::slotted([slot=title])*/.container slot[name=title].sc-calcite-notice-s>*,.container *.sc-calcite-notice-s>[slot=title]{margin:0px;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@.container slot[name=message]::slotted(*), \n.container *::slotted([slot=message])*/.container slot[name=message].sc-calcite-notice-s>*,.container *.sc-calcite-notice-s>[slot=message]{margin:0px;display:inline;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);margin-inline-end:var(--calcite-notice-spacing-token-small)}/*!@.notice-content*/.notice-content.sc-calcite-notice{box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;display:flex;min-inline-size:0px;flex-direction:column;overflow-wrap:break-word;flex:1 1 0;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:0 var(--calcite-notice-spacing-token-small)}/*!@.notice-content:first-of-type:not(:only-child)*/.notice-content.sc-calcite-notice:first-of-type:not(:only-child){padding-inline-start:var(--calcite-notice-spacing-token-large)}/*!@.notice-content:only-of-type*/.notice-content.sc-calcite-notice:only-of-type{padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large)}/*!@.notice-icon*/.notice-icon.sc-calcite-notice{display:flex;align-items:center;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto}/*!@.notice-close*/.notice-close.sc-calcite-notice{display:flex;cursor:pointer;align-items:center;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;-webkit-appearance:none}/*!@.notice-close:hover, .notice-close:focus*/.notice-close.sc-calcite-notice:hover,.notice-close.sc-calcite-notice:focus{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@.notice-close:active*/.notice-close.sc-calcite-notice:active{background-color:var(--calcite-ui-foreground-3)}/*!@.actions-end*/.actions-end.sc-calcite-notice{display:flex;align-self:stretch}/*!@:host([color=blue]) .container*/[color=blue].sc-calcite-notice-h .container.sc-calcite-notice{border-color:var(--calcite-ui-brand)}/*!@:host([color=blue]) .container .notice-icon*/[color=blue].sc-calcite-notice-h .container.sc-calcite-notice .notice-icon.sc-calcite-notice{color:var(--calcite-ui-brand)}/*!@:host([color=red]) .container*/[color=red].sc-calcite-notice-h .container.sc-calcite-notice{border-color:var(--calcite-ui-danger)}/*!@:host([color=red]) .container .notice-icon*/[color=red].sc-calcite-notice-h .container.sc-calcite-notice .notice-icon.sc-calcite-notice{color:var(--calcite-ui-danger)}/*!@:host([color=yellow]) .container*/[color=yellow].sc-calcite-notice-h .container.sc-calcite-notice{border-color:var(--calcite-ui-warning)}/*!@:host([color=yellow]) .container .notice-icon*/[color=yellow].sc-calcite-notice-h .container.sc-calcite-notice .notice-icon.sc-calcite-notice{color:var(--calcite-ui-warning)}/*!@:host([color=green]) .container*/[color=green].sc-calcite-notice-h .container.sc-calcite-notice{border-color:var(--calcite-ui-success)}/*!@:host([color=green]) .container .notice-icon*/[color=green].sc-calcite-notice-h .container.sc-calcite-notice .notice-icon.sc-calcite-notice{color:var(--calcite-ui-success)}";
  23528. /**
  23529. * Notices are intended to be used to present users with important-but-not-crucial contextual tips or copy. Because
  23530. * notices are displayed inline, a common use case is displaying them on page-load to present users with short hints or contextual copy.
  23531. * They are optionally dismissible - useful for keeping track of whether or not a user has dismissed the notice. You can also choose not
  23532. * to display a notice on page load and set the "active" attribute as needed to contextually provide inline messaging to users.
  23533. */
  23534. /**
  23535. * @slot title - A slot for adding the title.
  23536. * @slot message - A slot for adding the message.
  23537. * @slot link - A slot for adding actions to take, such as: undo, try again, link to page, etc.
  23538. * @slot actions-end - A slot for adding actions to the end of the component. It is recommended to use two or less actions.
  23539. */
  23540. class Notice {
  23541. constructor(hostRef) {
  23542. registerInstance(this, hostRef);
  23543. this.calciteNoticeClose = createEvent(this, "calciteNoticeClose", 6);
  23544. this.calciteNoticeOpen = createEvent(this, "calciteNoticeOpen", 6);
  23545. //--------------------------------------------------------------------------
  23546. //
  23547. // Properties
  23548. //
  23549. //---------------------------------------------------------------------------
  23550. /**
  23551. * When `true`, the component is active.
  23552. *
  23553. * @deprecated Use `open` instead.
  23554. */
  23555. this.active = false;
  23556. /** When `true`, the component is visible. */
  23557. this.open = false;
  23558. /** The color for the component's top border and icon. */
  23559. this.color = "blue";
  23560. /**
  23561. * When `true`, a close button is added to the component.
  23562. *
  23563. * @deprecated use `closable` instead.
  23564. */
  23565. this.dismissible = false;
  23566. /** When `true`, a close button is added to the component. */
  23567. this.closable = false;
  23568. /**
  23569. * Accessible name for the close button.
  23570. *
  23571. * @default "Close"
  23572. */
  23573. this.intlClose = TEXT$9.close;
  23574. /** Specifies the size of the component. */
  23575. this.scale = "m";
  23576. /** Specifies the width of the component. */
  23577. this.width = "auto";
  23578. //--------------------------------------------------------------------------
  23579. //
  23580. // Private Methods
  23581. //
  23582. //--------------------------------------------------------------------------
  23583. this.close = () => {
  23584. this.open = false;
  23585. this.calciteNoticeClose.emit();
  23586. };
  23587. }
  23588. activeHandler(value) {
  23589. this.open = value;
  23590. }
  23591. openHandler(value) {
  23592. this.active = value;
  23593. }
  23594. handleDismissible(value) {
  23595. this.closable = value;
  23596. }
  23597. handleClosable(value) {
  23598. this.dismissible = value;
  23599. }
  23600. updateRequestedIcon() {
  23601. this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
  23602. }
  23603. //--------------------------------------------------------------------------
  23604. //
  23605. // Lifecycle
  23606. //
  23607. //--------------------------------------------------------------------------
  23608. connectedCallback() {
  23609. connectConditionalSlotComponent(this);
  23610. const isOpen = this.active || this.open;
  23611. if (isOpen) {
  23612. this.activeHandler(isOpen);
  23613. this.openHandler(isOpen);
  23614. }
  23615. if (this.dismissible) {
  23616. this.handleDismissible(this.dismissible);
  23617. }
  23618. if (this.closable) {
  23619. this.handleClosable(this.closable);
  23620. }
  23621. }
  23622. disconnectedCallback() {
  23623. disconnectConditionalSlotComponent(this);
  23624. }
  23625. componentWillLoad() {
  23626. this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
  23627. }
  23628. render() {
  23629. const { el } = this;
  23630. const closeButton = (hAsync("button", { "aria-label": this.intlClose, class: CSS$m.close, onClick: this.close, ref: (el) => (this.closeButton = el) }, hAsync("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })));
  23631. const hasActionEnd = getSlotted(el, SLOTS$c.actionsEnd);
  23632. return (hAsync("div", { class: CSS$m.container }, this.requestedIcon ? (hAsync("div", { class: CSS$m.icon }, hAsync("calcite-icon", { icon: this.requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, hAsync("div", { class: CSS$m.content }, hAsync("slot", { name: SLOTS$c.title }), hAsync("slot", { name: SLOTS$c.message }), hAsync("slot", { name: SLOTS$c.link })), hasActionEnd ? (hAsync("div", { class: CSS$m.actionsEnd }, hAsync("slot", { name: SLOTS$c.actionsEnd }))) : null, this.closable ? closeButton : null));
  23633. }
  23634. //--------------------------------------------------------------------------
  23635. //
  23636. // Public Methods
  23637. //
  23638. //--------------------------------------------------------------------------
  23639. /** Sets focus on the component. */
  23640. async setFocus() {
  23641. const noticeLinkEl = this.el.querySelector("calcite-link");
  23642. if (!this.closeButton && !noticeLinkEl) {
  23643. return;
  23644. }
  23645. if (noticeLinkEl) {
  23646. noticeLinkEl.setFocus();
  23647. }
  23648. else if (this.closeButton) {
  23649. this.closeButton.focus();
  23650. }
  23651. }
  23652. get el() { return getElement(this); }
  23653. static get watchers() { return {
  23654. "active": ["activeHandler"],
  23655. "open": ["openHandler"],
  23656. "dismissible": ["handleDismissible"],
  23657. "closable": ["handleClosable"],
  23658. "icon": ["updateRequestedIcon"],
  23659. "color": ["updateRequestedIcon"]
  23660. }; }
  23661. static get style() { return noticeCss; }
  23662. static get cmpMeta() { return {
  23663. "$flags$": 9,
  23664. "$tagName$": "calcite-notice",
  23665. "$members$": {
  23666. "active": [1540],
  23667. "open": [1540],
  23668. "color": [513],
  23669. "dismissible": [516],
  23670. "closable": [516],
  23671. "icon": [520],
  23672. "intlClose": [1, "intl-close"],
  23673. "scale": [513],
  23674. "width": [513],
  23675. "setFocus": [64]
  23676. },
  23677. "$listeners$": undefined,
  23678. "$lazyBundleId$": "-",
  23679. "$attrsToReflect$": [["active", "active"], ["open", "open"], ["color", "color"], ["dismissible", "dismissible"], ["closable", "closable"], ["icon", "icon"], ["scale", "scale"], ["width", "width"]]
  23680. }; }
  23681. }
  23682. const optionCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-option:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-option{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-option{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-option{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-option{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-option{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-option:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-option:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-option-h{display:none}/*!@:host*/.sc-calcite-option-h{display:block}";
  23683. class Option {
  23684. constructor(hostRef) {
  23685. registerInstance(this, hostRef);
  23686. this.calciteInternalOptionChange = createEvent(this, "calciteInternalOptionChange", 6);
  23687. //--------------------------------------------------------------------------
  23688. //
  23689. // Properties
  23690. //
  23691. //--------------------------------------------------------------------------
  23692. /**
  23693. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  23694. */
  23695. this.disabled = false;
  23696. this.mutationObserver = createObserver();
  23697. }
  23698. handlePropChange(_newValue, _oldValue, propName) {
  23699. if (propName === "label" || propName === "value") {
  23700. this.ensureTextContentDependentProps();
  23701. }
  23702. this.calciteInternalOptionChange.emit();
  23703. }
  23704. //--------------------------------------------------------------------------
  23705. //
  23706. // Private Methods
  23707. //
  23708. //--------------------------------------------------------------------------
  23709. ensureTextContentDependentProps() {
  23710. const { el: { textContent } } = this;
  23711. if (!this.label || this.label === this.internallySetLabel) {
  23712. this.label = textContent;
  23713. this.internallySetLabel = textContent;
  23714. }
  23715. if (!this.value || this.value === this.internallySetValue) {
  23716. this.value = textContent;
  23717. this.internallySetValue = textContent;
  23718. }
  23719. }
  23720. //--------------------------------------------------------------------------
  23721. //
  23722. // Lifecycle
  23723. //
  23724. //--------------------------------------------------------------------------
  23725. connectedCallback() {
  23726. var _a;
  23727. this.ensureTextContentDependentProps();
  23728. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, {
  23729. attributeFilter: ["label", "value"],
  23730. characterData: true,
  23731. childList: true,
  23732. subtree: true
  23733. });
  23734. }
  23735. disconnectedCallback() {
  23736. var _a;
  23737. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  23738. }
  23739. //--------------------------------------------------------------------------
  23740. //
  23741. // Render Methods
  23742. //
  23743. //--------------------------------------------------------------------------
  23744. render() {
  23745. return hAsync("slot", null, this.label);
  23746. }
  23747. get el() { return getElement(this); }
  23748. static get watchers() { return {
  23749. "disabled": ["handlePropChange"],
  23750. "label": ["handlePropChange"],
  23751. "selected": ["handlePropChange"],
  23752. "value": ["handlePropChange"]
  23753. }; }
  23754. static get style() { return optionCss; }
  23755. static get cmpMeta() { return {
  23756. "$flags$": 9,
  23757. "$tagName$": "calcite-option",
  23758. "$members$": {
  23759. "disabled": [516],
  23760. "label": [1025],
  23761. "selected": [516],
  23762. "value": [1032]
  23763. },
  23764. "$listeners$": undefined,
  23765. "$lazyBundleId$": "-",
  23766. "$attrsToReflect$": [["disabled", "disabled"], ["selected", "selected"]]
  23767. }; }
  23768. }
  23769. const optionGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-option-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-option-group{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-option-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-option-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-option-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-option-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-option-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-option-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-option-group-h{display:none}/*!@:host*/.sc-calcite-option-group-h{display:block}";
  23770. /**
  23771. * @slot - A slot for adding `calcite-option`s.
  23772. */
  23773. class OptionGroup {
  23774. constructor(hostRef) {
  23775. registerInstance(this, hostRef);
  23776. this.calciteInternalOptionGroupChange = createEvent(this, "calciteInternalOptionGroupChange", 6);
  23777. //--------------------------------------------------------------------------
  23778. //
  23779. // Properties
  23780. //
  23781. //--------------------------------------------------------------------------
  23782. /**
  23783. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  23784. */
  23785. this.disabled = false;
  23786. }
  23787. handlePropChange() {
  23788. this.calciteInternalOptionGroupChange.emit();
  23789. }
  23790. //--------------------------------------------------------------------------
  23791. //
  23792. // Render Methods
  23793. //
  23794. //--------------------------------------------------------------------------
  23795. render() {
  23796. return (hAsync(Fragment, null, hAsync("div", null, this.label), hAsync("slot", null)));
  23797. }
  23798. static get watchers() { return {
  23799. "disabled": ["handlePropChange"],
  23800. "label": ["handlePropChange"]
  23801. }; }
  23802. static get style() { return optionGroupCss; }
  23803. static get cmpMeta() { return {
  23804. "$flags$": 9,
  23805. "$tagName$": "calcite-option-group",
  23806. "$members$": {
  23807. "disabled": [516],
  23808. "label": [1]
  23809. },
  23810. "$listeners$": undefined,
  23811. "$lazyBundleId$": "-",
  23812. "$attrsToReflect$": [["disabled", "disabled"]]
  23813. }; }
  23814. }
  23815. const CSS$l = {
  23816. page: "page",
  23817. selected: "is-selected",
  23818. previous: "previous",
  23819. next: "next",
  23820. disabled: "is-disabled",
  23821. ellipsis: "ellipsis",
  23822. ellipsisStart: "ellipsis--start",
  23823. ellipsisEnd: "ellipsis--end"
  23824. };
  23825. const TEXT$8 = {
  23826. nextLabel: "Next",
  23827. previousLabel: "Previous"
  23828. };
  23829. const paginationCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-pagination:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-pagination{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-pagination{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-pagination{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-pagination{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-pagination{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-pagination:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-pagination:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-pagination-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-pagination-h{--calcite-pagination-spacing:0.25rem 0.5rem}/*!@:host([scale=s]) .previous, :host([scale=s]) .next, :host([scale=s]) .page*/[scale=s].sc-calcite-pagination-h .previous.sc-calcite-pagination,[scale=s].sc-calcite-pagination-h .next.sc-calcite-pagination,[scale=s].sc-calcite-pagination-h .page.sc-calcite-pagination{block-size:1.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=s]) .previous, \n:host([scale=s]) .next*/[scale=s].sc-calcite-pagination-h .previous.sc-calcite-pagination,[scale=s].sc-calcite-pagination-h .next.sc-calcite-pagination{padding-inline:0.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-pagination-h{--calcite-pagination-spacing:0.5rem 0.75rem}/*!@:host([scale=m]) .previous, :host([scale=m]) .next, :host([scale=m]) .page*/[scale=m].sc-calcite-pagination-h .previous.sc-calcite-pagination,[scale=m].sc-calcite-pagination-h .next.sc-calcite-pagination,[scale=m].sc-calcite-pagination-h .page.sc-calcite-pagination{block-size:2rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=m]) .previous, \n:host([scale=m]) .next*/[scale=m].sc-calcite-pagination-h .previous.sc-calcite-pagination,[scale=m].sc-calcite-pagination-h .next.sc-calcite-pagination{padding-inline:0.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-pagination-h{--calcite-pagination-spacing:0.75rem 1rem}/*!@:host([scale=l]) .previous, :host([scale=l]) .next, :host([scale=l]) .page*/[scale=l].sc-calcite-pagination-h .previous.sc-calcite-pagination,[scale=l].sc-calcite-pagination-h .next.sc-calcite-pagination,[scale=l].sc-calcite-pagination-h .page.sc-calcite-pagination{block-size:2.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l]) .previous, \n:host([scale=l]) .next*/[scale=l].sc-calcite-pagination-h .previous.sc-calcite-pagination,[scale=l].sc-calcite-pagination-h .next.sc-calcite-pagination{padding-inline:1rem}/*!@:host*/.sc-calcite-pagination-h{display:flex;writing-mode:horizontal-tb}/*!@:host button*/.sc-calcite-pagination-h button.sc-calcite-pagination{outline-color:transparent}/*!@:host button:focus*/.sc-calcite-pagination-h button.sc-calcite-pagination:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.previous, \n.next, \n.page*/.previous.sc-calcite-pagination,.next.sc-calcite-pagination,.page.sc-calcite-pagination{box-sizing:border-box;display:flex;cursor:pointer;align-items:center;border-style:none;--tw-border-opacity:0;background-color:transparent;font-family:inherit;font-size:var(--calcite-font-size-0);line-height:1.25rem;color:var(--calcite-ui-text-3);border-block:2px solid transparent}/*!@.previous:hover, \n.next:hover, \n.page:hover*/.previous.sc-calcite-pagination:hover,.next.sc-calcite-pagination:hover,.page.sc-calcite-pagination:hover{color:var(--calcite-ui-text-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.page:hover*/.page.sc-calcite-pagination:hover{border-block-end-color:var(--calcite-ui-border-2)}/*!@.page.is-selected*/.page.is-selected.sc-calcite-pagination{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);border-block-end-color:var(--calcite-ui-brand)}/*!@.previous:hover, \n.next:hover*/.previous.sc-calcite-pagination:hover,.next.sc-calcite-pagination:hover{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-brand)}/*!@.previous:active, \n.next:active*/.previous.sc-calcite-pagination:active,.next.sc-calcite-pagination:active{background-color:var(--calcite-ui-foreground-3)}/*!@.previous.is-disabled, \n.next.is-disabled*/.previous.is-disabled.sc-calcite-pagination,.next.is-disabled.sc-calcite-pagination{pointer-events:none;background-color:transparent}/*!@.previous.is-disabled > calcite-icon, \n.next.is-disabled > calcite-icon*/.previous.is-disabled.sc-calcite-pagination>calcite-icon.sc-calcite-pagination,.next.is-disabled.sc-calcite-pagination>calcite-icon.sc-calcite-pagination{opacity:var(--calcite-ui-opacity-disabled)}/*!@.next*/.next.sc-calcite-pagination{margin-inline-end:0px}/*!@.page,\n.ellipsis*/.page.sc-calcite-pagination,.ellipsis.sc-calcite-pagination{padding:var(--calcite-pagination-spacing)}/*!@.ellipsis*/.ellipsis.sc-calcite-pagination{display:flex;align-items:flex-end;color:var(--calcite-ui-text-3)}";
  23830. const maxPagesDisplayed = 5;
  23831. class Pagination {
  23832. constructor(hostRef) {
  23833. registerInstance(this, hostRef);
  23834. this.calcitePaginationUpdate = createEvent(this, "calcitePaginationUpdate", 6);
  23835. this.calcitePaginationChange = createEvent(this, "calcitePaginationChange", 6);
  23836. //--------------------------------------------------------------------------
  23837. //
  23838. // Public Properties
  23839. //
  23840. //--------------------------------------------------------------------------
  23841. /**
  23842. * When `true`, number values are displayed with a group separator corresponding to the language and country format.
  23843. */
  23844. this.groupSeparator = false;
  23845. /** Specifies the number of items per page. */
  23846. this.num = 20;
  23847. /** Specifies the starting item number. */
  23848. this.start = 1;
  23849. /** Specifies the total number of items. */
  23850. this.total = 0;
  23851. /**
  23852. * Accessible name for the component's next button.
  23853. *
  23854. * @default "Next"
  23855. */
  23856. this.textLabelNext = TEXT$8.nextLabel;
  23857. /**
  23858. * Accessible name for the component's previous button.
  23859. *
  23860. * @default "Previous"
  23861. */
  23862. this.textLabelPrevious = TEXT$8.previousLabel;
  23863. /** Specifies the size of the component. */
  23864. this.scale = "m";
  23865. //--------------------------------------------------------------------------
  23866. //
  23867. // State
  23868. //
  23869. //--------------------------------------------------------------------------
  23870. this.effectiveLocale = "";
  23871. this.previousClicked = () => {
  23872. this.previousPage().then();
  23873. this.emitUpdate();
  23874. };
  23875. this.nextClicked = () => {
  23876. this.nextPage();
  23877. this.emitUpdate();
  23878. };
  23879. /**
  23880. * Returns a string representing the localized label value based on groupSeparator prop being on or off.
  23881. *
  23882. * @param value
  23883. */
  23884. this.determineGroupSeparator = (value) => {
  23885. numberStringFormatter.numberFormatOptions = {
  23886. locale: this.effectiveLocale,
  23887. numberingSystem: this.numberingSystem,
  23888. useGrouping: this.groupSeparator
  23889. };
  23890. return this.groupSeparator
  23891. ? numberStringFormatter.localize(value.toString())
  23892. : value.toString();
  23893. };
  23894. }
  23895. // --------------------------------------------------------------------------
  23896. //
  23897. // Lifecycle
  23898. //
  23899. // --------------------------------------------------------------------------
  23900. connectedCallback() {
  23901. connectLocalized(this);
  23902. }
  23903. disconnectedCallback() {
  23904. disconnectLocalized(this);
  23905. }
  23906. // --------------------------------------------------------------------------
  23907. //
  23908. // Public Methods
  23909. //
  23910. // --------------------------------------------------------------------------
  23911. /** Go to the next page of results. */
  23912. async nextPage() {
  23913. this.start = Math.min(this.getLastStart(), this.start + this.num);
  23914. }
  23915. /** Go to the previous page of results. */
  23916. async previousPage() {
  23917. this.start = Math.max(1, this.start - this.num);
  23918. }
  23919. // --------------------------------------------------------------------------
  23920. //
  23921. // Private Methods
  23922. //
  23923. // --------------------------------------------------------------------------
  23924. getLastStart() {
  23925. const { total, num } = this;
  23926. const lastStart = total % num === 0 ? total - num : Math.floor(total / num) * num;
  23927. return lastStart + 1;
  23928. }
  23929. showLeftEllipsis() {
  23930. return Math.floor(this.start / this.num) > 3;
  23931. }
  23932. showRightEllipsis() {
  23933. return (this.total - this.start) / this.num > 3;
  23934. }
  23935. emitUpdate() {
  23936. const changePayload = {
  23937. start: this.start,
  23938. total: this.total,
  23939. num: this.num
  23940. };
  23941. this.calcitePaginationChange.emit(changePayload);
  23942. this.calcitePaginationUpdate.emit(changePayload);
  23943. }
  23944. //--------------------------------------------------------------------------
  23945. //
  23946. // Render Methods
  23947. //
  23948. //--------------------------------------------------------------------------
  23949. renderPages() {
  23950. const lastStart = this.getLastStart();
  23951. let end;
  23952. let nextStart;
  23953. // if we don't need ellipses render the whole set
  23954. if (this.total / this.num <= maxPagesDisplayed) {
  23955. nextStart = 1 + this.num;
  23956. end = lastStart - this.num;
  23957. }
  23958. else {
  23959. // if we're within max pages of page 1
  23960. if (this.start / this.num < maxPagesDisplayed - 1) {
  23961. nextStart = 1 + this.num;
  23962. end = 1 + 4 * this.num;
  23963. }
  23964. else {
  23965. // if we're within max pages of last page
  23966. if (this.start + 3 * this.num >= this.total) {
  23967. nextStart = lastStart - 4 * this.num;
  23968. end = lastStart - this.num;
  23969. }
  23970. else {
  23971. nextStart = this.start - this.num;
  23972. end = this.start + this.num;
  23973. }
  23974. }
  23975. }
  23976. const pages = [];
  23977. while (nextStart <= end) {
  23978. pages.push(nextStart);
  23979. nextStart = nextStart + this.num;
  23980. }
  23981. return pages.map((page) => this.renderPage(page));
  23982. }
  23983. renderPage(start) {
  23984. const page = Math.floor(start / this.num) + (this.num === 1 ? 0 : 1);
  23985. const displayedPage = this.determineGroupSeparator(page);
  23986. return (hAsync("button", { class: {
  23987. [CSS$l.page]: true,
  23988. [CSS$l.selected]: start === this.start
  23989. }, onClick: () => {
  23990. this.start = start;
  23991. this.emitUpdate();
  23992. } }, displayedPage));
  23993. }
  23994. renderLeftEllipsis() {
  23995. if (this.total / this.num > maxPagesDisplayed && this.showLeftEllipsis()) {
  23996. return hAsync("span", { class: `${CSS$l.ellipsis} ${CSS$l.ellipsisStart}` }, "\u2026");
  23997. }
  23998. }
  23999. renderRightEllipsis() {
  24000. if (this.total / this.num > maxPagesDisplayed && this.showRightEllipsis()) {
  24001. return hAsync("span", { class: `${CSS$l.ellipsis} ${CSS$l.ellipsisEnd}` }, "\u2026");
  24002. }
  24003. }
  24004. render() {
  24005. const { total, num, start } = this;
  24006. const prevDisabled = num === 1 ? start <= num : start < num;
  24007. const nextDisabled = num === 1 ? start + num > total : start + num > total;
  24008. return (hAsync(Fragment, null, hAsync("button", { "aria-label": this.textLabelPrevious, class: {
  24009. [CSS$l.previous]: true,
  24010. [CSS$l.disabled]: prevDisabled
  24011. }, disabled: prevDisabled, onClick: this.previousClicked }, hAsync("calcite-icon", { flipRtl: true, icon: "chevronLeft", scale: "s" })), total > num ? this.renderPage(1) : null, this.renderLeftEllipsis(), this.renderPages(), this.renderRightEllipsis(), this.renderPage(this.getLastStart()), hAsync("button", { "aria-label": this.textLabelNext, class: {
  24012. [CSS$l.next]: true,
  24013. [CSS$l.disabled]: nextDisabled
  24014. }, disabled: nextDisabled, onClick: this.nextClicked }, hAsync("calcite-icon", { flipRtl: true, icon: "chevronRight", scale: "s" }))));
  24015. }
  24016. get el() { return getElement(this); }
  24017. static get style() { return paginationCss; }
  24018. static get cmpMeta() { return {
  24019. "$flags$": 9,
  24020. "$tagName$": "calcite-pagination",
  24021. "$members$": {
  24022. "groupSeparator": [516, "group-separator"],
  24023. "num": [514],
  24024. "numberingSystem": [1, "numbering-system"],
  24025. "start": [1538],
  24026. "total": [514],
  24027. "textLabelNext": [1, "text-label-next"],
  24028. "textLabelPrevious": [1, "text-label-previous"],
  24029. "scale": [513],
  24030. "effectiveLocale": [32],
  24031. "nextPage": [64],
  24032. "previousPage": [64]
  24033. },
  24034. "$listeners$": undefined,
  24035. "$lazyBundleId$": "-",
  24036. "$attrsToReflect$": [["groupSeparator", "group-separator"], ["num", "num"], ["start", "start"], ["total", "total"], ["scale", "scale"]]
  24037. }; }
  24038. }
  24039. const panelCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-panel:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-panel{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-panel{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-panel{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-panel{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-panel{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-panel:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-panel-h{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-panel-h *.sc-calcite-panel{box-sizing:border-box}/*!@:root*/.sc-calcite-panel:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-panel-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-panel-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-panel-h{position:relative;display:flex;inline-size:100%;flex:1 1 auto;overflow:hidden;--calcite-min-header-height:calc(var(--calcite-icon-size) * 3);--calcite-panel-max-height:unset;--calcite-panel-width:100%;--calcite-panel-min-width:unset;--calcite-panel-max-width:unset}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-panel-h[disabled] .sc-calcite-panel-s>[calcite-hydrated][disabled],[disabled].sc-calcite-panel-h [calcite-hydrated][disabled].sc-calcite-panel{opacity:1}/*!@.header*/.header.sc-calcite-panel{margin:0px;display:flex;align-content:space-between;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}/*!@.heading*/.heading.sc-calcite-panel{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}/*!@.header .heading*/.header.sc-calcite-panel .heading.sc-calcite-panel{flex:1 1 auto;padding:0.5rem}/*!@.container*/.container.sc-calcite-panel{margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;background-color:var(--calcite-ui-background);padding:0px;max-block-size:var(--calcite-panel-max-height);inline-size:var(--calcite-panel-width);max-inline-size:var(--calcite-panel-max-width);min-inline-size:var(--calcite-panel-min-width);transition:max-block-size var(--calcite-animation-timing), inline-size var(--calcite-animation-timing)}/*!@:host([height-scale=s])*/[height-scale=s].sc-calcite-panel-h{--calcite-panel-max-height:40vh}/*!@:host([height-scale=m])*/[height-scale=m].sc-calcite-panel-h{--calcite-panel-max-height:60vh}/*!@:host([height-scale=l])*/[height-scale=l].sc-calcite-panel-h{--calcite-panel-max-height:80vh}/*!@:host([width-scale=s])*/[width-scale=s].sc-calcite-panel-h{--calcite-panel-width:calc(var(--calcite-panel-width-multiplier) * 12vw);--calcite-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 300px);--calcite-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 150px)}/*!@:host([width-scale=m])*/[width-scale=m].sc-calcite-panel-h{--calcite-panel-width:calc(var(--calcite-panel-width-multiplier) * 20vw);--calcite-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 420px);--calcite-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 240px)}/*!@:host([width-scale=l])*/[width-scale=l].sc-calcite-panel-h{--calcite-panel-width:calc(var(--calcite-panel-width-multiplier) * 45vw);--calcite-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 680px);--calcite-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 340px)}/*!@.container[hidden]*/.container[hidden].sc-calcite-panel{display:none}/*!@.header*/.header.sc-calcite-panel{border-block-end:1px solid;position:sticky;inset-block-start:0px;z-index:400;inline-size:100%;align-items:stretch;justify-content:flex-start;background-color:var(--calcite-ui-foreground-1);border-block-end-color:var(--calcite-ui-border-3);flex:0 0 auto}/*!@.header-content*/.header-content.sc-calcite-panel{display:flex;flex-direction:column;overflow:hidden;padding-inline:0.75rem;padding-block:0.875rem;margin-inline-end:auto}/*!@.header-content .heading, \n.header-content .description*/.header-content.sc-calcite-panel .heading.sc-calcite-panel,.header-content.sc-calcite-panel .description.sc-calcite-panel{display:block;overflow-wrap:break-word;padding:0px}/*!@.header-content .heading*/.header-content.sc-calcite-panel .heading.sc-calcite-panel{margin-inline:0px;margin-block:0px 0.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;font-weight:var(--calcite-font-weight-medium)}/*!@.header-content .heading:only-child*/.header-content.sc-calcite-panel .heading.sc-calcite-panel:only-child{margin-block-end:0px}/*!@.header-content .description*/.header-content.sc-calcite-panel .description.sc-calcite-panel{font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}/*!@.back-button*/.back-button.sc-calcite-panel{border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);border-inline-end-width:1px}/*!@.header-actions*/.header-actions.sc-calcite-panel{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch}/*!@.header-actions--end*/.header-actions--end.sc-calcite-panel{margin-inline-start:auto}/*!@.content-wrapper*/.content-wrapper.sc-calcite-panel{overflow:auto}/*!@.content-height*/.content-height.sc-calcite-panel{block-size:100%}/*!@.content-container*/.content-container.sc-calcite-panel{display:flex;flex:1 1 auto;flex-direction:column;flex-wrap:nowrap;align-items:stretch;background-color:var(--calcite-ui-background)}/*!@.footer*/.footer.sc-calcite-panel{border-block-start:1px solid;position:sticky;inset-block-end:0px;display:flex;inline-size:100%;justify-content:space-evenly;background-color:var(--calcite-ui-foreground-1);border-block-start-color:var(--calcite-ui-border-3);flex:0 0 auto;min-block-size:3rem;padding:0.5rem}/*!@.fab-container*/.fab-container.sc-calcite-panel{position:sticky;inset-block-end:0px;z-index:300;margin-block:0px;margin-inline:auto;display:block;padding:0.5rem;inset-inline:0;inline-size:-moz-fit-content;inline-size:fit-content}/*!@[hidden]*/[hidden].sc-calcite-panel{display:none}";
  24040. /**
  24041. * @slot - A slot for adding custom content.
  24042. * @slot header-actions-start - A slot for adding actions or content to the start side of the header.
  24043. * @slot header-actions-end - A slot for adding actions or content to the end side of the header.
  24044. * @slot header-content - A slot for adding custom content to the header.
  24045. * @slot header-menu-actions - A slot for adding an overflow menu with actions inside a `calcite-dropdown`.
  24046. * @slot fab - A slot for adding a `calcite-fab` (floating action button) to perform an action.
  24047. * @slot footer-actions - A slot for adding buttons to the footer.
  24048. * @slot footer - A slot for adding custom content to the footer.
  24049. */
  24050. class Panel {
  24051. constructor(hostRef) {
  24052. registerInstance(this, hostRef);
  24053. this.calcitePanelClose = createEvent(this, "calcitePanelClose", 6);
  24054. this.calcitePanelDismiss = createEvent(this, "calcitePanelDismiss", 6);
  24055. this.calcitePanelDismissedChange = createEvent(this, "calcitePanelDismissedChange", 6);
  24056. this.calcitePanelScroll = createEvent(this, "calcitePanelScroll", 6);
  24057. this.calcitePanelBackClick = createEvent(this, "calcitePanelBackClick", 6);
  24058. // --------------------------------------------------------------------------
  24059. //
  24060. // Properties
  24061. //
  24062. // --------------------------------------------------------------------------
  24063. /**
  24064. * When `true`, hides the component.
  24065. *
  24066. * @deprecated use `closed` instead.
  24067. */
  24068. this.dismissed = false;
  24069. /** When `true`, the component will be hidden. */
  24070. this.closed = false;
  24071. /**
  24072. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  24073. */
  24074. this.disabled = false;
  24075. /**
  24076. * When `true`, a close button is added to the component.
  24077. *
  24078. * @deprecated use `closable` instead
  24079. */
  24080. this.dismissible = false;
  24081. /** When `true`, displays a close button in the trailing side of the header. */
  24082. this.closable = false;
  24083. /**
  24084. * When `true`, displays a back button in the header.
  24085. *
  24086. * @deprecated use `calcite-flow-item` instead.
  24087. */
  24088. this.showBackButton = false;
  24089. /**
  24090. * When `true`, a busy indicator is displayed.
  24091. */
  24092. this.loading = false;
  24093. /**
  24094. * When `true`, the action menu items in the `header-menu-actions` slot are open.
  24095. */
  24096. this.menuOpen = false;
  24097. this.resizeObserver = createObserver();
  24098. this.hasStartActions = false;
  24099. this.hasEndActions = false;
  24100. this.hasMenuItems = false;
  24101. this.hasHeaderContent = false;
  24102. this.hasFooterContent = false;
  24103. this.hasFooterActions = false;
  24104. this.hasFab = false;
  24105. // --------------------------------------------------------------------------
  24106. //
  24107. // Private Methods
  24108. //
  24109. // --------------------------------------------------------------------------
  24110. this.resizeHandler = () => {
  24111. const { panelScrollEl } = this;
  24112. if (!panelScrollEl ||
  24113. typeof panelScrollEl.scrollHeight !== "number" ||
  24114. typeof panelScrollEl.offsetHeight !== "number") {
  24115. return;
  24116. }
  24117. panelScrollEl.tabIndex = panelScrollEl.scrollHeight > panelScrollEl.offsetHeight ? 0 : -1;
  24118. };
  24119. this.setContainerRef = (node) => {
  24120. this.containerEl = node;
  24121. };
  24122. this.setCloseRef = (node) => {
  24123. this.closeButtonEl = node;
  24124. };
  24125. this.setBackRef = (node) => {
  24126. this.backButtonEl = node;
  24127. };
  24128. this.panelKeyDownHandler = (event) => {
  24129. if (this.closable && event.key === "Escape" && !event.defaultPrevented) {
  24130. this.close();
  24131. event.preventDefault();
  24132. }
  24133. };
  24134. this.close = () => {
  24135. this.closed = true;
  24136. this.calcitePanelDismiss.emit();
  24137. this.calcitePanelClose.emit();
  24138. };
  24139. this.panelScrollHandler = () => {
  24140. this.calcitePanelScroll.emit();
  24141. };
  24142. this.backButtonClick = () => {
  24143. this.calcitePanelBackClick.emit();
  24144. };
  24145. this.handleHeaderActionsStartSlotChange = (event) => {
  24146. const elements = event.target.assignedElements({
  24147. flatten: true
  24148. });
  24149. this.hasStartActions = !!elements.length;
  24150. };
  24151. this.handleHeaderActionsEndSlotChange = (event) => {
  24152. const elements = event.target.assignedElements({
  24153. flatten: true
  24154. });
  24155. this.hasEndActions = !!elements.length;
  24156. };
  24157. this.handleHeaderMenuActionsSlotChange = (event) => {
  24158. const elements = event.target.assignedElements({
  24159. flatten: true
  24160. });
  24161. this.hasMenuItems = !!elements.length;
  24162. };
  24163. this.handleHeaderContentSlotChange = (event) => {
  24164. const elements = event.target.assignedElements({
  24165. flatten: true
  24166. });
  24167. this.hasHeaderContent = !!elements.length;
  24168. };
  24169. this.handleFooterSlotChange = (event) => {
  24170. const elements = event.target.assignedElements({
  24171. flatten: true
  24172. });
  24173. this.hasFooterContent = !!elements.length;
  24174. };
  24175. this.handleFooterActionsSlotChange = (event) => {
  24176. const elements = event.target.assignedElements({
  24177. flatten: true
  24178. });
  24179. this.hasFooterActions = !!elements.length;
  24180. };
  24181. this.handleFabSlotChange = (event) => {
  24182. const elements = event.target.assignedElements({
  24183. flatten: true
  24184. });
  24185. this.hasFab = !!elements.length;
  24186. };
  24187. this.setPanelScrollEl = (el) => {
  24188. var _a, _b;
  24189. this.panelScrollEl = el;
  24190. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  24191. if (el) {
  24192. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.observe(el);
  24193. this.resizeHandler();
  24194. }
  24195. };
  24196. }
  24197. dismissedHandler(value) {
  24198. this.closed = value;
  24199. this.calcitePanelDismissedChange.emit();
  24200. }
  24201. closedHandler(value) {
  24202. this.dismissed = value;
  24203. }
  24204. dismissibleHandler(value) {
  24205. this.closable = value;
  24206. }
  24207. closableHandler(value) {
  24208. this.dismissible = value;
  24209. }
  24210. //--------------------------------------------------------------------------
  24211. //
  24212. // Lifecycle
  24213. //
  24214. //--------------------------------------------------------------------------
  24215. componentDidRender() {
  24216. updateHostInteraction(this);
  24217. }
  24218. // --------------------------------------------------------------------------
  24219. //
  24220. // Lifecycle
  24221. //
  24222. // --------------------------------------------------------------------------
  24223. connectedCallback() {
  24224. const isClosed = this.dismissed || this.closed;
  24225. const isClosable = this.dismissible || this.closable;
  24226. if (isClosed) {
  24227. this.dismissedHandler(isClosed);
  24228. this.closedHandler(isClosed);
  24229. }
  24230. if (isClosable) {
  24231. this.dismissibleHandler(isClosable);
  24232. this.closableHandler(isClosable);
  24233. }
  24234. }
  24235. disconnectedCallback() {
  24236. var _a;
  24237. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  24238. }
  24239. // --------------------------------------------------------------------------
  24240. //
  24241. // Methods
  24242. //
  24243. // --------------------------------------------------------------------------
  24244. /**
  24245. * Sets focus on the component.
  24246. *
  24247. * @param focusId
  24248. */
  24249. async setFocus(focusId) {
  24250. const { backButtonEl, closeButtonEl, containerEl } = this;
  24251. if (focusId === "back-button") {
  24252. backButtonEl === null || backButtonEl === void 0 ? void 0 : backButtonEl.setFocus();
  24253. return;
  24254. }
  24255. if (focusId === "dismiss-button") {
  24256. closeButtonEl === null || closeButtonEl === void 0 ? void 0 : closeButtonEl.setFocus();
  24257. return;
  24258. }
  24259. if (backButtonEl) {
  24260. backButtonEl.setFocus();
  24261. return;
  24262. }
  24263. if (closeButtonEl) {
  24264. closeButtonEl.setFocus();
  24265. return;
  24266. }
  24267. containerEl === null || containerEl === void 0 ? void 0 : containerEl.focus();
  24268. }
  24269. /**
  24270. * Scrolls the component's content to a specified set of coordinates.
  24271. *
  24272. * @example
  24273. * myCalciteFlowItem.scrollContentTo({
  24274. * left: 0, // Specifies the number of pixels along the X axis to scroll the window or element.
  24275. * top: 0, // Specifies the number of pixels along the Y axis to scroll the window or element
  24276. * behavior: "auto" // Specifies whether the scrolling should animate smoothly (smooth), or happen instantly in a single jump (auto, the default value).
  24277. * });
  24278. * @param options
  24279. */
  24280. async scrollContentTo(options) {
  24281. var _a;
  24282. (_a = this.panelScrollEl) === null || _a === void 0 ? void 0 : _a.scrollTo(options);
  24283. }
  24284. // --------------------------------------------------------------------------
  24285. //
  24286. // Render Methods
  24287. //
  24288. // --------------------------------------------------------------------------
  24289. renderBackButton() {
  24290. const { el } = this;
  24291. const rtl = getElementDir(el) === "rtl";
  24292. const { showBackButton, intlBack, backButtonClick } = this;
  24293. const label = intlBack || TEXT$f.back;
  24294. const icon = rtl ? ICONS$7.backRight : ICONS$7.backLeft;
  24295. return showBackButton ? (hAsync("calcite-action", { "aria-label": label, class: CSS$z.backButton, icon: icon, key: "back-button", onClick: backButtonClick, ref: this.setBackRef, scale: "s", slot: SLOTS$i.headerActionsStart, text: label })) : null;
  24296. }
  24297. renderHeaderContent() {
  24298. const { heading, headingLevel, summary, description, hasHeaderContent } = this;
  24299. const headingNode = heading ? (hAsync(Heading, { class: CSS$z.heading, level: headingLevel || HEADING_LEVEL$5 }, heading)) : null;
  24300. const descriptionNode = description || summary ? hAsync("span", { class: CSS$z.description }, description || summary) : null;
  24301. return !hasHeaderContent && (headingNode || descriptionNode) ? (hAsync("div", { class: CSS$z.headerContent, key: "header-content" }, headingNode, descriptionNode)) : null;
  24302. }
  24303. /**
  24304. * Allows user to override the entire header-content node.
  24305. */
  24306. renderHeaderSlottedContent() {
  24307. return (hAsync("div", { class: CSS$z.headerContent, hidden: !this.hasHeaderContent, key: "slotted-header-content" }, hAsync("slot", { name: SLOTS$i.headerContent, onSlotchange: this.handleHeaderContentSlotChange })));
  24308. }
  24309. renderHeaderStartActions() {
  24310. const { hasStartActions } = this;
  24311. return (hAsync("div", { class: { [CSS$z.headerActionsStart]: true, [CSS$z.headerActions]: true }, hidden: !hasStartActions, key: "header-actions-start" }, hAsync("slot", { name: SLOTS$i.headerActionsStart, onSlotchange: this.handleHeaderActionsStartSlotChange })));
  24312. }
  24313. renderHeaderActionsEnd() {
  24314. const { close, hasEndActions, intlClose, closable } = this;
  24315. const text = intlClose || TEXT$f.close;
  24316. const closableNode = closable ? (hAsync("calcite-action", { "aria-label": text, icon: ICONS$7.close, onClick: close, ref: this.setCloseRef, text: text })) : null;
  24317. const slotNode = (hAsync("slot", { name: SLOTS$i.headerActionsEnd, onSlotchange: this.handleHeaderActionsEndSlotChange }));
  24318. const showContainer = hasEndActions || closableNode;
  24319. return (hAsync("div", { class: { [CSS$z.headerActionsEnd]: true, [CSS$z.headerActions]: true }, hidden: !showContainer, key: "header-actions-end" }, slotNode, closableNode));
  24320. }
  24321. renderMenu() {
  24322. const { hasMenuItems, intlOptions, menuOpen } = this;
  24323. return (hAsync("calcite-action-menu", { flipPlacements: ["top", "bottom"], hidden: !hasMenuItems, key: "menu", label: intlOptions || TEXT$f.options, open: menuOpen, placement: "bottom-end" }, hAsync("calcite-action", { icon: ICONS$7.menu, slot: SLOTS$s.trigger, text: intlOptions || TEXT$f.options }), hAsync("slot", { name: SLOTS$i.headerMenuActions, onSlotchange: this.handleHeaderMenuActionsSlotChange })));
  24324. }
  24325. renderHeaderNode() {
  24326. const { showBackButton, hasHeaderContent, hasStartActions, hasEndActions, closable, hasMenuItems } = this;
  24327. const headerContentNode = this.renderHeaderContent();
  24328. const showHeader = showBackButton ||
  24329. hasHeaderContent ||
  24330. headerContentNode ||
  24331. hasStartActions ||
  24332. hasEndActions ||
  24333. closable ||
  24334. hasMenuItems;
  24335. return (hAsync("header", { class: CSS$z.header, hidden: !showHeader }, this.renderBackButton(), this.renderHeaderStartActions(), this.renderHeaderSlottedContent(), headerContentNode, this.renderHeaderActionsEnd(), this.renderMenu()));
  24336. }
  24337. renderFooterNode() {
  24338. const { hasFooterContent, hasFooterActions } = this;
  24339. const showFooter = hasFooterContent || hasFooterActions;
  24340. return (hAsync("footer", { class: CSS$z.footer, hidden: !showFooter }, hAsync("slot", { key: "footer-slot", name: SLOTS$i.footer, onSlotchange: this.handleFooterSlotChange }), hAsync("slot", { key: "footer-actions-slot", name: SLOTS$i.footerActions, onSlotchange: this.handleFooterActionsSlotChange })));
  24341. }
  24342. renderContent() {
  24343. const { hasFab } = this;
  24344. const defaultSlotNode = hAsync("slot", { key: "default-slot" });
  24345. const containerNode = hasFab ? (hAsync("section", { class: CSS$z.contentContainer }, defaultSlotNode)) : (defaultSlotNode);
  24346. return (hAsync("div", { class: {
  24347. [CSS$z.contentWrapper]: true,
  24348. [CSS$z.contentContainer]: !hasFab,
  24349. [CSS$z.contentHeight]: hasFab
  24350. }, onScroll: this.panelScrollHandler, ref: this.setPanelScrollEl }, containerNode, this.renderFab()));
  24351. }
  24352. renderFab() {
  24353. return (hAsync("div", { class: CSS$z.fabContainer, hidden: !this.hasFab }, hAsync("slot", { name: SLOTS$i.fab, onSlotchange: this.handleFabSlotChange })));
  24354. }
  24355. render() {
  24356. const { loading, panelKeyDownHandler, closed, closable } = this;
  24357. const panelNode = (hAsync("article", { "aria-busy": toAriaBoolean(loading), class: CSS$z.container, hidden: closed, onKeyDown: panelKeyDownHandler, ref: this.setContainerRef, tabIndex: closable ? 0 : -1 }, this.renderHeaderNode(), this.renderContent(), this.renderFooterNode()));
  24358. return (hAsync(Fragment, null, loading ? hAsync("calcite-scrim", { loading: loading }) : null, panelNode));
  24359. }
  24360. get el() { return getElement(this); }
  24361. static get watchers() { return {
  24362. "dismissed": ["dismissedHandler"],
  24363. "closed": ["closedHandler"],
  24364. "dismissible": ["dismissibleHandler"],
  24365. "closable": ["closableHandler"]
  24366. }; }
  24367. static get style() { return panelCss; }
  24368. static get cmpMeta() { return {
  24369. "$flags$": 9,
  24370. "$tagName$": "calcite-panel",
  24371. "$members$": {
  24372. "dismissed": [1540],
  24373. "closed": [1540],
  24374. "beforeBack": [16],
  24375. "disabled": [516],
  24376. "dismissible": [1540],
  24377. "closable": [1540],
  24378. "headingLevel": [514, "heading-level"],
  24379. "showBackButton": [516, "show-back-button"],
  24380. "intlBack": [1, "intl-back"],
  24381. "heightScale": [513, "height-scale"],
  24382. "widthScale": [513, "width-scale"],
  24383. "loading": [516],
  24384. "intlClose": [1, "intl-close"],
  24385. "intlOptions": [1, "intl-options"],
  24386. "heading": [1],
  24387. "summary": [1],
  24388. "description": [1],
  24389. "menuOpen": [516, "menu-open"],
  24390. "hasStartActions": [32],
  24391. "hasEndActions": [32],
  24392. "hasMenuItems": [32],
  24393. "hasHeaderContent": [32],
  24394. "hasFooterContent": [32],
  24395. "hasFooterActions": [32],
  24396. "hasFab": [32],
  24397. "setFocus": [64],
  24398. "scrollContentTo": [64]
  24399. },
  24400. "$listeners$": undefined,
  24401. "$lazyBundleId$": "-",
  24402. "$attrsToReflect$": [["dismissed", "dismissed"], ["closed", "closed"], ["disabled", "disabled"], ["dismissible", "dismissible"], ["closable", "closable"], ["headingLevel", "heading-level"], ["showBackButton", "show-back-button"], ["heightScale", "height-scale"], ["widthScale", "width-scale"], ["loading", "loading"], ["menuOpen", "menu-open"]]
  24403. }; }
  24404. }
  24405. const CSS$k = {
  24406. sticky: "sticky-pos"
  24407. };
  24408. var ICON_TYPES$1;
  24409. (function (ICON_TYPES) {
  24410. ICON_TYPES["circle"] = "circle";
  24411. ICON_TYPES["square"] = "square";
  24412. ICON_TYPES["grip"] = "grip";
  24413. })(ICON_TYPES$1 || (ICON_TYPES$1 = {}));
  24414. const SLOTS$b = {
  24415. menuActions: "menu-actions"
  24416. };
  24417. const CSS$j = {
  24418. heading: "heading",
  24419. container: "container",
  24420. indented: "container--indented"
  24421. };
  24422. const SLOTS$a = {
  24423. parentItem: "parent-item"
  24424. };
  24425. const HEADING_LEVEL$3 = 3;
  24426. function mutationObserverCallback() {
  24427. this.setUpItems();
  24428. this.setUpFilter();
  24429. this.deselectRemovedItems();
  24430. }
  24431. const SUPPORTED_ARROW_KEYS = ["ArrowUp", "ArrowDown"];
  24432. // --------------------------------------------------------------------------
  24433. //
  24434. // Lifecycle
  24435. //
  24436. // --------------------------------------------------------------------------
  24437. function initialize() {
  24438. this.setUpItems();
  24439. this.setUpFilter();
  24440. this.emitCalciteListChange = debounce(internalCalciteListChangeEvent.bind(this), 0);
  24441. }
  24442. function initializeObserver() {
  24443. var _a;
  24444. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  24445. }
  24446. function cleanUpObserver() {
  24447. var _a;
  24448. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  24449. }
  24450. // --------------------------------------------------------------------------
  24451. //
  24452. // Listeners
  24453. //
  24454. // --------------------------------------------------------------------------
  24455. function calciteListItemChangeHandler(event) {
  24456. const { selectedValues } = this;
  24457. const { item, value, selected, shiftPressed } = event.detail;
  24458. if (selected) {
  24459. if (this.multiple && shiftPressed) {
  24460. this.selectSiblings(item);
  24461. }
  24462. if (!this.multiple) {
  24463. this.deselectSiblingItems(item);
  24464. }
  24465. selectedValues.set(value, item);
  24466. }
  24467. else {
  24468. selectedValues.delete(value);
  24469. if (this.multiple && shiftPressed) {
  24470. this.selectSiblings(item, true);
  24471. }
  24472. }
  24473. if (!this.multiple) {
  24474. toggleSingleSelectItemTabbing(item, selected);
  24475. if (selected) {
  24476. focusElement(item);
  24477. }
  24478. }
  24479. this.lastSelectedItem = item;
  24480. this.emitCalciteListChange();
  24481. }
  24482. function calciteInternalListItemValueChangeHandler(event) {
  24483. const oldValue = event.detail.oldValue;
  24484. const selectedValues = this.selectedValues;
  24485. if (selectedValues.has(oldValue)) {
  24486. const item = selectedValues.get(oldValue);
  24487. selectedValues.delete(oldValue);
  24488. selectedValues.set(event.detail.newValue, item);
  24489. }
  24490. event.stopPropagation();
  24491. }
  24492. // --------------------------------------------------------------------------
  24493. //
  24494. // Private Methods
  24495. //
  24496. // --------------------------------------------------------------------------
  24497. function isValidNavigationKey(key) {
  24498. return !!SUPPORTED_ARROW_KEYS.find((k) => k === key);
  24499. }
  24500. function calciteListFocusOutHandler(event) {
  24501. const { el, items, multiple, selectedValues } = this;
  24502. if (multiple) {
  24503. return;
  24504. }
  24505. const focusedInside = el.contains(event.relatedTarget);
  24506. if (focusedInside) {
  24507. return;
  24508. }
  24509. filterOutDisabled(items).forEach((item) => {
  24510. toggleSingleSelectItemTabbing(item, selectedValues.size === 0 ? item.contains(event.target) || event.target === item : item.selected);
  24511. });
  24512. }
  24513. function keyDownHandler(event) {
  24514. const { key, target } = event;
  24515. if (!isValidNavigationKey(key)) {
  24516. return;
  24517. }
  24518. const { items, multiple, selectionFollowsFocus } = this;
  24519. const { length: totalItems } = items;
  24520. const currentIndex = items.indexOf(target);
  24521. if (!totalItems || currentIndex === -1) {
  24522. return;
  24523. }
  24524. event.preventDefault();
  24525. const index = moveItemIndex(this, target, key === "ArrowUp" ? "up" : "down");
  24526. const item = items[index];
  24527. items.forEach((i) => toggleSingleSelectItemTabbing(i, i === item));
  24528. if (!multiple && selectionFollowsFocus) {
  24529. item.selected = true;
  24530. }
  24531. focusElement(item);
  24532. }
  24533. function moveItemIndex(list, item, direction) {
  24534. const { items } = list;
  24535. const { length: totalItems } = items;
  24536. const currentIndex = items.indexOf(item);
  24537. const directionFactor = direction === "up" ? -1 : 1;
  24538. let moveOffset = 1;
  24539. let index = getRoundRobinIndex(currentIndex + directionFactor * moveOffset++, totalItems);
  24540. const firstMovedIndex = index;
  24541. while (items[index].disabled) {
  24542. index = getRoundRobinIndex(currentIndex + directionFactor * moveOffset++, totalItems);
  24543. if (index === firstMovedIndex) {
  24544. break;
  24545. }
  24546. }
  24547. return index;
  24548. }
  24549. function getItemIndex(list, item) {
  24550. const { items } = list;
  24551. return items.indexOf(item);
  24552. }
  24553. function filterOutDisabled(items) {
  24554. return items.filter((item) => !item.disabled);
  24555. }
  24556. function internalCalciteListChangeEvent() {
  24557. this.calciteListChange.emit(this.selectedValues);
  24558. }
  24559. function removeItem(event) {
  24560. if (event.defaultPrevented) {
  24561. return;
  24562. }
  24563. const item = event.target;
  24564. const selectedValues = this.selectedValues;
  24565. if (item.parentElement.tagName === "CALCITE-PICK-LIST-GROUP" && item.slot === SLOTS$a.parentItem) {
  24566. item.parentElement.remove();
  24567. Array.from(item.parentElement.children).forEach((item) => selectedValues.delete(item.value));
  24568. }
  24569. else {
  24570. item.remove();
  24571. selectedValues.delete(item.value);
  24572. }
  24573. this.emitCalciteListChange();
  24574. }
  24575. function toggleSingleSelectItemTabbing(item, selectable) {
  24576. if (item.disabled) {
  24577. return;
  24578. }
  24579. // using attribute intentionally
  24580. if (selectable) {
  24581. item.removeAttribute("tabindex");
  24582. }
  24583. else {
  24584. item.setAttribute("tabindex", "-1");
  24585. }
  24586. }
  24587. async function setFocus(focusId) {
  24588. var _a;
  24589. if (this.filterEnabled && focusId === "filter") {
  24590. await focusElement(this.filterEl);
  24591. return;
  24592. }
  24593. const { items, multiple, selectionFollowsFocus } = this;
  24594. if (items.length === 0) {
  24595. return;
  24596. }
  24597. if (multiple) {
  24598. return (_a = filterOutDisabled(items)[0]) === null || _a === void 0 ? void 0 : _a.setFocus();
  24599. }
  24600. const filtered = filterOutDisabled(items);
  24601. const focusTarget = filtered.find((item) => item.selected) || filtered[0];
  24602. if (selectionFollowsFocus && focusTarget) {
  24603. focusTarget.selected = true;
  24604. }
  24605. return focusTarget.setFocus();
  24606. }
  24607. function setUpItems(tagName) {
  24608. this.items = Array.from(this.el.querySelectorAll(tagName));
  24609. let hasSelected = false;
  24610. const { items } = this;
  24611. items.forEach((item) => {
  24612. item.icon = this.getIconType();
  24613. if (!this.multiple) {
  24614. item.disableDeselect = true;
  24615. toggleSingleSelectItemTabbing(item, false);
  24616. }
  24617. if (item.selected) {
  24618. hasSelected = true;
  24619. toggleSingleSelectItemTabbing(item, true);
  24620. this.selectedValues.set(item.value, item);
  24621. }
  24622. });
  24623. const [first] = items;
  24624. if (!hasSelected && first && !first.disabled) {
  24625. toggleSingleSelectItemTabbing(first, true);
  24626. }
  24627. }
  24628. function deselectRemovedItems() {
  24629. const selectedValues = this.selectedValues;
  24630. const itemValues = this.items.map(({ value }) => value);
  24631. selectedValues.forEach((selectedItem) => {
  24632. if (!itemValues.includes(selectedItem.value)) {
  24633. this.selectedValues.delete(selectedItem.value);
  24634. }
  24635. });
  24636. }
  24637. function deselectSiblingItems(item) {
  24638. this.items.forEach((currentItem) => {
  24639. if (currentItem.value !== item.value) {
  24640. currentItem.toggleSelected(false);
  24641. if (this.selectedValues.has(currentItem.value)) {
  24642. this.selectedValues.delete(currentItem.value);
  24643. }
  24644. }
  24645. });
  24646. }
  24647. function selectSiblings(item, deselect = false) {
  24648. if (!this.lastSelectedItem) {
  24649. return;
  24650. }
  24651. const { items } = this;
  24652. const start = items.findIndex((currentItem) => {
  24653. return currentItem.value === this.lastSelectedItem.value;
  24654. });
  24655. const end = items.findIndex((currentItem) => {
  24656. return currentItem.value === item.value;
  24657. });
  24658. items.slice(Math.min(start, end), Math.max(start, end)).forEach((currentItem) => {
  24659. currentItem.toggleSelected(!deselect);
  24660. if (!deselect) {
  24661. this.selectedValues.set(currentItem.value, currentItem);
  24662. }
  24663. else {
  24664. this.selectedValues.delete(currentItem.value);
  24665. }
  24666. });
  24667. }
  24668. let groups;
  24669. function handleFilter(event) {
  24670. const { filteredItems } = event.currentTarget;
  24671. const values = filteredItems.map((item) => item.value);
  24672. let hasSelectedMatch = false;
  24673. if (!groups) {
  24674. groups = new Set();
  24675. }
  24676. const matchedItems = this.items.filter((item) => {
  24677. const parent = item.parentElement;
  24678. const grouped = parent.matches("calcite-pick-list-group");
  24679. if (grouped) {
  24680. groups.add(parent);
  24681. }
  24682. const matches = values.includes(item.value);
  24683. item.hidden = !matches;
  24684. if (!hasSelectedMatch) {
  24685. hasSelectedMatch = matches && item.selected;
  24686. }
  24687. return matches;
  24688. });
  24689. groups.forEach((group) => {
  24690. const hasAtLeastOneMatch = matchedItems.some((item) => group.contains(item));
  24691. group.hidden = !hasAtLeastOneMatch;
  24692. if (!hasAtLeastOneMatch) {
  24693. return;
  24694. }
  24695. const parentItem = getSlotted(group, "parent-item");
  24696. if (parentItem) {
  24697. parentItem.hidden = false;
  24698. if (matchedItems.includes(parentItem)) {
  24699. Array.from(group.children).forEach((child) => (child.hidden = false));
  24700. }
  24701. }
  24702. });
  24703. groups.clear();
  24704. if (matchedItems.length > 0 && !hasSelectedMatch && !this.multiple) {
  24705. toggleSingleSelectItemTabbing(matchedItems[0], true);
  24706. }
  24707. }
  24708. function getItemData() {
  24709. return this.items.map((item) => ({
  24710. label: item.label,
  24711. description: item.description,
  24712. metadata: item.metadata,
  24713. value: item.value
  24714. }));
  24715. }
  24716. const List = ({ props: { disabled, loading, filterEnabled, dataForFilter, handleFilter, filterPlaceholder, setFilterEl, dragEnabled, storeAssistiveEl }, ...rest }) => {
  24717. const defaultSlot = hAsync("slot", null);
  24718. return (hAsync(Host, { "aria-busy": toAriaBoolean(loading), role: "menu", ...rest },
  24719. hAsync("section", null,
  24720. dragEnabled ? (hAsync("span", { "aria-live": "assertive", class: "assistive-text", ref: storeAssistiveEl })) : null,
  24721. hAsync("header", { class: { [CSS$k.sticky]: true } },
  24722. filterEnabled ? (hAsync("calcite-filter", { "aria-label": filterPlaceholder, disabled: loading || disabled, items: dataForFilter, onCalciteFilterChange: handleFilter, placeholder: filterPlaceholder, ref: setFilterEl })) : null,
  24723. hAsync("slot", { name: SLOTS$b.menuActions })),
  24724. loading ? hAsync("calcite-scrim", { loading: loading }) : null,
  24725. defaultSlot)));
  24726. };
  24727. const pickListCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-pick-list:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-pick-list{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-pick-list{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-pick-list{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-pick-list{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-pick-list{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-pick-list:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-pick-list:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-pick-list-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-pick-list-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-pick-list-h{position:relative;box-sizing:border-box;display:flex;flex-shrink:0;flex-grow:1;flex-direction:column;align-items:stretch;background-color:transparent;font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}/*!@:host **/.sc-calcite-pick-list-h *.sc-calcite-pick-list{box-sizing:border-box}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-pick-list-h[disabled] .sc-calcite-pick-list-s>[calcite-hydrated][disabled],[disabled].sc-calcite-pick-list-h [calcite-hydrated][disabled].sc-calcite-pick-list{opacity:1}/*!@:host([filter-enabled]) header*/[filter-enabled].sc-calcite-pick-list-h header.sc-calcite-pick-list{margin-block-end:0.25rem;display:flex;align-items:stretch;justify-content:flex-end;background-color:var(--calcite-ui-foreground-1);--tw-shadow:0 1px 0 var(--calcite-ui-border-3);--tw-shadow-colored:0 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([filter-enabled]) header.sticky-pos*/[filter-enabled].sc-calcite-pick-list-h header.sticky-pos.sc-calcite-pick-list{position:sticky;inset-block-start:0px;z-index:1}/*!@calcite-filter*/calcite-filter.sc-calcite-pick-list{margin-block-end:0px}/*!@:host([loading][disabled])*/[loading][disabled].sc-calcite-pick-list-h{min-block-size:2rem}";
  24728. /**
  24729. * @slot - A slot for adding `calcite-pick-list-item` or `calcite-pick-list-group` elements. Items are displayed as a vertical list.
  24730. * @slot menu-actions - A slot for adding a button and menu combination for performing actions, such as sorting.
  24731. */
  24732. class PickList {
  24733. constructor(hostRef) {
  24734. registerInstance(this, hostRef);
  24735. this.calciteListChange = createEvent(this, "calciteListChange", 6);
  24736. // --------------------------------------------------------------------------
  24737. //
  24738. // Properties
  24739. //
  24740. // --------------------------------------------------------------------------
  24741. /**
  24742. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  24743. */
  24744. this.disabled = false;
  24745. /**
  24746. * When `true`, an input appears at the top of the list that can be used by end users to filter items in the list.
  24747. */
  24748. this.filterEnabled = false;
  24749. /**
  24750. * When `true`, a busy indicator is displayed.
  24751. */
  24752. this.loading = false;
  24753. /**
  24754. * Similar to standard radio buttons and checkboxes.
  24755. * When `true`, a user can select multiple `calcite-pick-list-item`s at a time.
  24756. * When `false`, only a single `calcite-pick-list-item` can be selected at a time,
  24757. * and a new selection will deselect previous selections.
  24758. */
  24759. this.multiple = false;
  24760. /**
  24761. * When `true` and single selection is enabled, the selection changes when navigating `calcite-pick-list-item`s via keyboard.
  24762. */
  24763. this.selectionFollowsFocus = false;
  24764. // --------------------------------------------------------------------------
  24765. //
  24766. // Private Properties
  24767. //
  24768. // --------------------------------------------------------------------------
  24769. this.selectedValues = new Map();
  24770. this.dataForFilter = [];
  24771. this.lastSelectedItem = null;
  24772. this.mutationObserver = createObserver("mutation", mutationObserverCallback.bind(this));
  24773. this.setFilterEl = (el) => {
  24774. this.filterEl = el;
  24775. };
  24776. this.deselectRemovedItems = deselectRemovedItems.bind(this);
  24777. this.deselectSiblingItems = deselectSiblingItems.bind(this);
  24778. this.selectSiblings = selectSiblings.bind(this);
  24779. this.handleFilter = handleFilter.bind(this);
  24780. this.getItemData = getItemData.bind(this);
  24781. this.keyDownHandler = keyDownHandler.bind(this);
  24782. }
  24783. // --------------------------------------------------------------------------
  24784. //
  24785. // Lifecycle
  24786. //
  24787. // --------------------------------------------------------------------------
  24788. connectedCallback() {
  24789. initialize.call(this);
  24790. initializeObserver.call(this);
  24791. }
  24792. disconnectedCallback() {
  24793. cleanUpObserver.call(this);
  24794. }
  24795. componentDidRender() {
  24796. updateHostInteraction(this);
  24797. }
  24798. calciteListItemRemoveHandler(event) {
  24799. removeItem.call(this, event);
  24800. }
  24801. calciteListItemChangeHandler(event) {
  24802. calciteListItemChangeHandler.call(this, event);
  24803. }
  24804. calciteInternalListItemPropsChangeHandler(event) {
  24805. event.stopPropagation();
  24806. this.setUpFilter();
  24807. }
  24808. calciteInternalListItemValueChangeHandler(event) {
  24809. calciteInternalListItemValueChangeHandler.call(this, event);
  24810. event.stopPropagation();
  24811. }
  24812. calciteListFocusOutHandler(event) {
  24813. calciteListFocusOutHandler.call(this, event);
  24814. }
  24815. // --------------------------------------------------------------------------
  24816. //
  24817. // Private Methods
  24818. //
  24819. // --------------------------------------------------------------------------
  24820. setUpItems() {
  24821. setUpItems.call(this, "calcite-pick-list-item");
  24822. }
  24823. setUpFilter() {
  24824. if (this.filterEnabled) {
  24825. this.dataForFilter = this.getItemData();
  24826. }
  24827. }
  24828. // --------------------------------------------------------------------------
  24829. //
  24830. // Public Methods
  24831. //
  24832. // --------------------------------------------------------------------------
  24833. /** Returns the component's selected `calcite-pick-list-item`s. */
  24834. async getSelectedItems() {
  24835. return this.selectedValues;
  24836. }
  24837. /**
  24838. * Sets focus on the component.
  24839. *
  24840. * @param focusId
  24841. */
  24842. async setFocus(focusId) {
  24843. return setFocus.call(this, focusId);
  24844. }
  24845. // --------------------------------------------------------------------------
  24846. //
  24847. // Render Methods
  24848. //
  24849. // --------------------------------------------------------------------------
  24850. getIconType() {
  24851. return this.multiple ? ICON_TYPES$1.square : ICON_TYPES$1.circle;
  24852. }
  24853. render() {
  24854. return hAsync(List, { onKeyDown: this.keyDownHandler, props: this });
  24855. }
  24856. get el() { return getElement(this); }
  24857. static get style() { return pickListCss; }
  24858. static get cmpMeta() { return {
  24859. "$flags$": 9,
  24860. "$tagName$": "calcite-pick-list",
  24861. "$members$": {
  24862. "disabled": [516],
  24863. "filterEnabled": [516, "filter-enabled"],
  24864. "filterPlaceholder": [513, "filter-placeholder"],
  24865. "headingLevel": [514, "heading-level"],
  24866. "loading": [516],
  24867. "multiple": [516],
  24868. "selectionFollowsFocus": [516, "selection-follows-focus"],
  24869. "selectedValues": [32],
  24870. "dataForFilter": [32],
  24871. "getSelectedItems": [64],
  24872. "setFocus": [64]
  24873. },
  24874. "$listeners$": [[0, "calciteListItemRemove", "calciteListItemRemoveHandler"], [0, "calciteListItemChange", "calciteListItemChangeHandler"], [0, "calciteInternalListItemPropsChange", "calciteInternalListItemPropsChangeHandler"], [0, "calciteInternalListItemValueChange", "calciteInternalListItemValueChangeHandler"], [0, "focusout", "calciteListFocusOutHandler"]],
  24875. "$lazyBundleId$": "-",
  24876. "$attrsToReflect$": [["disabled", "disabled"], ["filterEnabled", "filter-enabled"], ["filterPlaceholder", "filter-placeholder"], ["headingLevel", "heading-level"], ["loading", "loading"], ["multiple", "multiple"], ["selectionFollowsFocus", "selection-follows-focus"]]
  24877. }; }
  24878. }
  24879. const pickListGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-pick-list-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-pick-list-group{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-pick-list-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-pick-list-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-pick-list-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-pick-list-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-pick-list-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-pick-list-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-pick-list-group-h{display:none}/*!@:host*/.sc-calcite-pick-list-group-h{margin-block-end:0.25rem;box-sizing:border-box;display:block;background-color:transparent;font-size:var(--calcite-font-size--1);color:var(--calcite-ui-text-2)}/*!@:host **/.sc-calcite-pick-list-group-h *.sc-calcite-pick-list-group{box-sizing:border-box}/*!@:host(:last-child)*/.sc-calcite-pick-list-group-h:last-child{margin-block-end:0px}/*!@.header*/.header.sc-calcite-pick-list-group{margin:0px;display:flex;align-content:space-between;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}/*!@.heading*/.heading.sc-calcite-pick-list-group{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}/*!@.header .heading*/.header.sc-calcite-pick-list-group .heading.sc-calcite-pick-list-group{flex:1 1 auto;padding:0.5rem}/*!@.heading*/.heading.sc-calcite-pick-list-group{margin-block:0.5rem;margin-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;font-size:var(--calcite-font-size--1);line-height:1.375;color:var(--calcite-ui-text-3)}/*!@.container--indented*/.container--indented.sc-calcite-pick-list-group{margin-inline-start:1.5rem}";
  24880. /**
  24881. * @slot - A slot for adding `calcite-pick-list-item` elements.
  24882. */
  24883. class PickListGroup {
  24884. constructor(hostRef) {
  24885. registerInstance(this, hostRef);
  24886. }
  24887. // --------------------------------------------------------------------------
  24888. //
  24889. // Lifecycle
  24890. //
  24891. // --------------------------------------------------------------------------
  24892. connectedCallback() {
  24893. connectConditionalSlotComponent(this);
  24894. }
  24895. disconnectedCallback() {
  24896. disconnectConditionalSlotComponent(this);
  24897. }
  24898. // --------------------------------------------------------------------------
  24899. //
  24900. // Render Methods
  24901. //
  24902. // --------------------------------------------------------------------------
  24903. render() {
  24904. var _a;
  24905. const { el, groupTitle, headingLevel } = this;
  24906. const hasParentItem = getSlotted(el, SLOTS$a.parentItem) !== null;
  24907. const sectionClasses = {
  24908. [CSS$j.container]: true,
  24909. [CSS$j.indented]: hasParentItem
  24910. };
  24911. const title = groupTitle;
  24912. const parentLevel = (_a = el.closest("calcite-pick-list")) === null || _a === void 0 ? void 0 : _a.headingLevel;
  24913. const relativeLevel = parentLevel ? constrainHeadingLevel(parentLevel + 1) : null;
  24914. const level = headingLevel || relativeLevel || HEADING_LEVEL$3;
  24915. return (hAsync(Fragment, null, title ? (hAsync(Heading, { class: CSS$j.heading, level: level }, title)) : null, hAsync("slot", { name: SLOTS$a.parentItem }), hAsync("section", { class: sectionClasses }, hAsync("slot", null))));
  24916. }
  24917. get el() { return getElement(this); }
  24918. static get style() { return pickListGroupCss; }
  24919. static get cmpMeta() { return {
  24920. "$flags$": 9,
  24921. "$tagName$": "calcite-pick-list-group",
  24922. "$members$": {
  24923. "groupTitle": [513, "group-title"],
  24924. "headingLevel": [514, "heading-level"]
  24925. },
  24926. "$listeners$": undefined,
  24927. "$lazyBundleId$": "-",
  24928. "$attrsToReflect$": [["groupTitle", "group-title"], ["headingLevel", "heading-level"]]
  24929. }; }
  24930. }
  24931. const CSS$i = {
  24932. actions: "actions",
  24933. actionsEnd: "actions--end",
  24934. actionsStart: "actions--start",
  24935. description: "description",
  24936. handle: "handle",
  24937. handleActivated: "handle--activated",
  24938. highlight: "highlight",
  24939. icon: "icon",
  24940. iconDot: "icon-dot",
  24941. label: "label",
  24942. remove: "remove",
  24943. title: "title",
  24944. textContainer: "text-container"
  24945. };
  24946. const ICONS$4 = {
  24947. checked: "check",
  24948. remove: "x"
  24949. };
  24950. const SLOTS$9 = {
  24951. actionsEnd: "actions-end",
  24952. actionsStart: "actions-start"
  24953. };
  24954. const TEXT$7 = {
  24955. remove: "Remove"
  24956. };
  24957. const pickListItemCss = "@charset \"UTF-8\";@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-pick-list-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-pick-list-item{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-pick-list-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-pick-list-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-pick-list-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-pick-list-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-pick-list-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-pick-list-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-pick-list-item-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-pick-list-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-pick-list-item-h{margin:0px;margin-block-end:1px;box-sizing:border-box;display:flex;align-items:stretch;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-1);--tw-shadow:0 1px 0 var(--calcite-ui-border-3);--tw-shadow-colored:0 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition:background-color var(--calcite-animation-timing);animation:calcite-fade-in var(--calcite-animation-timing)}/*!@:host **/.sc-calcite-pick-list-item-h *.sc-calcite-pick-list-item{box-sizing:border-box}/*!@.label*/.label.sc-calcite-pick-list-item{display:flex;flex:1 1 auto;cursor:pointer;align-items:center;background-color:transparent;outline-color:transparent}/*!@.label:focus*/.label.sc-calcite-pick-list-item:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.label:hover*/.label.sc-calcite-pick-list-item:hover{background-color:var(--calcite-ui-foreground-2)}/*!@:host([non-interactive]:hover)*/[non-interactive].sc-calcite-pick-list-item-h:hover{background-color:var(--calcite-ui-foreground-1)}/*!@:host([non-interactive]) .label, \n:host([non-interactive]) .icon*/[non-interactive].sc-calcite-pick-list-item-h .label.sc-calcite-pick-list-item,[non-interactive].sc-calcite-pick-list-item-h .icon.sc-calcite-pick-list-item{pointer-events:none}/*!@.icon*/.icon.sc-calcite-pick-list-item{margin-block:0px;display:flex;cursor:pointer;align-items:center;padding:0.25rem;color:var(--calcite-ui-brand);flex:0 0 auto;line-height:0}/*!@.icon:hover*/.icon.sc-calcite-pick-list-item:hover{background-color:var(--calcite-ui-foreground-2)}/*!@.icon-dot*/.icon-dot.sc-calcite-pick-list-item{display:flex;inline-size:1.5rem;align-items:center;padding:0.5rem}/*!@.icon-dot:before*/.icon-dot.sc-calcite-pick-list-item:before{opacity:0;content:\"•\"}/*!@.icon calcite-icon*/.icon.sc-calcite-pick-list-item calcite-icon.sc-calcite-pick-list-item{opacity:0}/*!@:host([selected]) .icon-dot:before,\n:host([selected]) .icon calcite-icon*/[selected].sc-calcite-pick-list-item-h .icon-dot.sc-calcite-pick-list-item:before,[selected].sc-calcite-pick-list-item-h .icon.sc-calcite-pick-list-item calcite-icon.sc-calcite-pick-list-item{transition:opacity var(--calcite-animation-timing);opacity:1}/*!@.text-container*/.text-container.sc-calcite-pick-list-item{pointer-events:none;display:flex;flex-direction:column;flex-wrap:nowrap;overflow:hidden;padding-block:0.5rem;padding-inline:0.75rem;font-size:var(--calcite-font-size--2);line-height:1.375;word-wrap:break-word;word-break:break-word}/*!@.title*/.title.sc-calcite-pick-list-item{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-1)}/*!@.description*/.description.sc-calcite-pick-list-item{margin-block-start:0.125rem;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}/*!@.actions*/.actions.sc-calcite-pick-list-item{margin:0px;display:flex;flex:0 1 auto;align-items:stretch;justify-content:flex-end}/*!@.actions--start ~ .label*/.actions--start.sc-calcite-pick-list-item~.label.sc-calcite-pick-list-item{padding-inline-start:0.25rem}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-pick-list-item-h[disabled] .sc-calcite-pick-list-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-pick-list-item-h [calcite-hydrated][disabled].sc-calcite-pick-list-item{opacity:1}";
  24958. /**
  24959. * @slot actions-end - A slot for adding `calcite-action`s or content to the end side of the component.
  24960. * @slot actions-start - A slot for adding `calcite-action`s or content to the start side of the component.
  24961. */
  24962. class PickListItem {
  24963. constructor(hostRef) {
  24964. registerInstance(this, hostRef);
  24965. this.calciteListItemChange = createEvent(this, "calciteListItemChange", 6);
  24966. this.calciteListItemRemove = createEvent(this, "calciteListItemRemove", 7);
  24967. this.calciteInternalListItemPropsChange = createEvent(this, "calciteInternalListItemPropsChange", 6);
  24968. this.calciteInternalListItemValueChange = createEvent(this, "calciteInternalListItemValueChange", 6);
  24969. /**
  24970. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  24971. */
  24972. this.disabled = false;
  24973. /**
  24974. * When `false`, the component cannot be deselected by user interaction.
  24975. */
  24976. this.disableDeselect = false;
  24977. /**
  24978. * @internal
  24979. */
  24980. this.nonInteractive = false;
  24981. /**
  24982. * Determines the icon SVG symbol that will be shown. Options are `"circle"`, `"square"`, `"grip"` or `null`.
  24983. *
  24984. * @see [ICON_TYPES](https://github.com/Esri/calcite-components/blob/master/src/components/pick-list/resources.ts#L5)
  24985. */
  24986. this.icon = null;
  24987. /**
  24988. * When `true`, displays a remove action that removes the item from the list.
  24989. */
  24990. this.removable = false;
  24991. /**
  24992. * When `true`, selects an item. Toggles when an item is checked/unchecked.
  24993. */
  24994. this.selected = false;
  24995. /**
  24996. * When `removable` is `true`, the accessible name for the component's remove button.
  24997. *
  24998. * @default "Remove"
  24999. */
  25000. this.intlRemove = TEXT$7.remove;
  25001. // --------------------------------------------------------------------------
  25002. //
  25003. // Private Methods
  25004. //
  25005. // --------------------------------------------------------------------------
  25006. this.pickListClickHandler = (event) => {
  25007. if (this.disabled || (this.disableDeselect && this.selected) || this.nonInteractive) {
  25008. return;
  25009. }
  25010. this.shiftPressed = event.shiftKey;
  25011. this.selected = !this.selected;
  25012. };
  25013. this.pickListKeyDownHandler = (event) => {
  25014. if (event.key === " ") {
  25015. event.preventDefault();
  25016. if ((this.disableDeselect && this.selected) || this.nonInteractive) {
  25017. return;
  25018. }
  25019. this.selected = !this.selected;
  25020. }
  25021. };
  25022. this.removeClickHandler = () => {
  25023. this.calciteListItemRemove.emit();
  25024. };
  25025. }
  25026. descriptionWatchHandler() {
  25027. this.calciteInternalListItemPropsChange.emit();
  25028. }
  25029. labelWatchHandler() {
  25030. this.calciteInternalListItemPropsChange.emit();
  25031. }
  25032. metadataWatchHandler() {
  25033. this.calciteInternalListItemPropsChange.emit();
  25034. }
  25035. selectedWatchHandler() {
  25036. this.calciteListItemChange.emit({
  25037. item: this.el,
  25038. value: this.value,
  25039. selected: this.selected,
  25040. shiftPressed: this.shiftPressed
  25041. });
  25042. this.shiftPressed = false;
  25043. }
  25044. valueWatchHandler(newValue, oldValue) {
  25045. this.calciteInternalListItemValueChange.emit({ oldValue, newValue });
  25046. }
  25047. // --------------------------------------------------------------------------
  25048. //
  25049. // Lifecycle
  25050. //
  25051. // --------------------------------------------------------------------------
  25052. connectedCallback() {
  25053. connectConditionalSlotComponent(this);
  25054. }
  25055. disconnectedCallback() {
  25056. disconnectConditionalSlotComponent(this);
  25057. }
  25058. componentDidRender() {
  25059. updateHostInteraction(this, this.el.closest("calcite-pick-list") ? "managed" : false);
  25060. }
  25061. // --------------------------------------------------------------------------
  25062. //
  25063. // Public Methods
  25064. //
  25065. // --------------------------------------------------------------------------
  25066. /**
  25067. * Toggles the selection state. By default this won't trigger an event.
  25068. * The first argument allows the value to be coerced, rather than swapping values.
  25069. *
  25070. * @param coerce
  25071. */
  25072. async toggleSelected(coerce) {
  25073. this.selected = typeof coerce === "boolean" ? coerce : !this.selected;
  25074. }
  25075. /** Sets focus on the component. */
  25076. async setFocus() {
  25077. var _a;
  25078. (_a = this.focusEl) === null || _a === void 0 ? void 0 : _a.focus();
  25079. }
  25080. // --------------------------------------------------------------------------
  25081. //
  25082. // Render Methods
  25083. //
  25084. // --------------------------------------------------------------------------
  25085. renderIcon() {
  25086. const { icon } = this;
  25087. if (!icon) {
  25088. return null;
  25089. }
  25090. return (hAsync("span", { class: {
  25091. [CSS$i.icon]: true,
  25092. [CSS$i.iconDot]: icon === ICON_TYPES$1.circle
  25093. }, onClick: this.pickListClickHandler }, icon === ICON_TYPES$1.square ? hAsync("calcite-icon", { icon: ICONS$4.checked, scale: "s" }) : null));
  25094. }
  25095. renderRemoveAction() {
  25096. return this.removable ? (hAsync("calcite-action", { class: CSS$i.remove, icon: ICONS$4.remove, onCalciteActionClick: this.removeClickHandler, slot: SLOTS$9.actionsEnd, text: this.intlRemove })) : null;
  25097. }
  25098. renderActionsStart() {
  25099. const { el } = this;
  25100. const hasActionsStart = getSlotted(el, SLOTS$9.actionsStart);
  25101. return hasActionsStart ? (hAsync("div", { class: { [CSS$i.actions]: true, [CSS$i.actionsStart]: true } }, hAsync("slot", { name: SLOTS$9.actionsStart }))) : null;
  25102. }
  25103. renderActionsEnd() {
  25104. const { el, removable } = this;
  25105. const hasActionsEnd = getSlotted(el, SLOTS$9.actionsEnd);
  25106. return hasActionsEnd || removable ? (hAsync("div", { class: { [CSS$i.actions]: true, [CSS$i.actionsEnd]: true } }, hAsync("slot", { name: SLOTS$9.actionsEnd }), this.renderRemoveAction())) : null;
  25107. }
  25108. render() {
  25109. const { description, label } = this;
  25110. return (hAsync(Fragment, null, this.renderIcon(), this.renderActionsStart(), hAsync("label", { "aria-label": label, class: CSS$i.label, onClick: this.pickListClickHandler, onKeyDown: this.pickListKeyDownHandler, ref: (focusEl) => (this.focusEl = focusEl), tabIndex: 0 }, hAsync("div", { "aria-checked": toAriaBoolean(this.selected), class: CSS$i.textContainer, role: "menuitemcheckbox" }, hAsync("span", { class: CSS$i.title }, label), description ? hAsync("span", { class: CSS$i.description }, description) : null)), this.renderActionsEnd()));
  25111. }
  25112. get el() { return getElement(this); }
  25113. static get watchers() { return {
  25114. "description": ["descriptionWatchHandler"],
  25115. "label": ["labelWatchHandler"],
  25116. "metadata": ["metadataWatchHandler"],
  25117. "selected": ["selectedWatchHandler"],
  25118. "value": ["valueWatchHandler"]
  25119. }; }
  25120. static get style() { return pickListItemCss; }
  25121. static get cmpMeta() { return {
  25122. "$flags$": 9,
  25123. "$tagName$": "calcite-pick-list-item",
  25124. "$members$": {
  25125. "description": [513],
  25126. "disabled": [516],
  25127. "disableDeselect": [516, "disable-deselect"],
  25128. "nonInteractive": [516, "non-interactive"],
  25129. "icon": [513],
  25130. "label": [513],
  25131. "metadata": [16],
  25132. "removable": [516],
  25133. "selected": [1540],
  25134. "intlRemove": [513, "intl-remove"],
  25135. "value": [8],
  25136. "toggleSelected": [64],
  25137. "setFocus": [64]
  25138. },
  25139. "$listeners$": undefined,
  25140. "$lazyBundleId$": "-",
  25141. "$attrsToReflect$": [["description", "description"], ["disabled", "disabled"], ["disableDeselect", "disable-deselect"], ["nonInteractive", "non-interactive"], ["icon", "icon"], ["label", "label"], ["removable", "removable"], ["selected", "selected"], ["intlRemove", "intl-remove"]]
  25142. }; }
  25143. }
  25144. const CSS$h = {
  25145. container: "container",
  25146. arrow: "arrow",
  25147. imageContainer: "image-container",
  25148. closeButtonContainer: "close-button-container",
  25149. closeButton: "close-button",
  25150. content: "content",
  25151. hasHeader: "has-header",
  25152. header: "header",
  25153. headerContent: "header-content",
  25154. heading: "heading"
  25155. };
  25156. const TEXT$6 = {
  25157. close: "Close"
  25158. };
  25159. const defaultPopoverPlacement = "auto";
  25160. const ARIA_CONTROLS = "aria-controls";
  25161. const ARIA_EXPANDED = "aria-expanded";
  25162. const HEADING_LEVEL$2 = 2;
  25163. class PopoverManager$1 {
  25164. constructor() {
  25165. // --------------------------------------------------------------------------
  25166. //
  25167. // Private Properties
  25168. //
  25169. // --------------------------------------------------------------------------
  25170. this.registeredElements = new Map();
  25171. this.registeredElementCount = 0;
  25172. // --------------------------------------------------------------------------
  25173. //
  25174. // Private Methods
  25175. //
  25176. // --------------------------------------------------------------------------
  25177. this.queryPopover = (composedPath) => {
  25178. const { registeredElements } = this;
  25179. const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
  25180. return registeredElements.get(registeredElement);
  25181. };
  25182. this.togglePopovers = (event) => {
  25183. const composedPath = event.composedPath();
  25184. const togglePopover = this.queryPopover(composedPath);
  25185. if (togglePopover && !togglePopover.triggerDisabled) {
  25186. togglePopover.toggle();
  25187. }
  25188. Array.from(this.registeredElements.values())
  25189. .filter((popover) => popover !== togglePopover && popover.autoClose && popover.open && !composedPath.includes(popover))
  25190. .forEach((popover) => popover.toggle(false));
  25191. };
  25192. this.keyHandler = (event) => {
  25193. if (event.defaultPrevented || !isActivationKey(event.key)) {
  25194. return;
  25195. }
  25196. this.togglePopovers(event);
  25197. };
  25198. this.clickHandler = (event) => {
  25199. if (isPrimaryPointerButton(event)) {
  25200. this.togglePopovers(event);
  25201. }
  25202. };
  25203. }
  25204. // --------------------------------------------------------------------------
  25205. //
  25206. // Public Methods
  25207. //
  25208. // --------------------------------------------------------------------------
  25209. registerElement(referenceEl, popover) {
  25210. this.registeredElementCount++;
  25211. this.registeredElements.set(referenceEl, popover);
  25212. if (this.registeredElementCount === 1) {
  25213. this.addListeners();
  25214. }
  25215. }
  25216. unregisterElement(referenceEl) {
  25217. if (this.registeredElements.delete(referenceEl)) {
  25218. this.registeredElementCount--;
  25219. }
  25220. if (this.registeredElementCount === 0) {
  25221. this.removeListeners();
  25222. }
  25223. }
  25224. addListeners() {
  25225. document.addEventListener("pointerdown", this.clickHandler, { capture: true });
  25226. document.addEventListener("keydown", this.keyHandler, { capture: true });
  25227. }
  25228. removeListeners() {
  25229. document.removeEventListener("pointerdown", this.clickHandler, { capture: true });
  25230. document.removeEventListener("keydown", this.keyHandler, { capture: true });
  25231. }
  25232. }
  25233. const popoverCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-popover:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-popover{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-popover{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-popover{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-popover{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-popover{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-popover:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-popover:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-popover-h{display:none}/*!@:host*/.sc-calcite-popover-h{display:block;position:absolute;z-index:900}/*!@.calcite-floating-ui-anim*/.calcite-floating-ui-anim.sc-calcite-popover{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}/*!@:host([data-placement^=bottom]) .calcite-floating-ui-anim*/[data-placement^=bottom].sc-calcite-popover-h .calcite-floating-ui-anim.sc-calcite-popover{transform:translateY(-5px)}/*!@:host([data-placement^=top]) .calcite-floating-ui-anim*/[data-placement^=top].sc-calcite-popover-h .calcite-floating-ui-anim.sc-calcite-popover{transform:translateY(5px)}/*!@:host([data-placement^=left]) .calcite-floating-ui-anim*/[data-placement^=left].sc-calcite-popover-h .calcite-floating-ui-anim.sc-calcite-popover{transform:translateX(5px)}/*!@:host([data-placement^=right]) .calcite-floating-ui-anim*/[data-placement^=right].sc-calcite-popover-h .calcite-floating-ui-anim.sc-calcite-popover{transform:translateX(-5px)}/*!@:host([data-placement]) .calcite-floating-ui-anim--active*/[data-placement].sc-calcite-popover-h .calcite-floating-ui-anim--active.sc-calcite-popover{opacity:1;visibility:visible;transform:translate(0)}/*!@:host([calcite-hydrated-hidden])*/[calcite-hydrated-hidden].sc-calcite-popover-h{visibility:hidden !important;pointer-events:none}/*!@.arrow,\n.arrow::before*/.arrow.sc-calcite-popover,.arrow.sc-calcite-popover::before{position:absolute;inline-size:8px;block-size:8px;z-index:-1}/*!@.arrow::before*/.arrow.sc-calcite-popover::before{content:\"\";--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transform:rotate(45deg);background:var(--calcite-ui-foreground-1)}/*!@:host([data-placement^=top]) .arrow*/[data-placement^=top].sc-calcite-popover-h .arrow.sc-calcite-popover{inset-block-end:-4px}/*!@:host([data-placement^=bottom]) .arrow*/[data-placement^=bottom].sc-calcite-popover-h .arrow.sc-calcite-popover{inset-block-start:-4px}/*!@:host([data-placement^=left]) .arrow*/[data-placement^=left].sc-calcite-popover-h .arrow.sc-calcite-popover{direction:ltr;inset-inline-end:-4px}/*!@:host([data-placement^=right]) .arrow*/[data-placement^=right].sc-calcite-popover-h .arrow.sc-calcite-popover{direction:ltr;inset-inline-start:-4px}/*!@:host*/.sc-calcite-popover-h{pointer-events:none}/*!@:host([open])*/[open].sc-calcite-popover-h{pointer-events:initial}/*!@.calcite-floating-ui-anim*/.calcite-floating-ui-anim.sc-calcite-popover{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}/*!@.arrow::before*/.arrow.sc-calcite-popover::before{outline:1px solid var(--calcite-ui-border-3)}/*!@.header*/.header.sc-calcite-popover{display:flex;flex:1 1 auto;align-items:stretch;justify-content:flex-start;border-width:0px;border-block-end-width:1px;border-style:solid;background-color:var(--calcite-ui-foreground-1);border-block-end-color:var(--calcite-ui-border-3)}/*!@.heading*/.heading.sc-calcite-popover{margin:0px;display:block;flex:1 1 auto;align-self:center;white-space:normal;padding-inline:1rem;padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);word-wrap:break-word;word-break:break-word}/*!@.container*/.container.sc-calcite-popover{position:relative;display:flex;block-size:100%;flex-direction:row;flex-wrap:nowrap;border-radius:0.25rem;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1)}/*!@.container.has-header*/.container.has-header.sc-calcite-popover{flex-direction:column}/*!@.content*/.content.sc-calcite-popover{display:flex;block-size:100%;inline-size:100%;flex-direction:column;flex-wrap:nowrap;align-self:center;word-wrap:break-word;word-break:break-word}/*!@.close-button-container*/.close-button-container.sc-calcite-popover{display:flex;overflow:hidden;flex:0 0 auto;border-start-end-radius:0.25rem;border-end-end-radius:0.25rem}/*!@::slotted(calcite-panel), \n::slotted(calcite-flow)*/.sc-calcite-popover-s>calcite-panel,.sc-calcite-popover-s>calcite-flow{block-size:100%}";
  25234. const manager$1 = new PopoverManager$1();
  25235. /**
  25236. * @slot - A slot for adding custom content.
  25237. */
  25238. class Popover {
  25239. constructor(hostRef) {
  25240. registerInstance(this, hostRef);
  25241. this.calcitePopoverBeforeClose = createEvent(this, "calcitePopoverBeforeClose", 6);
  25242. this.calcitePopoverClose = createEvent(this, "calcitePopoverClose", 6);
  25243. this.calcitePopoverBeforeOpen = createEvent(this, "calcitePopoverBeforeOpen", 6);
  25244. this.calcitePopoverOpen = createEvent(this, "calcitePopoverOpen", 6);
  25245. // --------------------------------------------------------------------------
  25246. //
  25247. // Properties
  25248. //
  25249. // --------------------------------------------------------------------------
  25250. /**
  25251. * When `true`, clicking outside of the component automatically closes open `calcite-popover`s.
  25252. */
  25253. this.autoClose = false;
  25254. /**
  25255. * When `true`, a close button is added to the component.
  25256. *
  25257. * @deprecated use dismissible instead.
  25258. */
  25259. this.closeButton = false;
  25260. /**
  25261. * When `true`, a close button is added to the component.
  25262. *
  25263. * @deprecated use `closable` instead.
  25264. */
  25265. this.dismissible = false;
  25266. /** When `true`, display a close button within the component. */
  25267. this.closable = false;
  25268. /**
  25269. * When `true`, prevents flipping the component's placement when overlapping its `referenceElement`.
  25270. */
  25271. this.disableFlip = false;
  25272. /**
  25273. * When `true`, removes the caret pointer.
  25274. */
  25275. this.disablePointer = false;
  25276. /**
  25277. * Offsets the position of the component away from the `referenceElement`.
  25278. *
  25279. * @default 6
  25280. */
  25281. this.offsetDistance = defaultOffsetDistance;
  25282. /**
  25283. * Offsets the position of the component along the `referenceElement`.
  25284. */
  25285. this.offsetSkidding = 0;
  25286. /**
  25287. * When `true`, displays and positions the component.
  25288. */
  25289. this.open = false;
  25290. /**
  25291. * Determines the type of positioning to use for the overlaid content.
  25292. *
  25293. * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
  25294. *
  25295. * `"fixed"` value should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
  25296. *
  25297. */
  25298. this.overlayPositioning = "absolute";
  25299. /**
  25300. * Determines where the component will be positioned relative to the `referenceElement`.
  25301. *
  25302. * @see [LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)
  25303. */
  25304. this.placement = defaultPopoverPlacement;
  25305. /**
  25306. * When `true`, disables automatically toggling the component when its `referenceElement` has been triggered.
  25307. *
  25308. * This property can be set to `true` to manage when the component is open.
  25309. */
  25310. this.triggerDisabled = false;
  25311. /**
  25312. * Accessible name for the component's close button.
  25313. *
  25314. * @default "Close"
  25315. */
  25316. this.intlClose = TEXT$6.close;
  25317. this.guid = `calcite-popover-${guid()}`;
  25318. this.openTransitionProp = "opacity";
  25319. this.hasLoaded = false;
  25320. // --------------------------------------------------------------------------
  25321. //
  25322. // Private Methods
  25323. //
  25324. // --------------------------------------------------------------------------
  25325. this.setTransitionEl = (el) => {
  25326. this.transitionEl = el;
  25327. connectOpenCloseComponent(this);
  25328. };
  25329. this.setFilteredPlacements = () => {
  25330. const { el, flipPlacements } = this;
  25331. this.filteredFlipPlacements = flipPlacements
  25332. ? filterComputedPlacements(flipPlacements, el)
  25333. : null;
  25334. };
  25335. this.setUpReferenceElement = (warn = true) => {
  25336. this.removeReferences();
  25337. this.effectiveReferenceElement = this.getReferenceElement();
  25338. connectFloatingUI(this, this.effectiveReferenceElement, this.el);
  25339. const { el, referenceElement, effectiveReferenceElement } = this;
  25340. if (warn && referenceElement && !effectiveReferenceElement) {
  25341. console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
  25342. el
  25343. });
  25344. }
  25345. this.addReferences();
  25346. };
  25347. this.getId = () => {
  25348. return this.el.id || this.guid;
  25349. };
  25350. this.setExpandedAttr = () => {
  25351. const { effectiveReferenceElement, open } = this;
  25352. if (!effectiveReferenceElement) {
  25353. return;
  25354. }
  25355. if ("setAttribute" in effectiveReferenceElement) {
  25356. effectiveReferenceElement.setAttribute(ARIA_EXPANDED, toAriaBoolean(open));
  25357. }
  25358. };
  25359. this.addReferences = () => {
  25360. const { effectiveReferenceElement } = this;
  25361. if (!effectiveReferenceElement) {
  25362. return;
  25363. }
  25364. const id = this.getId();
  25365. if ("setAttribute" in effectiveReferenceElement) {
  25366. effectiveReferenceElement.setAttribute(ARIA_CONTROLS, id);
  25367. }
  25368. manager$1.registerElement(effectiveReferenceElement, this.el);
  25369. this.setExpandedAttr();
  25370. };
  25371. this.removeReferences = () => {
  25372. const { effectiveReferenceElement } = this;
  25373. if (!effectiveReferenceElement) {
  25374. return;
  25375. }
  25376. if ("removeAttribute" in effectiveReferenceElement) {
  25377. effectiveReferenceElement.removeAttribute(ARIA_CONTROLS);
  25378. effectiveReferenceElement.removeAttribute(ARIA_EXPANDED);
  25379. }
  25380. manager$1.unregisterElement(effectiveReferenceElement);
  25381. };
  25382. this.hide = () => {
  25383. this.open = false;
  25384. };
  25385. this.storeArrowEl = (el) => {
  25386. this.arrowEl = el;
  25387. this.reposition(true);
  25388. };
  25389. }
  25390. handleDismissible(value) {
  25391. this.closable = value;
  25392. }
  25393. handleClosable(value) {
  25394. this.dismissible = value;
  25395. }
  25396. flipPlacementsHandler() {
  25397. this.setFilteredPlacements();
  25398. this.reposition(true);
  25399. }
  25400. offsetDistanceOffsetHandler() {
  25401. this.reposition(true);
  25402. }
  25403. offsetSkiddingHandler() {
  25404. this.reposition(true);
  25405. }
  25406. openHandler(value) {
  25407. if (value) {
  25408. this.reposition(true);
  25409. }
  25410. else {
  25411. updateAfterClose(this.el);
  25412. }
  25413. this.setExpandedAttr();
  25414. }
  25415. overlayPositioningHandler() {
  25416. this.reposition(true);
  25417. }
  25418. placementHandler() {
  25419. this.reposition(true);
  25420. }
  25421. referenceElementHandler() {
  25422. this.setUpReferenceElement();
  25423. this.reposition(true);
  25424. }
  25425. // --------------------------------------------------------------------------
  25426. //
  25427. // Lifecycle
  25428. //
  25429. // --------------------------------------------------------------------------
  25430. connectedCallback() {
  25431. this.setFilteredPlacements();
  25432. connectOpenCloseComponent(this);
  25433. const closable = this.closable || this.dismissible;
  25434. if (closable) {
  25435. this.handleDismissible(closable);
  25436. }
  25437. if (closable) {
  25438. this.handleClosable(closable);
  25439. }
  25440. this.setUpReferenceElement(this.hasLoaded);
  25441. }
  25442. componentDidLoad() {
  25443. if (this.referenceElement && !this.effectiveReferenceElement) {
  25444. this.setUpReferenceElement();
  25445. }
  25446. this.reposition();
  25447. this.hasLoaded = true;
  25448. }
  25449. disconnectedCallback() {
  25450. this.removeReferences();
  25451. disconnectFloatingUI(this, this.effectiveReferenceElement, this.el);
  25452. disconnectOpenCloseComponent(this);
  25453. }
  25454. // --------------------------------------------------------------------------
  25455. //
  25456. // Public Methods
  25457. //
  25458. // --------------------------------------------------------------------------
  25459. /**
  25460. * Updates the position of the component.
  25461. *
  25462. * @param delayed
  25463. */
  25464. async reposition(delayed = false) {
  25465. const { el, effectiveReferenceElement, placement, overlayPositioning, disableFlip, filteredFlipPlacements, offsetDistance, offsetSkidding, arrowEl } = this;
  25466. return reposition(this, {
  25467. floatingEl: el,
  25468. referenceEl: effectiveReferenceElement,
  25469. overlayPositioning,
  25470. placement,
  25471. disableFlip,
  25472. flipPlacements: filteredFlipPlacements,
  25473. offsetDistance,
  25474. offsetSkidding,
  25475. includeArrow: !this.disablePointer,
  25476. arrowEl,
  25477. type: "popover"
  25478. }, delayed);
  25479. }
  25480. /**
  25481. * Sets focus on the component.
  25482. *
  25483. * @param focusId
  25484. */
  25485. async setFocus(focusId) {
  25486. var _a;
  25487. const { closeButtonEl } = this;
  25488. if (focusId === "close-button" && closeButtonEl) {
  25489. forceUpdate$1(closeButtonEl);
  25490. closeButtonEl.setFocus();
  25491. return;
  25492. }
  25493. (_a = this.el) === null || _a === void 0 ? void 0 : _a.focus();
  25494. }
  25495. /**
  25496. * Toggles the component's open property.
  25497. *
  25498. * @param value
  25499. */
  25500. async toggle(value = !this.open) {
  25501. this.open = value;
  25502. }
  25503. getReferenceElement() {
  25504. const { referenceElement, el } = this;
  25505. return ((typeof referenceElement === "string"
  25506. ? queryElementRoots(el, { id: referenceElement })
  25507. : referenceElement) || null);
  25508. }
  25509. onBeforeOpen() {
  25510. this.calcitePopoverBeforeOpen.emit();
  25511. }
  25512. onOpen() {
  25513. this.calcitePopoverOpen.emit();
  25514. }
  25515. onBeforeClose() {
  25516. this.calcitePopoverBeforeClose.emit();
  25517. }
  25518. onClose() {
  25519. this.calcitePopoverClose.emit();
  25520. }
  25521. // --------------------------------------------------------------------------
  25522. //
  25523. // Render Methods
  25524. //
  25525. // --------------------------------------------------------------------------
  25526. renderCloseButton() {
  25527. const { closeButton, intlClose, heading, closable } = this;
  25528. return closable || closeButton ? (hAsync("div", { class: CSS$h.closeButtonContainer }, hAsync("calcite-action", { class: CSS$h.closeButton, onClick: this.hide, ref: (closeButtonEl) => (this.closeButtonEl = closeButtonEl), scale: heading ? "s" : "m", text: intlClose }, hAsync("calcite-icon", { icon: "x", scale: heading ? "s" : "m" })))) : null;
  25529. }
  25530. renderHeader() {
  25531. const { heading, headingLevel } = this;
  25532. const headingNode = heading ? (hAsync(Heading, { class: CSS$h.heading, level: headingLevel || HEADING_LEVEL$2 }, heading)) : null;
  25533. return headingNode ? (hAsync("div", { class: CSS$h.header }, headingNode, this.renderCloseButton())) : null;
  25534. }
  25535. render() {
  25536. const { effectiveReferenceElement, heading, label, open, disablePointer } = this;
  25537. const displayed = effectiveReferenceElement && open;
  25538. const hidden = !displayed;
  25539. const arrowNode = !disablePointer ? hAsync("div", { class: CSS$h.arrow, ref: this.storeArrowEl }) : null;
  25540. return (hAsync(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "aria-live": "polite", "calcite-hydrated-hidden": hidden, id: this.getId(), role: "dialog" }, hAsync("div", { class: {
  25541. [FloatingCSS.animation]: true,
  25542. [FloatingCSS.animationActive]: displayed
  25543. }, ref: this.setTransitionEl }, arrowNode, hAsync("div", { class: {
  25544. [CSS$h.hasHeader]: !!heading,
  25545. [CSS$h.container]: true
  25546. } }, this.renderHeader(), hAsync("div", { class: CSS$h.content }, hAsync("slot", null)), !heading ? this.renderCloseButton() : null))));
  25547. }
  25548. get el() { return getElement(this); }
  25549. static get watchers() { return {
  25550. "dismissible": ["handleDismissible"],
  25551. "closable": ["handleClosable"],
  25552. "flipPlacements": ["flipPlacementsHandler"],
  25553. "offsetDistance": ["offsetDistanceOffsetHandler"],
  25554. "offsetSkidding": ["offsetSkiddingHandler"],
  25555. "open": ["openHandler"],
  25556. "overlayPositioning": ["overlayPositioningHandler"],
  25557. "placement": ["placementHandler"],
  25558. "referenceElement": ["referenceElementHandler"]
  25559. }; }
  25560. static get style() { return popoverCss; }
  25561. static get cmpMeta() { return {
  25562. "$flags$": 9,
  25563. "$tagName$": "calcite-popover",
  25564. "$members$": {
  25565. "autoClose": [516, "auto-close"],
  25566. "closeButton": [516, "close-button"],
  25567. "dismissible": [1540],
  25568. "closable": [1540],
  25569. "disableFlip": [516, "disable-flip"],
  25570. "disablePointer": [516, "disable-pointer"],
  25571. "flipPlacements": [16],
  25572. "heading": [1],
  25573. "headingLevel": [514, "heading-level"],
  25574. "label": [1],
  25575. "offsetDistance": [514, "offset-distance"],
  25576. "offsetSkidding": [514, "offset-skidding"],
  25577. "open": [1540],
  25578. "overlayPositioning": [513, "overlay-positioning"],
  25579. "placement": [513],
  25580. "referenceElement": [1, "reference-element"],
  25581. "triggerDisabled": [516, "trigger-disabled"],
  25582. "intlClose": [1, "intl-close"],
  25583. "effectiveReferenceElement": [32],
  25584. "reposition": [64],
  25585. "setFocus": [64],
  25586. "toggle": [64]
  25587. },
  25588. "$listeners$": undefined,
  25589. "$lazyBundleId$": "-",
  25590. "$attrsToReflect$": [["autoClose", "auto-close"], ["closeButton", "close-button"], ["dismissible", "dismissible"], ["closable", "closable"], ["disableFlip", "disable-flip"], ["disablePointer", "disable-pointer"], ["headingLevel", "heading-level"], ["offsetDistance", "offset-distance"], ["offsetSkidding", "offset-skidding"], ["open", "open"], ["overlayPositioning", "overlay-positioning"], ["placement", "placement"], ["triggerDisabled", "trigger-disabled"]]
  25591. }; }
  25592. }
  25593. const popoverManagerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-popover-manager:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-popover-manager{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-popover-manager{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-popover-manager{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-popover-manager{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-popover-manager{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-popover-manager:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-popover-manager:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-popover-manager-h{display:none}/*!@:host*/.sc-calcite-popover-manager-h{position:relative;display:block}";
  25594. /**
  25595. * @slot - A slot for adding elements that reference a 'calcite-popover' by the 'selector' property.
  25596. * @deprecated No longer required for popover usage.
  25597. */
  25598. class PopoverManager {
  25599. constructor(hostRef) {
  25600. registerInstance(this, hostRef);
  25601. this.mutationObserver = createObserver();
  25602. // --------------------------------------------------------------------------
  25603. //
  25604. // Properties
  25605. //
  25606. // --------------------------------------------------------------------------
  25607. /**
  25608. * CSS Selector to match reference elements for popovers. Reference elements will be identified by this selector in order to open their associated popover.
  25609. *
  25610. * @default `[data-calcite-popover-reference]`
  25611. */
  25612. this.selector = "[data-calcite-popover-reference]";
  25613. /**
  25614. * Automatically closes any currently open popovers when clicking outside of a popover.
  25615. */
  25616. this.autoClose = false;
  25617. }
  25618. autoCloseHandler() {
  25619. this.setAutoClose();
  25620. }
  25621. // --------------------------------------------------------------------------
  25622. //
  25623. // Lifecycle
  25624. //
  25625. // --------------------------------------------------------------------------
  25626. connectedCallback() {
  25627. var _a;
  25628. this.setAutoClose();
  25629. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  25630. }
  25631. disconnectedCallback() {
  25632. var _a;
  25633. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  25634. }
  25635. // --------------------------------------------------------------------------
  25636. //
  25637. // Render Methods
  25638. //
  25639. // --------------------------------------------------------------------------
  25640. render() {
  25641. return hAsync("slot", null);
  25642. }
  25643. // --------------------------------------------------------------------------
  25644. //
  25645. // Private Methods
  25646. //
  25647. // --------------------------------------------------------------------------
  25648. setAutoClose() {
  25649. const { autoClose, el } = this;
  25650. el.querySelectorAll("calcite-popover").forEach((popover) => (popover.autoClose = autoClose));
  25651. }
  25652. get el() { return getElement(this); }
  25653. static get watchers() { return {
  25654. "autoClose": ["autoCloseHandler"]
  25655. }; }
  25656. static get style() { return popoverManagerCss; }
  25657. static get cmpMeta() { return {
  25658. "$flags$": 9,
  25659. "$tagName$": "calcite-popover-manager",
  25660. "$members$": {
  25661. "selector": [513],
  25662. "autoClose": [516, "auto-close"]
  25663. },
  25664. "$listeners$": undefined,
  25665. "$lazyBundleId$": "-",
  25666. "$attrsToReflect$": [["selector", "selector"], ["autoClose", "auto-close"]]
  25667. }; }
  25668. }
  25669. const progressCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-progress:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-progress{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-progress{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-progress{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-progress{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-progress{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-progress:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-progress:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-progress-h{display:none}/*!@:host*/.sc-calcite-progress-h{position:relative;display:block;inline-size:100%}/*!@.track, \n.bar*/.track.sc-calcite-progress,.bar.sc-calcite-progress{position:absolute;inset-block-start:0px;block-size:2px}/*!@.track*/.track.sc-calcite-progress{z-index:1;inline-size:100%;overflow:hidden;background:var(--calcite-ui-border-3)}/*!@.bar*/.bar.sc-calcite-progress{z-index:1;background-color:var(--calcite-ui-brand)}@media (forced-colors: active){/*!@.track*/.track.sc-calcite-progress{background-color:highlightText}/*!@.bar*/.bar.sc-calcite-progress{background-color:linkText}}/*!@.indeterminate*/.indeterminate.sc-calcite-progress{inline-size:20%;animation:looping-progress-bar-ani calc(var(--calcite-internal-animation-timing-medium) * 11) linear infinite}/*!@.reversed*/.reversed.sc-calcite-progress{animation-direction:reverse}/*!@.text*/.text.sc-calcite-progress{padding-inline:0px;padding-block:1rem 0px;text-align:center;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}@keyframes looping-progress-bar-ani{0%{transform:translate3d(-100%, 0, 0)}50%{inline-size:40%}100%{transform:translate3d(600%, 0, 0)}}";
  25670. class Progress {
  25671. constructor(hostRef) {
  25672. registerInstance(this, hostRef);
  25673. /**
  25674. * Specifies the component type.
  25675. *
  25676. * Use `"indeterminate"` if finding actual progress value is impossible.
  25677. *
  25678. */
  25679. this.type = "determinate";
  25680. /** The component's progress value, with a range of 0.0 - 1.0. */
  25681. this.value = 0;
  25682. /** When `true` and for `"indeterminate"` progress bars, reverses the animation direction. */
  25683. this.reversed = false;
  25684. }
  25685. render() {
  25686. const isDeterminate = this.type === "determinate";
  25687. const barStyles = isDeterminate ? { width: `${this.value * 100}%` } : {};
  25688. return (hAsync("div", { "aria-label": this.label || this.text, "aria-valuemax": 1, "aria-valuemin": 0, "aria-valuenow": this.value, role: "progressbar" }, hAsync("div", { class: "track" }, hAsync("div", { class: {
  25689. bar: true,
  25690. indeterminate: this.type === "indeterminate",
  25691. reversed: this.reversed
  25692. }, style: barStyles })), this.text ? hAsync("div", { class: "text" }, this.text) : null));
  25693. }
  25694. get el() { return getElement(this); }
  25695. static get style() { return progressCss; }
  25696. static get cmpMeta() { return {
  25697. "$flags$": 9,
  25698. "$tagName$": "calcite-progress",
  25699. "$members$": {
  25700. "type": [513],
  25701. "value": [2],
  25702. "label": [1],
  25703. "text": [1],
  25704. "reversed": [516]
  25705. },
  25706. "$listeners$": undefined,
  25707. "$lazyBundleId$": "-",
  25708. "$attrsToReflect$": [["type", "type"], ["reversed", "reversed"]]
  25709. }; }
  25710. }
  25711. const CSS$g = {
  25712. container: "container"
  25713. };
  25714. const radioButtonCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-radio-button:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-radio-button{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-radio-button{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-radio-button{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-radio-button{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-radio-button{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-radio-button:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-radio-button:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-radio-button-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-radio-button-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-radio-button-h{display:block;cursor:pointer}/*!@:host .container*/.sc-calcite-radio-button-h .container.sc-calcite-radio-button{position:relative;outline:2px solid transparent;outline-offset:2px}/*!@:host .radio*/.sc-calcite-radio-button-h .radio.sc-calcite-radio-button{cursor:pointer;border-radius:9999px;background-color:var(--calcite-ui-foreground-1);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input)}/*!@:host([hovered]) .radio,\n:host(:not([checked])[focused]:not([disabled])) .radio*/[hovered].sc-calcite-radio-button-h .radio.sc-calcite-radio-button,.sc-calcite-radio-button-h:not([checked])[focused]:not([disabled]) .radio.sc-calcite-radio-button{box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@:host([focused]) .radio*/[focused].sc-calcite-radio-button-h .radio.sc-calcite-radio-button{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@:host([disabled]) .radio*/[disabled].sc-calcite-radio-button-h .radio.sc-calcite-radio-button{cursor:default;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-radio-button-h[disabled] .sc-calcite-radio-button-s>[calcite-hydrated][disabled],[disabled].sc-calcite-radio-button-h [calcite-hydrated][disabled].sc-calcite-radio-button{opacity:1}/*!@:host([hovered][disabled]) .radio*/[hovered][disabled].sc-calcite-radio-button-h .radio.sc-calcite-radio-button{box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input)}/*!@:host([scale=s])*/[scale=s].sc-calcite-radio-button-h{--calcite-radio-size:var(--calcite-font-size--2)}/*!@:host([scale=m])*/[scale=m].sc-calcite-radio-button-h{--calcite-radio-size:var(--calcite-font-size--1)}/*!@:host([scale=l])*/[scale=l].sc-calcite-radio-button-h{--calcite-radio-size:var(--calcite-font-size-0)}/*!@.radio*/.radio.sc-calcite-radio-button{block-size:var(--calcite-radio-size);max-inline-size:var(--calcite-radio-size);min-inline-size:var(--calcite-radio-size)}/*!@:host([scale=s][checked]) .radio,\n:host([hovered][scale=s][checked][disabled]) .radio*/[scale=s][checked].sc-calcite-radio-button-h .radio.sc-calcite-radio-button,[hovered][scale=s][checked][disabled].sc-calcite-radio-button-h .radio.sc-calcite-radio-button{box-shadow:inset 0 0 0 4px var(--calcite-ui-brand)}/*!@:host([scale=s][focused][checked]:not([disabled])) .radio*/[scale=s][focused][checked].sc-calcite-radio-button-h:not([disabled]) .radio.sc-calcite-radio-button{box-shadow:inset 0 0 0 4px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host([scale=m][checked]) .radio,\n:host([hovered][scale=m][checked][disabled]) .radio*/[scale=m][checked].sc-calcite-radio-button-h .radio.sc-calcite-radio-button,[hovered][scale=m][checked][disabled].sc-calcite-radio-button-h .radio.sc-calcite-radio-button{box-shadow:inset 0 0 0 5px var(--calcite-ui-brand)}/*!@:host([scale=m][focused][checked]:not([disabled])) .radio*/[scale=m][focused][checked].sc-calcite-radio-button-h:not([disabled]) .radio.sc-calcite-radio-button{box-shadow:inset 0 0 0 5px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host([scale=l][checked]) .radio,\n:host([hovered][scale=l][checked][disabled]) .radio*/[scale=l][checked].sc-calcite-radio-button-h .radio.sc-calcite-radio-button,[hovered][scale=l][checked][disabled].sc-calcite-radio-button-h .radio.sc-calcite-radio-button{box-shadow:inset 0 0 0 6px var(--calcite-ui-brand)}/*!@:host([scale=l][focused][checked]:not([disabled])) .radio*/[scale=l][focused][checked].sc-calcite-radio-button-h:not([disabled]) .radio.sc-calcite-radio-button{box-shadow:inset 0 0 0 6px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1)}@media (forced-colors: active){/*!@:host([checked]) .radio::after,\n:host([checked][disabled]) .radio::after*/[checked].sc-calcite-radio-button-h .radio.sc-calcite-radio-button::after,[checked][disabled].sc-calcite-radio-button-h .radio.sc-calcite-radio-button::after{content:\"\";inline-size:var(--calcite-radio-size);block-size:var(--calcite-radio-size);background-color:windowText;display:block}}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-radio-button-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  25715. class RadioButton {
  25716. constructor(hostRef) {
  25717. registerInstance(this, hostRef);
  25718. this.calciteInternalRadioButtonBlur = createEvent(this, "calciteInternalRadioButtonBlur", 6);
  25719. this.calciteRadioButtonChange = createEvent(this, "calciteRadioButtonChange", 6);
  25720. this.calciteInternalRadioButtonCheckedChange = createEvent(this, "calciteInternalRadioButtonCheckedChange", 6);
  25721. this.calciteInternalRadioButtonFocus = createEvent(this, "calciteInternalRadioButtonFocus", 6);
  25722. //--------------------------------------------------------------------------
  25723. //
  25724. // Properties
  25725. //
  25726. //--------------------------------------------------------------------------
  25727. /** When `true`, the component is checked. */
  25728. this.checked = false;
  25729. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  25730. this.disabled = false;
  25731. /**
  25732. * The focused state of the component.
  25733. *
  25734. * @internal
  25735. */
  25736. this.focused = false;
  25737. /** When `true`, the component is not displayed and is not focusable or checkable. */
  25738. this.hidden = false;
  25739. /**
  25740. * The hovered state of the component.
  25741. *
  25742. * @internal
  25743. */
  25744. this.hovered = false;
  25745. /** When `true`, the component must have a value selected from the `calcite-radio-button-group` in order for the form to submit. */
  25746. this.required = false;
  25747. /** Specifies the size of the component inherited from the `calcite-radio-button-group`. */
  25748. this.scale = "m";
  25749. //--------------------------------------------------------------------------
  25750. //
  25751. // Private Methods
  25752. //
  25753. //--------------------------------------------------------------------------
  25754. this.selectItem = (items, selectedIndex) => {
  25755. items[selectedIndex].click();
  25756. };
  25757. this.queryButtons = () => {
  25758. return Array.from(this.rootNode.querySelectorAll("calcite-radio-button:not([hidden])")).filter((radioButton) => radioButton.name === this.name);
  25759. };
  25760. this.isDefaultSelectable = () => {
  25761. const radioButtons = this.queryButtons();
  25762. return !radioButtons.some((radioButton) => radioButton.checked) && radioButtons[0] === this.el;
  25763. };
  25764. this.check = () => {
  25765. if (this.disabled) {
  25766. return;
  25767. }
  25768. this.uncheckAllRadioButtonsInGroup();
  25769. this.checked = true;
  25770. this.focused = true;
  25771. this.calciteRadioButtonChange.emit();
  25772. this.setFocus();
  25773. };
  25774. this.clickHandler = () => {
  25775. this.check();
  25776. };
  25777. this.setContainerEl = (el) => {
  25778. this.containerEl = el;
  25779. };
  25780. this.handleKeyDown = (event) => {
  25781. const keys = ["ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", " "];
  25782. const { key } = event;
  25783. const { el } = this;
  25784. if (keys.indexOf(key) === -1) {
  25785. return;
  25786. }
  25787. if (key === " ") {
  25788. this.check();
  25789. event.preventDefault();
  25790. return;
  25791. }
  25792. let adjustedKey = key;
  25793. if (getElementDir(el) === "rtl") {
  25794. if (key === "ArrowRight") {
  25795. adjustedKey = "ArrowLeft";
  25796. }
  25797. if (key === "ArrowLeft") {
  25798. adjustedKey = "ArrowRight";
  25799. }
  25800. }
  25801. const radioButtons = Array.from(this.rootNode.querySelectorAll("calcite-radio-button:not([hidden]")).filter((radioButton) => radioButton.name === this.name);
  25802. let currentIndex = 0;
  25803. const radioButtonsLength = radioButtons.length;
  25804. radioButtons.some((item, index) => {
  25805. if (item.checked) {
  25806. currentIndex = index;
  25807. return true;
  25808. }
  25809. });
  25810. switch (adjustedKey) {
  25811. case "ArrowLeft":
  25812. case "ArrowUp":
  25813. event.preventDefault();
  25814. this.selectItem(radioButtons, getRoundRobinIndex(Math.max(currentIndex - 1, -1), radioButtonsLength));
  25815. return;
  25816. case "ArrowRight":
  25817. case "ArrowDown":
  25818. event.preventDefault();
  25819. this.selectItem(radioButtons, getRoundRobinIndex(currentIndex + 1, radioButtonsLength));
  25820. return;
  25821. default:
  25822. return;
  25823. }
  25824. };
  25825. this.onContainerBlur = () => {
  25826. this.focused = false;
  25827. this.calciteInternalRadioButtonBlur.emit();
  25828. };
  25829. this.onContainerFocus = () => {
  25830. if (!this.disabled) {
  25831. this.focused = true;
  25832. this.calciteInternalRadioButtonFocus.emit();
  25833. }
  25834. };
  25835. }
  25836. checkedChanged(newChecked) {
  25837. if (newChecked) {
  25838. this.uncheckOtherRadioButtonsInGroup();
  25839. }
  25840. this.calciteInternalRadioButtonCheckedChange.emit();
  25841. }
  25842. nameChanged() {
  25843. this.checkLastRadioButton();
  25844. }
  25845. //--------------------------------------------------------------------------
  25846. //
  25847. // Public Methods
  25848. //
  25849. //--------------------------------------------------------------------------
  25850. /** Sets focus on the component. */
  25851. async setFocus() {
  25852. if (!this.disabled) {
  25853. focusElement(this.containerEl);
  25854. }
  25855. }
  25856. onLabelClick(event) {
  25857. if (!this.disabled && !this.hidden) {
  25858. this.uncheckOtherRadioButtonsInGroup();
  25859. const label = event.currentTarget;
  25860. const radioButton = label.for
  25861. ? this.rootNode.querySelector(`calcite-radio-button[id="${label.for}"]`)
  25862. : label.querySelector(`calcite-radio-button[name="${this.name}"]`);
  25863. if (radioButton) {
  25864. radioButton.checked = true;
  25865. radioButton.focused = true;
  25866. }
  25867. this.calciteRadioButtonChange.emit();
  25868. this.setFocus();
  25869. }
  25870. }
  25871. checkLastRadioButton() {
  25872. const radioButtons = this.queryButtons();
  25873. const checkedRadioButtons = radioButtons.filter((radioButton) => radioButton.checked);
  25874. if ((checkedRadioButtons === null || checkedRadioButtons === void 0 ? void 0 : checkedRadioButtons.length) > 1) {
  25875. const lastCheckedRadioButton = checkedRadioButtons[checkedRadioButtons.length - 1];
  25876. checkedRadioButtons
  25877. .filter((checkedRadioButton) => checkedRadioButton !== lastCheckedRadioButton)
  25878. .forEach((checkedRadioButton) => {
  25879. checkedRadioButton.checked = false;
  25880. checkedRadioButton.emitCheckedChange();
  25881. });
  25882. }
  25883. }
  25884. /** @internal */
  25885. async emitCheckedChange() {
  25886. this.calciteInternalRadioButtonCheckedChange.emit();
  25887. }
  25888. uncheckAllRadioButtonsInGroup() {
  25889. const radioButtons = this.queryButtons();
  25890. radioButtons.forEach((radioButton) => {
  25891. if (radioButton.checked) {
  25892. radioButton.checked = false;
  25893. radioButton.focused = false;
  25894. }
  25895. });
  25896. }
  25897. uncheckOtherRadioButtonsInGroup() {
  25898. const radioButtons = this.queryButtons();
  25899. const otherRadioButtons = radioButtons.filter((radioButton) => radioButton.guid !== this.guid);
  25900. otherRadioButtons.forEach((otherRadioButton) => {
  25901. if (otherRadioButton.checked) {
  25902. otherRadioButton.checked = false;
  25903. otherRadioButton.focused = false;
  25904. }
  25905. });
  25906. }
  25907. getTabIndex() {
  25908. if (this.disabled) {
  25909. return undefined;
  25910. }
  25911. return this.checked || this.isDefaultSelectable() ? 0 : -1;
  25912. }
  25913. //--------------------------------------------------------------------------
  25914. //
  25915. // Event Listeners
  25916. //
  25917. //--------------------------------------------------------------------------
  25918. mouseenter() {
  25919. this.hovered = true;
  25920. }
  25921. mouseleave() {
  25922. this.hovered = false;
  25923. }
  25924. //--------------------------------------------------------------------------
  25925. //
  25926. // Lifecycle
  25927. //
  25928. //--------------------------------------------------------------------------
  25929. connectedCallback() {
  25930. this.rootNode = this.el.getRootNode();
  25931. this.guid = this.el.id || `calcite-radio-button-${guid()}`;
  25932. if (this.name) {
  25933. this.checkLastRadioButton();
  25934. }
  25935. connectLabel(this);
  25936. connectForm(this);
  25937. }
  25938. componentDidLoad() {
  25939. if (this.focused && !this.disabled) {
  25940. this.setFocus();
  25941. }
  25942. }
  25943. disconnectedCallback() {
  25944. disconnectLabel(this);
  25945. disconnectForm(this);
  25946. }
  25947. componentDidRender() {
  25948. updateHostInteraction(this);
  25949. }
  25950. // --------------------------------------------------------------------------
  25951. //
  25952. // Render Methods
  25953. //
  25954. // --------------------------------------------------------------------------
  25955. render() {
  25956. const tabIndex = this.getTabIndex();
  25957. return (hAsync(Host, { onClick: this.clickHandler, onKeyDown: this.handleKeyDown }, hAsync("div", { "aria-checked": toAriaBoolean(this.checked), "aria-label": getLabelText(this), class: CSS$g.container, onBlur: this.onContainerBlur, onFocus: this.onContainerFocus, ref: this.setContainerEl, role: "radio", tabIndex: tabIndex }, hAsync("div", { class: "radio" })), hAsync(HiddenFormInputSlot, { component: this })));
  25958. }
  25959. get el() { return getElement(this); }
  25960. static get watchers() { return {
  25961. "checked": ["checkedChanged"],
  25962. "name": ["nameChanged"]
  25963. }; }
  25964. static get style() { return radioButtonCss; }
  25965. static get cmpMeta() { return {
  25966. "$flags$": 9,
  25967. "$tagName$": "calcite-radio-button",
  25968. "$members$": {
  25969. "checked": [1540],
  25970. "disabled": [516],
  25971. "focused": [1540],
  25972. "guid": [1537],
  25973. "hidden": [516],
  25974. "hovered": [1540],
  25975. "label": [1],
  25976. "name": [513],
  25977. "required": [516],
  25978. "scale": [513],
  25979. "value": [1032],
  25980. "setFocus": [64],
  25981. "emitCheckedChange": [64]
  25982. },
  25983. "$listeners$": [[1, "pointerenter", "mouseenter"], [1, "pointerleave", "mouseleave"]],
  25984. "$lazyBundleId$": "-",
  25985. "$attrsToReflect$": [["checked", "checked"], ["disabled", "disabled"], ["focused", "focused"], ["guid", "guid"], ["hidden", "hidden"], ["hovered", "hovered"], ["name", "name"], ["required", "required"], ["scale", "scale"]]
  25986. }; }
  25987. }
  25988. const radioButtonGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-radio-button-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-radio-button-group{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-radio-button-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-radio-button-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-radio-button-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-radio-button-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-radio-button-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-radio-button-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-radio-button-group-h{display:none}/*!@:host*/.sc-calcite-radio-button-group-h{display:flex;max-inline-size:100vw}/*!@:host([layout=horizontal])*/[layout=horizontal].sc-calcite-radio-button-group-h{flex-direction:row;flex-wrap:wrap}/*!@:host([layout=horizontal][scale=s])*/[layout=horizontal][scale=s].sc-calcite-radio-button-group-h{gap:1rem}/*!@:host([layout=horizontal][scale=m])*/[layout=horizontal][scale=m].sc-calcite-radio-button-group-h{gap:1.25rem}/*!@:host([layout=horizontal][scale=l])*/[layout=horizontal][scale=l].sc-calcite-radio-button-group-h{gap:1.5rem}/*!@:host([layout=vertical])*/[layout=vertical].sc-calcite-radio-button-group-h{flex-direction:column}";
  25989. /**
  25990. * @slot - A slot for adding `calcite-radio-button`s.
  25991. */
  25992. class RadioButtonGroup {
  25993. constructor(hostRef) {
  25994. registerInstance(this, hostRef);
  25995. this.calciteRadioButtonGroupChange = createEvent(this, "calciteRadioButtonGroupChange", 6);
  25996. //--------------------------------------------------------------------------
  25997. //
  25998. // Properties
  25999. //
  26000. //--------------------------------------------------------------------------
  26001. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  26002. this.disabled = false;
  26003. /** When `true`, the component is not displayed and its `calcite-radio-button`s are not focusable or checkable. */
  26004. this.hidden = false;
  26005. /** Defines the layout of the component. */
  26006. this.layout = "horizontal";
  26007. /** When `true`, the component must have a value in order for the form to submit. */
  26008. this.required = false;
  26009. /** Specifies the size of the component. */
  26010. this.scale = "m";
  26011. // --------------------------------------------------------------------------
  26012. //
  26013. // Private Properties
  26014. //
  26015. // --------------------------------------------------------------------------
  26016. this.mutationObserver = createObserver();
  26017. //--------------------------------------------------------------------------
  26018. //
  26019. // Private Methods
  26020. //
  26021. //--------------------------------------------------------------------------
  26022. this.passPropsToRadioButtons = () => {
  26023. const radioButtons = this.el.querySelectorAll("calcite-radio-button");
  26024. if (radioButtons.length > 0) {
  26025. radioButtons.forEach((radioButton) => {
  26026. radioButton.disabled = this.disabled || radioButton.disabled;
  26027. radioButton.hidden = this.hidden;
  26028. radioButton.name = this.name;
  26029. radioButton.required = this.required;
  26030. radioButton.scale = this.scale;
  26031. });
  26032. }
  26033. };
  26034. }
  26035. onDisabledChange() {
  26036. this.passPropsToRadioButtons();
  26037. }
  26038. onHiddenChange() {
  26039. this.passPropsToRadioButtons();
  26040. }
  26041. onLayoutChange() {
  26042. this.passPropsToRadioButtons();
  26043. }
  26044. onScaleChange() {
  26045. this.passPropsToRadioButtons();
  26046. }
  26047. //--------------------------------------------------------------------------
  26048. //
  26049. // Lifecycle
  26050. //
  26051. //--------------------------------------------------------------------------
  26052. connectedCallback() {
  26053. var _a;
  26054. this.passPropsToRadioButtons();
  26055. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  26056. }
  26057. disconnectedCallback() {
  26058. var _a;
  26059. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  26060. }
  26061. //--------------------------------------------------------------------------
  26062. //
  26063. // Event Listeners
  26064. //
  26065. //--------------------------------------------------------------------------
  26066. radioButtonChangeHandler(event) {
  26067. this.calciteRadioButtonGroupChange.emit(event.target.value);
  26068. }
  26069. // --------------------------------------------------------------------------
  26070. //
  26071. // Render Methods
  26072. //
  26073. // --------------------------------------------------------------------------
  26074. render() {
  26075. return (hAsync(Host, { role: "radiogroup" }, hAsync("slot", null)));
  26076. }
  26077. get el() { return getElement(this); }
  26078. static get watchers() { return {
  26079. "disabled": ["onDisabledChange"],
  26080. "hidden": ["onHiddenChange"],
  26081. "layout": ["onLayoutChange"],
  26082. "scale": ["onScaleChange"]
  26083. }; }
  26084. static get style() { return radioButtonGroupCss; }
  26085. static get cmpMeta() { return {
  26086. "$flags$": 9,
  26087. "$tagName$": "calcite-radio-button-group",
  26088. "$members$": {
  26089. "disabled": [516],
  26090. "hidden": [516],
  26091. "layout": [513],
  26092. "name": [513],
  26093. "required": [516],
  26094. "scale": [513]
  26095. },
  26096. "$listeners$": [[0, "calciteRadioButtonChange", "radioButtonChangeHandler"]],
  26097. "$lazyBundleId$": "-",
  26098. "$attrsToReflect$": [["disabled", "disabled"], ["hidden", "hidden"], ["layout", "layout"], ["name", "name"], ["required", "required"], ["scale", "scale"]]
  26099. }; }
  26100. }
  26101. const radioGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-radio-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-radio-group{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-radio-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-radio-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-radio-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-radio-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-radio-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-radio-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-radio-group-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-radio-group-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-radio-group-h{display:flex;background-color:var(--calcite-ui-foreground-1);inline-size:-moz-fit-content;inline-size:fit-content;outline:1px solid var(--calcite-ui-border-input);outline-offset:-1px}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-radio-group-h[disabled] .sc-calcite-radio-group-s>[calcite-hydrated][disabled],[disabled].sc-calcite-radio-group-h [calcite-hydrated][disabled].sc-calcite-radio-group{opacity:1}/*!@:host([layout=vertical])*/[layout=vertical].sc-calcite-radio-group-h{flex-direction:column;align-items:flex-start;align-self:flex-start}/*!@:host([width=full])*/[width=full].sc-calcite-radio-group-h{inline-size:100%;min-inline-size:-moz-fit-content;min-inline-size:fit-content}/*!@:host([width=full]) ::slotted(calcite-radio-group-item)*/.sc-calcite-radio-group-h[width=full] .sc-calcite-radio-group-s>calcite-radio-group-item{flex:1 1 auto}/*!@:host([width=full][layout=vertical]) ::slotted(calcite-radio-group-item)*/.sc-calcite-radio-group-h[width=full][layout=vertical] .sc-calcite-radio-group-s>calcite-radio-group-item{justify-content:flex-start}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-radio-group-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  26102. /**
  26103. * @slot - A slot for adding `calcite-radio-group-item`s.
  26104. */
  26105. class RadioGroup {
  26106. constructor(hostRef) {
  26107. registerInstance(this, hostRef);
  26108. this.calciteRadioGroupChange = createEvent(this, "calciteRadioGroupChange", 6);
  26109. //--------------------------------------------------------------------------
  26110. //
  26111. // Properties
  26112. //
  26113. //--------------------------------------------------------------------------
  26114. /** Specifies the appearance style of the component. */
  26115. this.appearance = "solid";
  26116. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  26117. this.disabled = false;
  26118. /**
  26119. * When `true`, the component must have a value in order for the form to submit.
  26120. *
  26121. * @internal
  26122. */
  26123. this.required = false;
  26124. /** Defines the layout of the component. */
  26125. this.layout = "horizontal";
  26126. /** Specifies the size of the component. */
  26127. this.scale = "m";
  26128. /** The component's `selectedItem` value. */
  26129. this.value = null;
  26130. /** Specifies the width of the component. */
  26131. this.width = "auto";
  26132. //--------------------------------------------------------------------------
  26133. //
  26134. // Event Listeners
  26135. //
  26136. //--------------------------------------------------------------------------
  26137. this.handleClick = (event) => {
  26138. if (event.target.localName === "calcite-radio-group-item") {
  26139. this.selectItem(event.target, true);
  26140. }
  26141. };
  26142. }
  26143. valueHandler(value) {
  26144. const items = this.getItems();
  26145. items.forEach((item) => (item.checked = item.value === value));
  26146. }
  26147. handleSelectedItemChange(newItem, oldItem) {
  26148. this.value = newItem === null || newItem === void 0 ? void 0 : newItem.value;
  26149. if (newItem === oldItem) {
  26150. return;
  26151. }
  26152. const items = this.getItems();
  26153. const match = Array.from(items)
  26154. .filter((item) => item === newItem)
  26155. .pop();
  26156. if (match) {
  26157. this.selectItem(match);
  26158. }
  26159. else if (items[0]) {
  26160. items[0].tabIndex = 0;
  26161. }
  26162. }
  26163. //--------------------------------------------------------------------------
  26164. //
  26165. // Lifecycle
  26166. //
  26167. //--------------------------------------------------------------------------
  26168. componentWillLoad() {
  26169. const items = this.getItems();
  26170. const lastChecked = Array.from(items)
  26171. .filter((item) => item.checked)
  26172. .pop();
  26173. if (lastChecked) {
  26174. this.selectItem(lastChecked);
  26175. }
  26176. else if (items[0]) {
  26177. items[0].tabIndex = 0;
  26178. }
  26179. }
  26180. componentDidLoad() {
  26181. afterConnectDefaultValueSet(this, this.value);
  26182. }
  26183. connectedCallback() {
  26184. connectLabel(this);
  26185. connectForm(this);
  26186. }
  26187. disconnectedCallback() {
  26188. disconnectLabel(this);
  26189. disconnectForm(this);
  26190. }
  26191. componentDidRender() {
  26192. updateHostInteraction(this);
  26193. }
  26194. render() {
  26195. return (hAsync(Host, { onClick: this.handleClick, role: "radiogroup" }, hAsync("slot", null), hAsync(HiddenFormInputSlot, { component: this })));
  26196. }
  26197. handleSelected(event) {
  26198. event.preventDefault();
  26199. this.selectItem(event.target);
  26200. event.stopPropagation();
  26201. }
  26202. handleKeyDown(event) {
  26203. const keys = ["ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", " "];
  26204. const { key } = event;
  26205. const { el, selectedItem } = this;
  26206. if (keys.indexOf(key) === -1) {
  26207. return;
  26208. }
  26209. let adjustedKey = key;
  26210. if (getElementDir(el) === "rtl") {
  26211. if (key === "ArrowRight") {
  26212. adjustedKey = "ArrowLeft";
  26213. }
  26214. if (key === "ArrowLeft") {
  26215. adjustedKey = "ArrowRight";
  26216. }
  26217. }
  26218. const items = this.getItems();
  26219. let selectedIndex = -1;
  26220. items.forEach((item, index) => {
  26221. if (item === selectedItem) {
  26222. selectedIndex = index;
  26223. }
  26224. });
  26225. switch (adjustedKey) {
  26226. case "ArrowLeft":
  26227. case "ArrowUp":
  26228. event.preventDefault();
  26229. const previous = selectedIndex < 1 ? items.item(items.length - 1) : items.item(selectedIndex - 1);
  26230. this.selectItem(previous, true);
  26231. return;
  26232. case "ArrowRight":
  26233. case "ArrowDown":
  26234. event.preventDefault();
  26235. const next = selectedIndex === -1 ? items.item(1) : items.item(selectedIndex + 1) || items.item(0);
  26236. this.selectItem(next, true);
  26237. return;
  26238. case " ":
  26239. event.preventDefault();
  26240. this.selectItem(event.target, true);
  26241. return;
  26242. default:
  26243. return;
  26244. }
  26245. }
  26246. // --------------------------------------------------------------------------
  26247. //
  26248. // Methods
  26249. //
  26250. // --------------------------------------------------------------------------
  26251. /** Sets focus on the component. */
  26252. async setFocus() {
  26253. var _a;
  26254. (_a = (this.selectedItem || this.getItems()[0])) === null || _a === void 0 ? void 0 : _a.focus();
  26255. }
  26256. //--------------------------------------------------------------------------
  26257. //
  26258. // Private Methods
  26259. //
  26260. //--------------------------------------------------------------------------
  26261. onLabelClick() {
  26262. this.setFocus();
  26263. }
  26264. getItems() {
  26265. return this.el.querySelectorAll("calcite-radio-group-item");
  26266. }
  26267. selectItem(selected, emit = false) {
  26268. if (selected === this.selectedItem) {
  26269. return;
  26270. }
  26271. const items = this.getItems();
  26272. let match = null;
  26273. items.forEach((item) => {
  26274. const matches = item.value === selected.value;
  26275. if ((matches && !item.checked) || (!matches && item.checked)) {
  26276. item.checked = matches;
  26277. }
  26278. item.tabIndex = matches ? 0 : -1;
  26279. if (matches) {
  26280. match = item;
  26281. if (emit) {
  26282. this.calciteRadioGroupChange.emit(match.value);
  26283. }
  26284. }
  26285. });
  26286. this.selectedItem = match;
  26287. }
  26288. get el() { return getElement(this); }
  26289. static get watchers() { return {
  26290. "value": ["valueHandler"],
  26291. "selectedItem": ["handleSelectedItemChange"]
  26292. }; }
  26293. static get style() { return radioGroupCss; }
  26294. static get cmpMeta() { return {
  26295. "$flags$": 9,
  26296. "$tagName$": "calcite-radio-group",
  26297. "$members$": {
  26298. "appearance": [513],
  26299. "disabled": [516],
  26300. "required": [516],
  26301. "layout": [513],
  26302. "name": [513],
  26303. "scale": [513],
  26304. "value": [1025],
  26305. "selectedItem": [1040],
  26306. "width": [513],
  26307. "setFocus": [64]
  26308. },
  26309. "$listeners$": [[0, "calciteInternalRadioGroupItemChange", "handleSelected"], [0, "keydown", "handleKeyDown"]],
  26310. "$lazyBundleId$": "-",
  26311. "$attrsToReflect$": [["appearance", "appearance"], ["disabled", "disabled"], ["required", "required"], ["layout", "layout"], ["name", "name"], ["scale", "scale"], ["width", "width"]]
  26312. }; }
  26313. }
  26314. const SLOTS$8 = {
  26315. input: "input"
  26316. };
  26317. const CSS$f = {
  26318. radioGroupItemIcon: "radio-group-item-icon"
  26319. };
  26320. const radioGroupItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-radio-group-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-radio-group-item{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-radio-group-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-radio-group-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-radio-group-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-radio-group-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-radio-group-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-radio-group-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-radio-group-item-h{display:none}/*!@:host*/.sc-calcite-radio-group-item-h{display:flex;cursor:pointer;align-self:stretch;font-weight:var(--calcite-font-weight-normal);transition:background-color var(--calcite-internal-animation-timing-fast) ease-in-out, border-color var(--calcite-animation-timing) ease-in-out}/*!@:host label*/.sc-calcite-radio-group-item-h label.sc-calcite-radio-group-item{pointer-events:none;margin:0.125rem;box-sizing:border-box;display:flex;flex:1 1 0%;align-items:center;color:var(--calcite-ui-text-3);transition:background-color var(--calcite-internal-animation-timing-fast) ease-in-out, border-color var(--calcite-internal-animation-timing-fast) ease-in-out, color var(--calcite-internal-animation-timing-fast) ease-in-out}/*!@.label--horizontal*/.label--horizontal.sc-calcite-radio-group-item{justify-content:center}/*!@:host*/.sc-calcite-radio-group-item-h{outline-color:transparent}/*!@:host(:focus)*/.sc-calcite-radio-group-item-h:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-1px}/*!@.label--scale-s*/.label--scale-s.sc-calcite-radio-group-item{padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem;padding-block:0.125rem}/*!@.label--scale-m*/.label--scale-m.sc-calcite-radio-group-item{padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem;padding-block:0.375rem}/*!@.label--scale-l*/.label--scale-l.sc-calcite-radio-group-item{padding-inline:1rem;padding-block:0.625rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host(:hover) label*/.sc-calcite-radio-group-item-h:hover label.sc-calcite-radio-group-item{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@:host(:active) label*/.sc-calcite-radio-group-item-h:active label.sc-calcite-radio-group-item{background-color:var(--calcite-ui-foreground-3)}/*!@:host([checked]) label*/[checked].sc-calcite-radio-group-item-h label.sc-calcite-radio-group-item{cursor:default;border-color:var(--calcite-ui-brand);background-color:var(--calcite-ui-brand);color:var(--calcite-ui-background)}/*!@:host([checked]) .label--outline*/[checked].sc-calcite-radio-group-item-h .label--outline.sc-calcite-radio-group-item{border-color:var(--calcite-ui-brand);background-color:var(--calcite-ui-foreground-1);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand);color:var(--calcite-ui-brand)}/*!@::slotted(input)*/.sc-calcite-radio-group-item-s>input{display:none}@media (forced-colors: active){/*!@:host([checked]) label*/[checked].sc-calcite-radio-group-item-h label.sc-calcite-radio-group-item{background-color:highlight}/*!@:host([checked]) .label--outline*/[checked].sc-calcite-radio-group-item-h .label--outline.sc-calcite-radio-group-item{outline:2px solid transparent;outline-offset:2px}/*!@:host([checked]) label:not([class~=label--outline]) .radio-group-item-icon*/[checked].sc-calcite-radio-group-item-h label.sc-calcite-radio-group-item:not([class~=label--outline]) .radio-group-item-icon.sc-calcite-radio-group-item{color:highlightText}}/*!@.radio-group-item-icon*/.radio-group-item-icon.sc-calcite-radio-group-item{position:relative;margin:0px;display:inline-flex;line-height:inherit}/*!@:host([icon-position=start]) .label--scale-s .radio-group-item-icon*/[icon-position=start].sc-calcite-radio-group-item-h .label--scale-s.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-end:0.5rem}/*!@:host([icon-position=end]) .label--scale-s .radio-group-item-icon*/[icon-position=end].sc-calcite-radio-group-item-h .label--scale-s.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-end:unset;margin-inline-start:0.5rem}/*!@:host([icon-position=start]) .label--scale-m .radio-group-item-icon*/[icon-position=start].sc-calcite-radio-group-item-h .label--scale-m.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-end:0.75rem}/*!@:host([icon-position=end]) .label--scale-m .radio-group-item-icon*/[icon-position=end].sc-calcite-radio-group-item-h .label--scale-m.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-end:unset;margin-inline-start:0.75rem}/*!@:host([icon-position=start]) .label--scale-l .radio-group-item-icon*/[icon-position=start].sc-calcite-radio-group-item-h .label--scale-l.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-end:1rem}/*!@:host([icon-position=end]) .label--scale-l .radio-group-item-icon*/[icon-position=end].sc-calcite-radio-group-item-h .label--scale-l.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-end:unset;margin-inline-start:1rem}/*!@:host([icon-start]) .label--scale-s .radio-group-item-icon*/[icon-start].sc-calcite-radio-group-item-h .label--scale-s.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-end:0.5rem}/*!@:host([icon-end]) .label--scale-s .radio-group-item-icon*/[icon-end].sc-calcite-radio-group-item-h .label--scale-s.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-start:0.5rem}/*!@:host([icon-start]) .label--scale-m .radio-group-item-icon*/[icon-start].sc-calcite-radio-group-item-h .label--scale-m.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-end:0.75rem}/*!@:host([icon-end]) .label--scale-m .radio-group-item-icon*/[icon-end].sc-calcite-radio-group-item-h .label--scale-m.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-start:0.75rem}/*!@:host([icon-start]) .label--scale-l .radio-group-item-icon*/[icon-start].sc-calcite-radio-group-item-h .label--scale-l.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-end:1rem}/*!@:host([icon-end]) .label--scale-l .radio-group-item-icon*/[icon-end].sc-calcite-radio-group-item-h .label--scale-l.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-start:1rem}";
  26321. class RadioGroupItem {
  26322. constructor(hostRef) {
  26323. registerInstance(this, hostRef);
  26324. this.calciteInternalRadioGroupItemChange = createEvent(this, "calciteInternalRadioGroupItemChange", 6);
  26325. //--------------------------------------------------------------------------
  26326. //
  26327. // Properties
  26328. //
  26329. //--------------------------------------------------------------------------
  26330. /** When `true`, the component is checked. */
  26331. this.checked = false;
  26332. /** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
  26333. this.iconFlipRtl = false;
  26334. /**
  26335. * Specifies the placement of the icon.
  26336. *
  26337. * @deprecated Use either `iconStart` or `iconEnd` but do not combine them with `icon` and `iconPosition`.
  26338. */
  26339. this.iconPosition = "start";
  26340. }
  26341. handleCheckedChange() {
  26342. this.calciteInternalRadioGroupItemChange.emit();
  26343. }
  26344. render() {
  26345. const { checked, value } = this;
  26346. const scale = getElementProp(this.el, "scale", "m");
  26347. const appearance = getElementProp(this.el, "appearance", "solid");
  26348. const layout = getElementProp(this.el, "layout", "horizontal");
  26349. const iconStartEl = this.iconStart ? (hAsync("calcite-icon", { class: CSS$f.radioGroupItemIcon, flipRtl: this.iconFlipRtl, icon: this.iconStart, key: "icon-start", scale: "s" })) : null;
  26350. const iconEndEl = this.iconEnd ? (hAsync("calcite-icon", { class: CSS$f.radioGroupItemIcon, flipRtl: this.iconFlipRtl, icon: this.iconEnd, key: "icon-end", scale: "s" })) : null;
  26351. const iconEl = (hAsync("calcite-icon", { class: CSS$f.radioGroupItemIcon, flipRtl: this.iconFlipRtl, icon: this.icon, key: "icon", scale: "s" }));
  26352. const iconAtStart = this.icon && this.iconPosition === "start" && !this.iconStart ? iconEl : null;
  26353. const iconAtEnd = this.icon && this.iconPosition === "end" && !this.iconEnd ? iconEl : null;
  26354. return (hAsync(Host, { "aria-checked": toAriaBoolean(checked), "aria-label": value, role: "radio" }, hAsync("label", { class: {
  26355. "label--scale-s": scale === "s",
  26356. "label--scale-m": scale === "m",
  26357. "label--scale-l": scale === "l",
  26358. "label--horizontal": layout === "horizontal",
  26359. "label--outline": appearance === "outline"
  26360. } }, iconAtStart, this.iconStart ? iconStartEl : null, hAsync("slot", null, value), hAsync("slot", { name: SLOTS$8.input }), iconAtEnd, this.iconEnd ? iconEndEl : null)));
  26361. }
  26362. get el() { return getElement(this); }
  26363. static get watchers() { return {
  26364. "checked": ["handleCheckedChange"]
  26365. }; }
  26366. static get style() { return radioGroupItemCss; }
  26367. static get cmpMeta() { return {
  26368. "$flags$": 9,
  26369. "$tagName$": "calcite-radio-group-item",
  26370. "$members$": {
  26371. "checked": [1540],
  26372. "icon": [513],
  26373. "iconFlipRtl": [516, "icon-flip-rtl"],
  26374. "iconPosition": [513, "icon-position"],
  26375. "iconStart": [513, "icon-start"],
  26376. "iconEnd": [513, "icon-end"],
  26377. "value": [1032]
  26378. },
  26379. "$listeners$": undefined,
  26380. "$lazyBundleId$": "-",
  26381. "$attrsToReflect$": [["checked", "checked"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["iconPosition", "icon-position"], ["iconStart", "icon-start"], ["iconEnd", "icon-end"]]
  26382. }; }
  26383. }
  26384. const TEXT$5 = {
  26385. rating: "Rating",
  26386. stars: "Stars: ${num}"
  26387. };
  26388. const ratingCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-rating:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-rating{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-rating{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-rating{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-rating{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-rating{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-rating:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-rating:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-rating-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-rating-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-rating-h{position:relative;display:flex;align-items:center;inline-size:-moz-fit-content;inline-size:fit-content}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-rating-h[disabled] .sc-calcite-rating-s>[calcite-hydrated][disabled],[disabled].sc-calcite-rating-h [calcite-hydrated][disabled].sc-calcite-rating{opacity:1}/*!@:host([scale=s])*/[scale=s].sc-calcite-rating-h{block-size:1.5rem;--calcite-rating-spacing-unit:0.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-rating-h{block-size:2rem;--calcite-rating-spacing-unit:0.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-rating-h{block-size:2.75rem;--calcite-rating-spacing-unit:0.75rem}/*!@:host([read-only])*/[read-only].sc-calcite-rating-h{pointer-events:none}/*!@.fieldset*/.fieldset.sc-calcite-rating{margin:0px;display:flex;border-width:0px;padding:0px}/*!@.wrapper*/.wrapper.sc-calcite-rating{display:inline-block;margin-inline-end:var(--calcite-rating-spacing-unit)}/*!@.star*/.star.sc-calcite-rating{position:relative;display:flex;cursor:pointer;outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;color:var(--calcite-ui-border-input)}/*!@.focused*/.focused.sc-calcite-rating{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.average,\n.fraction*/.average.sc-calcite-rating,.fraction.sc-calcite-rating{color:var(--calcite-ui-warning)}/*!@.hovered,\n.selected,\n:host([read-only]) .average,\n:host([read-only]) .fraction*/.hovered.sc-calcite-rating,.selected.sc-calcite-rating,[read-only].sc-calcite-rating-h .average.sc-calcite-rating,[read-only].sc-calcite-rating-h .fraction.sc-calcite-rating{color:var(--calcite-ui-brand)}/*!@:host .fraction*/.sc-calcite-rating-h .fraction.sc-calcite-rating{pointer-events:none;position:absolute;inset-block-start:0px;overflow:hidden;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;inset-inline-start:0}/*!@calcite-chip*/calcite-chip.sc-calcite-rating{pointer-events:none;cursor:default}/*!@.number--average*/.number--average.sc-calcite-rating{font-weight:var(--calcite-font-weight-bold)}/*!@.number--count*/.number--count.sc-calcite-rating{color:var(--calcite-ui-text-2);font-style:italic}/*!@.number--count:not(:first-child)*/.number--count.sc-calcite-rating:not(:first-child){margin-inline-start:var(--calcite-rating-spacing-unit)}/*!@.visually-hidden*/.visually-hidden.sc-calcite-rating{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-rating-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  26389. class Rating {
  26390. constructor(hostRef) {
  26391. registerInstance(this, hostRef);
  26392. this.calciteRatingChange = createEvent(this, "calciteRatingChange", 6);
  26393. // --------------------------------------------------------------------------
  26394. //
  26395. // Properties
  26396. //
  26397. // --------------------------------------------------------------------------
  26398. /** Specifies the size of the component. */
  26399. this.scale = "m";
  26400. /** The component's value. */
  26401. this.value = 0;
  26402. /** When `true`, the component's value can be read, but cannot be modified. */
  26403. this.readOnly = false;
  26404. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  26405. this.disabled = false;
  26406. /** When `true`, and if available, displays the `average` and/or `count` data summary in a `calcite-chip`. */
  26407. this.showChip = false;
  26408. /**
  26409. * Accessible name for the component.
  26410. *
  26411. * @default "Rating"
  26412. */
  26413. this.intlRating = TEXT$5.rating;
  26414. /**
  26415. * Accessible name for each star. The `${num}` in the string will be replaced by the number.
  26416. *
  26417. * @default "Stars: ${num}"
  26418. */
  26419. this.intlStars = TEXT$5.stars;
  26420. /**
  26421. * When `true`, the component must have a value in order for the form to submit.
  26422. *
  26423. * @internal
  26424. */
  26425. this.required = false;
  26426. this.onKeyboardPressed = (event) => {
  26427. if (!this.required && isActivationKey(event.key)) {
  26428. event.preventDefault();
  26429. this.updateValue(0);
  26430. }
  26431. };
  26432. this.onFocusChange = (selectedRatingValue) => {
  26433. this.hasFocus = true;
  26434. if (!this.required && this.focusValue === selectedRatingValue) {
  26435. this.updateValue(0);
  26436. }
  26437. else {
  26438. this.focusValue = selectedRatingValue;
  26439. }
  26440. };
  26441. this.guid = `calcite-ratings-${guid()}`;
  26442. }
  26443. //--------------------------------------------------------------------------
  26444. //
  26445. // Lifecycle
  26446. //
  26447. //--------------------------------------------------------------------------
  26448. connectedCallback() {
  26449. connectLabel(this);
  26450. connectForm(this);
  26451. }
  26452. disconnectedCallback() {
  26453. disconnectLabel(this);
  26454. disconnectForm(this);
  26455. }
  26456. componentDidRender() {
  26457. updateHostInteraction(this);
  26458. }
  26459. //--------------------------------------------------------------------------
  26460. //
  26461. // Event Listeners
  26462. //
  26463. //--------------------------------------------------------------------------
  26464. blurHandler() {
  26465. this.hasFocus = false;
  26466. }
  26467. // --------------------------------------------------------------------------
  26468. //
  26469. // Render Methods
  26470. //
  26471. // --------------------------------------------------------------------------
  26472. renderStars() {
  26473. return [1, 2, 3, 4, 5].map((i) => {
  26474. const selected = this.value >= i;
  26475. const average = this.average && !this.value && i <= this.average;
  26476. const hovered = i <= this.hoverValue;
  26477. const fraction = this.average && this.average + 1 - i;
  26478. const partial = !this.value && !hovered && fraction > 0 && fraction < 1;
  26479. const focused = this.hasFocus && this.focusValue === i;
  26480. return (hAsync("span", { class: { wrapper: true } }, hAsync("label", { class: { star: true, focused, selected, average, hovered, partial }, htmlFor: `${this.guid}-${i}`, onPointerOver: () => {
  26481. this.hoverValue = i;
  26482. } }, hAsync("calcite-icon", { "aria-hidden": "true", class: "icon", icon: selected || average || this.readOnly ? "star-f" : "star", scale: this.scale }), partial && (hAsync("div", { class: "fraction", style: { width: `${fraction * 100}%` } }, hAsync("calcite-icon", { icon: "star-f", scale: this.scale }))), hAsync("span", { class: "visually-hidden" }, this.intlStars.replace("${num}", `${i}`))), hAsync("input", { checked: i === this.value, class: "visually-hidden", disabled: this.disabled || this.readOnly, id: `${this.guid}-${i}`, name: this.guid, onChange: () => this.updateValue(i), onClick: (event) =>
  26483. // click is fired from the component's label, so we treat this as an internal event
  26484. event.stopPropagation(), onFocus: () => this.onFocusChange(i), onKeyDown: this.onKeyboardPressed, ref: (el) => (i === 1 || i === this.value) && (this.inputFocusRef = el), type: "radio", value: i })));
  26485. });
  26486. }
  26487. render() {
  26488. const { disabled, intlRating, showChip, scale, count, average } = this;
  26489. return (hAsync(Fragment, null, hAsync("fieldset", { class: "fieldset", disabled: disabled, onBlur: () => (this.hoverValue = null), onPointerLeave: () => (this.hoverValue = null), onTouchEnd: () => (this.hoverValue = null) }, hAsync("legend", { class: "visually-hidden" }, intlRating), this.renderStars()), (count || average) && showChip ? (hAsync("calcite-chip", { scale: scale, value: count === null || count === void 0 ? void 0 : count.toString() }, !!average && hAsync("span", { class: "number--average" }, average.toString()), !!count && hAsync("span", { class: "number--count" }, "(", count === null || count === void 0 ? void 0 :
  26490. count.toString(), ")"))) : null, hAsync(HiddenFormInputSlot, { component: this })));
  26491. }
  26492. //--------------------------------------------------------------------------
  26493. //
  26494. // Private Methods
  26495. //
  26496. //--------------------------------------------------------------------------
  26497. onLabelClick() {
  26498. this.setFocus();
  26499. }
  26500. updateValue(value) {
  26501. this.value = value;
  26502. this.calciteRatingChange.emit({ value });
  26503. }
  26504. //--------------------------------------------------------------------------
  26505. //
  26506. // Public Methods
  26507. //
  26508. //--------------------------------------------------------------------------
  26509. /** Sets focus on the component. */
  26510. async setFocus() {
  26511. var _a;
  26512. (_a = this.inputFocusRef) === null || _a === void 0 ? void 0 : _a.focus();
  26513. }
  26514. get el() { return getElement(this); }
  26515. static get style() { return ratingCss; }
  26516. static get cmpMeta() { return {
  26517. "$flags$": 9,
  26518. "$tagName$": "calcite-rating",
  26519. "$members$": {
  26520. "scale": [513],
  26521. "value": [1538],
  26522. "readOnly": [516, "read-only"],
  26523. "disabled": [516],
  26524. "showChip": [516, "show-chip"],
  26525. "count": [514],
  26526. "average": [514],
  26527. "name": [513],
  26528. "intlRating": [1, "intl-rating"],
  26529. "intlStars": [1, "intl-stars"],
  26530. "required": [516],
  26531. "hoverValue": [32],
  26532. "focusValue": [32],
  26533. "hasFocus": [32],
  26534. "setFocus": [64]
  26535. },
  26536. "$listeners$": [[0, "blur", "blurHandler"]],
  26537. "$lazyBundleId$": "-",
  26538. "$attrsToReflect$": [["scale", "scale"], ["value", "value"], ["readOnly", "read-only"], ["disabled", "disabled"], ["showChip", "show-chip"], ["count", "count"], ["average", "average"], ["name", "name"], ["required", "required"]]
  26539. }; }
  26540. }
  26541. const CSS$e = {
  26542. scrim: "scrim",
  26543. content: "content"
  26544. };
  26545. const TEXT$4 = {
  26546. loading: "Loading"
  26547. };
  26548. const scrimCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-scrim:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-scrim{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-scrim{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-scrim{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-scrim{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-scrim{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-scrim:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-scrim:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-scrim-h{display:none}/*!@:host*/.sc-calcite-scrim-h{position:absolute;inset:0px;z-index:700;display:flex;block-size:100%;inline-size:100%;flex-direction:column;align-items:stretch}@keyframes calcite-scrim-fade-in{0%{--tw-bg-opacity:0}100%{--tw-text-opacity:1}}/*!@.scrim*/.scrim.sc-calcite-scrim{position:absolute;inset:0px;display:flex;flex-direction:column;align-content:center;align-items:center;justify-content:center;overflow:hidden;animation:calcite-scrim-fade-in var(--calcite-internal-animation-timing-medium) ease-in-out;background-color:var(--calcite-scrim-background)}/*!@.content*/.content.sc-calcite-scrim{padding:1rem}";
  26549. /**
  26550. * @slot - A slot for adding custom content, primarily loading information.
  26551. */
  26552. class Scrim {
  26553. constructor(hostRef) {
  26554. registerInstance(this, hostRef);
  26555. // --------------------------------------------------------------------------
  26556. //
  26557. // Properties
  26558. //
  26559. // --------------------------------------------------------------------------
  26560. /**
  26561. * Accessible name when the component is loading.
  26562. *
  26563. * @default "Loading"
  26564. */
  26565. this.intlLoading = TEXT$4.loading;
  26566. /**
  26567. * When `true`, a busy indicator is displayed.
  26568. */
  26569. this.loading = false;
  26570. }
  26571. // --------------------------------------------------------------------------
  26572. //
  26573. // Render Method
  26574. //
  26575. // --------------------------------------------------------------------------
  26576. render() {
  26577. const { el, loading, intlLoading } = this;
  26578. const hasContent = el.innerHTML.trim().length > 0;
  26579. const loaderNode = loading ? hAsync("calcite-loader", { active: true, label: intlLoading }) : null;
  26580. const contentNode = hasContent ? (hAsync("div", { class: CSS$e.content }, hAsync("slot", null))) : null;
  26581. return (hAsync("div", { class: CSS$e.scrim }, loaderNode, contentNode));
  26582. }
  26583. get el() { return getElement(this); }
  26584. static get style() { return scrimCss; }
  26585. static get cmpMeta() { return {
  26586. "$flags$": 9,
  26587. "$tagName$": "calcite-scrim",
  26588. "$members$": {
  26589. "intlLoading": [1, "intl-loading"],
  26590. "loading": [516]
  26591. },
  26592. "$listeners$": undefined,
  26593. "$lazyBundleId$": "-",
  26594. "$attrsToReflect$": [["loading", "loading"]]
  26595. }; }
  26596. }
  26597. const CSS$d = {
  26598. icon: "icon",
  26599. iconContainer: "icon-container",
  26600. select: "select"
  26601. };
  26602. const selectCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-select:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-select{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-select{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-select{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-select{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-select{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-select:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-select-h{--calcite-icon-size:1rem;--calcite-spacing-eighth:0.125rem;--calcite-spacing-quarter:0.25rem;--calcite-spacing-half:0.5rem;--calcite-spacing-three-quarters:0.75rem;--calcite-spacing:1rem;--calcite-spacing-plus-quarter:1.25rem;--calcite-spacing-plus-half:1.5rem;--calcite-spacing-double:2rem;--calcite-menu-min-width:10rem;--calcite-header-min-height:3rem;--calcite-footer-min-height:3rem}/*!@:root*/.sc-calcite-select:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-select-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-select-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-select-h{position:relative;display:flex;align-items:stretch;inline-size:var(--select-width)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-select-h[disabled] .sc-calcite-select-s>[calcite-hydrated][disabled],[disabled].sc-calcite-select-h [calcite-hydrated][disabled].sc-calcite-select{opacity:1}/*!@:host([scale=s])*/[scale=s].sc-calcite-select-h{block-size:1.5rem;--calcite-select-font-size:var(--calcite-font-size--2);--calcite-select-spacing-inline:0.5rem 2rem}/*!@:host([scale=s]) .icon-container*/[scale=s].sc-calcite-select-h .icon-container.sc-calcite-select{padding-inline:0.5rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-select-h{block-size:2rem;--calcite-select-font-size:var(--calcite-font-size--1);--calcite-select-spacing-inline:0.75rem 2.5rem}/*!@:host([scale=m]) .icon-container*/[scale=m].sc-calcite-select-h .icon-container.sc-calcite-select{padding-inline:0.75rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-select-h{block-size:44px;--calcite-select-font-size:var(--calcite-font-size-0);--calcite-select-spacing-inline:1rem 3rem}/*!@:host([scale=l]) .icon-container*/[scale=l].sc-calcite-select-h .icon-container.sc-calcite-select{padding-inline:1rem}/*!@:host([width=auto])*/[width=auto].sc-calcite-select-h{inline-size:auto}/*!@:host([width=half])*/[width=half].sc-calcite-select-h{inline-size:50%}/*!@:host([width=full])*/[width=full].sc-calcite-select-h{inline-size:100%}/*!@.select*/.select.sc-calcite-select{margin:0px;box-sizing:border-box;inline-size:100%;cursor:pointer;-webkit-appearance:none;appearance:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:0px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);font-family:inherit;color:var(--calcite-ui-text-2);outline-color:transparent;font-size:var(--calcite-select-font-size);padding-inline:var(--calcite-select-spacing-inline);border-inline-end-width:0px}/*!@.select:focus*/.select.sc-calcite-select:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.select:hover*/.select.sc-calcite-select:hover{background-color:var(--calcite-ui-foreground-2)}/*!@select:disabled*/select.sc-calcite-select:disabled{border-color:var(--calcite-ui-border-input);--tw-bg-opacity:1}/*!@.icon-container*/.icon-container.sc-calcite-select{pointer-events:none;position:absolute;inset-block:0px;display:flex;align-items:center;border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:transparent;color:var(--calcite-ui-text-2);inset-inline-end:0px;border-inline-width:0px 1px}/*!@.select:focus ~ .icon-container*/.select.sc-calcite-select:focus~.icon-container.sc-calcite-select{border-color:transparent}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-select-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  26603. function isOption(optionOrGroup) {
  26604. return optionOrGroup.tagName === "CALCITE-OPTION";
  26605. }
  26606. function isOptionGroup(optionOrGroup) {
  26607. return optionOrGroup.tagName === "CALCITE-OPTION-GROUP";
  26608. }
  26609. /**
  26610. * @slot - A slot for adding `calcite-option`s.
  26611. */
  26612. class Select {
  26613. constructor(hostRef) {
  26614. registerInstance(this, hostRef);
  26615. this.calciteSelectChange = createEvent(this, "calciteSelectChange", 6);
  26616. //--------------------------------------------------------------------------
  26617. //
  26618. // Properties
  26619. //
  26620. //--------------------------------------------------------------------------
  26621. /**
  26622. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  26623. */
  26624. this.disabled = false;
  26625. /**
  26626. * When `true`, the component must have a value in order for the form to submit.
  26627. *
  26628. * @internal
  26629. */
  26630. this.required = false;
  26631. /**
  26632. * Specifies the size of the component.
  26633. */
  26634. this.scale = "m";
  26635. /** The component's `selectedOption` value. */
  26636. this.value = null;
  26637. /**
  26638. * Specifies the width of the component.
  26639. */
  26640. this.width = "auto";
  26641. this.componentToNativeEl = new Map();
  26642. this.mutationObserver = createObserver();
  26643. this.handleInternalSelectChange = () => {
  26644. const selected = this.selectEl.selectedOptions[0];
  26645. this.selectFromNativeOption(selected);
  26646. requestAnimationFrame(() => this.emitChangeEvent());
  26647. };
  26648. this.populateInternalSelect = () => {
  26649. const optionsAndGroups = Array.from(this.el.children).filter((child) => child.tagName === "CALCITE-OPTION" || child.tagName === "CALCITE-OPTION-GROUP");
  26650. this.clearInternalSelect();
  26651. optionsAndGroups.forEach((optionOrGroup) => { var _a; return (_a = this.selectEl) === null || _a === void 0 ? void 0 : _a.append(this.toNativeElement(optionOrGroup)); });
  26652. };
  26653. this.storeSelectRef = (node) => {
  26654. this.selectEl = node;
  26655. this.populateInternalSelect();
  26656. const selected = this.selectEl.selectedOptions[0];
  26657. this.selectFromNativeOption(selected);
  26658. };
  26659. this.emitChangeEvent = () => {
  26660. this.calciteSelectChange.emit();
  26661. };
  26662. }
  26663. valueHandler(value) {
  26664. const items = this.el.querySelectorAll("calcite-option");
  26665. items.forEach((item) => (item.selected = item.value === value));
  26666. }
  26667. selectedOptionHandler(selectedOption) {
  26668. this.value = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value;
  26669. }
  26670. //--------------------------------------------------------------------------
  26671. //
  26672. // Lifecycle
  26673. //
  26674. //--------------------------------------------------------------------------
  26675. connectedCallback() {
  26676. var _a;
  26677. const { el } = this;
  26678. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(el, {
  26679. subtree: true,
  26680. childList: true
  26681. });
  26682. connectLabel(this);
  26683. connectForm(this);
  26684. }
  26685. disconnectedCallback() {
  26686. var _a;
  26687. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  26688. disconnectLabel(this);
  26689. disconnectForm(this);
  26690. }
  26691. componentDidLoad() {
  26692. var _a, _b;
  26693. afterConnectDefaultValueSet(this, (_b = (_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "");
  26694. }
  26695. componentDidRender() {
  26696. updateHostInteraction(this);
  26697. }
  26698. //--------------------------------------------------------------------------
  26699. //
  26700. // Public Methods
  26701. //
  26702. //--------------------------------------------------------------------------
  26703. /** Sets focus on the component. */
  26704. async setFocus() {
  26705. focusElement(this.selectEl);
  26706. }
  26707. handleOptionOrGroupChange(event) {
  26708. event.stopPropagation();
  26709. const optionOrGroup = event.target;
  26710. const nativeEl = this.componentToNativeEl.get(optionOrGroup);
  26711. if (!nativeEl) {
  26712. return;
  26713. }
  26714. this.updateNativeElement(optionOrGroup, nativeEl);
  26715. if (isOption(optionOrGroup) && optionOrGroup.selected) {
  26716. this.deselectAllExcept(optionOrGroup);
  26717. this.selectedOption = optionOrGroup;
  26718. }
  26719. }
  26720. //--------------------------------------------------------------------------
  26721. //
  26722. // Private Methods
  26723. //
  26724. //--------------------------------------------------------------------------
  26725. onLabelClick() {
  26726. this.setFocus();
  26727. }
  26728. updateNativeElement(optionOrGroup, nativeOptionOrGroup) {
  26729. nativeOptionOrGroup.disabled = optionOrGroup.disabled;
  26730. nativeOptionOrGroup.label = optionOrGroup.label;
  26731. if (isOption(optionOrGroup)) {
  26732. const option = nativeOptionOrGroup;
  26733. option.selected = optionOrGroup.selected;
  26734. option.value = optionOrGroup.value;
  26735. // need to set innerText for mobile
  26736. // see https://stackoverflow.com/questions/35021620/ios-safari-not-showing-all-options-for-select-menu/41749701
  26737. option.innerText = optionOrGroup.label;
  26738. }
  26739. }
  26740. clearInternalSelect() {
  26741. this.componentToNativeEl.forEach((value) => value.remove());
  26742. this.componentToNativeEl.clear();
  26743. }
  26744. selectFromNativeOption(nativeOption) {
  26745. if (!nativeOption) {
  26746. return;
  26747. }
  26748. let futureSelected;
  26749. this.componentToNativeEl.forEach((nativeOptionOrGroup, optionOrGroup) => {
  26750. if (isOption(optionOrGroup) && nativeOptionOrGroup === nativeOption) {
  26751. optionOrGroup.selected = true;
  26752. futureSelected = optionOrGroup;
  26753. this.deselectAllExcept(optionOrGroup);
  26754. }
  26755. });
  26756. if (futureSelected) {
  26757. this.selectedOption = futureSelected;
  26758. }
  26759. }
  26760. toNativeElement(optionOrGroup) {
  26761. if (isOption(optionOrGroup)) {
  26762. const option = document.createElement("option");
  26763. this.updateNativeElement(optionOrGroup, option);
  26764. this.componentToNativeEl.set(optionOrGroup, option);
  26765. return option;
  26766. }
  26767. if (isOptionGroup(optionOrGroup)) {
  26768. const group = document.createElement("optgroup");
  26769. this.updateNativeElement(optionOrGroup, group);
  26770. Array.from(optionOrGroup.children).forEach((option) => {
  26771. const nativeOption = this.toNativeElement(option);
  26772. group.append(nativeOption);
  26773. this.componentToNativeEl.set(optionOrGroup, nativeOption);
  26774. });
  26775. this.componentToNativeEl.set(optionOrGroup, group);
  26776. return group;
  26777. }
  26778. throw new Error("unsupported element child provided");
  26779. }
  26780. deselectAllExcept(except) {
  26781. this.el.querySelectorAll("calcite-option").forEach((option) => {
  26782. if (option === except) {
  26783. return;
  26784. }
  26785. option.selected = false;
  26786. });
  26787. }
  26788. //--------------------------------------------------------------------------
  26789. //
  26790. // Render Methods
  26791. //
  26792. //--------------------------------------------------------------------------
  26793. renderChevron() {
  26794. return (hAsync("div", { class: CSS$d.iconContainer }, hAsync("calcite-icon", { class: CSS$d.icon, icon: "chevron-down", scale: "s" })));
  26795. }
  26796. render() {
  26797. return (hAsync(Fragment, null, hAsync("select", { "aria-label": this.label, class: CSS$d.select, disabled: this.disabled, onChange: this.handleInternalSelectChange, ref: this.storeSelectRef }, hAsync("slot", null)), this.renderChevron(), hAsync(HiddenFormInputSlot, { component: this })));
  26798. }
  26799. get el() { return getElement(this); }
  26800. static get watchers() { return {
  26801. "value": ["valueHandler"],
  26802. "selectedOption": ["selectedOptionHandler"]
  26803. }; }
  26804. static get style() { return selectCss; }
  26805. static get cmpMeta() { return {
  26806. "$flags$": 9,
  26807. "$tagName$": "calcite-select",
  26808. "$members$": {
  26809. "disabled": [516],
  26810. "label": [1],
  26811. "name": [513],
  26812. "required": [516],
  26813. "scale": [513],
  26814. "value": [1025],
  26815. "selectedOption": [1040],
  26816. "width": [513],
  26817. "setFocus": [64]
  26818. },
  26819. "$listeners$": [[0, "calciteInternalOptionChange", "handleOptionOrGroupChange"], [0, "calciteInternalOptionGroupChange", "handleOptionOrGroupChange"]],
  26820. "$lazyBundleId$": "-",
  26821. "$attrsToReflect$": [["disabled", "disabled"], ["name", "name"], ["required", "required"], ["scale", "scale"], ["width", "width"]]
  26822. }; }
  26823. }
  26824. const CSS$c = {
  26825. main: "main",
  26826. mainReversed: "main--reversed",
  26827. content: "content",
  26828. contentBehind: "content--behind",
  26829. footer: "footer"
  26830. };
  26831. const SLOTS$7 = {
  26832. centerRow: "center-row",
  26833. primaryPanel: "primary-panel",
  26834. contextualPanel: "contextual-panel",
  26835. panelStart: "panel-start",
  26836. panelEnd: "panel-end",
  26837. header: "header",
  26838. footer: "footer"
  26839. };
  26840. const shellCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-shell:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-shell{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-shell{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-shell{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-shell{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-shell{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-shell:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-shell-h{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-shell-h *.sc-calcite-shell{box-sizing:border-box}/*!@:root*/.sc-calcite-shell:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-shell-h{display:none}/*!@:host*/.sc-calcite-shell-h{position:absolute;inset:0px;display:flex;block-size:100%;inline-size:100%;flex-direction:column;overflow:hidden;--calcite-shell-tip-spacing:26vw}/*!@.main*/.main.sc-calcite-shell{position:relative;display:flex;block-size:100%;inline-size:100%;flex:1 1 auto;flex-direction:row;justify-content:space-between;overflow:hidden}/*!@.main--reversed*/.main--reversed.sc-calcite-shell{flex-direction:row-reverse}/*!@.content*/.content.sc-calcite-shell{display:flex;block-size:100%;inline-size:100%;flex-direction:column;flex-wrap:nowrap;overflow:auto}/*!@.content ::slotted(calcite-shell-center-row), \n.content ::slotted(calcite-panel), \n.content ::slotted(calcite-flow)*/.content .sc-calcite-shell-s>calcite-shell-center-row,.content .sc-calcite-shell-s>calcite-panel,.content .sc-calcite-shell-s>calcite-flow{flex:1 1 auto;align-self:stretch;max-block-size:unset}/*!@.content--behind*/.content--behind.sc-calcite-shell{position:absolute;inset:0px;border-width:0px;z-index:calc(1 - 1);display:initial}/*!@::slotted(calcite-shell-center-row)*/.sc-calcite-shell-s>calcite-shell-center-row{inline-size:unset}/*!@::slotted(.header .heading)*/.sc-calcite-shell-s>.header .heading{font-size:var(--calcite-font-size--2);line-height:1.375;font-weight:var(--calcite-font-weight-normal)}/*!@slot[name=panel-end]::slotted(calcite-shell-panel)*/slot[name=panel-end].sc-calcite-shell-s>calcite-shell-panel{margin-inline-start:auto}/*!@::slotted(calcite-shell-panel), \n::slotted(calcite-shell-center-row)*/.sc-calcite-shell-s>calcite-shell-panel,.sc-calcite-shell-s>calcite-shell-center-row{position:relative;z-index:1}/*!@::slotted(calcite-panel), \n::slotted(calcite-flow)*/.sc-calcite-shell-s>calcite-panel,.sc-calcite-shell-s>calcite-flow{border-width:1px;border-inline-start-width:0px;border-inline-end-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3)}/*!@slot[name=center-row]::slotted(calcite-shell-center-row:not([detached]))*/slot[name=center-row].sc-calcite-shell-s>calcite-shell-center-row:not([detached]){border-inline-start-width:1px;border-inline-end-width:1px;border-color:var(--calcite-ui-border-3)}/*!@::slotted(calcite-tip-manager)*/.sc-calcite-shell-s>calcite-tip-manager{position:absolute;z-index:500;box-sizing:border-box}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}/*!@::slotted(calcite-tip-manager)*/.sc-calcite-shell-s>calcite-tip-manager{animation:in-up var(--calcite-internal-animation-timing-slow) ease-in-out;border-radius:0.25rem;--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);inset-block-end:0.5rem;inset-inline:var(--calcite-shell-tip-spacing)}";
  26841. /**
  26842. * @slot - A slot for adding content to the component. This content will appear between any leading and trailing panels added to the component, such as a map.
  26843. * @slot header - A slot for adding header content. This content will be positioned at the top of the component.
  26844. * @slot footer - A slot for adding footer content. This content will be positioned at the bottom of the component.
  26845. * @slot panel-start - A slot for adding the starting `calcite-shell-panel`.
  26846. * @slot panel-end - A slot for adding the ending `calcite-shell-panel`.
  26847. * @slot primary-panel - [DEPRECATED] A slot for adding the leading `calcite-shell-panel`.
  26848. * @slot contextual-panel - [DEPRECATED] A slot for adding the trailing `calcite-shell-panel`.
  26849. * @slot center-row - A slot for adding content to the center row.
  26850. */
  26851. class Shell {
  26852. constructor(hostRef) {
  26853. registerInstance(this, hostRef);
  26854. // --------------------------------------------------------------------------
  26855. //
  26856. // Properties
  26857. //
  26858. // --------------------------------------------------------------------------
  26859. /**
  26860. * Positions the center content behind any `calcite-shell-panel`s.
  26861. */
  26862. this.contentBehind = false;
  26863. }
  26864. // --------------------------------------------------------------------------
  26865. //
  26866. // Lifecycle
  26867. //
  26868. // --------------------------------------------------------------------------
  26869. connectedCallback() {
  26870. connectConditionalSlotComponent(this);
  26871. }
  26872. disconnectedCallback() {
  26873. disconnectConditionalSlotComponent(this);
  26874. }
  26875. // --------------------------------------------------------------------------
  26876. //
  26877. // Render Methods
  26878. //
  26879. // --------------------------------------------------------------------------
  26880. renderHeader() {
  26881. const hasHeader = !!getSlotted(this.el, SLOTS$7.header);
  26882. return hasHeader ? hAsync("slot", { key: "header", name: SLOTS$7.header }) : null;
  26883. }
  26884. renderContent() {
  26885. const defaultSlotNode = hAsync("slot", { key: "default-slot" });
  26886. const centerRowSlotNode = hAsync("slot", { key: "center-row-slot", name: SLOTS$7.centerRow });
  26887. const contentContainerKey = "content-container";
  26888. const content = !!this.contentBehind
  26889. ? [
  26890. hAsync("div", { class: {
  26891. [CSS$c.content]: true,
  26892. [CSS$c.contentBehind]: true
  26893. }, key: contentContainerKey }, defaultSlotNode),
  26894. centerRowSlotNode
  26895. ]
  26896. : [
  26897. hAsync("div", { class: CSS$c.content, key: contentContainerKey }, defaultSlotNode, centerRowSlotNode)
  26898. ];
  26899. return content;
  26900. }
  26901. renderFooter() {
  26902. const hasFooter = !!getSlotted(this.el, SLOTS$7.footer);
  26903. return hasFooter ? (hAsync("div", { class: CSS$c.footer, key: "footer" }, hAsync("slot", { name: SLOTS$7.footer }))) : null;
  26904. }
  26905. renderMain() {
  26906. const primaryPanel = getSlotted(this.el, SLOTS$7.primaryPanel);
  26907. const mainClasses = {
  26908. [CSS$c.main]: true,
  26909. [CSS$c.mainReversed]: (primaryPanel === null || primaryPanel === void 0 ? void 0 : primaryPanel.position) === "end"
  26910. };
  26911. return (hAsync("div", { class: mainClasses }, hAsync("slot", { name: SLOTS$7.primaryPanel }), hAsync("slot", { name: SLOTS$7.panelStart }), this.renderContent(), hAsync("slot", { name: SLOTS$7.panelEnd }), hAsync("slot", { name: SLOTS$7.contextualPanel })));
  26912. }
  26913. render() {
  26914. return (hAsync(Fragment, null, this.renderHeader(), this.renderMain(), this.renderFooter()));
  26915. }
  26916. get el() { return getElement(this); }
  26917. static get style() { return shellCss; }
  26918. static get cmpMeta() { return {
  26919. "$flags$": 9,
  26920. "$tagName$": "calcite-shell",
  26921. "$members$": {
  26922. "contentBehind": [516, "content-behind"]
  26923. },
  26924. "$listeners$": undefined,
  26925. "$lazyBundleId$": "-",
  26926. "$attrsToReflect$": [["contentBehind", "content-behind"]]
  26927. }; }
  26928. }
  26929. const CSS$b = {
  26930. actionBarContainer: "action-bar-container",
  26931. content: "content"
  26932. };
  26933. const SLOTS$6 = {
  26934. actionBar: "action-bar"
  26935. };
  26936. const shellCenterRowCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-shell-center-row:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-shell-center-row{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-shell-center-row{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-shell-center-row{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-shell-center-row{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-shell-center-row{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-shell-center-row:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-shell-center-row-h{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}/*!@:host **/.sc-calcite-shell-center-row-h *.sc-calcite-shell-center-row{box-sizing:border-box}/*!@:root*/.sc-calcite-shell-center-row:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-shell-center-row-h{display:none}/*!@:host*/.sc-calcite-shell-center-row-h{display:flex;flex:1 1 auto;overflow:hidden;background-color:transparent}/*!@.content*/.content.sc-calcite-shell-center-row{margin:0px;display:flex;block-size:100%;inline-size:100%;overflow:hidden;flex:1 0 0}/*!@.action-bar-container*/.action-bar-container.sc-calcite-shell-center-row{display:flex}/*!@:host([detached])*/[detached].sc-calcite-shell-center-row-h{margin-inline:0.5rem;margin-block:0.5rem 1.5rem}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}/*!@:host([detached])*/[detached].sc-calcite-shell-center-row-h{animation:in-up var(--calcite-internal-animation-timing-slow) ease-in-out;border-radius:0.25rem;border-width:0px;--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([position=end])*/[position=end].sc-calcite-shell-center-row-h{align-self:flex-end}/*!@:host([position=start])*/[position=start].sc-calcite-shell-center-row-h{align-self:flex-start}/*!@:host([height-scale=s])*/[height-scale=s].sc-calcite-shell-center-row-h{block-size:33.333333%}/*!@:host([height-scale=m])*/[height-scale=m].sc-calcite-shell-center-row-h{block-size:70%}/*!@:host([height-scale=l])*/[height-scale=l].sc-calcite-shell-center-row-h{block-size:100%}/*!@:host([height-scale=l][detached])*/[height-scale=l][detached].sc-calcite-shell-center-row-h{block-size:calc(100% - 2rem)}/*!@::slotted(calcite-panel)*/.sc-calcite-shell-center-row-s>calcite-panel{block-size:100%;inline-size:100%}/*!@::slotted(calcite-action-bar),\n::slotted(calcite-action-bar[position=end])*/.sc-calcite-shell-center-row-s>calcite-action-bar,.sc-calcite-shell-center-row-s>calcite-action-bar[position=end]{border-inline-end:1px solid;border-color:var(--calcite-ui-border-3)}";
  26937. /**
  26938. * @slot - A slot for adding content to the `calcite-shell-panel`.
  26939. * @slot action-bar - A slot for adding a `calcite-action-bar` to the `calcite-shell-panel`.
  26940. */
  26941. class ShellCenterRow {
  26942. constructor(hostRef) {
  26943. registerInstance(this, hostRef);
  26944. // --------------------------------------------------------------------------
  26945. //
  26946. // Properties
  26947. //
  26948. // --------------------------------------------------------------------------
  26949. /**
  26950. * When `true`, the content area displays like a floating panel.
  26951. */
  26952. this.detached = false;
  26953. /**
  26954. * Specifies the maximum height of the component.
  26955. */
  26956. this.heightScale = "s";
  26957. /**
  26958. * Specifies the component's position. Will be flipped when the element direction is right-to-left (`"rtl"`).
  26959. */
  26960. this.position = "end";
  26961. }
  26962. // --------------------------------------------------------------------------
  26963. //
  26964. // Lifecycle
  26965. //
  26966. // --------------------------------------------------------------------------
  26967. connectedCallback() {
  26968. connectConditionalSlotComponent(this);
  26969. }
  26970. disconnectedCallback() {
  26971. disconnectConditionalSlotComponent(this);
  26972. }
  26973. // --------------------------------------------------------------------------
  26974. //
  26975. // Render Methods
  26976. //
  26977. // --------------------------------------------------------------------------
  26978. render() {
  26979. const { el } = this;
  26980. const contentNode = (hAsync("div", { class: CSS$b.content }, hAsync("slot", null)));
  26981. const actionBar = getSlotted(el, SLOTS$6.actionBar);
  26982. const actionBarNode = actionBar ? (hAsync("div", { class: CSS$b.actionBarContainer, key: "action-bar" }, hAsync("slot", { name: SLOTS$6.actionBar }))) : null;
  26983. const children = [actionBarNode, contentNode];
  26984. if ((actionBar === null || actionBar === void 0 ? void 0 : actionBar.position) === "end") {
  26985. children.reverse();
  26986. }
  26987. return hAsync(Fragment, null, children);
  26988. }
  26989. get el() { return getElement(this); }
  26990. static get style() { return shellCenterRowCss; }
  26991. static get cmpMeta() { return {
  26992. "$flags$": 9,
  26993. "$tagName$": "calcite-shell-center-row",
  26994. "$members$": {
  26995. "detached": [516],
  26996. "heightScale": [513, "height-scale"],
  26997. "position": [513]
  26998. },
  26999. "$listeners$": undefined,
  27000. "$lazyBundleId$": "-",
  27001. "$attrsToReflect$": [["detached", "detached"], ["heightScale", "height-scale"], ["position", "position"]]
  27002. }; }
  27003. }
  27004. const CSS$a = {
  27005. container: "container",
  27006. content: "content",
  27007. contentHeader: "content__header",
  27008. contentBody: "content__body",
  27009. contentDetached: "content--detached",
  27010. separator: "separator"
  27011. };
  27012. const SLOTS$5 = {
  27013. actionBar: "action-bar",
  27014. header: "header"
  27015. };
  27016. const TEXT$3 = {
  27017. resize: "Resize"
  27018. };
  27019. const shellPanelCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-shell-panel:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-shell-panel{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-shell-panel{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-shell-panel{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-shell-panel{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-shell-panel{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-shell-panel:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-shell-panel:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-shell-panel-h{display:none}/*!@:host*/.sc-calcite-shell-panel-h{pointer-events:none;display:flex;flex:0 1 auto;align-items:stretch;--calcite-shell-panel-detached-max-height:unset}/*!@.container*/.container.sc-calcite-shell-panel{pointer-events:none;box-sizing:border-box;display:flex;flex:1 1 auto;align-items:stretch;background-color:transparent;font-size:var(--calcite-font-size--1);color:var(--calcite-ui-text-2)}/*!@.container **/.container.sc-calcite-shell-panel *.sc-calcite-shell-panel{box-sizing:border-box}/*!@:host(:hover) .separator:not(:hover):not(:focus), \n:host(:focus-within) .separator:not(:hover):not(:focus)*/.sc-calcite-shell-panel-h:hover .separator.sc-calcite-shell-panel:not(:hover):not(:focus),.sc-calcite-shell-panel-h:focus-within .separator.sc-calcite-shell-panel:not(:hover):not(:focus){opacity:1;background-color:var(--calcite-ui-border-3)}/*!@.separator*/.separator.sc-calcite-shell-panel{pointer-events:auto;position:absolute;inset-block:0px;display:flex;block-size:100%;inline-size:0.125rem;background-color:transparent;opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;cursor:col-resize;outline:none}/*!@.separator:hover*/.separator.sc-calcite-shell-panel:hover{opacity:1;background-color:var(--calcite-ui-border-2)}/*!@.separator:focus*/.separator.sc-calcite-shell-panel:focus{background-color:var(--calcite-ui-brand);opacity:1}/*!@:host([position=start]) .separator*/[position=start].sc-calcite-shell-panel-h .separator.sc-calcite-shell-panel{inset-inline-end:-2px}/*!@:host([position=end]) .separator*/[position=end].sc-calcite-shell-panel-h .separator.sc-calcite-shell-panel{inset-inline-start:-2px}/*!@::slotted(calcite-panel), \n::slotted(calcite-flow)*/.sc-calcite-shell-panel-s>calcite-panel,.sc-calcite-shell-panel-s>calcite-flow{block-size:100%;inline-size:100%;flex:1 1 auto;max-block-size:unset;max-inline-size:unset}/*!@::slotted(.calcite-match-height)*/.sc-calcite-shell-panel-s>.calcite-match-height{display:flex;flex:1 1 auto;overflow:hidden}/*!@.content*/.content.sc-calcite-shell-panel{pointer-events:auto;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;align-self:stretch;background-color:var(--calcite-ui-background);padding:0px;inline-size:var(--calcite-shell-panel-width);max-inline-size:var(--calcite-shell-panel-max-width);min-inline-size:var(--calcite-shell-panel-min-width);transition:max-block-size var(--calcite-animation-timing), max-inline-size var(--calcite-animation-timing)}/*!@.content__header*/.content__header.sc-calcite-shell-panel{display:flex;flex:0 1 auto;flex-direction:column;flex-wrap:nowrap;align-items:stretch}/*!@.content__body*/.content__body.sc-calcite-shell-panel{display:flex;flex:1 1 auto;flex-direction:column;overflow:hidden}/*!@:host([width-scale=s]) .content*/[width-scale=s].sc-calcite-shell-panel-h .content.sc-calcite-shell-panel{--calcite-shell-panel-width:calc(var(--calcite-panel-width-multiplier) * 12vw);--calcite-shell-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 300px);--calcite-shell-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 150px)}/*!@:host([width-scale=m]) .content*/[width-scale=m].sc-calcite-shell-panel-h .content.sc-calcite-shell-panel{--calcite-shell-panel-width:calc(var(--calcite-panel-width-multiplier) * 20vw);--calcite-shell-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 420px);--calcite-shell-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 240px)}/*!@:host([width-scale=l]) .content*/[width-scale=l].sc-calcite-shell-panel-h .content.sc-calcite-shell-panel{--calcite-shell-panel-width:calc(var(--calcite-panel-width-multiplier) * 45vw);--calcite-shell-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 680px);--calcite-shell-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 340px)}/*!@:host([detached-height-scale=s]) .content--detached*/[detached-height-scale=s].sc-calcite-shell-panel-h .content--detached.sc-calcite-shell-panel{--calcite-shell-panel-detached-max-height:40vh}/*!@:host([detached-height-scale=m]) .content--detached*/[detached-height-scale=m].sc-calcite-shell-panel-h .content--detached.sc-calcite-shell-panel{--calcite-shell-panel-detached-max-height:60vh}/*!@:host([detached-height-scale=l]) .content--detached*/[detached-height-scale=l].sc-calcite-shell-panel-h .content--detached.sc-calcite-shell-panel{--calcite-shell-panel-detached-max-height:80vh}/*!@.content--detached*/.content--detached.sc-calcite-shell-panel{margin-inline:0.5rem;margin-block:0.5rem auto;block-size:auto;overflow:hidden;border-radius:0.25rem;--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);max-block-size:var(--calcite-shell-panel-detached-max-height)}/*!@.content--detached ::slotted(calcite-panel),\n.content--detached ::slotted(calcite-flow)*/.content--detached .sc-calcite-shell-panel-s>calcite-panel,.content--detached .sc-calcite-shell-panel-s>calcite-flow{max-block-size:unset}/*!@:host([position=start]) .content--detached ::slotted(calcite-panel), \n:host([position=start]) .content--detached ::slotted(calcite-flow), \n:host([position=end]) .content--detached ::slotted(calcite-panel), \n:host([position=end]) .content--detached ::slotted(calcite-flow)*/.sc-calcite-shell-panel-h[position=start] .content--detached .sc-calcite-shell-panel-s>calcite-panel,.sc-calcite-shell-panel-h[position=start] .content--detached .sc-calcite-shell-panel-s>calcite-flow,.sc-calcite-shell-panel-h[position=end] .content--detached .sc-calcite-shell-panel-s>calcite-panel,.sc-calcite-shell-panel-h[position=end] .content--detached .sc-calcite-shell-panel-s>calcite-flow{border-style:none}/*!@.content[hidden]*/.content[hidden].sc-calcite-shell-panel{display:none}/*!@slot[name=action-bar]::slotted(calcite-action-bar), \n.content ::slotted(calcite-flow), \n.content ::slotted(calcite-panel:not([dismissed]))*/slot[name=action-bar].sc-calcite-shell-panel-s>calcite-action-bar,.content .sc-calcite-shell-panel-s>calcite-flow,.content .sc-calcite-shell-panel-s>calcite-panel:not([dismissed]){border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}/*!@:host([position=start]) slot[name=action-bar]::slotted(calcite-action-bar),\n:host([position=start]) .content ::slotted(calcite-flow),\n:host([position=start]) .content ::slotted(calcite-panel)*/.sc-calcite-shell-panel-h[position=start] slot[name=action-bar].sc-calcite-shell-panel-s>calcite-action-bar,.sc-calcite-shell-panel-h[position=start] .content .sc-calcite-shell-panel-s>calcite-flow,.sc-calcite-shell-panel-h[position=start] .content .sc-calcite-shell-panel-s>calcite-panel{border-inline-start:none}/*!@:host([position=end]) slot[name=action-bar]::slotted(calcite-action-bar),\n:host([position=end]) .content ::slotted(calcite-flow),\n:host([position=end]) .content ::slotted(calcite-panel)*/.sc-calcite-shell-panel-h[position=end] slot[name=action-bar].sc-calcite-shell-panel-s>calcite-action-bar,.sc-calcite-shell-panel-h[position=end] .content .sc-calcite-shell-panel-s>calcite-flow,.sc-calcite-shell-panel-h[position=end] .content .sc-calcite-shell-panel-s>calcite-panel{border-inline-end:none}";
  27020. /**
  27021. * @slot - A slot for adding content to the component.
  27022. * @slot action-bar - A slot for adding a `calcite-action-bar` to the component.
  27023. */
  27024. class ShellPanel {
  27025. constructor(hostRef) {
  27026. registerInstance(this, hostRef);
  27027. this.calciteShellPanelToggle = createEvent(this, "calciteShellPanelToggle", 6);
  27028. // --------------------------------------------------------------------------
  27029. //
  27030. // Properties
  27031. //
  27032. // --------------------------------------------------------------------------
  27033. /**
  27034. * When `true`, hides the component's content area.
  27035. */
  27036. this.collapsed = false;
  27037. /**
  27038. * When `true`, the content area displays like a floating panel.
  27039. */
  27040. this.detached = false;
  27041. /**
  27042. * When `detached`, specifies the maximum height of the component.
  27043. */
  27044. this.detachedHeightScale = "l";
  27045. /**
  27046. * Specifies the width of the component's content area.
  27047. */
  27048. this.widthScale = "m";
  27049. /**
  27050. * Accessible name for the resize separator.
  27051. *
  27052. * @default "Resize"
  27053. */
  27054. this.intlResize = TEXT$3.resize;
  27055. /**
  27056. * When `true` and not `detached`, the component's content area is resizable.
  27057. */
  27058. this.resizable = false;
  27059. this.contentWidth = null;
  27060. this.initialContentWidth = null;
  27061. this.initialClientX = null;
  27062. this.contentWidthMax = null;
  27063. this.contentWidthMin = null;
  27064. this.step = 1;
  27065. this.stepMultiplier = 10;
  27066. this.storeContentEl = (contentEl) => {
  27067. this.contentEl = contentEl;
  27068. };
  27069. this.getKeyAdjustedWidth = (event) => {
  27070. const { key } = event;
  27071. const { el, step, stepMultiplier, contentWidthMin, contentWidthMax, initialContentWidth, position } = this;
  27072. const multipliedStep = step * stepMultiplier;
  27073. const MOVEMENT_KEYS = [
  27074. "ArrowUp",
  27075. "ArrowDown",
  27076. "ArrowLeft",
  27077. "ArrowRight",
  27078. "Home",
  27079. "End",
  27080. "PageUp",
  27081. "PageDown"
  27082. ];
  27083. if (MOVEMENT_KEYS.indexOf(key) > -1) {
  27084. event.preventDefault();
  27085. }
  27086. const dir = getElementDir(el);
  27087. const directionKeys = ["ArrowLeft", "ArrowRight"];
  27088. const directionFactor = dir === "rtl" && directionKeys.includes(key) ? -1 : 1;
  27089. const increaseKeys = key === "ArrowUp" ||
  27090. (position === "end" ? key === directionKeys[0] : key === directionKeys[1]);
  27091. if (increaseKeys) {
  27092. const stepValue = event.shiftKey ? multipliedStep : step;
  27093. return initialContentWidth + directionFactor * stepValue;
  27094. }
  27095. const decreaseKeys = key === "ArrowDown" ||
  27096. (position === "end" ? key === directionKeys[1] : key === directionKeys[0]);
  27097. if (decreaseKeys) {
  27098. const stepValue = event.shiftKey ? multipliedStep : step;
  27099. return initialContentWidth - directionFactor * stepValue;
  27100. }
  27101. if (typeof contentWidthMin === "number" && key === "Home") {
  27102. return contentWidthMin;
  27103. }
  27104. if (typeof contentWidthMax === "number" && key === "End") {
  27105. return contentWidthMax;
  27106. }
  27107. if (key === "PageDown") {
  27108. return initialContentWidth - multipliedStep;
  27109. }
  27110. if (key === "PageUp") {
  27111. return initialContentWidth + multipliedStep;
  27112. }
  27113. return null;
  27114. };
  27115. this.separatorKeyDown = (event) => {
  27116. this.setInitialContentWidth();
  27117. const width = this.getKeyAdjustedWidth(event);
  27118. if (typeof width === "number") {
  27119. this.setContentWidth(width);
  27120. }
  27121. };
  27122. this.separatorPointerMove = (event) => {
  27123. event.preventDefault();
  27124. const { el, initialContentWidth, position, initialClientX } = this;
  27125. const offset = event.clientX - initialClientX;
  27126. const dir = getElementDir(el);
  27127. const adjustmentDirection = dir === "rtl" ? -1 : 1;
  27128. const adjustedOffset = position === "end" ? -adjustmentDirection * offset : adjustmentDirection * offset;
  27129. const width = initialContentWidth + adjustedOffset;
  27130. this.setContentWidth(width);
  27131. };
  27132. this.separatorPointerUp = (event) => {
  27133. if (!isPrimaryPointerButton(event)) {
  27134. return;
  27135. }
  27136. event.preventDefault();
  27137. document.removeEventListener("pointerup", this.separatorPointerUp);
  27138. document.removeEventListener("pointermove", this.separatorPointerMove);
  27139. };
  27140. this.setInitialContentWidth = () => {
  27141. var _a;
  27142. this.initialContentWidth = (_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
  27143. };
  27144. this.separatorPointerDown = (event) => {
  27145. if (!isPrimaryPointerButton(event)) {
  27146. return;
  27147. }
  27148. event.preventDefault();
  27149. const { separatorEl } = this;
  27150. separatorEl && document.activeElement !== separatorEl && separatorEl.focus();
  27151. this.setInitialContentWidth();
  27152. this.initialClientX = event.clientX;
  27153. document.addEventListener("pointerup", this.separatorPointerUp);
  27154. document.addEventListener("pointermove", this.separatorPointerMove);
  27155. };
  27156. this.connectSeparator = (separatorEl) => {
  27157. this.disconnectSeparator();
  27158. this.separatorEl = separatorEl;
  27159. separatorEl.addEventListener("pointerdown", this.separatorPointerDown);
  27160. };
  27161. this.disconnectSeparator = () => {
  27162. var _a;
  27163. (_a = this.separatorEl) === null || _a === void 0 ? void 0 : _a.removeEventListener("pointerdown", this.separatorPointerDown);
  27164. };
  27165. }
  27166. watchHandler() {
  27167. this.calciteShellPanelToggle.emit();
  27168. }
  27169. //--------------------------------------------------------------------------
  27170. //
  27171. // Lifecycle
  27172. //
  27173. //--------------------------------------------------------------------------
  27174. connectedCallback() {
  27175. connectConditionalSlotComponent(this);
  27176. }
  27177. disconnectedCallback() {
  27178. disconnectConditionalSlotComponent(this);
  27179. this.disconnectSeparator();
  27180. }
  27181. componentDidLoad() {
  27182. this.updateAriaValues();
  27183. }
  27184. // --------------------------------------------------------------------------
  27185. //
  27186. // Render Methods
  27187. //
  27188. // --------------------------------------------------------------------------
  27189. renderHeader() {
  27190. const { el } = this;
  27191. const hasHeader = getSlotted(el, SLOTS$5.header);
  27192. return hasHeader ? (hAsync("div", { class: CSS$a.contentHeader, key: "header" }, hAsync("slot", { name: SLOTS$5.header }))) : null;
  27193. }
  27194. render() {
  27195. const { collapsed, detached, position, initialContentWidth, contentWidth, contentWidthMax, contentWidthMin, intlResize, resizable } = this;
  27196. const allowResizing = !detached && resizable;
  27197. const contentNode = (hAsync("div", { class: { [CSS$a.content]: true, [CSS$a.contentDetached]: detached }, hidden: collapsed, key: "content", ref: this.storeContentEl, style: allowResizing && contentWidth ? { width: `${contentWidth}px` } : null }, this.renderHeader(), hAsync("div", { class: CSS$a.contentBody }, hAsync("slot", null))));
  27198. const separatorNode = allowResizing ? (hAsync("div", { "aria-label": intlResize, "aria-orientation": "horizontal", "aria-valuemax": contentWidthMax, "aria-valuemin": contentWidthMin, "aria-valuenow": contentWidth !== null && contentWidth !== void 0 ? contentWidth : initialContentWidth, class: CSS$a.separator, key: "separator", onKeyDown: this.separatorKeyDown, ref: this.connectSeparator, role: "separator", tabIndex: 0, "touch-action": "none" })) : null;
  27199. const actionBarNode = hAsync("slot", { key: "action-bar", name: SLOTS$5.actionBar });
  27200. const mainNodes = [actionBarNode, contentNode, separatorNode];
  27201. if (position === "end") {
  27202. mainNodes.reverse();
  27203. }
  27204. return hAsync("div", { class: { [CSS$a.container]: true } }, mainNodes);
  27205. }
  27206. // --------------------------------------------------------------------------
  27207. //
  27208. // private Methods
  27209. //
  27210. // --------------------------------------------------------------------------
  27211. setContentWidth(width) {
  27212. const { contentWidthMax, contentWidthMin } = this;
  27213. const roundedWidth = Math.round(width);
  27214. this.contentWidth =
  27215. typeof contentWidthMax === "number" && typeof contentWidthMin === "number"
  27216. ? clamp(roundedWidth, contentWidthMin, contentWidthMax)
  27217. : roundedWidth;
  27218. }
  27219. updateAriaValues() {
  27220. const { contentEl } = this;
  27221. const computedStyle = contentEl && getComputedStyle(contentEl);
  27222. if (!computedStyle) {
  27223. return;
  27224. }
  27225. const max = parseInt(computedStyle.getPropertyValue("max-width"), 10);
  27226. const min = parseInt(computedStyle.getPropertyValue("min-width"), 10);
  27227. const valueNow = parseInt(computedStyle.getPropertyValue("width"), 10);
  27228. if (typeof valueNow === "number" && !isNaN(valueNow)) {
  27229. this.initialContentWidth = valueNow;
  27230. }
  27231. if (typeof max === "number" && !isNaN(max)) {
  27232. this.contentWidthMax = max;
  27233. }
  27234. if (typeof min === "number" && !isNaN(min)) {
  27235. this.contentWidthMin = min;
  27236. }
  27237. forceUpdate$1(this);
  27238. }
  27239. get el() { return getElement(this); }
  27240. static get watchers() { return {
  27241. "collapsed": ["watchHandler"]
  27242. }; }
  27243. static get style() { return shellPanelCss; }
  27244. static get cmpMeta() { return {
  27245. "$flags$": 9,
  27246. "$tagName$": "calcite-shell-panel",
  27247. "$members$": {
  27248. "collapsed": [516],
  27249. "detached": [516],
  27250. "detachedHeightScale": [513, "detached-height-scale"],
  27251. "widthScale": [513, "width-scale"],
  27252. "position": [513],
  27253. "intlResize": [1, "intl-resize"],
  27254. "resizable": [516],
  27255. "contentWidth": [32]
  27256. },
  27257. "$listeners$": undefined,
  27258. "$lazyBundleId$": "-",
  27259. "$attrsToReflect$": [["collapsed", "collapsed"], ["detached", "detached"], ["detachedHeightScale", "detached-height-scale"], ["widthScale", "width-scale"], ["position", "position"], ["resizable", "resizable"]]
  27260. }; }
  27261. }
  27262. const CSS$9 = {
  27263. handleLabel: "handle__label",
  27264. handleLabelMinValue: "handle__label--minValue",
  27265. handleLabelValue: "handle__label--value",
  27266. tickMin: "tick__label--min",
  27267. tickMax: "tick__label--max"
  27268. };
  27269. const sliderCss = "@charset \"UTF-8\";@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-slider:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-slider{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-slider{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-slider{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-slider{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-slider{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-slider:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-slider:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-slider-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-slider-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@.scale--s*/.scale--s.sc-calcite-slider{--calcite-slider-handle-size:10px;--calcite-slider-handle-extension-height:6.5px;--calcite-slider-container-font-size:var(--calcite-font-size--3)}/*!@.scale--s .handle__label, \n.scale--s .tick__label*/.scale--s.sc-calcite-slider .handle__label.sc-calcite-slider,.scale--s.sc-calcite-slider .tick__label.sc-calcite-slider{line-height:.75rem}/*!@.scale--m*/.scale--m.sc-calcite-slider{--calcite-slider-handle-size:14px;--calcite-slider-handle-extension-height:8px;--calcite-slider-container-font-size:var(--calcite-font-size--2)}/*!@.scale--m .handle__label, \n.scale--m .tick__label*/.scale--m.sc-calcite-slider .handle__label.sc-calcite-slider,.scale--m.sc-calcite-slider .tick__label.sc-calcite-slider{line-height:1rem}/*!@.scale--l*/.scale--l.sc-calcite-slider{--calcite-slider-handle-size:16px;--calcite-slider-handle-extension-height:10.5px;--calcite-slider-container-font-size:var(--calcite-font-size--1)}/*!@.scale--l .handle__label, \n.scale--l .tick__label*/.scale--l.sc-calcite-slider .handle__label.sc-calcite-slider,.scale--l.sc-calcite-slider .tick__label.sc-calcite-slider{line-height:1rem}/*!@.handle__label, \n.tick__label*/.handle__label.sc-calcite-slider,.tick__label.sc-calcite-slider{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2);font-size:var(--calcite-slider-container-font-size)}/*!@:host*/.sc-calcite-slider-h{display:block}/*!@.container*/.container.sc-calcite-slider{position:relative;display:block;overflow-wrap:normal;word-break:normal;padding-inline:calc(var(--calcite-slider-handle-size) * 0.5);padding-block:calc(var(--calcite-slider-handle-size) * 0.5);margin-block:calc(var(--calcite-slider-handle-size) * 0.5);margin-inline:0;--calcite-slider-full-handle-height:calc(\n var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height)\n )}/*!@:host([disabled]) .track__range,\n:host([disabled]) .tick--active*/[disabled].sc-calcite-slider-h .track__range.sc-calcite-slider,[disabled].sc-calcite-slider-h .tick--active.sc-calcite-slider{background-color:var(--calcite-ui-text-3)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-slider-h[disabled] .sc-calcite-slider-s>[calcite-hydrated][disabled],[disabled].sc-calcite-slider-h [calcite-hydrated][disabled].sc-calcite-slider{opacity:1}/*!@.scale--s .thumb:not(.thumb--precise)*/.scale--s.sc-calcite-slider .thumb.sc-calcite-slider:not(.thumb--precise){--calcite-slider-thumb-y-offset:-6px}/*!@.scale--m .thumb:not(.thumb--precise)*/.scale--m.sc-calcite-slider .thumb.sc-calcite-slider:not(.thumb--precise){--calcite-slider-thumb-y-offset:-8px}/*!@.scale--l .thumb:not(.thumb--precise)*/.scale--l.sc-calcite-slider .thumb.sc-calcite-slider:not(.thumb--precise){--calcite-slider-thumb-y-offset:-9px}/*!@:host([precise]:not([has-histogram])) .container .thumb--value*/[precise].sc-calcite-slider-h:not([has-histogram]) .container.sc-calcite-slider .thumb--value.sc-calcite-slider{--calcite-slider-thumb-y-offset:calc(var(--calcite-slider-full-handle-height) * -1)}/*!@.thumb-container*/.thumb-container.sc-calcite-slider{position:relative;max-inline-size:100%}/*!@.thumb*/.thumb.sc-calcite-slider{--calcite-slider-thumb-x-offset:calc(var(--calcite-slider-handle-size) * 0.5);position:absolute;margin:0px;display:flex;cursor:pointer;flex-direction:column;align-items:center;border-style:none;background-color:transparent;padding:0px;font-family:inherit;outline:2px solid transparent;outline-offset:2px;transform:translate(var(--calcite-slider-thumb-x-offset), var(--calcite-slider-thumb-y-offset))}/*!@.thumb .handle__label.static, .thumb .handle__label.transformed*/.thumb.sc-calcite-slider .handle__label.static.sc-calcite-slider,.thumb.sc-calcite-slider .handle__label.transformed.sc-calcite-slider{position:absolute;inset-block:0px;opacity:0}/*!@.thumb .handle__label.hyphen::after*/.thumb.sc-calcite-slider .handle__label.hyphen.sc-calcite-slider::after{content:\"—\";display:inline-block;inline-size:1em}/*!@.thumb .handle__label.hyphen--wrap*/.thumb.sc-calcite-slider .handle__label.hyphen--wrap.sc-calcite-slider{display:flex}/*!@.thumb .handle*/.thumb.sc-calcite-slider .handle.sc-calcite-slider{box-sizing:border-box;border-radius:9999px;background-color:var(--calcite-ui-foreground-1);outline-color:transparent;block-size:var(--calcite-slider-handle-size);inline-size:var(--calcite-slider-handle-size);box-shadow:0 0 0 2px var(--calcite-ui-text-3) inset;transition:border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, box-shadow var(--calcite-animation-timing) ease}/*!@.thumb .handle-extension*/.thumb.sc-calcite-slider .handle-extension.sc-calcite-slider{inline-size:0.125rem;block-size:var(--calcite-slider-handle-extension-height);background-color:var(--calcite-ui-text-3)}/*!@.thumb:hover .handle*/.thumb.sc-calcite-slider:hover .handle.sc-calcite-slider{box-shadow:0 0 0 3px var(--calcite-ui-brand) inset}/*!@.thumb:hover .handle-extension*/.thumb.sc-calcite-slider:hover .handle-extension.sc-calcite-slider{background-color:var(--calcite-ui-brand)}/*!@.thumb:focus .handle*/.thumb.sc-calcite-slider:focus .handle.sc-calcite-slider{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.thumb:focus .handle-extension*/.thumb.sc-calcite-slider:focus .handle-extension.sc-calcite-slider{background-color:var(--calcite-ui-brand)}/*!@.thumb.thumb--minValue*/.thumb.thumb--minValue.sc-calcite-slider{transform:translate(calc(var(--calcite-slider-thumb-x-offset) * -1), var(--calcite-slider-thumb-y-offset))}/*!@.thumb.thumb--precise*/.thumb.thumb--precise.sc-calcite-slider{--calcite-slider-thumb-y-offset:-2px}/*!@:host([label-handles]) .thumb*/[label-handles].sc-calcite-slider-h .thumb.sc-calcite-slider{--calcite-slider-thumb-x-offset:50%}/*!@:host([label-handles]):host(:not([has-histogram])) .scale--s .thumb:not(.thumb--precise)*/[label-handles].sc-calcite-slider-h(.sc-calcite-slider-h:not([has-histogram])) .scale--s.sc-calcite-slider .thumb.sc-calcite-slider:not(.thumb--precise){--calcite-slider-thumb-y-offset:-23px}/*!@:host([label-handles]):host(:not([has-histogram])) .scale--m .thumb:not(.thumb--precise)*/[label-handles].sc-calcite-slider-h(.sc-calcite-slider-h:not([has-histogram])) .scale--m.sc-calcite-slider .thumb.sc-calcite-slider:not(.thumb--precise){--calcite-slider-thumb-y-offset:-30px}/*!@:host([label-handles]):host(:not([has-histogram])) .scale--l .thumb:not(.thumb--precise)*/[label-handles].sc-calcite-slider-h(.sc-calcite-slider-h:not([has-histogram])) .scale--l.sc-calcite-slider .thumb.sc-calcite-slider:not(.thumb--precise){--calcite-slider-thumb-y-offset:-32px}/*!@:host([has-histogram][label-handles]) .handle__label,\n:host([label-handles]:not([has-histogram])) .thumb--minValue.thumb--precise .handle__label*/[has-histogram][label-handles].sc-calcite-slider-h .handle__label.sc-calcite-slider,[label-handles].sc-calcite-slider-h:not([has-histogram]) .thumb--minValue.thumb--precise.sc-calcite-slider .handle__label.sc-calcite-slider{margin-block-start:0.5em}/*!@:host(:not([has-histogram]):not([precise])) .handle__label,\n:host([label-handles]:not([has-histogram])) .thumb--value .handle__label*/.sc-calcite-slider-h:not([has-histogram]):not([precise]) .handle__label.sc-calcite-slider,[label-handles].sc-calcite-slider-h:not([has-histogram]) .thumb--value.sc-calcite-slider .handle__label.sc-calcite-slider{margin-block-end:0.5em}/*!@:host([label-handles][precise]):host(:not([has-histogram])) .scale--s .thumb--value*/[label-handles][precise].sc-calcite-slider-h(.sc-calcite-slider-h:not([has-histogram])) .scale--s.sc-calcite-slider .thumb--value.sc-calcite-slider{--calcite-slider-thumb-y-offset:-33px}/*!@:host([label-handles][precise]):host(:not([has-histogram])) .scale--m .thumb--value*/[label-handles][precise].sc-calcite-slider-h(.sc-calcite-slider-h:not([has-histogram])) .scale--m.sc-calcite-slider .thumb--value.sc-calcite-slider{--calcite-slider-thumb-y-offset:-44px}/*!@:host([label-handles][precise]):host(:not([has-histogram])) .scale--l .thumb--value*/[label-handles][precise].sc-calcite-slider-h(.sc-calcite-slider-h:not([has-histogram])) .scale--l.sc-calcite-slider .thumb--value.sc-calcite-slider{--calcite-slider-thumb-y-offset:-49px}/*!@.thumb:focus .handle, \n.thumb--active .handle*/.thumb.sc-calcite-slider:focus .handle.sc-calcite-slider,.thumb--active.sc-calcite-slider .handle.sc-calcite-slider{background-color:var(--calcite-ui-brand);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.16)}/*!@.thumb:hover.thumb--precise:after, \n.thumb:focus.thumb--precise:after, \n.thumb--active.thumb--precise:after*/.thumb.sc-calcite-slider:hover.thumb--precise:after,.thumb.sc-calcite-slider:focus.thumb--precise:after,.thumb--active.thumb--precise.sc-calcite-slider:after{background-color:var(--calcite-ui-brand)}/*!@.track*/.track.sc-calcite-slider{position:relative;block-size:0.125rem;border-radius:0px;background-color:var(--calcite-ui-border-2);transition:all var(--calcite-internal-animation-timing-medium) ease-in}/*!@.track__range*/.track__range.sc-calcite-slider{position:absolute;inset-block-start:0px;block-size:0.125rem;background-color:var(--calcite-ui-brand)}/*!@.container--range .track__range:hover*/.container--range.sc-calcite-slider .track__range.sc-calcite-slider:hover{cursor:ew-resize}/*!@.container--range .track__range:after*/.container--range.sc-calcite-slider .track__range.sc-calcite-slider:after{position:absolute;inline-size:100%;content:\"\";inset-block-start:calc(var(--calcite-slider-full-handle-height) * 0.5 * -1);block-size:calc(var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height))}@media (forced-colors: active){/*!@.thumb*/.thumb.sc-calcite-slider{outline-width:0;outline-offset:0}/*!@.handle*/.handle.sc-calcite-slider{outline:2px solid transparent;outline-offset:2px}/*!@.thumb:focus .handle,\n.thumb .handle-extension,\n.thumb:hover .handle-extension,\n.thumb:focus .handle-extension,\n.thumb:active .handle-extension*/.thumb.sc-calcite-slider:focus .handle.sc-calcite-slider,.thumb.sc-calcite-slider .handle-extension.sc-calcite-slider,.thumb.sc-calcite-slider:hover .handle-extension.sc-calcite-slider,.thumb.sc-calcite-slider:focus .handle-extension.sc-calcite-slider,.thumb.sc-calcite-slider:active .handle-extension.sc-calcite-slider{background-color:canvasText}/*!@.track*/.track.sc-calcite-slider{background-color:canvasText}/*!@.track__range*/.track__range.sc-calcite-slider{background-color:highlight}}/*!@.tick*/.tick.sc-calcite-slider{position:absolute;block-size:0.25rem;inline-size:0.125rem;border-width:1px;border-style:solid;background-color:var(--calcite-ui-border-input);border-color:var(--calcite-ui-foreground-1);inset-block-start:-2px;pointer-events:none;margin-inline-start:calc(-1 * 0.125rem)}/*!@.tick--active*/.tick--active.sc-calcite-slider{background-color:var(--calcite-ui-brand)}/*!@.tick__label*/.tick__label.sc-calcite-slider{pointer-events:none;margin-block-start:0.875rem;display:flex;justify-content:center}/*!@.tick__label--min*/.tick__label--min.sc-calcite-slider{transition:opacity var(--calcite-animation-timing)}/*!@.tick__label--max*/.tick__label--max.sc-calcite-slider{transition:opacity var(--calcite-internal-animation-timing-fast)}/*!@:host([has-histogram][label-handles]) .tick__label--min, \n:host([has-histogram][label-handles]) .tick__label--max, \n:host([has-histogram][precise]) .tick__label--min, \n:host([has-histogram][precise]) .tick__label--max*/[has-histogram][label-handles].sc-calcite-slider-h .tick__label--min.sc-calcite-slider,[has-histogram][label-handles].sc-calcite-slider-h .tick__label--max.sc-calcite-slider,[has-histogram][precise].sc-calcite-slider-h .tick__label--min.sc-calcite-slider,[has-histogram][precise].sc-calcite-slider-h .tick__label--max.sc-calcite-slider{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}/*!@.graph*/.graph.sc-calcite-slider{color:var(--calcite-ui-foreground-3);block-size:48px}/*!@:host([label-ticks][ticks]) .container*/[label-ticks][ticks].sc-calcite-slider-h .container.sc-calcite-slider{padding-block-end:calc(0.875rem + var(--calcite-slider-container-font-size))}/*!@:host([has-histogram]):host([precise][label-handles]) .container*/[has-histogram].sc-calcite-slider-h([precise][label-handles]).sc-calcite-slider-h .container.sc-calcite-slider{padding-block-end:calc(var(--calcite-slider-full-handle-height) + 1em)}/*!@:host([has-histogram]):host([label-handles]:not([precise])) .container*/[has-histogram].sc-calcite-slider-h([label-handles].sc-calcite-slider-h:not([precise])) .container.sc-calcite-slider{padding-block-end:calc(var(--calcite-slider-handle-size) * 0.5 + 1em)}/*!@:host([has-histogram]):host([precise]:not([label-handles])) .container*/[has-histogram].sc-calcite-slider-h([precise].sc-calcite-slider-h:not([label-handles])) .container.sc-calcite-slider{padding-block-end:var(--calcite-slider-full-handle-height)}/*!@:host(:not([has-histogram])):host([precise]:not([label-handles])) .container*/.sc-calcite-slider-h:not([has-histogram]).sc-calcite-slider-h([precise]:not([label-handles])) .container.sc-calcite-slider{padding-block-start:var(--calcite-slider-full-handle-height)}/*!@:host(:not([has-histogram])):host([precise]:not([label-handles])) .container--range*/.sc-calcite-slider-h:not([has-histogram]).sc-calcite-slider-h([precise]:not([label-handles])) .container--range.sc-calcite-slider{padding-block-end:var(--calcite-slider-full-handle-height)}/*!@:host(:not([has-histogram])):host([label-handles]:not([precise])) .container*/.sc-calcite-slider-h:not([has-histogram]).sc-calcite-slider-h([label-handles]:not([precise])) .container.sc-calcite-slider{padding-block-start:calc(var(--calcite-slider-full-handle-height) + 4px)}/*!@:host(:not([has-histogram])):host([label-handles][precise]) .container*/.sc-calcite-slider-h:not([has-histogram]).sc-calcite-slider-h([label-handles][precise]) .container.sc-calcite-slider{padding-block-start:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}/*!@:host(:not([has-histogram])):host([label-handles][precise]) .container--range*/.sc-calcite-slider-h:not([has-histogram]).sc-calcite-slider-h([label-handles][precise]) .container--range.sc-calcite-slider{padding-block-end:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-slider-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  27270. function isRange(value) {
  27271. return Array.isArray(value);
  27272. }
  27273. class Slider {
  27274. constructor(hostRef) {
  27275. registerInstance(this, hostRef);
  27276. this.calciteSliderInput = createEvent(this, "calciteSliderInput", 6);
  27277. this.calciteSliderChange = createEvent(this, "calciteSliderChange", 6);
  27278. this.calciteSliderUpdate = createEvent(this, "calciteSliderUpdate", 6);
  27279. //--------------------------------------------------------------------------
  27280. //
  27281. // Properties
  27282. //
  27283. //--------------------------------------------------------------------------
  27284. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  27285. this.disabled = false;
  27286. /**
  27287. * When `true`, number values are displayed with a group separator corresponding to the language and country format.
  27288. */
  27289. this.groupSeparator = false;
  27290. /** When `true`, indicates a histogram is present. */
  27291. this.hasHistogram = false;
  27292. /** When `true`, displays label handles with their numeric value. */
  27293. this.labelHandles = false;
  27294. /** When `true` and `ticks` is specified, displays label tick marks with their numeric value. */
  27295. this.labelTicks = false;
  27296. /** The component's maximum selectable value. */
  27297. this.max = 100;
  27298. /** The component's minimum selectable value. */
  27299. this.min = 0;
  27300. /**
  27301. * When `true`, the slider will display values from high to low.
  27302. *
  27303. * Note that this value will be ignored if the slider has an associated histogram.
  27304. */
  27305. this.mirrored = false;
  27306. /** When `true`, sets a finer point for handles. */
  27307. this.precise = false;
  27308. /**
  27309. * When `true`, the component must have a value in order for the form to submit.
  27310. */
  27311. this.required = false;
  27312. /** When `true`, enables snap selection in coordination with `step` via a mouse. */
  27313. this.snap = false;
  27314. /** Specifies the interval to move with the up, or down keys. */
  27315. this.step = 1;
  27316. /** The component's value. */
  27317. this.value = 0;
  27318. /**
  27319. * Specifies the size of the component.
  27320. */
  27321. this.scale = "m";
  27322. this.activeProp = "value";
  27323. this.guid = `calcite-slider-${guid()}`;
  27324. this.effectiveLocale = "";
  27325. this.minMaxValueRange = null;
  27326. this.minValueDragRange = null;
  27327. this.maxValueDragRange = null;
  27328. this.tickValues = [];
  27329. this.dragUpdate = (event) => {
  27330. event.preventDefault();
  27331. if (this.dragProp) {
  27332. const value = this.translate(event.clientX || event.pageX);
  27333. if (isRange(this.value) && this.dragProp === "minMaxValue") {
  27334. if (this.minValueDragRange && this.maxValueDragRange && this.minMaxValueRange) {
  27335. const newMinValue = value - this.minValueDragRange;
  27336. const newMaxValue = value + this.maxValueDragRange;
  27337. if (newMaxValue <= this.max &&
  27338. newMinValue >= this.min &&
  27339. newMaxValue - newMinValue === this.minMaxValueRange) {
  27340. this.setValue({
  27341. minValue: this.clamp(newMinValue, "minValue"),
  27342. maxValue: this.clamp(newMaxValue, "maxValue")
  27343. });
  27344. }
  27345. }
  27346. else {
  27347. this.minValueDragRange = value - this.minValue;
  27348. this.maxValueDragRange = this.maxValue - value;
  27349. this.minMaxValueRange = this.maxValue - this.minValue;
  27350. }
  27351. }
  27352. else {
  27353. this.setValue({ [this.dragProp]: this.clamp(value, this.dragProp) });
  27354. }
  27355. }
  27356. };
  27357. this.pointerUpDragEnd = (event) => {
  27358. if (!isPrimaryPointerButton(event)) {
  27359. return;
  27360. }
  27361. this.dragEnd(event);
  27362. };
  27363. this.dragEnd = (event) => {
  27364. this.removeDragListeners();
  27365. this.focusActiveHandle(event.clientX);
  27366. if (this.lastDragPropValue != this[this.dragProp]) {
  27367. this.emitChange();
  27368. }
  27369. this.dragProp = null;
  27370. this.lastDragPropValue = null;
  27371. this.minValueDragRange = null;
  27372. this.maxValueDragRange = null;
  27373. this.minMaxValueRange = null;
  27374. };
  27375. /**
  27376. * Set the reference of the track Element
  27377. *
  27378. * @internal
  27379. * @param node
  27380. */
  27381. this.storeTrackRef = (node) => {
  27382. this.trackEl = node;
  27383. };
  27384. /**
  27385. * Returns a string representing the localized label value based if the groupSeparator prop is parsed.
  27386. *
  27387. * @param value
  27388. */
  27389. this.determineGroupSeparator = (value) => {
  27390. if (typeof value === "number") {
  27391. numberStringFormatter.numberFormatOptions = {
  27392. locale: this.effectiveLocale,
  27393. numberingSystem: this.numberingSystem,
  27394. useGrouping: this.groupSeparator
  27395. };
  27396. return numberStringFormatter.localize(value.toString());
  27397. }
  27398. };
  27399. }
  27400. histogramWatcher(newHistogram) {
  27401. this.hasHistogram = !!newHistogram;
  27402. }
  27403. valueHandler() {
  27404. this.setMinMaxFromValue();
  27405. }
  27406. minMaxValueHandler() {
  27407. this.setValueFromMinMax();
  27408. }
  27409. //--------------------------------------------------------------------------
  27410. //
  27411. // Lifecycle
  27412. //
  27413. //--------------------------------------------------------------------------
  27414. connectedCallback() {
  27415. connectLocalized(this);
  27416. this.setMinMaxFromValue();
  27417. this.setValueFromMinMax();
  27418. connectLabel(this);
  27419. connectForm(this);
  27420. }
  27421. disconnectedCallback() {
  27422. disconnectLabel(this);
  27423. disconnectForm(this);
  27424. disconnectLocalized(this);
  27425. this.removeDragListeners();
  27426. }
  27427. componentWillLoad() {
  27428. this.tickValues = this.generateTickValues();
  27429. if (!isRange(this.value)) {
  27430. this.value = this.clamp(this.value);
  27431. }
  27432. afterConnectDefaultValueSet(this, this.value);
  27433. if (this.snap && !isRange(this.value)) {
  27434. this.value = this.getClosestStep(this.value);
  27435. }
  27436. if (this.histogram) {
  27437. this.hasHistogram = true;
  27438. }
  27439. }
  27440. componentDidRender() {
  27441. if (this.labelHandles) {
  27442. this.adjustHostObscuredHandleLabel("value");
  27443. if (isRange(this.value)) {
  27444. this.adjustHostObscuredHandleLabel("minValue");
  27445. if (!(this.precise && !this.hasHistogram)) {
  27446. this.hyphenateCollidingRangeHandleLabels();
  27447. }
  27448. }
  27449. }
  27450. this.hideObscuredBoundingTickLabels();
  27451. updateHostInteraction(this);
  27452. }
  27453. render() {
  27454. const id = this.el.id || this.guid;
  27455. const maxProp = isRange(this.value) ? "maxValue" : "value";
  27456. const value = isRange(this.value) ? this.maxValue : this.value;
  27457. const displayedValue = this.determineGroupSeparator(value);
  27458. const displayedMinValue = this.determineGroupSeparator(this.minValue);
  27459. const min = this.minValue || this.min;
  27460. const useMinValue = this.shouldUseMinValue();
  27461. const minInterval = this.getUnitInterval(useMinValue ? this.minValue : min) * 100;
  27462. const maxInterval = this.getUnitInterval(value) * 100;
  27463. const mirror = this.shouldMirror();
  27464. const leftThumbOffset = `${mirror ? 100 - minInterval : minInterval}%`;
  27465. const rightThumbOffset = `${mirror ? maxInterval : 100 - maxInterval}%`;
  27466. const valueIsRange = isRange(this.value);
  27467. const handleLabelMinValueClasses = `${CSS$9.handleLabel} ${CSS$9.handleLabelMinValue}`;
  27468. const handleLabelValueClasses = `${CSS$9.handleLabel} ${CSS$9.handleLabelValue}`;
  27469. const handle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  27470. thumb: true,
  27471. "thumb--value": true,
  27472. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
  27473. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" })));
  27474. const labeledHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  27475. thumb: true,
  27476. "thumb--value": true,
  27477. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
  27478. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("span", { "aria-hidden": "true", class: handleLabelValueClasses }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} static` }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} transformed` }, displayedValue), hAsync("div", { class: "handle" })));
  27479. const histogramLabeledHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  27480. thumb: true,
  27481. "thumb--value": true,
  27482. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
  27483. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" }), hAsync("span", { "aria-hidden": "true", class: handleLabelValueClasses }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} static` }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} transformed` }, displayedValue)));
  27484. const preciseHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  27485. thumb: true,
  27486. "thumb--value": true,
  27487. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
  27488. "thumb--precise": true
  27489. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" }), hAsync("div", { class: "handle-extension" })));
  27490. const histogramPreciseHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  27491. thumb: true,
  27492. "thumb--value": true,
  27493. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
  27494. "thumb--precise": true
  27495. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle-extension" }), hAsync("div", { class: "handle" })));
  27496. const labeledPreciseHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  27497. thumb: true,
  27498. "thumb--value": true,
  27499. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
  27500. "thumb--precise": true
  27501. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("span", { "aria-hidden": "true", class: handleLabelValueClasses }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} static` }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} transformed` }, displayedValue), hAsync("div", { class: "handle" }), hAsync("div", { class: "handle-extension" })));
  27502. const histogramLabeledPreciseHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
  27503. thumb: true,
  27504. "thumb--value": true,
  27505. "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
  27506. "thumb--precise": true
  27507. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle-extension" }), hAsync("div", { class: "handle" }), hAsync("span", { "aria-hidden": "true", class: handleLabelValueClasses }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} static` }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} transformed` }, displayedValue)));
  27508. const minHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
  27509. thumb: true,
  27510. "thumb--minValue": true,
  27511. "thumb--active": this.dragProp === "minValue"
  27512. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" })));
  27513. const minLabeledHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
  27514. thumb: true,
  27515. "thumb--minValue": true,
  27516. "thumb--active": this.dragProp === "minValue"
  27517. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("span", { "aria-hidden": "true", class: handleLabelMinValueClasses }, displayedMinValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} static` }, displayedMinValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} transformed` }, displayedMinValue), hAsync("div", { class: "handle" })));
  27518. const minHistogramLabeledHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
  27519. thumb: true,
  27520. "thumb--minValue": true,
  27521. "thumb--active": this.dragProp === "minValue"
  27522. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" }), hAsync("span", { "aria-hidden": "true", class: handleLabelMinValueClasses }, displayedMinValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} static` }, displayedMinValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} transformed` }, displayedMinValue)));
  27523. const minPreciseHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
  27524. thumb: true,
  27525. "thumb--minValue": true,
  27526. "thumb--active": this.dragProp === "minValue",
  27527. "thumb--precise": true
  27528. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle-extension" }), hAsync("div", { class: "handle" })));
  27529. const minLabeledPreciseHandle = (hAsync("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
  27530. thumb: true,
  27531. "thumb--minValue": true,
  27532. "thumb--active": this.dragProp === "minValue",
  27533. "thumb--precise": true
  27534. }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle-extension" }), hAsync("div", { class: "handle" }), hAsync("span", { "aria-hidden": "true", class: handleLabelMinValueClasses }, displayedMinValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} static` }, displayedMinValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} transformed` }, displayedMinValue)));
  27535. return (hAsync(Host, { id: id, onTouchStart: this.handleTouchStart }, hAsync("div", { class: {
  27536. ["container"]: true,
  27537. ["container--range"]: valueIsRange,
  27538. [`scale--${this.scale}`]: true
  27539. } }, this.renderGraph(), hAsync("div", { class: "track", ref: this.storeTrackRef }, hAsync("div", { class: "track__range", onPointerDown: (event) => this.pointerDownDragStart(event, "minMaxValue"), style: {
  27540. left: `${mirror ? 100 - maxInterval : minInterval}%`,
  27541. right: `${mirror ? minInterval : 100 - maxInterval}%`
  27542. } }), hAsync("div", { class: "ticks" }, this.tickValues.map((tick) => {
  27543. const tickOffset = `${this.getUnitInterval(tick) * 100}%`;
  27544. let activeTicks = tick >= min && tick <= value;
  27545. if (useMinValue) {
  27546. activeTicks = tick >= this.minValue && tick <= this.maxValue;
  27547. }
  27548. return (hAsync("span", { class: {
  27549. tick: true,
  27550. "tick--active": activeTicks
  27551. }, style: {
  27552. left: mirror ? "" : tickOffset,
  27553. right: mirror ? tickOffset : ""
  27554. } }, this.renderTickLabel(tick)));
  27555. }))), hAsync("div", { class: "thumb-container" }, !this.precise && !this.labelHandles && valueIsRange && minHandle, !this.hasHistogram &&
  27556. !this.precise &&
  27557. this.labelHandles &&
  27558. valueIsRange &&
  27559. minLabeledHandle, this.precise && !this.labelHandles && valueIsRange && minPreciseHandle, this.precise && this.labelHandles && valueIsRange && minLabeledPreciseHandle, this.hasHistogram &&
  27560. !this.precise &&
  27561. this.labelHandles &&
  27562. valueIsRange &&
  27563. minHistogramLabeledHandle, !this.precise && !this.labelHandles && handle, !this.hasHistogram && !this.precise && this.labelHandles && labeledHandle, !this.hasHistogram && this.precise && !this.labelHandles && preciseHandle, this.hasHistogram && this.precise && !this.labelHandles && histogramPreciseHandle, !this.hasHistogram && this.precise && this.labelHandles && labeledPreciseHandle, this.hasHistogram && !this.precise && this.labelHandles && histogramLabeledHandle, this.hasHistogram &&
  27564. this.precise &&
  27565. this.labelHandles &&
  27566. histogramLabeledPreciseHandle, hAsync(HiddenFormInputSlot, { component: this })))));
  27567. }
  27568. renderGraph() {
  27569. return this.histogram ? (hAsync("calcite-graph", { class: "graph", colorStops: this.histogramStops, data: this.histogram, highlightMax: isRange(this.value) ? this.maxValue : this.value, highlightMin: isRange(this.value) ? this.minValue : this.min, max: this.max, min: this.min })) : null;
  27570. }
  27571. renderTickLabel(tick) {
  27572. const valueIsRange = isRange(this.value);
  27573. const isMinTickLabel = tick === this.min;
  27574. const isMaxTickLabel = tick === this.max;
  27575. const displayedTickValue = this.determineGroupSeparator(tick);
  27576. const tickLabel = (hAsync("span", { class: {
  27577. tick__label: true,
  27578. [CSS$9.tickMin]: isMinTickLabel,
  27579. [CSS$9.tickMax]: isMaxTickLabel
  27580. } }, displayedTickValue));
  27581. if (this.labelTicks && !this.hasHistogram && !valueIsRange) {
  27582. return tickLabel;
  27583. }
  27584. if (this.labelTicks &&
  27585. !this.hasHistogram &&
  27586. valueIsRange &&
  27587. !this.precise &&
  27588. !this.labelHandles) {
  27589. return tickLabel;
  27590. }
  27591. if (this.labelTicks &&
  27592. !this.hasHistogram &&
  27593. valueIsRange &&
  27594. !this.precise &&
  27595. this.labelHandles) {
  27596. return tickLabel;
  27597. }
  27598. if (this.labelTicks &&
  27599. !this.hasHistogram &&
  27600. valueIsRange &&
  27601. this.precise &&
  27602. (isMinTickLabel || isMaxTickLabel)) {
  27603. return tickLabel;
  27604. }
  27605. if (this.labelTicks && this.hasHistogram && !this.precise && !this.labelHandles) {
  27606. return tickLabel;
  27607. }
  27608. if (this.labelTicks &&
  27609. this.hasHistogram &&
  27610. this.precise &&
  27611. !this.labelHandles &&
  27612. (isMinTickLabel || isMaxTickLabel)) {
  27613. return tickLabel;
  27614. }
  27615. if (this.labelTicks &&
  27616. this.hasHistogram &&
  27617. !this.precise &&
  27618. this.labelHandles &&
  27619. (isMinTickLabel || isMaxTickLabel)) {
  27620. return tickLabel;
  27621. }
  27622. if (this.labelTicks &&
  27623. this.hasHistogram &&
  27624. this.precise &&
  27625. this.labelHandles &&
  27626. (isMinTickLabel || isMaxTickLabel)) {
  27627. return tickLabel;
  27628. }
  27629. return null;
  27630. }
  27631. //--------------------------------------------------------------------------
  27632. //
  27633. // Event Listeners
  27634. //
  27635. //--------------------------------------------------------------------------
  27636. keyDownHandler(event) {
  27637. const mirror = this.shouldMirror();
  27638. const { activeProp, max, min, pageStep, step } = this;
  27639. const value = this[activeProp];
  27640. const { key } = event;
  27641. if (isActivationKey(key)) {
  27642. event.preventDefault();
  27643. return;
  27644. }
  27645. let adjustment;
  27646. if (key === "ArrowUp" || key === "ArrowRight") {
  27647. const directionFactor = mirror && key === "ArrowRight" ? -1 : 1;
  27648. adjustment = value + step * directionFactor;
  27649. }
  27650. else if (key === "ArrowDown" || key === "ArrowLeft") {
  27651. const directionFactor = mirror && key === "ArrowLeft" ? -1 : 1;
  27652. adjustment = value - step * directionFactor;
  27653. }
  27654. else if (key === "PageUp") {
  27655. if (pageStep) {
  27656. adjustment = value + pageStep;
  27657. }
  27658. }
  27659. else if (key === "PageDown") {
  27660. if (pageStep) {
  27661. adjustment = value - pageStep;
  27662. }
  27663. }
  27664. else if (key === "Home") {
  27665. adjustment = min;
  27666. }
  27667. else if (key === "End") {
  27668. adjustment = max;
  27669. }
  27670. if (isNaN(adjustment)) {
  27671. return;
  27672. }
  27673. event.preventDefault();
  27674. const fixedDecimalAdjustment = Number(adjustment.toFixed(decimalPlaces(step)));
  27675. this.setValue({
  27676. [activeProp]: this.clamp(fixedDecimalAdjustment, activeProp)
  27677. });
  27678. }
  27679. pointerDownHandler(event) {
  27680. if (!isPrimaryPointerButton(event)) {
  27681. return;
  27682. }
  27683. const x = event.clientX || event.pageX;
  27684. const position = this.translate(x);
  27685. let prop = "value";
  27686. if (isRange(this.value)) {
  27687. const inRange = position >= this.minValue && position <= this.maxValue;
  27688. if (inRange && this.lastDragProp === "minMaxValue") {
  27689. prop = "minMaxValue";
  27690. }
  27691. else {
  27692. const closerToMax = Math.abs(this.maxValue - position) < Math.abs(this.minValue - position);
  27693. prop = closerToMax || position > this.maxValue ? "maxValue" : "minValue";
  27694. }
  27695. }
  27696. this.lastDragPropValue = this[prop];
  27697. this.dragStart(prop);
  27698. const isThumbActive = this.el.shadowRoot.querySelector(".thumb:active");
  27699. if (!isThumbActive) {
  27700. this.setValue({ [prop]: this.clamp(position, prop) });
  27701. }
  27702. this.focusActiveHandle(x);
  27703. }
  27704. handleTouchStart(event) {
  27705. // needed to prevent extra click at the end of a handle drag
  27706. event.preventDefault();
  27707. }
  27708. //--------------------------------------------------------------------------
  27709. //
  27710. // Public Methods
  27711. //
  27712. //--------------------------------------------------------------------------
  27713. /** Sets focus on the component. */
  27714. async setFocus() {
  27715. const handle = this.minHandle ? this.minHandle : this.maxHandle;
  27716. handle === null || handle === void 0 ? void 0 : handle.focus();
  27717. }
  27718. //--------------------------------------------------------------------------
  27719. //
  27720. // Private Methods
  27721. //
  27722. //--------------------------------------------------------------------------
  27723. setValueFromMinMax() {
  27724. const { minValue, maxValue } = this;
  27725. if (typeof minValue === "number" && typeof maxValue === "number") {
  27726. this.value = [minValue, maxValue];
  27727. }
  27728. }
  27729. setMinMaxFromValue() {
  27730. const { value } = this;
  27731. if (isRange(value)) {
  27732. this.minValue = value[0];
  27733. this.maxValue = value[1];
  27734. }
  27735. }
  27736. onLabelClick() {
  27737. this.setFocus();
  27738. }
  27739. shouldMirror() {
  27740. return this.mirrored && !this.hasHistogram;
  27741. }
  27742. shouldUseMinValue() {
  27743. if (!isRange(this.value)) {
  27744. return false;
  27745. }
  27746. return ((this.hasHistogram && this.maxValue === 0) || (!this.hasHistogram && this.minValue === 0));
  27747. }
  27748. generateTickValues() {
  27749. const ticks = [];
  27750. let current = this.min;
  27751. while (this.ticks && current < this.max + this.ticks) {
  27752. ticks.push(Math.min(current, this.max));
  27753. current = current + this.ticks;
  27754. }
  27755. return ticks;
  27756. }
  27757. pointerDownDragStart(event, prop) {
  27758. if (!isPrimaryPointerButton(event)) {
  27759. return;
  27760. }
  27761. this.dragStart(prop);
  27762. }
  27763. dragStart(prop) {
  27764. this.dragProp = prop;
  27765. this.lastDragProp = this.dragProp;
  27766. this.activeProp = prop;
  27767. document.addEventListener("pointermove", this.dragUpdate);
  27768. document.addEventListener("pointerup", this.pointerUpDragEnd);
  27769. document.addEventListener("pointercancel", this.dragEnd);
  27770. }
  27771. focusActiveHandle(valueX) {
  27772. switch (this.dragProp) {
  27773. case "minValue":
  27774. this.minHandle.focus();
  27775. break;
  27776. case "maxValue":
  27777. case "value":
  27778. this.maxHandle.focus();
  27779. break;
  27780. case "minMaxValue":
  27781. this.getClosestHandle(valueX).focus();
  27782. break;
  27783. }
  27784. }
  27785. emitInput() {
  27786. this.calciteSliderInput.emit();
  27787. this.calciteSliderUpdate.emit();
  27788. }
  27789. emitChange() {
  27790. this.calciteSliderChange.emit();
  27791. }
  27792. removeDragListeners() {
  27793. document.removeEventListener("pointermove", this.dragUpdate);
  27794. document.removeEventListener("pointerup", this.pointerUpDragEnd);
  27795. document.removeEventListener("pointercancel", this.dragEnd);
  27796. }
  27797. /**
  27798. * Set prop value(s) if changed at the component level
  27799. *
  27800. * @param {object} values - a set of key/value pairs delineating what properties in the component to update
  27801. */
  27802. setValue(values) {
  27803. let valueChanged;
  27804. Object.keys(values).forEach((propName) => {
  27805. const newValue = values[propName];
  27806. if (!valueChanged) {
  27807. const oldValue = this[propName];
  27808. valueChanged = oldValue !== newValue;
  27809. }
  27810. this[propName] = newValue;
  27811. });
  27812. if (!valueChanged) {
  27813. return;
  27814. }
  27815. const dragging = this.dragProp;
  27816. if (!dragging) {
  27817. this.emitChange();
  27818. }
  27819. this.emitInput();
  27820. }
  27821. /**
  27822. * If number is outside range, constrain to min or max
  27823. *
  27824. * @param value
  27825. * @param prop
  27826. * @internal
  27827. */
  27828. clamp(value, prop) {
  27829. value = clamp(value, this.min, this.max);
  27830. // ensure that maxValue and minValue don't swap positions
  27831. if (prop === "maxValue") {
  27832. value = Math.max(value, this.minValue);
  27833. }
  27834. if (prop === "minValue") {
  27835. value = Math.min(value, this.maxValue);
  27836. }
  27837. return value;
  27838. }
  27839. /**
  27840. * Translate a pixel position to value along the range
  27841. *
  27842. * @param x
  27843. * @internal
  27844. */
  27845. translate(x) {
  27846. const range = this.max - this.min;
  27847. const { left, width } = this.trackEl.getBoundingClientRect();
  27848. const percent = (x - left) / width;
  27849. const mirror = this.shouldMirror();
  27850. const clampedValue = this.clamp(this.min + range * (mirror ? 1 - percent : percent));
  27851. let value = Number(clampedValue.toFixed(decimalPlaces(this.step)));
  27852. if (this.snap && this.step) {
  27853. value = this.getClosestStep(value);
  27854. }
  27855. return value;
  27856. }
  27857. /**
  27858. * Get closest allowed value along stepped values
  27859. *
  27860. * @param num
  27861. * @internal
  27862. */
  27863. getClosestStep(num) {
  27864. num = Number(this.clamp(num).toFixed(decimalPlaces(this.step)));
  27865. if (this.step) {
  27866. const step = Math.round(num / this.step) * this.step;
  27867. num = Number(this.clamp(step).toFixed(decimalPlaces(this.step)));
  27868. }
  27869. return num;
  27870. }
  27871. getClosestHandle(valueX) {
  27872. return this.getDistanceX(this.maxHandle, valueX) > this.getDistanceX(this.minHandle, valueX)
  27873. ? this.minHandle
  27874. : this.maxHandle;
  27875. }
  27876. getDistanceX(el, valueX) {
  27877. return Math.abs(el.getBoundingClientRect().left - valueX);
  27878. }
  27879. getFontSizeForElement(element) {
  27880. return Number(window.getComputedStyle(element).getPropertyValue("font-size").match(/\d+/)[0]);
  27881. }
  27882. /**
  27883. * Get position of value along range as fractional value
  27884. *
  27885. * @param num
  27886. * @return {number} number in the unit interval [0,1]
  27887. * @internal
  27888. */
  27889. getUnitInterval(num) {
  27890. num = this.clamp(num);
  27891. const range = this.max - this.min;
  27892. return (num - this.min) / range;
  27893. }
  27894. adjustHostObscuredHandleLabel(name) {
  27895. const label = this.el.shadowRoot.querySelector(`.handle__label--${name}`);
  27896. const labelStatic = this.el.shadowRoot.querySelector(`.handle__label--${name}.static`);
  27897. const labelTransformed = this.el.shadowRoot.querySelector(`.handle__label--${name}.transformed`);
  27898. const labelStaticBounds = labelStatic.getBoundingClientRect();
  27899. const labelStaticOffset = this.getHostOffset(labelStaticBounds.left, labelStaticBounds.right);
  27900. label.style.transform = `translateX(${labelStaticOffset}px)`;
  27901. labelTransformed.style.transform = `translateX(${labelStaticOffset}px)`;
  27902. }
  27903. hyphenateCollidingRangeHandleLabels() {
  27904. const { shadowRoot } = this.el;
  27905. const mirror = this.shouldMirror();
  27906. const leftModifier = mirror ? "value" : "minValue";
  27907. const rightModifier = mirror ? "minValue" : "value";
  27908. const leftValueLabel = shadowRoot.querySelector(`.handle__label--${leftModifier}`);
  27909. const leftValueLabelStatic = shadowRoot.querySelector(`.handle__label--${leftModifier}.static`);
  27910. const leftValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${leftModifier}.transformed`);
  27911. const leftValueLabelStaticHostOffset = this.getHostOffset(leftValueLabelStatic.getBoundingClientRect().left, leftValueLabelStatic.getBoundingClientRect().right);
  27912. const rightValueLabel = shadowRoot.querySelector(`.handle__label--${rightModifier}`);
  27913. const rightValueLabelStatic = shadowRoot.querySelector(`.handle__label--${rightModifier}.static`);
  27914. const rightValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${rightModifier}.transformed`);
  27915. const rightValueLabelStaticHostOffset = this.getHostOffset(rightValueLabelStatic.getBoundingClientRect().left, rightValueLabelStatic.getBoundingClientRect().right);
  27916. const labelFontSize = this.getFontSizeForElement(leftValueLabel);
  27917. const labelTransformedOverlap = this.getRangeLabelOverlap(leftValueLabelTransformed, rightValueLabelTransformed);
  27918. const hyphenLabel = leftValueLabel;
  27919. const labelOffset = labelFontSize / 2;
  27920. if (labelTransformedOverlap > 0) {
  27921. hyphenLabel.classList.add("hyphen", "hyphen--wrap");
  27922. if (rightValueLabelStaticHostOffset === 0 && leftValueLabelStaticHostOffset === 0) {
  27923. // Neither handle overlaps the host boundary
  27924. let leftValueLabelTranslate = labelTransformedOverlap / 2 - labelOffset;
  27925. leftValueLabelTranslate =
  27926. Math.sign(leftValueLabelTranslate) === -1
  27927. ? Math.abs(leftValueLabelTranslate)
  27928. : -leftValueLabelTranslate;
  27929. const leftValueLabelTransformedHostOffset = this.getHostOffset(leftValueLabelTransformed.getBoundingClientRect().left +
  27930. leftValueLabelTranslate -
  27931. labelOffset, leftValueLabelTransformed.getBoundingClientRect().right +
  27932. leftValueLabelTranslate -
  27933. labelOffset);
  27934. let rightValueLabelTranslate = labelTransformedOverlap / 2;
  27935. const rightValueLabelTransformedHostOffset = this.getHostOffset(rightValueLabelTransformed.getBoundingClientRect().left + rightValueLabelTranslate, rightValueLabelTransformed.getBoundingClientRect().right + rightValueLabelTranslate);
  27936. if (leftValueLabelTransformedHostOffset !== 0) {
  27937. leftValueLabelTranslate += leftValueLabelTransformedHostOffset;
  27938. rightValueLabelTranslate += leftValueLabelTransformedHostOffset;
  27939. }
  27940. if (rightValueLabelTransformedHostOffset !== 0) {
  27941. leftValueLabelTranslate += rightValueLabelTransformedHostOffset;
  27942. rightValueLabelTranslate += rightValueLabelTransformedHostOffset;
  27943. }
  27944. leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
  27945. leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
  27946. rightValueLabel.style.transform = `translateX(${rightValueLabelTranslate}px)`;
  27947. rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelTranslate}px)`;
  27948. }
  27949. else if (leftValueLabelStaticHostOffset > 0 || rightValueLabelStaticHostOffset > 0) {
  27950. // labels overlap host boundary on the left side
  27951. leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset + labelOffset}px)`;
  27952. rightValueLabel.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
  27953. rightValueLabelTransformed.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
  27954. }
  27955. else if (leftValueLabelStaticHostOffset < 0 || rightValueLabelStaticHostOffset < 0) {
  27956. // labels overlap host boundary on the right side
  27957. let leftValueLabelTranslate = Math.abs(leftValueLabelStaticHostOffset) + labelTransformedOverlap - labelOffset;
  27958. leftValueLabelTranslate =
  27959. Math.sign(leftValueLabelTranslate) === -1
  27960. ? Math.abs(leftValueLabelTranslate)
  27961. : -leftValueLabelTranslate;
  27962. leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
  27963. leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
  27964. }
  27965. }
  27966. else {
  27967. hyphenLabel.classList.remove("hyphen", "hyphen--wrap");
  27968. leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
  27969. leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
  27970. rightValueLabel.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
  27971. rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
  27972. }
  27973. }
  27974. /**
  27975. * Hides bounding tick labels that are obscured by either handle.
  27976. */
  27977. hideObscuredBoundingTickLabels() {
  27978. const valueIsRange = isRange(this.value);
  27979. if (!this.hasHistogram && !valueIsRange && !this.labelHandles && !this.precise) {
  27980. return;
  27981. }
  27982. if (!this.hasHistogram && !valueIsRange && this.labelHandles && !this.precise) {
  27983. return;
  27984. }
  27985. if (!this.hasHistogram && !valueIsRange && !this.labelHandles && this.precise) {
  27986. return;
  27987. }
  27988. if (!this.hasHistogram && !valueIsRange && this.labelHandles && this.precise) {
  27989. return;
  27990. }
  27991. if (!this.hasHistogram && valueIsRange && !this.precise) {
  27992. return;
  27993. }
  27994. if (this.hasHistogram && !this.precise && !this.labelHandles) {
  27995. return;
  27996. }
  27997. const minHandle = this.el.shadowRoot.querySelector(".thumb--minValue");
  27998. const maxHandle = this.el.shadowRoot.querySelector(".thumb--value");
  27999. const minTickLabel = this.el.shadowRoot.querySelector(".tick__label--min");
  28000. const maxTickLabel = this.el.shadowRoot.querySelector(".tick__label--max");
  28001. if (!minHandle && maxHandle && minTickLabel && maxTickLabel) {
  28002. minTickLabel.style.opacity = this.isMinTickLabelObscured(minTickLabel, maxHandle) ? "0" : "1";
  28003. maxTickLabel.style.opacity = this.isMaxTickLabelObscured(maxTickLabel, maxHandle) ? "0" : "1";
  28004. }
  28005. if (minHandle && maxHandle && minTickLabel && maxTickLabel) {
  28006. minTickLabel.style.opacity =
  28007. this.isMinTickLabelObscured(minTickLabel, minHandle) ||
  28008. this.isMinTickLabelObscured(minTickLabel, maxHandle)
  28009. ? "0"
  28010. : "1";
  28011. maxTickLabel.style.opacity =
  28012. this.isMaxTickLabelObscured(maxTickLabel, minHandle) ||
  28013. (this.isMaxTickLabelObscured(maxTickLabel, maxHandle) && this.hasHistogram)
  28014. ? "0"
  28015. : "1";
  28016. }
  28017. }
  28018. /**
  28019. * Returns an integer representing the number of pixels to offset on the left or right side based on desired position behavior.
  28020. *
  28021. * @param leftBounds
  28022. * @param rightBounds
  28023. * @internal
  28024. */
  28025. getHostOffset(leftBounds, rightBounds) {
  28026. const hostBounds = this.el.getBoundingClientRect();
  28027. const buffer = 7;
  28028. if (leftBounds + buffer < hostBounds.left) {
  28029. return hostBounds.left - leftBounds - buffer;
  28030. }
  28031. if (rightBounds - buffer > hostBounds.right) {
  28032. return -(rightBounds - hostBounds.right) + buffer;
  28033. }
  28034. return 0;
  28035. }
  28036. /**
  28037. * Returns an integer representing the number of pixels that the two given span elements are overlapping, taking into account
  28038. * a space in between the two spans equal to the font-size set on them to account for the space needed to render a hyphen.
  28039. *
  28040. * @param leftLabel
  28041. * @param rightLabel
  28042. */
  28043. getRangeLabelOverlap(leftLabel, rightLabel) {
  28044. const leftLabelBounds = leftLabel.getBoundingClientRect();
  28045. const rightLabelBounds = rightLabel.getBoundingClientRect();
  28046. const leftLabelFontSize = this.getFontSizeForElement(leftLabel);
  28047. const rangeLabelOverlap = leftLabelBounds.right + leftLabelFontSize - rightLabelBounds.left;
  28048. return Math.max(rangeLabelOverlap, 0);
  28049. }
  28050. /**
  28051. * Returns a boolean value representing if the minLabel span element is obscured (being overlapped) by the given handle div element.
  28052. *
  28053. * @param minLabel
  28054. * @param handle
  28055. */
  28056. isMinTickLabelObscured(minLabel, handle) {
  28057. const minLabelBounds = minLabel.getBoundingClientRect();
  28058. const handleBounds = handle.getBoundingClientRect();
  28059. return intersects(minLabelBounds, handleBounds);
  28060. }
  28061. /**
  28062. * Returns a boolean value representing if the maxLabel span element is obscured (being overlapped) by the given handle div element.
  28063. *
  28064. * @param maxLabel
  28065. * @param handle
  28066. */
  28067. isMaxTickLabelObscured(maxLabel, handle) {
  28068. const maxLabelBounds = maxLabel.getBoundingClientRect();
  28069. const handleBounds = handle.getBoundingClientRect();
  28070. return intersects(maxLabelBounds, handleBounds);
  28071. }
  28072. get el() { return getElement(this); }
  28073. static get watchers() { return {
  28074. "histogram": ["histogramWatcher"],
  28075. "value": ["valueHandler"],
  28076. "minValue": ["minMaxValueHandler"],
  28077. "maxValue": ["minMaxValueHandler"]
  28078. }; }
  28079. static get style() { return sliderCss; }
  28080. static get cmpMeta() { return {
  28081. "$flags$": 9,
  28082. "$tagName$": "calcite-slider",
  28083. "$members$": {
  28084. "disabled": [516],
  28085. "groupSeparator": [516, "group-separator"],
  28086. "hasHistogram": [1540, "has-histogram"],
  28087. "histogram": [16],
  28088. "histogramStops": [16],
  28089. "labelHandles": [516, "label-handles"],
  28090. "labelTicks": [516, "label-ticks"],
  28091. "max": [514],
  28092. "maxLabel": [1, "max-label"],
  28093. "maxValue": [1026, "max-value"],
  28094. "min": [514],
  28095. "minLabel": [1, "min-label"],
  28096. "minValue": [1026, "min-value"],
  28097. "mirrored": [516],
  28098. "name": [513],
  28099. "numberingSystem": [1, "numbering-system"],
  28100. "pageStep": [514, "page-step"],
  28101. "precise": [516],
  28102. "required": [516],
  28103. "snap": [516],
  28104. "step": [514],
  28105. "ticks": [514],
  28106. "value": [1538],
  28107. "scale": [513],
  28108. "effectiveLocale": [32],
  28109. "minMaxValueRange": [32],
  28110. "minValueDragRange": [32],
  28111. "maxValueDragRange": [32],
  28112. "tickValues": [32],
  28113. "setFocus": [64]
  28114. },
  28115. "$listeners$": [[0, "keydown", "keyDownHandler"], [1, "pointerdown", "pointerDownHandler"]],
  28116. "$lazyBundleId$": "-",
  28117. "$attrsToReflect$": [["disabled", "disabled"], ["groupSeparator", "group-separator"], ["hasHistogram", "has-histogram"], ["labelHandles", "label-handles"], ["labelTicks", "label-ticks"], ["max", "max"], ["min", "min"], ["mirrored", "mirrored"], ["name", "name"], ["pageStep", "page-step"], ["precise", "precise"], ["required", "required"], ["snap", "snap"], ["step", "step"], ["ticks", "ticks"], ["value", "value"], ["scale", "scale"]]
  28118. }; }
  28119. }
  28120. /**!
  28121. * Sortable 1.15.0
  28122. * @author RubaXa <trash@rubaxa.org>
  28123. * @author owenm <owen23355@gmail.com>
  28124. * @license MIT
  28125. */
  28126. function ownKeys(object, enumerableOnly) {
  28127. var keys = Object.keys(object);
  28128. if (Object.getOwnPropertySymbols) {
  28129. var symbols = Object.getOwnPropertySymbols(object);
  28130. if (enumerableOnly) {
  28131. symbols = symbols.filter(function (sym) {
  28132. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  28133. });
  28134. }
  28135. keys.push.apply(keys, symbols);
  28136. }
  28137. return keys;
  28138. }
  28139. function _objectSpread2(target) {
  28140. for (var i = 1; i < arguments.length; i++) {
  28141. var source = arguments[i] != null ? arguments[i] : {};
  28142. if (i % 2) {
  28143. ownKeys(Object(source), true).forEach(function (key) {
  28144. _defineProperty(target, key, source[key]);
  28145. });
  28146. } else if (Object.getOwnPropertyDescriptors) {
  28147. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  28148. } else {
  28149. ownKeys(Object(source)).forEach(function (key) {
  28150. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  28151. });
  28152. }
  28153. }
  28154. return target;
  28155. }
  28156. function _typeof(obj) {
  28157. "@babel/helpers - typeof";
  28158. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  28159. _typeof = function (obj) {
  28160. return typeof obj;
  28161. };
  28162. } else {
  28163. _typeof = function (obj) {
  28164. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  28165. };
  28166. }
  28167. return _typeof(obj);
  28168. }
  28169. function _defineProperty(obj, key, value) {
  28170. if (key in obj) {
  28171. Object.defineProperty(obj, key, {
  28172. value: value,
  28173. enumerable: true,
  28174. configurable: true,
  28175. writable: true
  28176. });
  28177. } else {
  28178. obj[key] = value;
  28179. }
  28180. return obj;
  28181. }
  28182. function _extends() {
  28183. _extends = Object.assign || function (target) {
  28184. for (var i = 1; i < arguments.length; i++) {
  28185. var source = arguments[i];
  28186. for (var key in source) {
  28187. if (Object.prototype.hasOwnProperty.call(source, key)) {
  28188. target[key] = source[key];
  28189. }
  28190. }
  28191. }
  28192. return target;
  28193. };
  28194. return _extends.apply(this, arguments);
  28195. }
  28196. function _objectWithoutPropertiesLoose(source, excluded) {
  28197. if (source == null) return {};
  28198. var target = {};
  28199. var sourceKeys = Object.keys(source);
  28200. var key, i;
  28201. for (i = 0; i < sourceKeys.length; i++) {
  28202. key = sourceKeys[i];
  28203. if (excluded.indexOf(key) >= 0) continue;
  28204. target[key] = source[key];
  28205. }
  28206. return target;
  28207. }
  28208. function _objectWithoutProperties(source, excluded) {
  28209. if (source == null) return {};
  28210. var target = _objectWithoutPropertiesLoose(source, excluded);
  28211. var key, i;
  28212. if (Object.getOwnPropertySymbols) {
  28213. var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
  28214. for (i = 0; i < sourceSymbolKeys.length; i++) {
  28215. key = sourceSymbolKeys[i];
  28216. if (excluded.indexOf(key) >= 0) continue;
  28217. if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
  28218. target[key] = source[key];
  28219. }
  28220. }
  28221. return target;
  28222. }
  28223. var version = "1.15.0";
  28224. function userAgent(pattern) {
  28225. if (typeof window !== 'undefined' && window.navigator) {
  28226. return !! /*@__PURE__*/navigator.userAgent.match(pattern);
  28227. }
  28228. }
  28229. var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
  28230. var Edge = userAgent(/Edge/i);
  28231. var FireFox = userAgent(/firefox/i);
  28232. var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
  28233. var IOS = userAgent(/iP(ad|od|hone)/i);
  28234. var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
  28235. var captureMode = {
  28236. capture: false,
  28237. passive: false
  28238. };
  28239. function on(el, event, fn) {
  28240. el.addEventListener(event, fn, !IE11OrLess && captureMode);
  28241. }
  28242. function off(el, event, fn) {
  28243. el.removeEventListener(event, fn, !IE11OrLess && captureMode);
  28244. }
  28245. function matches(
  28246. /**HTMLElement*/
  28247. el,
  28248. /**String*/
  28249. selector) {
  28250. if (!selector) return;
  28251. selector[0] === '>' && (selector = selector.substring(1));
  28252. if (el) {
  28253. try {
  28254. if (el.matches) {
  28255. return el.matches(selector);
  28256. } else if (el.msMatchesSelector) {
  28257. return el.msMatchesSelector(selector);
  28258. } else if (el.webkitMatchesSelector) {
  28259. return el.webkitMatchesSelector(selector);
  28260. }
  28261. } catch (_) {
  28262. return false;
  28263. }
  28264. }
  28265. return false;
  28266. }
  28267. function getParentOrHost(el) {
  28268. return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
  28269. }
  28270. function closest(
  28271. /**HTMLElement*/
  28272. el,
  28273. /**String*/
  28274. selector,
  28275. /**HTMLElement*/
  28276. ctx, includeCTX) {
  28277. if (el) {
  28278. ctx = ctx || document;
  28279. do {
  28280. if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
  28281. return el;
  28282. }
  28283. if (el === ctx) break;
  28284. /* jshint boss:true */
  28285. } while (el = getParentOrHost(el));
  28286. }
  28287. return null;
  28288. }
  28289. var R_SPACE = /\s+/g;
  28290. function toggleClass(el, name, state) {
  28291. if (el && name) {
  28292. if (el.classList) {
  28293. el.classList[state ? 'add' : 'remove'](name);
  28294. } else {
  28295. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  28296. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  28297. }
  28298. }
  28299. }
  28300. function css(el, prop, val) {
  28301. var style = el && el.style;
  28302. if (style) {
  28303. if (val === void 0) {
  28304. if (document.defaultView && document.defaultView.getComputedStyle) {
  28305. val = document.defaultView.getComputedStyle(el, '');
  28306. } else if (el.currentStyle) {
  28307. val = el.currentStyle;
  28308. }
  28309. return prop === void 0 ? val : val[prop];
  28310. } else {
  28311. if (!(prop in style) && prop.indexOf('webkit') === -1) {
  28312. prop = '-webkit-' + prop;
  28313. }
  28314. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  28315. }
  28316. }
  28317. }
  28318. function matrix(el, selfOnly) {
  28319. var appliedTransforms = '';
  28320. if (typeof el === 'string') {
  28321. appliedTransforms = el;
  28322. } else {
  28323. do {
  28324. var transform = css(el, 'transform');
  28325. if (transform && transform !== 'none') {
  28326. appliedTransforms = transform + ' ' + appliedTransforms;
  28327. }
  28328. /* jshint boss:true */
  28329. } while (!selfOnly && (el = el.parentNode));
  28330. }
  28331. var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
  28332. /*jshint -W056 */
  28333. return matrixFn && new matrixFn(appliedTransforms);
  28334. }
  28335. function find(ctx, tagName, iterator) {
  28336. if (ctx) {
  28337. var list = ctx.getElementsByTagName(tagName),
  28338. i = 0,
  28339. n = list.length;
  28340. if (iterator) {
  28341. for (; i < n; i++) {
  28342. iterator(list[i], i);
  28343. }
  28344. }
  28345. return list;
  28346. }
  28347. return [];
  28348. }
  28349. function getWindowScrollingElement() {
  28350. var scrollingElement = document.scrollingElement;
  28351. if (scrollingElement) {
  28352. return scrollingElement;
  28353. } else {
  28354. return document.documentElement;
  28355. }
  28356. }
  28357. /**
  28358. * Returns the "bounding client rect" of given element
  28359. * @param {HTMLElement} el The element whose boundingClientRect is wanted
  28360. * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
  28361. * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
  28362. * @param {[Boolean]} undoScale Whether the container's scale() should be undone
  28363. * @param {[HTMLElement]} container The parent the element will be placed in
  28364. * @return {Object} The boundingClientRect of el, with specified adjustments
  28365. */
  28366. function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
  28367. if (!el.getBoundingClientRect && el !== window) return;
  28368. var elRect, top, left, bottom, right, height, width;
  28369. if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
  28370. elRect = el.getBoundingClientRect();
  28371. top = elRect.top;
  28372. left = elRect.left;
  28373. bottom = elRect.bottom;
  28374. right = elRect.right;
  28375. height = elRect.height;
  28376. width = elRect.width;
  28377. } else {
  28378. top = 0;
  28379. left = 0;
  28380. bottom = window.innerHeight;
  28381. right = window.innerWidth;
  28382. height = window.innerHeight;
  28383. width = window.innerWidth;
  28384. }
  28385. if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
  28386. // Adjust for translate()
  28387. container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
  28388. // Not needed on <= IE11
  28389. if (!IE11OrLess) {
  28390. do {
  28391. if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {
  28392. var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container
  28393. top -= containerRect.top + parseInt(css(container, 'border-top-width'));
  28394. left -= containerRect.left + parseInt(css(container, 'border-left-width'));
  28395. bottom = top + elRect.height;
  28396. right = left + elRect.width;
  28397. break;
  28398. }
  28399. /* jshint boss:true */
  28400. } while (container = container.parentNode);
  28401. }
  28402. }
  28403. if (undoScale && el !== window) {
  28404. // Adjust for scale()
  28405. var elMatrix = matrix(container || el),
  28406. scaleX = elMatrix && elMatrix.a,
  28407. scaleY = elMatrix && elMatrix.d;
  28408. if (elMatrix) {
  28409. top /= scaleY;
  28410. left /= scaleX;
  28411. width /= scaleX;
  28412. height /= scaleY;
  28413. bottom = top + height;
  28414. right = left + width;
  28415. }
  28416. }
  28417. return {
  28418. top: top,
  28419. left: left,
  28420. bottom: bottom,
  28421. right: right,
  28422. width: width,
  28423. height: height
  28424. };
  28425. }
  28426. /**
  28427. * Checks if a side of an element is scrolled past a side of its parents
  28428. * @param {HTMLElement} el The element who's side being scrolled out of view is in question
  28429. * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
  28430. * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
  28431. * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
  28432. */
  28433. function isScrolledPast(el, elSide, parentSide) {
  28434. var parent = getParentAutoScrollElement(el, true),
  28435. elSideVal = getRect(el)[elSide];
  28436. /* jshint boss:true */
  28437. while (parent) {
  28438. var parentSideVal = getRect(parent)[parentSide],
  28439. visible = void 0;
  28440. if (parentSide === 'top' || parentSide === 'left') {
  28441. visible = elSideVal >= parentSideVal;
  28442. } else {
  28443. visible = elSideVal <= parentSideVal;
  28444. }
  28445. if (!visible) return parent;
  28446. if (parent === getWindowScrollingElement()) break;
  28447. parent = getParentAutoScrollElement(parent, false);
  28448. }
  28449. return false;
  28450. }
  28451. /**
  28452. * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
  28453. * and non-draggable elements
  28454. * @param {HTMLElement} el The parent element
  28455. * @param {Number} childNum The index of the child
  28456. * @param {Object} options Parent Sortable's options
  28457. * @return {HTMLElement} The child at index childNum, or null if not found
  28458. */
  28459. function getChild(el, childNum, options, includeDragEl) {
  28460. var currentChild = 0,
  28461. i = 0,
  28462. children = el.children;
  28463. while (i < children.length) {
  28464. if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
  28465. if (currentChild === childNum) {
  28466. return children[i];
  28467. }
  28468. currentChild++;
  28469. }
  28470. i++;
  28471. }
  28472. return null;
  28473. }
  28474. /**
  28475. * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
  28476. * @param {HTMLElement} el Parent element
  28477. * @param {selector} selector Any other elements that should be ignored
  28478. * @return {HTMLElement} The last child, ignoring ghostEl
  28479. */
  28480. function lastChild(el, selector) {
  28481. var last = el.lastElementChild;
  28482. while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {
  28483. last = last.previousElementSibling;
  28484. }
  28485. return last || null;
  28486. }
  28487. /**
  28488. * Returns the index of an element within its parent for a selected set of
  28489. * elements
  28490. * @param {HTMLElement} el
  28491. * @param {selector} selector
  28492. * @return {number}
  28493. */
  28494. function index(el, selector) {
  28495. var index = 0;
  28496. if (!el || !el.parentNode) {
  28497. return -1;
  28498. }
  28499. /* jshint boss:true */
  28500. while (el = el.previousElementSibling) {
  28501. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {
  28502. index++;
  28503. }
  28504. }
  28505. return index;
  28506. }
  28507. /**
  28508. * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
  28509. * The value is returned in real pixels.
  28510. * @param {HTMLElement} el
  28511. * @return {Array} Offsets in the format of [left, top]
  28512. */
  28513. function getRelativeScrollOffset(el) {
  28514. var offsetLeft = 0,
  28515. offsetTop = 0,
  28516. winScroller = getWindowScrollingElement();
  28517. if (el) {
  28518. do {
  28519. var elMatrix = matrix(el),
  28520. scaleX = elMatrix.a,
  28521. scaleY = elMatrix.d;
  28522. offsetLeft += el.scrollLeft * scaleX;
  28523. offsetTop += el.scrollTop * scaleY;
  28524. } while (el !== winScroller && (el = el.parentNode));
  28525. }
  28526. return [offsetLeft, offsetTop];
  28527. }
  28528. /**
  28529. * Returns the index of the object within the given array
  28530. * @param {Array} arr Array that may or may not hold the object
  28531. * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
  28532. * @return {Number} The index of the object in the array, or -1
  28533. */
  28534. function indexOfObject(arr, obj) {
  28535. for (var i in arr) {
  28536. if (!arr.hasOwnProperty(i)) continue;
  28537. for (var key in obj) {
  28538. if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
  28539. }
  28540. }
  28541. return -1;
  28542. }
  28543. function getParentAutoScrollElement(el, includeSelf) {
  28544. // skip to window
  28545. if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
  28546. var elem = el;
  28547. var gotSelf = false;
  28548. do {
  28549. // we don't need to get elem css if it isn't even overflowing in the first place (performance)
  28550. if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
  28551. var elemCSS = css(elem);
  28552. if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
  28553. if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
  28554. if (gotSelf || includeSelf) return elem;
  28555. gotSelf = true;
  28556. }
  28557. }
  28558. /* jshint boss:true */
  28559. } while (elem = elem.parentNode);
  28560. return getWindowScrollingElement();
  28561. }
  28562. function extend(dst, src) {
  28563. if (dst && src) {
  28564. for (var key in src) {
  28565. if (src.hasOwnProperty(key)) {
  28566. dst[key] = src[key];
  28567. }
  28568. }
  28569. }
  28570. return dst;
  28571. }
  28572. function isRectEqual(rect1, rect2) {
  28573. return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);
  28574. }
  28575. var _throttleTimeout;
  28576. function throttle(callback, ms) {
  28577. return function () {
  28578. if (!_throttleTimeout) {
  28579. var args = arguments,
  28580. _this = this;
  28581. if (args.length === 1) {
  28582. callback.call(_this, args[0]);
  28583. } else {
  28584. callback.apply(_this, args);
  28585. }
  28586. _throttleTimeout = setTimeout(function () {
  28587. _throttleTimeout = void 0;
  28588. }, ms);
  28589. }
  28590. };
  28591. }
  28592. function cancelThrottle() {
  28593. clearTimeout(_throttleTimeout);
  28594. _throttleTimeout = void 0;
  28595. }
  28596. function scrollBy(el, x, y) {
  28597. el.scrollLeft += x;
  28598. el.scrollTop += y;
  28599. }
  28600. function clone(el) {
  28601. var Polymer = window.Polymer;
  28602. var $ = window.jQuery || window.Zepto;
  28603. if (Polymer && Polymer.dom) {
  28604. return Polymer.dom(el).cloneNode(true);
  28605. } else if ($) {
  28606. return $(el).clone(true)[0];
  28607. } else {
  28608. return el.cloneNode(true);
  28609. }
  28610. }
  28611. var expando = 'Sortable' + new Date().getTime();
  28612. function AnimationStateManager() {
  28613. var animationStates = [],
  28614. animationCallbackId;
  28615. return {
  28616. captureAnimationState: function captureAnimationState() {
  28617. animationStates = [];
  28618. if (!this.options.animation) return;
  28619. var children = [].slice.call(this.el.children);
  28620. children.forEach(function (child) {
  28621. if (css(child, 'display') === 'none' || child === Sortable.ghost) return;
  28622. animationStates.push({
  28623. target: child,
  28624. rect: getRect(child)
  28625. });
  28626. var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation
  28627. if (child.thisAnimationDuration) {
  28628. var childMatrix = matrix(child, true);
  28629. if (childMatrix) {
  28630. fromRect.top -= childMatrix.f;
  28631. fromRect.left -= childMatrix.e;
  28632. }
  28633. }
  28634. child.fromRect = fromRect;
  28635. });
  28636. },
  28637. addAnimationState: function addAnimationState(state) {
  28638. animationStates.push(state);
  28639. },
  28640. removeAnimationState: function removeAnimationState(target) {
  28641. animationStates.splice(indexOfObject(animationStates, {
  28642. target: target
  28643. }), 1);
  28644. },
  28645. animateAll: function animateAll(callback) {
  28646. var _this = this;
  28647. if (!this.options.animation) {
  28648. clearTimeout(animationCallbackId);
  28649. if (typeof callback === 'function') callback();
  28650. return;
  28651. }
  28652. var animating = false,
  28653. animationTime = 0;
  28654. animationStates.forEach(function (state) {
  28655. var time = 0,
  28656. target = state.target,
  28657. fromRect = target.fromRect,
  28658. toRect = getRect(target),
  28659. prevFromRect = target.prevFromRect,
  28660. prevToRect = target.prevToRect,
  28661. animatingRect = state.rect,
  28662. targetMatrix = matrix(target, true);
  28663. if (targetMatrix) {
  28664. // Compensate for current animation
  28665. toRect.top -= targetMatrix.f;
  28666. toRect.left -= targetMatrix.e;
  28667. }
  28668. target.toRect = toRect;
  28669. if (target.thisAnimationDuration) {
  28670. // Could also check if animatingRect is between fromRect and toRect
  28671. if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect
  28672. (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
  28673. // If returning to same place as started from animation and on same axis
  28674. time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
  28675. }
  28676. } // if fromRect != toRect: animate
  28677. if (!isRectEqual(toRect, fromRect)) {
  28678. target.prevFromRect = fromRect;
  28679. target.prevToRect = toRect;
  28680. if (!time) {
  28681. time = _this.options.animation;
  28682. }
  28683. _this.animate(target, animatingRect, toRect, time);
  28684. }
  28685. if (time) {
  28686. animating = true;
  28687. animationTime = Math.max(animationTime, time);
  28688. clearTimeout(target.animationResetTimer);
  28689. target.animationResetTimer = setTimeout(function () {
  28690. target.animationTime = 0;
  28691. target.prevFromRect = null;
  28692. target.fromRect = null;
  28693. target.prevToRect = null;
  28694. target.thisAnimationDuration = null;
  28695. }, time);
  28696. target.thisAnimationDuration = time;
  28697. }
  28698. });
  28699. clearTimeout(animationCallbackId);
  28700. if (!animating) {
  28701. if (typeof callback === 'function') callback();
  28702. } else {
  28703. animationCallbackId = setTimeout(function () {
  28704. if (typeof callback === 'function') callback();
  28705. }, animationTime);
  28706. }
  28707. animationStates = [];
  28708. },
  28709. animate: function animate(target, currentRect, toRect, duration) {
  28710. if (duration) {
  28711. css(target, 'transition', '');
  28712. css(target, 'transform', '');
  28713. var elMatrix = matrix(this.el),
  28714. scaleX = elMatrix && elMatrix.a,
  28715. scaleY = elMatrix && elMatrix.d,
  28716. translateX = (currentRect.left - toRect.left) / (scaleX || 1),
  28717. translateY = (currentRect.top - toRect.top) / (scaleY || 1);
  28718. target.animatingX = !!translateX;
  28719. target.animatingY = !!translateY;
  28720. css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
  28721. this.forRepaintDummy = repaint(target); // repaint
  28722. css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
  28723. css(target, 'transform', 'translate3d(0,0,0)');
  28724. typeof target.animated === 'number' && clearTimeout(target.animated);
  28725. target.animated = setTimeout(function () {
  28726. css(target, 'transition', '');
  28727. css(target, 'transform', '');
  28728. target.animated = false;
  28729. target.animatingX = false;
  28730. target.animatingY = false;
  28731. }, duration);
  28732. }
  28733. }
  28734. };
  28735. }
  28736. function repaint(target) {
  28737. return target.offsetWidth;
  28738. }
  28739. function calculateRealTime(animatingRect, fromRect, toRect, options) {
  28740. return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
  28741. }
  28742. var plugins = [];
  28743. var defaults = {
  28744. initializeByDefault: true
  28745. };
  28746. var PluginManager = {
  28747. mount: function mount(plugin) {
  28748. // Set default static properties
  28749. for (var option in defaults) {
  28750. if (defaults.hasOwnProperty(option) && !(option in plugin)) {
  28751. plugin[option] = defaults[option];
  28752. }
  28753. }
  28754. plugins.forEach(function (p) {
  28755. if (p.pluginName === plugin.pluginName) {
  28756. throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
  28757. }
  28758. });
  28759. plugins.push(plugin);
  28760. },
  28761. pluginEvent: function pluginEvent(eventName, sortable, evt) {
  28762. var _this = this;
  28763. this.eventCanceled = false;
  28764. evt.cancel = function () {
  28765. _this.eventCanceled = true;
  28766. };
  28767. var eventNameGlobal = eventName + 'Global';
  28768. plugins.forEach(function (plugin) {
  28769. if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable
  28770. if (sortable[plugin.pluginName][eventNameGlobal]) {
  28771. sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
  28772. sortable: sortable
  28773. }, evt));
  28774. } // Only fire plugin event if plugin is enabled in this sortable,
  28775. // and plugin has event defined
  28776. if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
  28777. sortable[plugin.pluginName][eventName](_objectSpread2({
  28778. sortable: sortable
  28779. }, evt));
  28780. }
  28781. });
  28782. },
  28783. initializePlugins: function initializePlugins(sortable, el, defaults, options) {
  28784. plugins.forEach(function (plugin) {
  28785. var pluginName = plugin.pluginName;
  28786. if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;
  28787. var initialized = new plugin(sortable, el, sortable.options);
  28788. initialized.sortable = sortable;
  28789. initialized.options = sortable.options;
  28790. sortable[pluginName] = initialized; // Add default options from plugin
  28791. _extends(defaults, initialized.defaults);
  28792. });
  28793. for (var option in sortable.options) {
  28794. if (!sortable.options.hasOwnProperty(option)) continue;
  28795. var modified = this.modifyOption(sortable, option, sortable.options[option]);
  28796. if (typeof modified !== 'undefined') {
  28797. sortable.options[option] = modified;
  28798. }
  28799. }
  28800. },
  28801. getEventProperties: function getEventProperties(name, sortable) {
  28802. var eventProperties = {};
  28803. plugins.forEach(function (plugin) {
  28804. if (typeof plugin.eventProperties !== 'function') return;
  28805. _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
  28806. });
  28807. return eventProperties;
  28808. },
  28809. modifyOption: function modifyOption(sortable, name, value) {
  28810. var modifiedValue;
  28811. plugins.forEach(function (plugin) {
  28812. // Plugin must exist on the Sortable
  28813. if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin
  28814. if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {
  28815. modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
  28816. }
  28817. });
  28818. return modifiedValue;
  28819. }
  28820. };
  28821. function dispatchEvent(_ref) {
  28822. var sortable = _ref.sortable,
  28823. rootEl = _ref.rootEl,
  28824. name = _ref.name,
  28825. targetEl = _ref.targetEl,
  28826. cloneEl = _ref.cloneEl,
  28827. toEl = _ref.toEl,
  28828. fromEl = _ref.fromEl,
  28829. oldIndex = _ref.oldIndex,
  28830. newIndex = _ref.newIndex,
  28831. oldDraggableIndex = _ref.oldDraggableIndex,
  28832. newDraggableIndex = _ref.newDraggableIndex,
  28833. originalEvent = _ref.originalEvent,
  28834. putSortable = _ref.putSortable,
  28835. extraEventProperties = _ref.extraEventProperties;
  28836. sortable = sortable || rootEl && rootEl[expando];
  28837. if (!sortable) return;
  28838. var evt,
  28839. options = sortable.options,
  28840. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature
  28841. if (window.CustomEvent && !IE11OrLess && !Edge) {
  28842. evt = new CustomEvent(name, {
  28843. bubbles: true,
  28844. cancelable: true
  28845. });
  28846. } else {
  28847. evt = document.createEvent('Event');
  28848. evt.initEvent(name, true, true);
  28849. }
  28850. evt.to = toEl || rootEl;
  28851. evt.from = fromEl || rootEl;
  28852. evt.item = targetEl || rootEl;
  28853. evt.clone = cloneEl;
  28854. evt.oldIndex = oldIndex;
  28855. evt.newIndex = newIndex;
  28856. evt.oldDraggableIndex = oldDraggableIndex;
  28857. evt.newDraggableIndex = newDraggableIndex;
  28858. evt.originalEvent = originalEvent;
  28859. evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
  28860. var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
  28861. for (var option in allEventProperties) {
  28862. evt[option] = allEventProperties[option];
  28863. }
  28864. if (rootEl) {
  28865. rootEl.dispatchEvent(evt);
  28866. }
  28867. if (options[onName]) {
  28868. options[onName].call(sortable, evt);
  28869. }
  28870. }
  28871. var _excluded = ["evt"];
  28872. var pluginEvent = function pluginEvent(eventName, sortable) {
  28873. var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
  28874. originalEvent = _ref.evt,
  28875. data = _objectWithoutProperties(_ref, _excluded);
  28876. PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
  28877. dragEl: dragEl,
  28878. parentEl: parentEl,
  28879. ghostEl: ghostEl,
  28880. rootEl: rootEl,
  28881. nextEl: nextEl,
  28882. lastDownEl: lastDownEl,
  28883. cloneEl: cloneEl,
  28884. cloneHidden: cloneHidden,
  28885. dragStarted: moved,
  28886. putSortable: putSortable,
  28887. activeSortable: Sortable.active,
  28888. originalEvent: originalEvent,
  28889. oldIndex: oldIndex,
  28890. oldDraggableIndex: oldDraggableIndex,
  28891. newIndex: newIndex,
  28892. newDraggableIndex: newDraggableIndex,
  28893. hideGhostForTarget: _hideGhostForTarget,
  28894. unhideGhostForTarget: _unhideGhostForTarget,
  28895. cloneNowHidden: function cloneNowHidden() {
  28896. cloneHidden = true;
  28897. },
  28898. cloneNowShown: function cloneNowShown() {
  28899. cloneHidden = false;
  28900. },
  28901. dispatchSortableEvent: function dispatchSortableEvent(name) {
  28902. _dispatchEvent({
  28903. sortable: sortable,
  28904. name: name,
  28905. originalEvent: originalEvent
  28906. });
  28907. }
  28908. }, data));
  28909. };
  28910. function _dispatchEvent(info) {
  28911. dispatchEvent(_objectSpread2({
  28912. putSortable: putSortable,
  28913. cloneEl: cloneEl,
  28914. targetEl: dragEl,
  28915. rootEl: rootEl,
  28916. oldIndex: oldIndex,
  28917. oldDraggableIndex: oldDraggableIndex,
  28918. newIndex: newIndex,
  28919. newDraggableIndex: newDraggableIndex
  28920. }, info));
  28921. }
  28922. var dragEl,
  28923. parentEl,
  28924. ghostEl,
  28925. rootEl,
  28926. nextEl,
  28927. lastDownEl,
  28928. cloneEl,
  28929. cloneHidden,
  28930. oldIndex,
  28931. newIndex,
  28932. oldDraggableIndex,
  28933. newDraggableIndex,
  28934. activeGroup,
  28935. putSortable,
  28936. awaitingDragStarted = false,
  28937. ignoreNextClick = false,
  28938. sortables = [],
  28939. tapEvt,
  28940. touchEvt,
  28941. lastDx,
  28942. lastDy,
  28943. tapDistanceLeft,
  28944. tapDistanceTop,
  28945. moved,
  28946. lastTarget,
  28947. lastDirection,
  28948. pastFirstInvertThresh = false,
  28949. isCircumstantialInvert = false,
  28950. targetMoveDistance,
  28951. // For positioning ghost absolutely
  28952. ghostRelativeParent,
  28953. ghostRelativeParentInitialScroll = [],
  28954. // (left, top)
  28955. _silent = false,
  28956. savedInputChecked = [];
  28957. /** @const */
  28958. var documentExists = typeof document !== 'undefined',
  28959. PositionGhostAbsolutely = IOS,
  28960. CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
  28961. // This will not pass for IE9, because IE9 DnD only works on anchors
  28962. supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
  28963. supportCssPointerEvents = function () {
  28964. if (!documentExists) return; // false when <= IE11
  28965. if (IE11OrLess) {
  28966. return false;
  28967. }
  28968. var el = document.createElement('x');
  28969. el.style.cssText = 'pointer-events:auto';
  28970. return el.style.pointerEvents === 'auto';
  28971. }(),
  28972. _detectDirection = function _detectDirection(el, options) {
  28973. var elCSS = css(el),
  28974. elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),
  28975. child1 = getChild(el, 0, options),
  28976. child2 = getChild(el, 1, options),
  28977. firstChildCSS = child1 && css(child1),
  28978. secondChildCSS = child2 && css(child2),
  28979. firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,
  28980. secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
  28981. if (elCSS.display === 'flex') {
  28982. return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';
  28983. }
  28984. if (elCSS.display === 'grid') {
  28985. return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';
  28986. }
  28987. if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') {
  28988. var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right';
  28989. return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';
  28990. }
  28991. return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';
  28992. },
  28993. _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
  28994. var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
  28995. dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,
  28996. dragElOppLength = vertical ? dragRect.width : dragRect.height,
  28997. targetS1Opp = vertical ? targetRect.left : targetRect.top,
  28998. targetS2Opp = vertical ? targetRect.right : targetRect.bottom,
  28999. targetOppLength = vertical ? targetRect.width : targetRect.height;
  29000. return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
  29001. },
  29002. /**
  29003. * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
  29004. * @param {Number} x X position
  29005. * @param {Number} y Y position
  29006. * @return {HTMLElement} Element of the first found nearest Sortable
  29007. */
  29008. _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
  29009. var ret;
  29010. sortables.some(function (sortable) {
  29011. var threshold = sortable[expando].options.emptyInsertThreshold;
  29012. if (!threshold || lastChild(sortable)) return;
  29013. var rect = getRect(sortable),
  29014. insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
  29015. insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
  29016. if (insideHorizontally && insideVertically) {
  29017. return ret = sortable;
  29018. }
  29019. });
  29020. return ret;
  29021. },
  29022. _prepareGroup = function _prepareGroup(options) {
  29023. function toFn(value, pull) {
  29024. return function (to, from, dragEl, evt) {
  29025. var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
  29026. if (value == null && (pull || sameGroup)) {
  29027. // Default pull value
  29028. // Default pull and put value if same group
  29029. return true;
  29030. } else if (value == null || value === false) {
  29031. return false;
  29032. } else if (pull && value === 'clone') {
  29033. return value;
  29034. } else if (typeof value === 'function') {
  29035. return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
  29036. } else {
  29037. var otherGroup = (pull ? to : from).options.group.name;
  29038. return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
  29039. }
  29040. };
  29041. }
  29042. var group = {};
  29043. var originalGroup = options.group;
  29044. if (!originalGroup || _typeof(originalGroup) != 'object') {
  29045. originalGroup = {
  29046. name: originalGroup
  29047. };
  29048. }
  29049. group.name = originalGroup.name;
  29050. group.checkPull = toFn(originalGroup.pull, true);
  29051. group.checkPut = toFn(originalGroup.put);
  29052. group.revertClone = originalGroup.revertClone;
  29053. options.group = group;
  29054. },
  29055. _hideGhostForTarget = function _hideGhostForTarget() {
  29056. if (!supportCssPointerEvents && ghostEl) {
  29057. css(ghostEl, 'display', 'none');
  29058. }
  29059. },
  29060. _unhideGhostForTarget = function _unhideGhostForTarget() {
  29061. if (!supportCssPointerEvents && ghostEl) {
  29062. css(ghostEl, 'display', '');
  29063. }
  29064. }; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
  29065. if (documentExists && !ChromeForAndroid) {
  29066. document.addEventListener('click', function (evt) {
  29067. if (ignoreNextClick) {
  29068. evt.preventDefault();
  29069. evt.stopPropagation && evt.stopPropagation();
  29070. evt.stopImmediatePropagation && evt.stopImmediatePropagation();
  29071. ignoreNextClick = false;
  29072. return false;
  29073. }
  29074. }, true);
  29075. }
  29076. var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
  29077. if (dragEl) {
  29078. evt = evt.touches ? evt.touches[0] : evt;
  29079. var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
  29080. if (nearest) {
  29081. // Create imitation event
  29082. var event = {};
  29083. for (var i in evt) {
  29084. if (evt.hasOwnProperty(i)) {
  29085. event[i] = evt[i];
  29086. }
  29087. }
  29088. event.target = event.rootEl = nearest;
  29089. event.preventDefault = void 0;
  29090. event.stopPropagation = void 0;
  29091. nearest[expando]._onDragOver(event);
  29092. }
  29093. }
  29094. };
  29095. var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
  29096. if (dragEl) {
  29097. dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
  29098. }
  29099. };
  29100. /**
  29101. * @class Sortable
  29102. * @param {HTMLElement} el
  29103. * @param {Object} [options]
  29104. */
  29105. function Sortable(el, options) {
  29106. if (!(el && el.nodeType && el.nodeType === 1)) {
  29107. throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
  29108. }
  29109. this.el = el; // root element
  29110. this.options = options = _extends({}, options); // Export instance
  29111. el[expando] = this;
  29112. var defaults = {
  29113. group: null,
  29114. sort: true,
  29115. disabled: false,
  29116. store: null,
  29117. handle: null,
  29118. draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',
  29119. swapThreshold: 1,
  29120. // percentage; 0 <= x <= 1
  29121. invertSwap: false,
  29122. // invert always
  29123. invertedSwapThreshold: null,
  29124. // will be set to same as swapThreshold if default
  29125. removeCloneOnHide: true,
  29126. direction: function direction() {
  29127. return _detectDirection(el, this.options);
  29128. },
  29129. ghostClass: 'sortable-ghost',
  29130. chosenClass: 'sortable-chosen',
  29131. dragClass: 'sortable-drag',
  29132. ignore: 'a, img',
  29133. filter: null,
  29134. preventOnFilter: true,
  29135. animation: 0,
  29136. easing: null,
  29137. setData: function setData(dataTransfer, dragEl) {
  29138. dataTransfer.setData('Text', dragEl.textContent);
  29139. },
  29140. dropBubble: false,
  29141. dragoverBubble: false,
  29142. dataIdAttr: 'data-id',
  29143. delay: 0,
  29144. delayOnTouchOnly: false,
  29145. touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
  29146. forceFallback: false,
  29147. fallbackClass: 'sortable-fallback',
  29148. fallbackOnBody: false,
  29149. fallbackTolerance: 0,
  29150. fallbackOffset: {
  29151. x: 0,
  29152. y: 0
  29153. },
  29154. supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
  29155. emptyInsertThreshold: 5
  29156. };
  29157. PluginManager.initializePlugins(this, el, defaults); // Set default options
  29158. for (var name in defaults) {
  29159. !(name in options) && (options[name] = defaults[name]);
  29160. }
  29161. _prepareGroup(options); // Bind all private methods
  29162. for (var fn in this) {
  29163. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  29164. this[fn] = this[fn].bind(this);
  29165. }
  29166. } // Setup drag mode
  29167. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  29168. if (this.nativeDraggable) {
  29169. // Touch start threshold cannot be greater than the native dragstart threshold
  29170. this.options.touchStartThreshold = 1;
  29171. } // Bind events
  29172. if (options.supportPointer) {
  29173. on(el, 'pointerdown', this._onTapStart);
  29174. } else {
  29175. on(el, 'mousedown', this._onTapStart);
  29176. on(el, 'touchstart', this._onTapStart);
  29177. }
  29178. if (this.nativeDraggable) {
  29179. on(el, 'dragover', this);
  29180. on(el, 'dragenter', this);
  29181. }
  29182. sortables.push(this.el); // Restore sorting
  29183. options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager
  29184. _extends(this, AnimationStateManager());
  29185. }
  29186. Sortable.prototype =
  29187. /** @lends Sortable.prototype */
  29188. {
  29189. constructor: Sortable,
  29190. _isOutsideThisEl: function _isOutsideThisEl(target) {
  29191. if (!this.el.contains(target) && target !== this.el) {
  29192. lastTarget = null;
  29193. }
  29194. },
  29195. _getDirection: function _getDirection(evt, target) {
  29196. return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
  29197. },
  29198. _onTapStart: function _onTapStart(
  29199. /** Event|TouchEvent */
  29200. evt) {
  29201. if (!evt.cancelable) return;
  29202. var _this = this,
  29203. el = this.el,
  29204. options = this.options,
  29205. preventOnFilter = options.preventOnFilter,
  29206. type = evt.type,
  29207. touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,
  29208. target = (touch || evt).target,
  29209. originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,
  29210. filter = options.filter;
  29211. _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  29212. if (dragEl) {
  29213. return;
  29214. }
  29215. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  29216. return; // only left button and enabled
  29217. } // cancel dnd if original target is content editable
  29218. if (originalTarget.isContentEditable) {
  29219. return;
  29220. } // Safari ignores further event handling after mousedown
  29221. if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
  29222. return;
  29223. }
  29224. target = closest(target, options.draggable, el, false);
  29225. if (target && target.animated) {
  29226. return;
  29227. }
  29228. if (lastDownEl === target) {
  29229. // Ignoring duplicate `down`
  29230. return;
  29231. } // Get the index of the dragged element within its parent
  29232. oldIndex = index(target);
  29233. oldDraggableIndex = index(target, options.draggable); // Check filter
  29234. if (typeof filter === 'function') {
  29235. if (filter.call(this, evt, target, this)) {
  29236. _dispatchEvent({
  29237. sortable: _this,
  29238. rootEl: originalTarget,
  29239. name: 'filter',
  29240. targetEl: target,
  29241. toEl: el,
  29242. fromEl: el
  29243. });
  29244. pluginEvent('filter', _this, {
  29245. evt: evt
  29246. });
  29247. preventOnFilter && evt.cancelable && evt.preventDefault();
  29248. return; // cancel dnd
  29249. }
  29250. } else if (filter) {
  29251. filter = filter.split(',').some(function (criteria) {
  29252. criteria = closest(originalTarget, criteria.trim(), el, false);
  29253. if (criteria) {
  29254. _dispatchEvent({
  29255. sortable: _this,
  29256. rootEl: criteria,
  29257. name: 'filter',
  29258. targetEl: target,
  29259. fromEl: el,
  29260. toEl: el
  29261. });
  29262. pluginEvent('filter', _this, {
  29263. evt: evt
  29264. });
  29265. return true;
  29266. }
  29267. });
  29268. if (filter) {
  29269. preventOnFilter && evt.cancelable && evt.preventDefault();
  29270. return; // cancel dnd
  29271. }
  29272. }
  29273. if (options.handle && !closest(originalTarget, options.handle, el, false)) {
  29274. return;
  29275. } // Prepare `dragstart`
  29276. this._prepareDragStart(evt, touch, target);
  29277. },
  29278. _prepareDragStart: function _prepareDragStart(
  29279. /** Event */
  29280. evt,
  29281. /** Touch */
  29282. touch,
  29283. /** HTMLElement */
  29284. target) {
  29285. var _this = this,
  29286. el = _this.el,
  29287. options = _this.options,
  29288. ownerDocument = el.ownerDocument,
  29289. dragStartFn;
  29290. if (target && !dragEl && target.parentNode === el) {
  29291. var dragRect = getRect(target);
  29292. rootEl = el;
  29293. dragEl = target;
  29294. parentEl = dragEl.parentNode;
  29295. nextEl = dragEl.nextSibling;
  29296. lastDownEl = target;
  29297. activeGroup = options.group;
  29298. Sortable.dragged = dragEl;
  29299. tapEvt = {
  29300. target: dragEl,
  29301. clientX: (touch || evt).clientX,
  29302. clientY: (touch || evt).clientY
  29303. };
  29304. tapDistanceLeft = tapEvt.clientX - dragRect.left;
  29305. tapDistanceTop = tapEvt.clientY - dragRect.top;
  29306. this._lastX = (touch || evt).clientX;
  29307. this._lastY = (touch || evt).clientY;
  29308. dragEl.style['will-change'] = 'all';
  29309. dragStartFn = function dragStartFn() {
  29310. pluginEvent('delayEnded', _this, {
  29311. evt: evt
  29312. });
  29313. if (Sortable.eventCanceled) {
  29314. _this._onDrop();
  29315. return;
  29316. } // Delayed drag has been triggered
  29317. // we can re-enable the events: touchmove/mousemove
  29318. _this._disableDelayedDragEvents();
  29319. if (!FireFox && _this.nativeDraggable) {
  29320. dragEl.draggable = true;
  29321. } // Bind the events: dragstart/dragend
  29322. _this._triggerDragStart(evt, touch); // Drag start event
  29323. _dispatchEvent({
  29324. sortable: _this,
  29325. name: 'choose',
  29326. originalEvent: evt
  29327. }); // Chosen item
  29328. toggleClass(dragEl, options.chosenClass, true);
  29329. }; // Disable "draggable"
  29330. options.ignore.split(',').forEach(function (criteria) {
  29331. find(dragEl, criteria.trim(), _disableDraggable);
  29332. });
  29333. on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
  29334. on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
  29335. on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
  29336. on(ownerDocument, 'mouseup', _this._onDrop);
  29337. on(ownerDocument, 'touchend', _this._onDrop);
  29338. on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)
  29339. if (FireFox && this.nativeDraggable) {
  29340. this.options.touchStartThreshold = 4;
  29341. dragEl.draggable = true;
  29342. }
  29343. pluginEvent('delayStart', this, {
  29344. evt: evt
  29345. }); // Delay is impossible for native DnD in Edge or IE
  29346. if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
  29347. if (Sortable.eventCanceled) {
  29348. this._onDrop();
  29349. return;
  29350. } // If the user moves the pointer or let go the click or touch
  29351. // before the delay has been reached:
  29352. // disable the delayed drag
  29353. on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  29354. on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  29355. on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  29356. on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
  29357. on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
  29358. options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
  29359. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  29360. } else {
  29361. dragStartFn();
  29362. }
  29363. }
  29364. },
  29365. _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(
  29366. /** TouchEvent|PointerEvent **/
  29367. e) {
  29368. var touch = e.touches ? e.touches[0] : e;
  29369. if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
  29370. this._disableDelayedDrag();
  29371. }
  29372. },
  29373. _disableDelayedDrag: function _disableDelayedDrag() {
  29374. dragEl && _disableDraggable(dragEl);
  29375. clearTimeout(this._dragStartTimer);
  29376. this._disableDelayedDragEvents();
  29377. },
  29378. _disableDelayedDragEvents: function _disableDelayedDragEvents() {
  29379. var ownerDocument = this.el.ownerDocument;
  29380. off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  29381. off(ownerDocument, 'touchend', this._disableDelayedDrag);
  29382. off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  29383. off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
  29384. off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
  29385. off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
  29386. },
  29387. _triggerDragStart: function _triggerDragStart(
  29388. /** Event */
  29389. evt,
  29390. /** Touch */
  29391. touch) {
  29392. touch = touch || evt.pointerType == 'touch' && evt;
  29393. if (!this.nativeDraggable || touch) {
  29394. if (this.options.supportPointer) {
  29395. on(document, 'pointermove', this._onTouchMove);
  29396. } else if (touch) {
  29397. on(document, 'touchmove', this._onTouchMove);
  29398. } else {
  29399. on(document, 'mousemove', this._onTouchMove);
  29400. }
  29401. } else {
  29402. on(dragEl, 'dragend', this);
  29403. on(rootEl, 'dragstart', this._onDragStart);
  29404. }
  29405. try {
  29406. if (document.selection) {
  29407. // Timeout neccessary for IE9
  29408. _nextTick(function () {
  29409. document.selection.empty();
  29410. });
  29411. } else {
  29412. window.getSelection().removeAllRanges();
  29413. }
  29414. } catch (err) {}
  29415. },
  29416. _dragStarted: function _dragStarted(fallback, evt) {
  29417. awaitingDragStarted = false;
  29418. if (rootEl && dragEl) {
  29419. pluginEvent('dragStarted', this, {
  29420. evt: evt
  29421. });
  29422. if (this.nativeDraggable) {
  29423. on(document, 'dragover', _checkOutsideTargetEl);
  29424. }
  29425. var options = this.options; // Apply effect
  29426. !fallback && toggleClass(dragEl, options.dragClass, false);
  29427. toggleClass(dragEl, options.ghostClass, true);
  29428. Sortable.active = this;
  29429. fallback && this._appendGhost(); // Drag start event
  29430. _dispatchEvent({
  29431. sortable: this,
  29432. name: 'start',
  29433. originalEvent: evt
  29434. });
  29435. } else {
  29436. this._nulling();
  29437. }
  29438. },
  29439. _emulateDragOver: function _emulateDragOver() {
  29440. if (touchEvt) {
  29441. this._lastX = touchEvt.clientX;
  29442. this._lastY = touchEvt.clientY;
  29443. _hideGhostForTarget();
  29444. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
  29445. var parent = target;
  29446. while (target && target.shadowRoot) {
  29447. target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
  29448. if (target === parent) break;
  29449. parent = target;
  29450. }
  29451. dragEl.parentNode[expando]._isOutsideThisEl(target);
  29452. if (parent) {
  29453. do {
  29454. if (parent[expando]) {
  29455. var inserted = void 0;
  29456. inserted = parent[expando]._onDragOver({
  29457. clientX: touchEvt.clientX,
  29458. clientY: touchEvt.clientY,
  29459. target: target,
  29460. rootEl: parent
  29461. });
  29462. if (inserted && !this.options.dragoverBubble) {
  29463. break;
  29464. }
  29465. }
  29466. target = parent; // store last element
  29467. }
  29468. /* jshint boss:true */
  29469. while (parent = parent.parentNode);
  29470. }
  29471. _unhideGhostForTarget();
  29472. }
  29473. },
  29474. _onTouchMove: function _onTouchMove(
  29475. /**TouchEvent*/
  29476. evt) {
  29477. if (tapEvt) {
  29478. var options = this.options,
  29479. fallbackTolerance = options.fallbackTolerance,
  29480. fallbackOffset = options.fallbackOffset,
  29481. touch = evt.touches ? evt.touches[0] : evt,
  29482. ghostMatrix = ghostEl && matrix(ghostEl, true),
  29483. scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
  29484. scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
  29485. relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
  29486. dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
  29487. dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging
  29488. if (!Sortable.active && !awaitingDragStarted) {
  29489. if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  29490. return;
  29491. }
  29492. this._onDragStart(evt, true);
  29493. }
  29494. if (ghostEl) {
  29495. if (ghostMatrix) {
  29496. ghostMatrix.e += dx - (lastDx || 0);
  29497. ghostMatrix.f += dy - (lastDy || 0);
  29498. } else {
  29499. ghostMatrix = {
  29500. a: 1,
  29501. b: 0,
  29502. c: 0,
  29503. d: 1,
  29504. e: dx,
  29505. f: dy
  29506. };
  29507. }
  29508. var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
  29509. css(ghostEl, 'webkitTransform', cssMatrix);
  29510. css(ghostEl, 'mozTransform', cssMatrix);
  29511. css(ghostEl, 'msTransform', cssMatrix);
  29512. css(ghostEl, 'transform', cssMatrix);
  29513. lastDx = dx;
  29514. lastDy = dy;
  29515. touchEvt = touch;
  29516. }
  29517. evt.cancelable && evt.preventDefault();
  29518. }
  29519. },
  29520. _appendGhost: function _appendGhost() {
  29521. // Bug if using scale(): https://stackoverflow.com/questions/2637058
  29522. // Not being adjusted for
  29523. if (!ghostEl) {
  29524. var container = this.options.fallbackOnBody ? document.body : rootEl,
  29525. rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),
  29526. options = this.options; // Position absolutely
  29527. if (PositionGhostAbsolutely) {
  29528. // Get relatively positioned parent
  29529. ghostRelativeParent = container;
  29530. while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {
  29531. ghostRelativeParent = ghostRelativeParent.parentNode;
  29532. }
  29533. if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
  29534. if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
  29535. rect.top += ghostRelativeParent.scrollTop;
  29536. rect.left += ghostRelativeParent.scrollLeft;
  29537. } else {
  29538. ghostRelativeParent = getWindowScrollingElement();
  29539. }
  29540. ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
  29541. }
  29542. ghostEl = dragEl.cloneNode(true);
  29543. toggleClass(ghostEl, options.ghostClass, false);
  29544. toggleClass(ghostEl, options.fallbackClass, true);
  29545. toggleClass(ghostEl, options.dragClass, true);
  29546. css(ghostEl, 'transition', '');
  29547. css(ghostEl, 'transform', '');
  29548. css(ghostEl, 'box-sizing', 'border-box');
  29549. css(ghostEl, 'margin', 0);
  29550. css(ghostEl, 'top', rect.top);
  29551. css(ghostEl, 'left', rect.left);
  29552. css(ghostEl, 'width', rect.width);
  29553. css(ghostEl, 'height', rect.height);
  29554. css(ghostEl, 'opacity', '0.8');
  29555. css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');
  29556. css(ghostEl, 'zIndex', '100000');
  29557. css(ghostEl, 'pointerEvents', 'none');
  29558. Sortable.ghost = ghostEl;
  29559. container.appendChild(ghostEl); // Set transform-origin
  29560. css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');
  29561. }
  29562. },
  29563. _onDragStart: function _onDragStart(
  29564. /**Event*/
  29565. evt,
  29566. /**boolean*/
  29567. fallback) {
  29568. var _this = this;
  29569. var dataTransfer = evt.dataTransfer;
  29570. var options = _this.options;
  29571. pluginEvent('dragStart', this, {
  29572. evt: evt
  29573. });
  29574. if (Sortable.eventCanceled) {
  29575. this._onDrop();
  29576. return;
  29577. }
  29578. pluginEvent('setupClone', this);
  29579. if (!Sortable.eventCanceled) {
  29580. cloneEl = clone(dragEl);
  29581. cloneEl.removeAttribute("id");
  29582. cloneEl.draggable = false;
  29583. cloneEl.style['will-change'] = '';
  29584. this._hideClone();
  29585. toggleClass(cloneEl, this.options.chosenClass, false);
  29586. Sortable.clone = cloneEl;
  29587. } // #1143: IFrame support workaround
  29588. _this.cloneId = _nextTick(function () {
  29589. pluginEvent('clone', _this);
  29590. if (Sortable.eventCanceled) return;
  29591. if (!_this.options.removeCloneOnHide) {
  29592. rootEl.insertBefore(cloneEl, dragEl);
  29593. }
  29594. _this._hideClone();
  29595. _dispatchEvent({
  29596. sortable: _this,
  29597. name: 'clone'
  29598. });
  29599. });
  29600. !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events
  29601. if (fallback) {
  29602. ignoreNextClick = true;
  29603. _this._loopId = setInterval(_this._emulateDragOver, 50);
  29604. } else {
  29605. // Undo what was set in _prepareDragStart before drag started
  29606. off(document, 'mouseup', _this._onDrop);
  29607. off(document, 'touchend', _this._onDrop);
  29608. off(document, 'touchcancel', _this._onDrop);
  29609. if (dataTransfer) {
  29610. dataTransfer.effectAllowed = 'move';
  29611. options.setData && options.setData.call(_this, dataTransfer, dragEl);
  29612. }
  29613. on(document, 'drop', _this); // #1276 fix:
  29614. css(dragEl, 'transform', 'translateZ(0)');
  29615. }
  29616. awaitingDragStarted = true;
  29617. _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
  29618. on(document, 'selectstart', _this);
  29619. moved = true;
  29620. if (Safari) {
  29621. css(document.body, 'user-select', 'none');
  29622. }
  29623. },
  29624. // Returns true - if no further action is needed (either inserted or another condition)
  29625. _onDragOver: function _onDragOver(
  29626. /**Event*/
  29627. evt) {
  29628. var el = this.el,
  29629. target = evt.target,
  29630. dragRect,
  29631. targetRect,
  29632. revert,
  29633. options = this.options,
  29634. group = options.group,
  29635. activeSortable = Sortable.active,
  29636. isOwner = activeGroup === group,
  29637. canSort = options.sort,
  29638. fromSortable = putSortable || activeSortable,
  29639. vertical,
  29640. _this = this,
  29641. completedFired = false;
  29642. if (_silent) return;
  29643. function dragOverEvent(name, extra) {
  29644. pluginEvent(name, _this, _objectSpread2({
  29645. evt: evt,
  29646. isOwner: isOwner,
  29647. axis: vertical ? 'vertical' : 'horizontal',
  29648. revert: revert,
  29649. dragRect: dragRect,
  29650. targetRect: targetRect,
  29651. canSort: canSort,
  29652. fromSortable: fromSortable,
  29653. target: target,
  29654. completed: completed,
  29655. onMove: function onMove(target, after) {
  29656. return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);
  29657. },
  29658. changed: changed
  29659. }, extra));
  29660. } // Capture animation state
  29661. function capture() {
  29662. dragOverEvent('dragOverAnimationCapture');
  29663. _this.captureAnimationState();
  29664. if (_this !== fromSortable) {
  29665. fromSortable.captureAnimationState();
  29666. }
  29667. } // Return invocation when dragEl is inserted (or completed)
  29668. function completed(insertion) {
  29669. dragOverEvent('dragOverCompleted', {
  29670. insertion: insertion
  29671. });
  29672. if (insertion) {
  29673. // Clones must be hidden before folding animation to capture dragRectAbsolute properly
  29674. if (isOwner) {
  29675. activeSortable._hideClone();
  29676. } else {
  29677. activeSortable._showClone(_this);
  29678. }
  29679. if (_this !== fromSortable) {
  29680. // Set ghost class to new sortable's ghost class
  29681. toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
  29682. toggleClass(dragEl, options.ghostClass, true);
  29683. }
  29684. if (putSortable !== _this && _this !== Sortable.active) {
  29685. putSortable = _this;
  29686. } else if (_this === Sortable.active && putSortable) {
  29687. putSortable = null;
  29688. } // Animation
  29689. if (fromSortable === _this) {
  29690. _this._ignoreWhileAnimating = target;
  29691. }
  29692. _this.animateAll(function () {
  29693. dragOverEvent('dragOverAnimationComplete');
  29694. _this._ignoreWhileAnimating = null;
  29695. });
  29696. if (_this !== fromSortable) {
  29697. fromSortable.animateAll();
  29698. fromSortable._ignoreWhileAnimating = null;
  29699. }
  29700. } // Null lastTarget if it is not inside a previously swapped element
  29701. if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
  29702. lastTarget = null;
  29703. } // no bubbling and not fallback
  29704. if (!options.dragoverBubble && !evt.rootEl && target !== document) {
  29705. dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted
  29706. !insertion && nearestEmptyInsertDetectEvent(evt);
  29707. }
  29708. !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
  29709. return completedFired = true;
  29710. } // Call when dragEl has been inserted
  29711. function changed() {
  29712. newIndex = index(dragEl);
  29713. newDraggableIndex = index(dragEl, options.draggable);
  29714. _dispatchEvent({
  29715. sortable: _this,
  29716. name: 'change',
  29717. toEl: el,
  29718. newIndex: newIndex,
  29719. newDraggableIndex: newDraggableIndex,
  29720. originalEvent: evt
  29721. });
  29722. }
  29723. if (evt.preventDefault !== void 0) {
  29724. evt.cancelable && evt.preventDefault();
  29725. }
  29726. target = closest(target, options.draggable, el, true);
  29727. dragOverEvent('dragOver');
  29728. if (Sortable.eventCanceled) return completedFired;
  29729. if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
  29730. return completed(false);
  29731. }
  29732. ignoreNextClick = false;
  29733. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list
  29734. : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
  29735. vertical = this._getDirection(evt, target) === 'vertical';
  29736. dragRect = getRect(dragEl);
  29737. dragOverEvent('dragOverValid');
  29738. if (Sortable.eventCanceled) return completedFired;
  29739. if (revert) {
  29740. parentEl = rootEl; // actualization
  29741. capture();
  29742. this._hideClone();
  29743. dragOverEvent('revert');
  29744. if (!Sortable.eventCanceled) {
  29745. if (nextEl) {
  29746. rootEl.insertBefore(dragEl, nextEl);
  29747. } else {
  29748. rootEl.appendChild(dragEl);
  29749. }
  29750. }
  29751. return completed(true);
  29752. }
  29753. var elLastChild = lastChild(el, options.draggable);
  29754. if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
  29755. // Insert to end of list
  29756. // If already at end of list: Do not insert
  29757. if (elLastChild === dragEl) {
  29758. return completed(false);
  29759. } // if there is a last element, it is the target
  29760. if (elLastChild && el === evt.target) {
  29761. target = elLastChild;
  29762. }
  29763. if (target) {
  29764. targetRect = getRect(target);
  29765. }
  29766. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
  29767. capture();
  29768. if (elLastChild && elLastChild.nextSibling) {
  29769. // the last draggable element is not the last node
  29770. el.insertBefore(dragEl, elLastChild.nextSibling);
  29771. } else {
  29772. el.appendChild(dragEl);
  29773. }
  29774. parentEl = el; // actualization
  29775. changed();
  29776. return completed(true);
  29777. }
  29778. } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
  29779. // Insert to start of list
  29780. var firstChild = getChild(el, 0, options, true);
  29781. if (firstChild === dragEl) {
  29782. return completed(false);
  29783. }
  29784. target = firstChild;
  29785. targetRect = getRect(target);
  29786. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
  29787. capture();
  29788. el.insertBefore(dragEl, firstChild);
  29789. parentEl = el; // actualization
  29790. changed();
  29791. return completed(true);
  29792. }
  29793. } else if (target.parentNode === el) {
  29794. targetRect = getRect(target);
  29795. var direction = 0,
  29796. targetBeforeFirstSwap,
  29797. differentLevel = dragEl.parentNode !== el,
  29798. differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),
  29799. side1 = vertical ? 'top' : 'left',
  29800. scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),
  29801. scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
  29802. if (lastTarget !== target) {
  29803. targetBeforeFirstSwap = targetRect[side1];
  29804. pastFirstInvertThresh = false;
  29805. isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
  29806. }
  29807. direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
  29808. var sibling;
  29809. if (direction !== 0) {
  29810. // Check if target is beside dragEl in respective direction (ignoring hidden elements)
  29811. var dragIndex = index(dragEl);
  29812. do {
  29813. dragIndex -= direction;
  29814. sibling = parentEl.children[dragIndex];
  29815. } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
  29816. } // If dragEl is already beside target: Do not insert
  29817. if (direction === 0 || sibling === target) {
  29818. return completed(false);
  29819. }
  29820. lastTarget = target;
  29821. lastDirection = direction;
  29822. var nextSibling = target.nextElementSibling,
  29823. after = false;
  29824. after = direction === 1;
  29825. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  29826. if (moveVector !== false) {
  29827. if (moveVector === 1 || moveVector === -1) {
  29828. after = moveVector === 1;
  29829. }
  29830. _silent = true;
  29831. setTimeout(_unsilent, 30);
  29832. capture();
  29833. if (after && !nextSibling) {
  29834. el.appendChild(dragEl);
  29835. } else {
  29836. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  29837. } // Undo chrome's scroll adjustment (has no effect on other browsers)
  29838. if (scrolledPastTop) {
  29839. scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
  29840. }
  29841. parentEl = dragEl.parentNode; // actualization
  29842. // must be done before animation
  29843. if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
  29844. targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
  29845. }
  29846. changed();
  29847. return completed(true);
  29848. }
  29849. }
  29850. if (el.contains(dragEl)) {
  29851. return completed(false);
  29852. }
  29853. }
  29854. return false;
  29855. },
  29856. _ignoreWhileAnimating: null,
  29857. _offMoveEvents: function _offMoveEvents() {
  29858. off(document, 'mousemove', this._onTouchMove);
  29859. off(document, 'touchmove', this._onTouchMove);
  29860. off(document, 'pointermove', this._onTouchMove);
  29861. off(document, 'dragover', nearestEmptyInsertDetectEvent);
  29862. off(document, 'mousemove', nearestEmptyInsertDetectEvent);
  29863. off(document, 'touchmove', nearestEmptyInsertDetectEvent);
  29864. },
  29865. _offUpEvents: function _offUpEvents() {
  29866. var ownerDocument = this.el.ownerDocument;
  29867. off(ownerDocument, 'mouseup', this._onDrop);
  29868. off(ownerDocument, 'touchend', this._onDrop);
  29869. off(ownerDocument, 'pointerup', this._onDrop);
  29870. off(ownerDocument, 'touchcancel', this._onDrop);
  29871. off(document, 'selectstart', this);
  29872. },
  29873. _onDrop: function _onDrop(
  29874. /**Event*/
  29875. evt) {
  29876. var el = this.el,
  29877. options = this.options; // Get the index of the dragged element within its parent
  29878. newIndex = index(dragEl);
  29879. newDraggableIndex = index(dragEl, options.draggable);
  29880. pluginEvent('drop', this, {
  29881. evt: evt
  29882. });
  29883. parentEl = dragEl && dragEl.parentNode; // Get again after plugin event
  29884. newIndex = index(dragEl);
  29885. newDraggableIndex = index(dragEl, options.draggable);
  29886. if (Sortable.eventCanceled) {
  29887. this._nulling();
  29888. return;
  29889. }
  29890. awaitingDragStarted = false;
  29891. isCircumstantialInvert = false;
  29892. pastFirstInvertThresh = false;
  29893. clearInterval(this._loopId);
  29894. clearTimeout(this._dragStartTimer);
  29895. _cancelNextTick(this.cloneId);
  29896. _cancelNextTick(this._dragStartId); // Unbind events
  29897. if (this.nativeDraggable) {
  29898. off(document, 'drop', this);
  29899. off(el, 'dragstart', this._onDragStart);
  29900. }
  29901. this._offMoveEvents();
  29902. this._offUpEvents();
  29903. if (Safari) {
  29904. css(document.body, 'user-select', '');
  29905. }
  29906. css(dragEl, 'transform', '');
  29907. if (evt) {
  29908. if (moved) {
  29909. evt.cancelable && evt.preventDefault();
  29910. !options.dropBubble && evt.stopPropagation();
  29911. }
  29912. ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
  29913. if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
  29914. // Remove clone(s)
  29915. cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
  29916. }
  29917. if (dragEl) {
  29918. if (this.nativeDraggable) {
  29919. off(dragEl, 'dragend', this);
  29920. }
  29921. _disableDraggable(dragEl);
  29922. dragEl.style['will-change'] = ''; // Remove classes
  29923. // ghostClass is added in dragStarted
  29924. if (moved && !awaitingDragStarted) {
  29925. toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
  29926. }
  29927. toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event
  29928. _dispatchEvent({
  29929. sortable: this,
  29930. name: 'unchoose',
  29931. toEl: parentEl,
  29932. newIndex: null,
  29933. newDraggableIndex: null,
  29934. originalEvent: evt
  29935. });
  29936. if (rootEl !== parentEl) {
  29937. if (newIndex >= 0) {
  29938. // Add event
  29939. _dispatchEvent({
  29940. rootEl: parentEl,
  29941. name: 'add',
  29942. toEl: parentEl,
  29943. fromEl: rootEl,
  29944. originalEvent: evt
  29945. }); // Remove event
  29946. _dispatchEvent({
  29947. sortable: this,
  29948. name: 'remove',
  29949. toEl: parentEl,
  29950. originalEvent: evt
  29951. }); // drag from one list and drop into another
  29952. _dispatchEvent({
  29953. rootEl: parentEl,
  29954. name: 'sort',
  29955. toEl: parentEl,
  29956. fromEl: rootEl,
  29957. originalEvent: evt
  29958. });
  29959. _dispatchEvent({
  29960. sortable: this,
  29961. name: 'sort',
  29962. toEl: parentEl,
  29963. originalEvent: evt
  29964. });
  29965. }
  29966. putSortable && putSortable.save();
  29967. } else {
  29968. if (newIndex !== oldIndex) {
  29969. if (newIndex >= 0) {
  29970. // drag & drop within the same list
  29971. _dispatchEvent({
  29972. sortable: this,
  29973. name: 'update',
  29974. toEl: parentEl,
  29975. originalEvent: evt
  29976. });
  29977. _dispatchEvent({
  29978. sortable: this,
  29979. name: 'sort',
  29980. toEl: parentEl,
  29981. originalEvent: evt
  29982. });
  29983. }
  29984. }
  29985. }
  29986. if (Sortable.active) {
  29987. /* jshint eqnull:true */
  29988. if (newIndex == null || newIndex === -1) {
  29989. newIndex = oldIndex;
  29990. newDraggableIndex = oldDraggableIndex;
  29991. }
  29992. _dispatchEvent({
  29993. sortable: this,
  29994. name: 'end',
  29995. toEl: parentEl,
  29996. originalEvent: evt
  29997. }); // Save sorting
  29998. this.save();
  29999. }
  30000. }
  30001. }
  30002. this._nulling();
  30003. },
  30004. _nulling: function _nulling() {
  30005. pluginEvent('nulling', this);
  30006. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
  30007. savedInputChecked.forEach(function (el) {
  30008. el.checked = true;
  30009. });
  30010. savedInputChecked.length = lastDx = lastDy = 0;
  30011. },
  30012. handleEvent: function handleEvent(
  30013. /**Event*/
  30014. evt) {
  30015. switch (evt.type) {
  30016. case 'drop':
  30017. case 'dragend':
  30018. this._onDrop(evt);
  30019. break;
  30020. case 'dragenter':
  30021. case 'dragover':
  30022. if (dragEl) {
  30023. this._onDragOver(evt);
  30024. _globalDragOver(evt);
  30025. }
  30026. break;
  30027. case 'selectstart':
  30028. evt.preventDefault();
  30029. break;
  30030. }
  30031. },
  30032. /**
  30033. * Serializes the item into an array of string.
  30034. * @returns {String[]}
  30035. */
  30036. toArray: function toArray() {
  30037. var order = [],
  30038. el,
  30039. children = this.el.children,
  30040. i = 0,
  30041. n = children.length,
  30042. options = this.options;
  30043. for (; i < n; i++) {
  30044. el = children[i];
  30045. if (closest(el, options.draggable, this.el, false)) {
  30046. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  30047. }
  30048. }
  30049. return order;
  30050. },
  30051. /**
  30052. * Sorts the elements according to the array.
  30053. * @param {String[]} order order of the items
  30054. */
  30055. sort: function sort(order, useAnimation) {
  30056. var items = {},
  30057. rootEl = this.el;
  30058. this.toArray().forEach(function (id, i) {
  30059. var el = rootEl.children[i];
  30060. if (closest(el, this.options.draggable, rootEl, false)) {
  30061. items[id] = el;
  30062. }
  30063. }, this);
  30064. useAnimation && this.captureAnimationState();
  30065. order.forEach(function (id) {
  30066. if (items[id]) {
  30067. rootEl.removeChild(items[id]);
  30068. rootEl.appendChild(items[id]);
  30069. }
  30070. });
  30071. useAnimation && this.animateAll();
  30072. },
  30073. /**
  30074. * Save the current sorting
  30075. */
  30076. save: function save() {
  30077. var store = this.options.store;
  30078. store && store.set && store.set(this);
  30079. },
  30080. /**
  30081. * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
  30082. * @param {HTMLElement} el
  30083. * @param {String} [selector] default: `options.draggable`
  30084. * @returns {HTMLElement|null}
  30085. */
  30086. closest: function closest$1(el, selector) {
  30087. return closest(el, selector || this.options.draggable, this.el, false);
  30088. },
  30089. /**
  30090. * Set/get option
  30091. * @param {string} name
  30092. * @param {*} [value]
  30093. * @returns {*}
  30094. */
  30095. option: function option(name, value) {
  30096. var options = this.options;
  30097. if (value === void 0) {
  30098. return options[name];
  30099. } else {
  30100. var modifiedValue = PluginManager.modifyOption(this, name, value);
  30101. if (typeof modifiedValue !== 'undefined') {
  30102. options[name] = modifiedValue;
  30103. } else {
  30104. options[name] = value;
  30105. }
  30106. if (name === 'group') {
  30107. _prepareGroup(options);
  30108. }
  30109. }
  30110. },
  30111. /**
  30112. * Destroy
  30113. */
  30114. destroy: function destroy() {
  30115. pluginEvent('destroy', this);
  30116. var el = this.el;
  30117. el[expando] = null;
  30118. off(el, 'mousedown', this._onTapStart);
  30119. off(el, 'touchstart', this._onTapStart);
  30120. off(el, 'pointerdown', this._onTapStart);
  30121. if (this.nativeDraggable) {
  30122. off(el, 'dragover', this);
  30123. off(el, 'dragenter', this);
  30124. } // Remove draggable attributes
  30125. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  30126. el.removeAttribute('draggable');
  30127. });
  30128. this._onDrop();
  30129. this._disableDelayedDragEvents();
  30130. sortables.splice(sortables.indexOf(this.el), 1);
  30131. this.el = el = null;
  30132. },
  30133. _hideClone: function _hideClone() {
  30134. if (!cloneHidden) {
  30135. pluginEvent('hideClone', this);
  30136. if (Sortable.eventCanceled) return;
  30137. css(cloneEl, 'display', 'none');
  30138. if (this.options.removeCloneOnHide && cloneEl.parentNode) {
  30139. cloneEl.parentNode.removeChild(cloneEl);
  30140. }
  30141. cloneHidden = true;
  30142. }
  30143. },
  30144. _showClone: function _showClone(putSortable) {
  30145. if (putSortable.lastPutMode !== 'clone') {
  30146. this._hideClone();
  30147. return;
  30148. }
  30149. if (cloneHidden) {
  30150. pluginEvent('showClone', this);
  30151. if (Sortable.eventCanceled) return; // show clone at dragEl or original position
  30152. if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
  30153. rootEl.insertBefore(cloneEl, dragEl);
  30154. } else if (nextEl) {
  30155. rootEl.insertBefore(cloneEl, nextEl);
  30156. } else {
  30157. rootEl.appendChild(cloneEl);
  30158. }
  30159. if (this.options.group.revertClone) {
  30160. this.animate(dragEl, cloneEl);
  30161. }
  30162. css(cloneEl, 'display', '');
  30163. cloneHidden = false;
  30164. }
  30165. }
  30166. };
  30167. function _globalDragOver(
  30168. /**Event*/
  30169. evt) {
  30170. if (evt.dataTransfer) {
  30171. evt.dataTransfer.dropEffect = 'move';
  30172. }
  30173. evt.cancelable && evt.preventDefault();
  30174. }
  30175. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
  30176. var evt,
  30177. sortable = fromEl[expando],
  30178. onMoveFn = sortable.options.onMove,
  30179. retVal; // Support for new CustomEvent feature
  30180. if (window.CustomEvent && !IE11OrLess && !Edge) {
  30181. evt = new CustomEvent('move', {
  30182. bubbles: true,
  30183. cancelable: true
  30184. });
  30185. } else {
  30186. evt = document.createEvent('Event');
  30187. evt.initEvent('move', true, true);
  30188. }
  30189. evt.to = toEl;
  30190. evt.from = fromEl;
  30191. evt.dragged = dragEl;
  30192. evt.draggedRect = dragRect;
  30193. evt.related = targetEl || toEl;
  30194. evt.relatedRect = targetRect || getRect(toEl);
  30195. evt.willInsertAfter = willInsertAfter;
  30196. evt.originalEvent = originalEvent;
  30197. fromEl.dispatchEvent(evt);
  30198. if (onMoveFn) {
  30199. retVal = onMoveFn.call(sortable, evt, originalEvent);
  30200. }
  30201. return retVal;
  30202. }
  30203. function _disableDraggable(el) {
  30204. el.draggable = false;
  30205. }
  30206. function _unsilent() {
  30207. _silent = false;
  30208. }
  30209. function _ghostIsFirst(evt, vertical, sortable) {
  30210. var rect = getRect(getChild(sortable.el, 0, sortable.options, true));
  30211. var spacer = 10;
  30212. return vertical ? evt.clientX < rect.left - spacer || evt.clientY < rect.top && evt.clientX < rect.right : evt.clientY < rect.top - spacer || evt.clientY < rect.bottom && evt.clientX < rect.left;
  30213. }
  30214. function _ghostIsLast(evt, vertical, sortable) {
  30215. var rect = getRect(lastChild(sortable.el, sortable.options.draggable));
  30216. var spacer = 10;
  30217. return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer;
  30218. }
  30219. function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
  30220. var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
  30221. targetLength = vertical ? targetRect.height : targetRect.width,
  30222. targetS1 = vertical ? targetRect.top : targetRect.left,
  30223. targetS2 = vertical ? targetRect.bottom : targetRect.right,
  30224. invert = false;
  30225. if (!invertSwap) {
  30226. // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold
  30227. if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
  30228. // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2
  30229. // check if past first invert threshold on side opposite of lastDirection
  30230. if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {
  30231. // past first invert threshold, do not restrict inverted threshold to dragEl shadow
  30232. pastFirstInvertThresh = true;
  30233. }
  30234. if (!pastFirstInvertThresh) {
  30235. // dragEl shadow (target move distance shadow)
  30236. if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow
  30237. : mouseOnAxis > targetS2 - targetMoveDistance) {
  30238. return -lastDirection;
  30239. }
  30240. } else {
  30241. invert = true;
  30242. }
  30243. } else {
  30244. // Regular
  30245. if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {
  30246. return _getInsertDirection(target);
  30247. }
  30248. }
  30249. }
  30250. invert = invert || invertSwap;
  30251. if (invert) {
  30252. // Invert of regular
  30253. if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
  30254. return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
  30255. }
  30256. }
  30257. return 0;
  30258. }
  30259. /**
  30260. * Gets the direction dragEl must be swapped relative to target in order to make it
  30261. * seem that dragEl has been "inserted" into that element's position
  30262. * @param {HTMLElement} target The target whose position dragEl is being inserted at
  30263. * @return {Number} Direction dragEl must be swapped
  30264. */
  30265. function _getInsertDirection(target) {
  30266. if (index(dragEl) < index(target)) {
  30267. return 1;
  30268. } else {
  30269. return -1;
  30270. }
  30271. }
  30272. /**
  30273. * Generate id
  30274. * @param {HTMLElement} el
  30275. * @returns {String}
  30276. * @private
  30277. */
  30278. function _generateId(el) {
  30279. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  30280. i = str.length,
  30281. sum = 0;
  30282. while (i--) {
  30283. sum += str.charCodeAt(i);
  30284. }
  30285. return sum.toString(36);
  30286. }
  30287. function _saveInputCheckedState(root) {
  30288. savedInputChecked.length = 0;
  30289. var inputs = root.getElementsByTagName('input');
  30290. var idx = inputs.length;
  30291. while (idx--) {
  30292. var el = inputs[idx];
  30293. el.checked && savedInputChecked.push(el);
  30294. }
  30295. }
  30296. function _nextTick(fn) {
  30297. return setTimeout(fn, 0);
  30298. }
  30299. function _cancelNextTick(id) {
  30300. return clearTimeout(id);
  30301. } // Fixed #973:
  30302. if (documentExists) {
  30303. on(document, 'touchmove', function (evt) {
  30304. if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
  30305. evt.preventDefault();
  30306. }
  30307. });
  30308. } // Export utils
  30309. Sortable.utils = {
  30310. on: on,
  30311. off: off,
  30312. css: css,
  30313. find: find,
  30314. is: function is(el, selector) {
  30315. return !!closest(el, selector, el, false);
  30316. },
  30317. extend: extend,
  30318. throttle: throttle,
  30319. closest: closest,
  30320. toggleClass: toggleClass,
  30321. clone: clone,
  30322. index: index,
  30323. nextTick: _nextTick,
  30324. cancelNextTick: _cancelNextTick,
  30325. detectDirection: _detectDirection,
  30326. getChild: getChild
  30327. };
  30328. /**
  30329. * Get the Sortable instance of an element
  30330. * @param {HTMLElement} element The element
  30331. * @return {Sortable|undefined} The instance of Sortable
  30332. */
  30333. Sortable.get = function (element) {
  30334. return element[expando];
  30335. };
  30336. /**
  30337. * Mount a plugin to Sortable
  30338. * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
  30339. */
  30340. Sortable.mount = function () {
  30341. for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
  30342. plugins[_key] = arguments[_key];
  30343. }
  30344. if (plugins[0].constructor === Array) plugins = plugins[0];
  30345. plugins.forEach(function (plugin) {
  30346. if (!plugin.prototype || !plugin.prototype.constructor) {
  30347. throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
  30348. }
  30349. if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
  30350. PluginManager.mount(plugin);
  30351. });
  30352. };
  30353. /**
  30354. * Create sortable instance
  30355. * @param {HTMLElement} el
  30356. * @param {Object} [options]
  30357. */
  30358. Sortable.create = function (el, options) {
  30359. return new Sortable(el, options);
  30360. }; // Export
  30361. Sortable.version = version;
  30362. var autoScrolls = [],
  30363. scrollEl,
  30364. scrollRootEl,
  30365. scrolling = false,
  30366. lastAutoScrollX,
  30367. lastAutoScrollY,
  30368. touchEvt$1,
  30369. pointerElemChangedInterval;
  30370. function AutoScrollPlugin() {
  30371. function AutoScroll() {
  30372. this.defaults = {
  30373. scroll: true,
  30374. forceAutoScrollFallback: false,
  30375. scrollSensitivity: 30,
  30376. scrollSpeed: 10,
  30377. bubbleScroll: true
  30378. }; // Bind all private methods
  30379. for (var fn in this) {
  30380. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  30381. this[fn] = this[fn].bind(this);
  30382. }
  30383. }
  30384. }
  30385. AutoScroll.prototype = {
  30386. dragStarted: function dragStarted(_ref) {
  30387. var originalEvent = _ref.originalEvent;
  30388. if (this.sortable.nativeDraggable) {
  30389. on(document, 'dragover', this._handleAutoScroll);
  30390. } else {
  30391. if (this.options.supportPointer) {
  30392. on(document, 'pointermove', this._handleFallbackAutoScroll);
  30393. } else if (originalEvent.touches) {
  30394. on(document, 'touchmove', this._handleFallbackAutoScroll);
  30395. } else {
  30396. on(document, 'mousemove', this._handleFallbackAutoScroll);
  30397. }
  30398. }
  30399. },
  30400. dragOverCompleted: function dragOverCompleted(_ref2) {
  30401. var originalEvent = _ref2.originalEvent;
  30402. // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
  30403. if (!this.options.dragOverBubble && !originalEvent.rootEl) {
  30404. this._handleAutoScroll(originalEvent);
  30405. }
  30406. },
  30407. drop: function drop() {
  30408. if (this.sortable.nativeDraggable) {
  30409. off(document, 'dragover', this._handleAutoScroll);
  30410. } else {
  30411. off(document, 'pointermove', this._handleFallbackAutoScroll);
  30412. off(document, 'touchmove', this._handleFallbackAutoScroll);
  30413. off(document, 'mousemove', this._handleFallbackAutoScroll);
  30414. }
  30415. clearPointerElemChangedInterval();
  30416. clearAutoScrolls();
  30417. cancelThrottle();
  30418. },
  30419. nulling: function nulling() {
  30420. touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
  30421. autoScrolls.length = 0;
  30422. },
  30423. _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
  30424. this._handleAutoScroll(evt, true);
  30425. },
  30426. _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
  30427. var _this = this;
  30428. var x = (evt.touches ? evt.touches[0] : evt).clientX,
  30429. y = (evt.touches ? evt.touches[0] : evt).clientY,
  30430. elem = document.elementFromPoint(x, y);
  30431. touchEvt$1 = evt; // IE does not seem to have native autoscroll,
  30432. // Edge's autoscroll seems too conditional,
  30433. // MACOS Safari does not have autoscroll,
  30434. // Firefox and Chrome are good
  30435. if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
  30436. autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change
  30437. var ogElemScroller = getParentAutoScrollElement(elem, true);
  30438. if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
  30439. pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour
  30440. pointerElemChangedInterval = setInterval(function () {
  30441. var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
  30442. if (newElem !== ogElemScroller) {
  30443. ogElemScroller = newElem;
  30444. clearAutoScrolls();
  30445. }
  30446. autoScroll(evt, _this.options, newElem, fallback);
  30447. }, 10);
  30448. lastAutoScrollX = x;
  30449. lastAutoScrollY = y;
  30450. }
  30451. } else {
  30452. // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll
  30453. if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
  30454. clearAutoScrolls();
  30455. return;
  30456. }
  30457. autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
  30458. }
  30459. }
  30460. };
  30461. return _extends(AutoScroll, {
  30462. pluginName: 'scroll',
  30463. initializeByDefault: true
  30464. });
  30465. }
  30466. function clearAutoScrolls() {
  30467. autoScrolls.forEach(function (autoScroll) {
  30468. clearInterval(autoScroll.pid);
  30469. });
  30470. autoScrolls = [];
  30471. }
  30472. function clearPointerElemChangedInterval() {
  30473. clearInterval(pointerElemChangedInterval);
  30474. }
  30475. var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
  30476. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  30477. if (!options.scroll) return;
  30478. var x = (evt.touches ? evt.touches[0] : evt).clientX,
  30479. y = (evt.touches ? evt.touches[0] : evt).clientY,
  30480. sens = options.scrollSensitivity,
  30481. speed = options.scrollSpeed,
  30482. winScroller = getWindowScrollingElement();
  30483. var scrollThisInstance = false,
  30484. scrollCustomFn; // New scroll root, set scrollEl
  30485. if (scrollRootEl !== rootEl) {
  30486. scrollRootEl = rootEl;
  30487. clearAutoScrolls();
  30488. scrollEl = options.scroll;
  30489. scrollCustomFn = options.scrollFn;
  30490. if (scrollEl === true) {
  30491. scrollEl = getParentAutoScrollElement(rootEl, true);
  30492. }
  30493. }
  30494. var layersOut = 0;
  30495. var currentParent = scrollEl;
  30496. do {
  30497. var el = currentParent,
  30498. rect = getRect(el),
  30499. top = rect.top,
  30500. bottom = rect.bottom,
  30501. left = rect.left,
  30502. right = rect.right,
  30503. width = rect.width,
  30504. height = rect.height,
  30505. canScrollX = void 0,
  30506. canScrollY = void 0,
  30507. scrollWidth = el.scrollWidth,
  30508. scrollHeight = el.scrollHeight,
  30509. elCSS = css(el),
  30510. scrollPosX = el.scrollLeft,
  30511. scrollPosY = el.scrollTop;
  30512. if (el === winScroller) {
  30513. canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
  30514. canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
  30515. } else {
  30516. canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
  30517. canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');
  30518. }
  30519. var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
  30520. var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
  30521. if (!autoScrolls[layersOut]) {
  30522. for (var i = 0; i <= layersOut; i++) {
  30523. if (!autoScrolls[i]) {
  30524. autoScrolls[i] = {};
  30525. }
  30526. }
  30527. }
  30528. if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
  30529. autoScrolls[layersOut].el = el;
  30530. autoScrolls[layersOut].vx = vx;
  30531. autoScrolls[layersOut].vy = vy;
  30532. clearInterval(autoScrolls[layersOut].pid);
  30533. if (vx != 0 || vy != 0) {
  30534. scrollThisInstance = true;
  30535. /* jshint loopfunc:true */
  30536. autoScrolls[layersOut].pid = setInterval(function () {
  30537. // emulate drag over during autoscroll (fallback), emulating native DnD behaviour
  30538. if (isFallback && this.layer === 0) {
  30539. Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely
  30540. }
  30541. var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
  30542. var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
  30543. if (typeof scrollCustomFn === 'function') {
  30544. if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
  30545. return;
  30546. }
  30547. }
  30548. scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
  30549. }.bind({
  30550. layer: layersOut
  30551. }), 24);
  30552. }
  30553. }
  30554. layersOut++;
  30555. } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
  30556. scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
  30557. }, 30);
  30558. var drop = function drop(_ref) {
  30559. var originalEvent = _ref.originalEvent,
  30560. putSortable = _ref.putSortable,
  30561. dragEl = _ref.dragEl,
  30562. activeSortable = _ref.activeSortable,
  30563. dispatchSortableEvent = _ref.dispatchSortableEvent,
  30564. hideGhostForTarget = _ref.hideGhostForTarget,
  30565. unhideGhostForTarget = _ref.unhideGhostForTarget;
  30566. if (!originalEvent) return;
  30567. var toSortable = putSortable || activeSortable;
  30568. hideGhostForTarget();
  30569. var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
  30570. var target = document.elementFromPoint(touch.clientX, touch.clientY);
  30571. unhideGhostForTarget();
  30572. if (toSortable && !toSortable.el.contains(target)) {
  30573. dispatchSortableEvent('spill');
  30574. this.onSpill({
  30575. dragEl: dragEl,
  30576. putSortable: putSortable
  30577. });
  30578. }
  30579. };
  30580. function Revert() {}
  30581. Revert.prototype = {
  30582. startIndex: null,
  30583. dragStart: function dragStart(_ref2) {
  30584. var oldDraggableIndex = _ref2.oldDraggableIndex;
  30585. this.startIndex = oldDraggableIndex;
  30586. },
  30587. onSpill: function onSpill(_ref3) {
  30588. var dragEl = _ref3.dragEl,
  30589. putSortable = _ref3.putSortable;
  30590. this.sortable.captureAnimationState();
  30591. if (putSortable) {
  30592. putSortable.captureAnimationState();
  30593. }
  30594. var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
  30595. if (nextSibling) {
  30596. this.sortable.el.insertBefore(dragEl, nextSibling);
  30597. } else {
  30598. this.sortable.el.appendChild(dragEl);
  30599. }
  30600. this.sortable.animateAll();
  30601. if (putSortable) {
  30602. putSortable.animateAll();
  30603. }
  30604. },
  30605. drop: drop
  30606. };
  30607. _extends(Revert, {
  30608. pluginName: 'revertOnSpill'
  30609. });
  30610. function Remove() {}
  30611. Remove.prototype = {
  30612. onSpill: function onSpill(_ref4) {
  30613. var dragEl = _ref4.dragEl,
  30614. putSortable = _ref4.putSortable;
  30615. var parentSortable = putSortable || this.sortable;
  30616. parentSortable.captureAnimationState();
  30617. dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
  30618. parentSortable.animateAll();
  30619. },
  30620. drop: drop
  30621. };
  30622. _extends(Remove, {
  30623. pluginName: 'removeOnSpill'
  30624. });
  30625. Sortable.mount(new AutoScrollPlugin());
  30626. Sortable.mount(Remove, Revert);
  30627. const CSS$8 = {
  30628. sortItem: "sort-item",
  30629. container: "container",
  30630. containerHorizontal: "container--horizontal",
  30631. containerVertical: "container--vertical"
  30632. };
  30633. const sortableListCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-sortable-list:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-sortable-list{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-sortable-list{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-sortable-list{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-sortable-list{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-sortable-list{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-sortable-list:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-sortable-list:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-sortable-list-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-sortable-list-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-sortable-list-h{display:flex}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-sortable-list-h[disabled] .sc-calcite-sortable-list-s>[calcite-hydrated][disabled],[disabled].sc-calcite-sortable-list-h [calcite-hydrated][disabled].sc-calcite-sortable-list{opacity:1}/*!@.container*/.container.sc-calcite-sortable-list{display:flex;flex:1 1 auto}/*!@.container--vertical*/.container--vertical.sc-calcite-sortable-list{flex-direction:column}/*!@.container--horizontal*/.container--horizontal.sc-calcite-sortable-list{flex-direction:row}";
  30634. /**
  30635. * @slot - A slot for adding sortable items.
  30636. */
  30637. class SortableList {
  30638. constructor(hostRef) {
  30639. registerInstance(this, hostRef);
  30640. this.calciteListOrderChange = createEvent(this, "calciteListOrderChange", 6);
  30641. /**
  30642. * The selector for the handle elements.
  30643. */
  30644. this.handleSelector = "calcite-handle";
  30645. /**
  30646. * Indicates the horizontal or vertical orientation of the component.
  30647. */
  30648. this.layout = "vertical";
  30649. /**
  30650. * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
  30651. */
  30652. this.disabled = false;
  30653. /**
  30654. * When true, content is waiting to be loaded. This state shows a busy indicator.
  30655. */
  30656. this.loading = false;
  30657. this.handleActivated = false;
  30658. this.items = [];
  30659. this.mutationObserver = createObserver();
  30660. }
  30661. // --------------------------------------------------------------------------
  30662. //
  30663. // Lifecycle
  30664. //
  30665. // --------------------------------------------------------------------------
  30666. connectedCallback() {
  30667. this.items = Array.from(this.el.children);
  30668. this.setUpDragAndDrop();
  30669. this.beginObserving();
  30670. }
  30671. disconnectedCallback() {
  30672. var _a;
  30673. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  30674. this.cleanUpDragAndDrop();
  30675. }
  30676. componentDidRender() {
  30677. updateHostInteraction(this);
  30678. }
  30679. calciteHandleNudgeHandler(event) {
  30680. var _a;
  30681. const sortItem = this.items.find((item) => {
  30682. return item.contains(event.detail.handle) || event.composedPath().includes(item);
  30683. });
  30684. const lastIndex = this.items.length - 1;
  30685. const startingIndex = this.items.indexOf(sortItem);
  30686. let appendInstead = false;
  30687. let buddyIndex;
  30688. switch (event.detail.direction) {
  30689. case "up":
  30690. event.preventDefault();
  30691. if (startingIndex === 0) {
  30692. appendInstead = true;
  30693. }
  30694. else {
  30695. buddyIndex = startingIndex - 1;
  30696. }
  30697. break;
  30698. case "down":
  30699. event.preventDefault();
  30700. if (startingIndex === lastIndex) {
  30701. buddyIndex = 0;
  30702. }
  30703. else if (startingIndex === lastIndex - 1) {
  30704. appendInstead = true;
  30705. }
  30706. else {
  30707. buddyIndex = startingIndex + 2;
  30708. }
  30709. break;
  30710. default:
  30711. return;
  30712. }
  30713. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  30714. if (appendInstead) {
  30715. sortItem.parentElement.appendChild(sortItem);
  30716. }
  30717. else {
  30718. sortItem.parentElement.insertBefore(sortItem, this.items[buddyIndex]);
  30719. }
  30720. this.items = Array.from(this.el.children);
  30721. event.detail.handle.activated = true;
  30722. event.detail.handle.setFocus();
  30723. this.beginObserving();
  30724. }
  30725. // --------------------------------------------------------------------------
  30726. //
  30727. // Private Methods
  30728. //
  30729. // --------------------------------------------------------------------------
  30730. setUpDragAndDrop() {
  30731. this.cleanUpDragAndDrop();
  30732. const options = {
  30733. dataIdAttr: "id",
  30734. group: this.group,
  30735. handle: this.handleSelector,
  30736. // Changed sorting within list
  30737. onUpdate: () => {
  30738. this.items = Array.from(this.el.children);
  30739. this.calciteListOrderChange.emit();
  30740. },
  30741. // Element dragging started
  30742. onStart: () => {
  30743. var _a;
  30744. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  30745. },
  30746. // Element dragging ended
  30747. onEnd: () => {
  30748. this.beginObserving();
  30749. }
  30750. };
  30751. if (this.dragSelector) {
  30752. options.draggable = this.dragSelector;
  30753. }
  30754. this.sortable = Sortable.create(this.el, options);
  30755. }
  30756. cleanUpDragAndDrop() {
  30757. var _a;
  30758. (_a = this.sortable) === null || _a === void 0 ? void 0 : _a.destroy();
  30759. this.sortable = null;
  30760. }
  30761. beginObserving() {
  30762. var _a;
  30763. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  30764. }
  30765. // --------------------------------------------------------------------------
  30766. //
  30767. // Render Methods
  30768. //
  30769. // --------------------------------------------------------------------------
  30770. render() {
  30771. const { layout } = this;
  30772. const horizontal = layout === "horizontal" || false;
  30773. return (hAsync("div", { class: {
  30774. [CSS$8.container]: true,
  30775. [CSS$8.containerVertical]: !horizontal,
  30776. [CSS$8.containerHorizontal]: horizontal
  30777. } }, hAsync("slot", null)));
  30778. }
  30779. get el() { return getElement(this); }
  30780. static get style() { return sortableListCss; }
  30781. static get cmpMeta() { return {
  30782. "$flags$": 9,
  30783. "$tagName$": "calcite-sortable-list",
  30784. "$members$": {
  30785. "dragSelector": [513, "drag-selector"],
  30786. "group": [513],
  30787. "handleSelector": [513, "handle-selector"],
  30788. "layout": [513],
  30789. "disabled": [516],
  30790. "loading": [516],
  30791. "handleActivated": [32]
  30792. },
  30793. "$listeners$": [[0, "calciteHandleNudge", "calciteHandleNudgeHandler"]],
  30794. "$lazyBundleId$": "-",
  30795. "$attrsToReflect$": [["dragSelector", "drag-selector"], ["group", "group"], ["handleSelector", "handle-selector"], ["layout", "layout"], ["disabled", "disabled"], ["loading", "loading"]]
  30796. }; }
  30797. }
  30798. const CSS$7 = {
  30799. container: "split-button__container",
  30800. dividerContainer: "split-button__divider-container",
  30801. divider: "split-button__divider",
  30802. widthAuto: "width-auto",
  30803. widthHalf: "width-half",
  30804. widthFull: "width-full"
  30805. };
  30806. const splitButtonCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-split-button:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-split-button{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-split-button{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-split-button{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-split-button{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-split-button{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-split-button:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-split-button:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-split-button-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-split-button-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-split-button-h{display:inline-block}/*!@:host .split-button__container*/.sc-calcite-split-button-h .split-button__container.sc-calcite-split-button{display:flex;align-items:stretch}/*!@:host .split-button__container > calcite-dropdown > calcite-button*/.sc-calcite-split-button-h .split-button__container.sc-calcite-split-button>calcite-dropdown.sc-calcite-split-button>calcite-button.sc-calcite-split-button{block-size:100%;vertical-align:top}/*!@:host:host([color=blue])*/.sc-calcite-split-button-h([color=blue]).sc-calcite-split-button-h{--calcite-split-button-background:var(--calcite-ui-brand);--calcite-split-button-divider:var(--calcite-ui-foreground-1)}/*!@:host:host([color=red])*/.sc-calcite-split-button-h([color=red]).sc-calcite-split-button-h{--calcite-split-button-background:var(--calcite-ui-danger);--calcite-split-button-divider:var(--calcite-ui-foreground-1)}/*!@:host:host([color=neutral])*/.sc-calcite-split-button-h([color=neutral]).sc-calcite-split-button-h{--calcite-split-button-background:var(--calcite-ui-foreground-3);--calcite-split-button-divider:var(--calcite-ui-text-1)}/*!@:host:host([color=inverse])*/.sc-calcite-split-button-h([color=inverse]).sc-calcite-split-button-h{--calcite-split-button-background:var(--calcite-ui-inverse);--calcite-split-button-divider:var(--calcite-ui-foreground-1)}/*!@:host([appearance=transparent]):host([color=blue])*/[appearance=transparent].sc-calcite-split-button-h([color=blue]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-brand)}/*!@:host([appearance=transparent]):host([color=red])*/[appearance=transparent].sc-calcite-split-button-h([color=red]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-danger)}/*!@:host([appearance=transparent]):host([color=neutral])*/[appearance=transparent].sc-calcite-split-button-h([color=neutral]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-text-1)}/*!@:host([appearance=transparent]):host([color=inverse])*/[appearance=transparent].sc-calcite-split-button-h([color=inverse]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-foreground-1)}/*!@:host([appearance=clear]),\n:host([appearance=transparent])*/[appearance=clear].sc-calcite-split-button-h,[appearance=transparent].sc-calcite-split-button-h{--calcite-split-button-background:transparent}/*!@:host([appearance=outline])*/[appearance=outline].sc-calcite-split-button-h{--calcite-split-button-background:var(--calcite-ui-foreground-1)}/*!@:host([appearance=clear]):host([color=blue]),\n:host([appearance=outline]):host([color=blue])*/[appearance=clear].sc-calcite-split-button-h([color=blue]).sc-calcite-split-button-h,[appearance=outline].sc-calcite-split-button-h([color=blue]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-brand)}/*!@:host([appearance=clear]):host([color=red]),\n:host([appearance=outline]):host([color=red])*/[appearance=clear].sc-calcite-split-button-h([color=red]).sc-calcite-split-button-h,[appearance=outline].sc-calcite-split-button-h([color=red]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-danger)}/*!@:host([appearance=clear]):host([color=neutral]),\n:host([appearance=outline]):host([color=neutral])*/[appearance=clear].sc-calcite-split-button-h([color=neutral]).sc-calcite-split-button-h,[appearance=outline].sc-calcite-split-button-h([color=neutral]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-foreground-3)}/*!@:host([appearance=clear]):host([color=inverse]),\n:host([appearance=outline]):host([color=inverse])*/[appearance=clear].sc-calcite-split-button-h([color=inverse]).sc-calcite-split-button-h,[appearance=outline].sc-calcite-split-button-h([color=inverse]).sc-calcite-split-button-h{--calcite-split-button-divider:var(--calcite-ui-inverse)}/*!@.width-auto*/.width-auto.sc-calcite-split-button{inline-size:auto}/*!@.width-half*/.width-half.sc-calcite-split-button{inline-size:50%}/*!@.width-full*/.width-full.sc-calcite-split-button{inline-size:100%}/*!@.split-button__divider-container*/.split-button__divider-container.sc-calcite-split-button{display:flex;inline-size:1px;align-items:stretch;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;background-color:var(--calcite-split-button-background)}/*!@.split-button__divider*/.split-button__divider.sc-calcite-split-button{margin-block:0.25rem;display:inline-block;inline-size:1px;background-color:var(--calcite-split-button-divider)}/*!@:host([appearance=outline]) .split-button__divider-container,\n:host([appearance=clear]) .split-button__divider-container,\n:host([appearance=minimal]) .split-button__divider-container*/[appearance=outline].sc-calcite-split-button-h .split-button__divider-container.sc-calcite-split-button,[appearance=clear].sc-calcite-split-button-h .split-button__divider-container.sc-calcite-split-button,[appearance=minimal].sc-calcite-split-button-h .split-button__divider-container.sc-calcite-split-button{border-block:1px solid var(--calcite-split-button-divider)}/*!@:host([appearance=outline]):hover .split-button__divider-container,\n:host([appearance=clear]):hover .split-button__divider-container,\n:host([appearance=minimal]):hover .split-button__divider-container*/[appearance=outline].sc-calcite-split-button-h:hover .split-button__divider-container.sc-calcite-split-button,[appearance=clear].sc-calcite-split-button-h:hover .split-button__divider-container.sc-calcite-split-button,[appearance=minimal].sc-calcite-split-button-h:hover .split-button__divider-container.sc-calcite-split-button{background-color:var(--calcite-split-button-divider)}/*!@:host([appearance=outline]:hover) .split-button__divider-container,\n:host([appearance=clear]:hover) .split-button__divider-container,\n:host([appearance=minimal]):hover .split-button__divider-container*/[appearance=outline].sc-calcite-split-button-h:hover .split-button__divider-container.sc-calcite-split-button,[appearance=clear].sc-calcite-split-button-h:hover .split-button__divider-container.sc-calcite-split-button,[appearance=minimal].sc-calcite-split-button-h:hover .split-button__divider-container.sc-calcite-split-button{background-color:var(--calcite-split-button-divider)}/*!@:host([appearance=outline]:focus-within):host([color=blue]),\n:host([appearance=clear]:focus-within):host([color=blue]),\n:host([appearance=minimal]:focus-within):host([color=blue])*/[appearance=outline].sc-calcite-split-button-h:focus-within.sc-calcite-split-button-h([color=blue]),[appearance=clear].sc-calcite-split-button-h:focus-within.sc-calcite-split-button-h([color=blue]),[appearance=minimal].sc-calcite-split-button-h:focus-within.sc-calcite-split-button-h([color=blue]){--calcite-split-button-divider:var(--calcite-ui-brand-press)}/*!@:host([appearance=outline]:focus-within):host([color=red]),\n:host([appearance=clear]:focus-within):host([color=red]),\n:host([appearance=minimal]:focus-within):host([color=red])*/[appearance=outline].sc-calcite-split-button-h:focus-within.sc-calcite-split-button-h([color=red]),[appearance=clear].sc-calcite-split-button-h:focus-within.sc-calcite-split-button-h([color=red]),[appearance=minimal].sc-calcite-split-button-h:focus-within.sc-calcite-split-button-h([color=red]){--calcite-split-button-divider:var(--calcite-ui-danger-press)}/*!@:host([appearance=outline]:focus-within) .split-button__divider-container,\n:host([appearance=clear]:focus-within) .split-button__divider-container,\n:host([appearance=minimal]:focus-within) .split-button__divider-container*/[appearance=outline].sc-calcite-split-button-h:focus-within .split-button__divider-container.sc-calcite-split-button,[appearance=clear].sc-calcite-split-button-h:focus-within .split-button__divider-container.sc-calcite-split-button,[appearance=minimal].sc-calcite-split-button-h:focus-within .split-button__divider-container.sc-calcite-split-button{background-color:var(--calcite-split-button-divider)}/*!@:host([disabled]) .split-button__divider-container*/[disabled].sc-calcite-split-button-h .split-button__divider-container.sc-calcite-split-button{opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([disabled]) calcite-dropdown > calcite-button*/[disabled].sc-calcite-split-button-h calcite-dropdown.sc-calcite-split-button>calcite-button.sc-calcite-split-button{pointer-events:none}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-split-button-h[disabled] .sc-calcite-split-button-s>[calcite-hydrated][disabled],[disabled].sc-calcite-split-button-h [calcite-hydrated][disabled].sc-calcite-split-button{opacity:1}";
  30807. /**
  30808. * @slot - A slot for adding `calcite-dropdown` content.
  30809. */
  30810. class SplitButton {
  30811. constructor(hostRef) {
  30812. registerInstance(this, hostRef);
  30813. this.calciteSplitButtonPrimaryClick = createEvent(this, "calciteSplitButtonPrimaryClick", 6);
  30814. this.calciteSplitButtonSecondaryClick = createEvent(this, "calciteSplitButtonSecondaryClick", 6);
  30815. /** Specifies the appearance style of the component. */
  30816. this.appearance = "solid";
  30817. /** Specifies the color of the component. */
  30818. this.color = "blue";
  30819. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  30820. this.disabled = false;
  30821. /**
  30822. * When `true`, the component is active.
  30823. *
  30824. * @internal
  30825. */
  30826. this.active = false;
  30827. /** Specifies the icon used for the dropdown menu. */
  30828. this.dropdownIconType = "chevron";
  30829. /**
  30830. When `true`, a busy indicator is displayed on the primary button.
  30831. */
  30832. this.loading = false;
  30833. /**
  30834. * Determines the type of positioning to use for the overlaid content.
  30835. *
  30836. * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
  30837. *
  30838. * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
  30839. *
  30840. */
  30841. this.overlayPositioning = "absolute";
  30842. /** Specifies the size of the component. */
  30843. this.scale = "m";
  30844. /** Specifies the width of the component. */
  30845. this.width = "auto";
  30846. this.calciteSplitButtonPrimaryClickHandler = (event) => this.calciteSplitButtonPrimaryClick.emit(event);
  30847. this.calciteSplitButtonSecondaryClickHandler = (event) => this.calciteSplitButtonSecondaryClick.emit(event);
  30848. }
  30849. handleDisabledChange(value) {
  30850. if (!value) {
  30851. this.active = false;
  30852. }
  30853. }
  30854. activeHandler() {
  30855. if (this.disabled) {
  30856. this.active = false;
  30857. }
  30858. }
  30859. //--------------------------------------------------------------------------
  30860. //
  30861. // Lifecycle
  30862. //
  30863. //--------------------------------------------------------------------------
  30864. componentDidRender() {
  30865. updateHostInteraction(this);
  30866. }
  30867. render() {
  30868. const widthClasses = {
  30869. [CSS$7.container]: true,
  30870. [CSS$7.widthAuto]: this.width === "auto",
  30871. [CSS$7.widthHalf]: this.width === "half",
  30872. [CSS$7.widthFull]: this.width === "full"
  30873. };
  30874. const buttonWidth = this.width === "auto" ? "auto" : "full";
  30875. return (hAsync("div", { class: widthClasses }, hAsync("calcite-button", { appearance: this.appearance, color: this.color, disabled: this.disabled, "icon-end": this.primaryIconEnd ? this.primaryIconEnd : null, "icon-start": this.primaryIconStart ? this.primaryIconStart : null, iconFlipRtl: this.primaryIconFlipRtl ? this.primaryIconFlipRtl : null, label: this.primaryLabel, loading: this.loading, onClick: this.calciteSplitButtonPrimaryClickHandler, scale: this.scale, splitChild: "primary", type: "button", width: buttonWidth }, this.primaryText), hAsync("div", { class: CSS$7.dividerContainer }, hAsync("div", { class: CSS$7.divider })), hAsync("calcite-dropdown", { active: this.active, disabled: this.disabled, onClick: this.calciteSplitButtonSecondaryClickHandler, overlayPositioning: this.overlayPositioning, placement: "bottom-end", scale: this.scale, width: this.scale }, hAsync("calcite-button", { appearance: this.appearance, color: this.color, disabled: this.disabled, "icon-start": this.dropdownIcon, label: this.dropdownLabel, scale: this.scale, slot: "dropdown-trigger", splitChild: "secondary", type: "button" }), hAsync("slot", null))));
  30876. }
  30877. get dropdownIcon() {
  30878. return this.dropdownIconType === "chevron"
  30879. ? "chevronDown"
  30880. : this.dropdownIconType === "caret"
  30881. ? "caretDown"
  30882. : this.dropdownIconType === "ellipsis"
  30883. ? "ellipsis"
  30884. : "handle-vertical";
  30885. }
  30886. get el() { return getElement(this); }
  30887. static get watchers() { return {
  30888. "disabled": ["handleDisabledChange"],
  30889. "active": ["activeHandler"]
  30890. }; }
  30891. static get style() { return splitButtonCss; }
  30892. static get cmpMeta() { return {
  30893. "$flags$": 9,
  30894. "$tagName$": "calcite-split-button",
  30895. "$members$": {
  30896. "appearance": [513],
  30897. "color": [513],
  30898. "disabled": [516],
  30899. "active": [1540],
  30900. "dropdownIconType": [513, "dropdown-icon-type"],
  30901. "dropdownLabel": [513, "dropdown-label"],
  30902. "loading": [516],
  30903. "overlayPositioning": [513, "overlay-positioning"],
  30904. "primaryIconEnd": [513, "primary-icon-end"],
  30905. "primaryIconFlipRtl": [513, "primary-icon-flip-rtl"],
  30906. "primaryIconStart": [513, "primary-icon-start"],
  30907. "primaryLabel": [513, "primary-label"],
  30908. "primaryText": [513, "primary-text"],
  30909. "scale": [513],
  30910. "width": [513]
  30911. },
  30912. "$listeners$": undefined,
  30913. "$lazyBundleId$": "-",
  30914. "$attrsToReflect$": [["appearance", "appearance"], ["color", "color"], ["disabled", "disabled"], ["active", "active"], ["dropdownIconType", "dropdown-icon-type"], ["dropdownLabel", "dropdown-label"], ["loading", "loading"], ["overlayPositioning", "overlay-positioning"], ["primaryIconEnd", "primary-icon-end"], ["primaryIconFlipRtl", "primary-icon-flip-rtl"], ["primaryIconStart", "primary-icon-start"], ["primaryLabel", "primary-label"], ["primaryText", "primary-text"], ["scale", "scale"], ["width", "width"]]
  30915. }; }
  30916. }
  30917. const stepperCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-stepper:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-stepper{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-stepper{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-stepper{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-stepper{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-stepper{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-stepper:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-stepper:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-stepper-h{display:none}/*!@:host*/.sc-calcite-stepper-h{position:relative;display:flex;inline-size:100%;min-inline-size:-moz-fit-content;min-inline-size:fit-content;flex-direction:row;flex-wrap:wrap;align-items:stretch;justify-content:space-between}/*!@:host([layout=vertical])*/[layout=vertical].sc-calcite-stepper-h{flex:1 1 auto;flex-direction:column}/*!@:host([layout=horizontal])*/[layout=horizontal].sc-calcite-stepper-h{display:grid;grid-template-areas:\"items\" \"content\"}";
  30918. /**
  30919. * @slot - A slot for adding `calcite-stepper-item`s.
  30920. */
  30921. class Stepper {
  30922. constructor(hostRef) {
  30923. registerInstance(this, hostRef);
  30924. this.calciteStepperItemChange = createEvent(this, "calciteStepperItemChange", 6);
  30925. this.calciteInternalStepperItemChange = createEvent(this, "calciteInternalStepperItemChange", 6);
  30926. //--------------------------------------------------------------------------
  30927. //
  30928. // Public Properties
  30929. //
  30930. //--------------------------------------------------------------------------
  30931. /** When `true`, displays a status icon in the `calcite-stepper-item` heading. */
  30932. this.icon = false;
  30933. /** Defines the layout of the component. */
  30934. this.layout = "horizontal";
  30935. /** When `true`, displays the step number in the `calcite-stepper-item` heading. */
  30936. this.numbered = false;
  30937. /** Specifies the size of the component. */
  30938. this.scale = "m";
  30939. //--------------------------------------------------------------------------
  30940. //
  30941. // Private State/Props
  30942. //
  30943. //--------------------------------------------------------------------------
  30944. this.itemMap = new Map();
  30945. /** list of sorted Stepper items */
  30946. this.items = [];
  30947. /** list of enabled Stepper items */
  30948. this.enabledItems = [];
  30949. }
  30950. //--------------------------------------------------------------------------
  30951. //
  30952. // Lifecycle
  30953. //
  30954. //--------------------------------------------------------------------------
  30955. componentDidLoad() {
  30956. // if no stepper items are set as active, default to the first one
  30957. if (typeof this.currentPosition !== "number") {
  30958. this.calciteInternalStepperItemChange.emit({
  30959. position: 0
  30960. });
  30961. }
  30962. }
  30963. render() {
  30964. return (hAsync("slot", { onSlotchange: (event) => {
  30965. const items = event.currentTarget
  30966. .assignedElements()
  30967. .filter((el) => (el === null || el === void 0 ? void 0 : el.tagName) === "CALCITE-STEPPER-ITEM");
  30968. const spacing = Array(items.length).fill("1fr").join(" ");
  30969. this.el.style.gridTemplateAreas = spacing;
  30970. this.el.style.gridTemplateColumns = spacing;
  30971. } }));
  30972. }
  30973. //--------------------------------------------------------------------------
  30974. //
  30975. // Event Listeners
  30976. //
  30977. //--------------------------------------------------------------------------
  30978. calciteInternalStepperItemKeyEvent(event) {
  30979. const item = event.detail.item;
  30980. const itemToFocus = event.target;
  30981. const isFirstItem = this.itemIndex(itemToFocus) === 0;
  30982. const isLastItem = this.itemIndex(itemToFocus) === this.enabledItems.length - 1;
  30983. switch (item.key) {
  30984. case "ArrowDown":
  30985. case "ArrowRight":
  30986. if (isLastItem) {
  30987. this.focusFirstItem();
  30988. }
  30989. else {
  30990. this.focusNextItem(itemToFocus);
  30991. }
  30992. break;
  30993. case "ArrowUp":
  30994. case "ArrowLeft":
  30995. if (isFirstItem) {
  30996. this.focusLastItem();
  30997. }
  30998. else {
  30999. this.focusPrevItem(itemToFocus);
  31000. }
  31001. break;
  31002. case "Home":
  31003. this.focusFirstItem();
  31004. break;
  31005. case "End":
  31006. this.focusLastItem();
  31007. break;
  31008. }
  31009. event.stopPropagation();
  31010. }
  31011. registerItem(event) {
  31012. const item = event.target;
  31013. const { content, position } = event.detail;
  31014. this.itemMap.set(item, { position, content });
  31015. this.items = this.sortItems();
  31016. this.enabledItems = this.filterItems();
  31017. event.stopPropagation();
  31018. }
  31019. updateItem(event) {
  31020. const { position } = event.detail;
  31021. if (typeof position === "number") {
  31022. this.currentPosition = position;
  31023. }
  31024. this.calciteInternalStepperItemChange.emit({
  31025. position
  31026. });
  31027. }
  31028. handleUserRequestedStepperItemSelect(event) {
  31029. const { position } = event.detail;
  31030. this.calciteStepperItemChange.emit({
  31031. position
  31032. });
  31033. }
  31034. //--------------------------------------------------------------------------
  31035. //
  31036. // Public Methods
  31037. //
  31038. //--------------------------------------------------------------------------
  31039. /** Set the next `calcite-stepper-item` as active. */
  31040. async nextStep() {
  31041. const enabledStepIndex = this.getEnabledStepIndex(this.currentPosition + 1, "next");
  31042. if (typeof enabledStepIndex !== "number") {
  31043. return;
  31044. }
  31045. this.updateStep(enabledStepIndex);
  31046. }
  31047. /** Set the previous `calcite-stepper-item` as active. */
  31048. async prevStep() {
  31049. const enabledStepIndex = this.getEnabledStepIndex(this.currentPosition - 1, "previous");
  31050. if (typeof enabledStepIndex !== "number") {
  31051. return;
  31052. }
  31053. this.updateStep(enabledStepIndex);
  31054. }
  31055. /**
  31056. * Set a specified `calcite-stepper-item` as active.
  31057. *
  31058. * @param step
  31059. */
  31060. async goToStep(step) {
  31061. const position = step - 1;
  31062. if (this.currentPosition !== position) {
  31063. this.updateStep(position);
  31064. }
  31065. }
  31066. /** Set the first `calcite-stepper-item` as active. */
  31067. async startStep() {
  31068. const enabledStepIndex = this.getEnabledStepIndex(0, "next");
  31069. if (typeof enabledStepIndex !== "number") {
  31070. return;
  31071. }
  31072. this.updateStep(enabledStepIndex);
  31073. }
  31074. /** Set the last `calcite-stepper-item` as active. */
  31075. async endStep() {
  31076. const enabledStepIndex = this.getEnabledStepIndex(this.items.length - 1, "previous");
  31077. if (typeof enabledStepIndex !== "number") {
  31078. return;
  31079. }
  31080. this.updateStep(enabledStepIndex);
  31081. }
  31082. //--------------------------------------------------------------------------
  31083. //
  31084. // Private Methods
  31085. //
  31086. //--------------------------------------------------------------------------
  31087. getEnabledStepIndex(startIndex, direction = "next") {
  31088. var _a;
  31089. const { items, currentPosition } = this;
  31090. let newIndex = startIndex;
  31091. while ((_a = items[newIndex]) === null || _a === void 0 ? void 0 : _a.disabled) {
  31092. newIndex = newIndex + (direction === "previous" ? -1 : 1);
  31093. }
  31094. return newIndex !== currentPosition && newIndex < items.length && newIndex >= 0
  31095. ? newIndex
  31096. : null;
  31097. }
  31098. updateStep(position) {
  31099. this.currentPosition = position;
  31100. this.calciteInternalStepperItemChange.emit({
  31101. position
  31102. });
  31103. }
  31104. focusFirstItem() {
  31105. const firstItem = this.enabledItems[0];
  31106. focusElement(firstItem);
  31107. }
  31108. focusLastItem() {
  31109. const lastItem = this.enabledItems[this.enabledItems.length - 1];
  31110. focusElement(lastItem);
  31111. }
  31112. focusNextItem(el) {
  31113. const index = this.itemIndex(el);
  31114. const nextItem = this.enabledItems[index + 1] || this.enabledItems[0];
  31115. focusElement(nextItem);
  31116. }
  31117. focusPrevItem(el) {
  31118. const index = this.itemIndex(el);
  31119. const prevItem = this.enabledItems[index - 1] || this.enabledItems[this.enabledItems.length - 1];
  31120. focusElement(prevItem);
  31121. }
  31122. itemIndex(el) {
  31123. return this.enabledItems.indexOf(el);
  31124. }
  31125. sortItems() {
  31126. const { itemMap } = this;
  31127. return Array.from(itemMap.keys()).sort((a, b) => itemMap.get(a).position - itemMap.get(b).position);
  31128. }
  31129. filterItems() {
  31130. return this.items.filter((item) => !item.disabled);
  31131. }
  31132. get el() { return getElement(this); }
  31133. static get style() { return stepperCss; }
  31134. static get cmpMeta() { return {
  31135. "$flags$": 9,
  31136. "$tagName$": "calcite-stepper",
  31137. "$members$": {
  31138. "icon": [516],
  31139. "layout": [513],
  31140. "numbered": [516],
  31141. "numberingSystem": [513, "numbering-system"],
  31142. "scale": [513],
  31143. "nextStep": [64],
  31144. "prevStep": [64],
  31145. "goToStep": [64],
  31146. "startStep": [64],
  31147. "endStep": [64]
  31148. },
  31149. "$listeners$": [[0, "calciteInternalStepperItemKeyEvent", "calciteInternalStepperItemKeyEvent"], [0, "calciteInternalStepperItemRegister", "registerItem"], [0, "calciteInternalStepperItemSelect", "updateItem"], [0, "calciteInternalUserRequestedStepperItemSelect", "handleUserRequestedStepperItemSelect"]],
  31150. "$lazyBundleId$": "-",
  31151. "$attrsToReflect$": [["icon", "icon"], ["layout", "layout"], ["numbered", "numbered"], ["numberingSystem", "numbering-system"], ["scale", "scale"]]
  31152. }; }
  31153. }
  31154. const stepperItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-stepper-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-stepper-item{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-stepper-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-stepper-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-stepper-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-stepper-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-stepper-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-stepper-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-stepper-item-h{display:none}/*!@:host([layout=horizontal][disabled]) .stepper-item-header, :host([disabled])*/[layout=horizontal][disabled].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item,[disabled].sc-calcite-stepper-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([scale=s])*/[scale=s].sc-calcite-stepper-item-h{--calcite-stepper-item-spacing-unit-s:0.25rem;--calcite-stepper-item-spacing-unit-m:0.75rem;--calcite-stepper-item-spacing-unit-l:1rem;font-size:var(--calcite-font-size--1);line-height:1rem;margin-inline-end:0.25rem}/*!@:host([scale=s]) .stepper-item-description*/[scale=s].sc-calcite-stepper-item-h .stepper-item-description.sc-calcite-stepper-item{font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-stepper-item-h{--calcite-stepper-item-spacing-unit-s:0.5rem;--calcite-stepper-item-spacing-unit-m:1rem;--calcite-stepper-item-spacing-unit-l:1.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;margin-inline-end:0.5rem}/*!@:host([scale=m]) .stepper-item-description*/[scale=m].sc-calcite-stepper-item-h .stepper-item-description.sc-calcite-stepper-item{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-stepper-item-h{--calcite-stepper-item-spacing-unit-s:0.75rem;--calcite-stepper-item-spacing-unit-m:1.25rem;--calcite-stepper-item-spacing-unit-l:1.5rem;font-size:var(--calcite-font-size-1);line-height:1.5rem;margin-inline-end:0.75rem}/*!@:host([scale=l]) .stepper-item-description*/[scale=l].sc-calcite-stepper-item-h .stepper-item-description.sc-calcite-stepper-item{font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host*/.sc-calcite-stepper-item-h{position:relative;display:flex;flex-grow:1;flex-direction:column;align-self:flex-start;margin-block-end:var(--calcite-stepper-item-spacing-unit-s)}/*!@:host .container*/.sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{position:relative;display:flex;flex-grow:1;cursor:pointer;flex-direction:column;border-width:0px;border-block-start-width:2px;border-style:solid;border-color:var(--calcite-ui-border-3);color:var(--calcite-ui-text-3);text-decoration-line:none;outline:2px solid transparent;outline-offset:2px;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host*/.sc-calcite-stepper-item-h{outline-color:transparent}/*!@:host(:focus)*/.sc-calcite-stepper-item-h:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@:host .stepper-item-header*/.sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{display:flex;cursor:pointer;align-items:flex-start}/*!@:host .stepper-item-content, \n:host .stepper-item-header*/.sc-calcite-stepper-item-h .stepper-item-content.sc-calcite-stepper-item,.sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);padding-block:var(--calcite-stepper-item-spacing-unit-l);padding-inline-end:var(--calcite-stepper-item-spacing-unit-m);text-align:start}/*!@:host .stepper-item-header **/.sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item *.sc-calcite-stepper-item{display:inline-flex;align-items:center;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host .stepper-item-content*/.sc-calcite-stepper-item-h .stepper-item-content.sc-calcite-stepper-item{display:none;inline-size:100%;flex-direction:column;font-size:var(--calcite-font-size--2);line-height:1.375}/*!@:host .stepper-item-icon*/.sc-calcite-stepper-item-h .stepper-item-icon.sc-calcite-stepper-item{margin-inline-end:var(--calcite-stepper-item-spacing-unit-m);margin-block-start:1px;display:inline-flex;block-size:0.75rem;flex-shrink:0;align-self:flex-start;color:var(--calcite-ui-text-3);opacity:var(--calcite-ui-opacity-disabled);transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host .stepper-item-header-text*/.sc-calcite-stepper-item-h .stepper-item-header-text.sc-calcite-stepper-item{flex-direction:column;text-align:initial;margin-inline-end:auto}/*!@:host .stepper-item-heading, \n:host .stepper-item-description*/.sc-calcite-stepper-item-h .stepper-item-heading.sc-calcite-stepper-item,.sc-calcite-stepper-item-h .stepper-item-description.sc-calcite-stepper-item{display:flex;inline-size:100%}/*!@:host .stepper-item-heading*/.sc-calcite-stepper-item-h .stepper-item-heading.sc-calcite-stepper-item{margin-block-end:0.25rem;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}/*!@:host .stepper-item-description*/.sc-calcite-stepper-item-h .stepper-item-description.sc-calcite-stepper-item{color:var(--calcite-ui-text-3)}/*!@:host .stepper-item-number*/.sc-calcite-stepper-item-h .stepper-item-number.sc-calcite-stepper-item{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-3);transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);margin-inline-end:var(--calcite-stepper-item-spacing-unit-m)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-stepper-item-h[disabled] .sc-calcite-stepper-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-stepper-item-h [calcite-hydrated][disabled].sc-calcite-stepper-item{opacity:1}/*!@:host([complete]) .container*/[complete].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-color:rgba(0, 122, 194, 0.5)}/*!@:host([complete]) .container .stepper-item-icon*/[complete].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-icon.sc-calcite-stepper-item{color:var(--calcite-ui-brand)}/*!@:host([error]) .container*/[error].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-block-start-color:var(--calcite-ui-danger)}/*!@:host([error]) .container .stepper-item-number*/[error].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-number.sc-calcite-stepper-item{color:var(--calcite-ui-danger)}/*!@:host([error]) .container .stepper-item-icon*/[error].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-icon.sc-calcite-stepper-item{opacity:1;color:var(--calcite-ui-danger)}/*!@:host(:hover:not([disabled]):not([selected])) .container, \n:host(:focus:not([disabled]):not([selected])) .container*/.sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item,.sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item{border-block-start-color:var(--calcite-ui-brand)}/*!@:host(:hover:not([disabled]):not([selected])) .container .stepper-item-heading, \n:host(:focus:not([disabled]):not([selected])) .container .stepper-item-heading*/.sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item .stepper-item-heading.sc-calcite-stepper-item,.sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item .stepper-item-heading.sc-calcite-stepper-item{color:var(--calcite-ui-text-1)}/*!@:host(:hover:not([disabled]):not([selected])) .container .stepper-item-description, \n:host(:focus:not([disabled]):not([selected])) .container .stepper-item-description*/.sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item .stepper-item-description.sc-calcite-stepper-item,.sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item .stepper-item-description.sc-calcite-stepper-item{color:var(--calcite-ui-text-2)}/*!@:host([error]:hover:not([disabled]):not([selected])) .container, \n:host([error]:focus:not([disabled]):not([selected])) .container*/[error].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item,[error].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item{border-block-start-color:var(--calcite-ui-danger-hover)}/*!@:host([selected]) .container*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-block-start-color:var(--calcite-ui-brand)}/*!@:host([selected]) .container .stepper-item-heading*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-heading.sc-calcite-stepper-item{color:var(--calcite-ui-text-1)}/*!@:host([selected]) .container .stepper-item-description*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-description.sc-calcite-stepper-item{color:var(--calcite-ui-text-2)}/*!@:host([selected]) .container .stepper-item-number*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-number.sc-calcite-stepper-item{color:var(--calcite-ui-brand)}/*!@:host([selected]) .container .stepper-item-icon*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-icon.sc-calcite-stepper-item{color:var(--calcite-ui-brand);opacity:1}/*!@:host([selected]) .container .stepper-item-content*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-content.sc-calcite-stepper-item{display:flex}/*!@:host([layout=vertical]) .container*/[layout=vertical].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{margin-inline:0px;margin-block-start:0px;flex:1 1 auto;border-block-start-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-block:0px;border-inline-start-width:2px;padding-inline-start:var(--calcite-stepper-item-spacing-unit-l)}/*!@:host([layout=vertical]) .container .stepper-item-icon*/[layout=vertical].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-icon.sc-calcite-stepper-item{order:3;margin-block:1px 0px;padding-inline-start:var(--calcite-stepper-item-spacing-unit-s);margin-inline-start:auto}/*!@:host([layout=vertical]) .container .stepper-item-header*/[layout=vertical].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-header.sc-calcite-stepper-item{padding-inline-end:0px}/*!@:host([layout=vertical]) .container .stepper-item-content*/[layout=vertical].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-content.sc-calcite-stepper-item{padding:0px}/*!@:host([layout=vertical][complete]) .container*/[layout=vertical][complete].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-color:rgba(0, 122, 194, 0.5)}/*!@:host([layout=vertical][complete]:hover:not([disabled]):not([selected])) .container, \n:host([layout=vertical][complete]:focus:not([disabled]):not([selected])) .container*/[layout=vertical][complete].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item,[layout=vertical][complete].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item{border-color:var(--calcite-ui-brand)}/*!@:host([layout=vertical][error]) .container*/[layout=vertical][error].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-color:var(--calcite-ui-danger)}/*!@:host([layout=vertical][selected]) .container*/[layout=vertical][selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-color:var(--calcite-ui-brand)}/*!@:host([layout=vertical][selected]) .container .stepper-item-content ::slotted(:last-child)*/.sc-calcite-stepper-item-h[layout=vertical][selected] .container .stepper-item-content .sc-calcite-stepper-item-s>:last-child{margin-block-end:var(--calcite-stepper-item-spacing-unit-l)}/*!@:host([layout=vertical]:hover:not([disabled]):not([selected])) .container,\n:host([layout=vertical]:focus:not([disabled]):not([selected])) .container*/[layout=vertical].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item,[layout=vertical].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item{border-color:rgba(0, 122, 194, 0.5)}/*!@:host([layout=vertical][error]:hover:not([disabled]):not([selected])) .container, \n:host([layout=vertical][error]:focus:not([disabled]):not([selected])) .container*/[layout=vertical][error].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item,[layout=vertical][error].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item{border-color:var(--calcite-ui-danger-hover)}/*!@:host([layout=horizontal])*/[layout=horizontal].sc-calcite-stepper-item-h{display:contents}/*!@:host([layout=horizontal]) .container*/[layout=horizontal].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{display:contents}/*!@:host([layout=horizontal]) .stepper-item-header*/[layout=horizontal].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{border-width:0px;border-block-start-width:2px;border-style:solid;border-color:var(--calcite-ui-border-3);outline-color:transparent;grid-row:items;margin-inline-end:0.5rem;margin-block-end:var(--calcite-stepper-item-spacing-unit-s)}/*!@:host([layout=horizontal]) .stepper-item-header:focus*/[layout=horizontal].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@:host([layout=horizontal]) .stepper-item-content*/[layout=horizontal].sc-calcite-stepper-item-h .stepper-item-content.sc-calcite-stepper-item{cursor:auto;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);padding-block:0;padding-inline-end:var(--calcite-stepper-item-spacing-unit-m);text-align:start}/*!@:host([layout=horizontal][selected]) .stepper-item-content*/[layout=horizontal][selected].sc-calcite-stepper-item-h .stepper-item-content.sc-calcite-stepper-item{grid-area:2/1/2/-1}/*!@:host([layout=horizontal][scale=s]) .stepper-item-header*/[layout=horizontal][scale=s].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{margin-inline-end:0.25rem;margin-block-end:var(--calcite-stepper-item-spacing-unit-s)}/*!@:host([layout=horizontal][scale=l]) .stepper-item-header*/[layout=horizontal][scale=l].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{margin-inline-end:0.75rem;margin-block-end:var(--calcite-stepper-item-spacing-unit-s)}/*!@:host([layout=horizontal][complete]) .stepper-item-header*/[layout=horizontal][complete].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{border-color:rgba(0, 122, 194, 0.5)}/*!@:host([layout=horizontal][complete]:hover:not([disabled]):not([selected])) .stepper-item-header, \n:host([layout=horizontal][complete]:focus:not([disabled]):not([selected])) .stepper-item-header*/[layout=horizontal][complete].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .stepper-item-header.sc-calcite-stepper-item,[layout=horizontal][complete].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .stepper-item-header.sc-calcite-stepper-item{border-color:var(--calcite-ui-brand)}/*!@:host([layout=horizontal][error]) .stepper-item-header*/[layout=horizontal][error].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{border-color:var(--calcite-ui-danger)}/*!@:host([layout=horizontal][selected]) .stepper-item-header*/[layout=horizontal][selected].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{border-color:var(--calcite-ui-brand)}/*!@:host([layout=horizontal]:hover:not([disabled]):not([selected])) .stepper-item-header,\n:host([layout=horizontal]:focus:not([disabled]):not([selected])) .stepper-item-header*/[layout=horizontal].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .stepper-item-header.sc-calcite-stepper-item,[layout=horizontal].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .stepper-item-header.sc-calcite-stepper-item{border-color:rgba(0, 122, 194, 0.5)}/*!@:host([layout=horizontal][error]:hover:not([disabled]):not([selected])) .stepper-item-header, \n:host([layout=horizontal][error]:focus:not([disabled]):not([selected])) .stepper-item-header*/[layout=horizontal][error].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .stepper-item-header.sc-calcite-stepper-item,[layout=horizontal][error].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .stepper-item-header.sc-calcite-stepper-item{border-color:var(--calcite-ui-danger-hover)}@media (forced-colors: active){/*!@:host .container*/.sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{outline-width:0;outline-offset:0}/*!@:host(:focus),\n:host(:focus-visible)*/.sc-calcite-stepper-item-h:focus,.sc-calcite-stepper-item-h:focus-visible{outline-color:canvasText}/*!@:host([selected]) .container*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-block-start-color:highlight}/*!@:host([selected]) .container .stepper-item-number*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-number.sc-calcite-stepper-item{color:highlight}/*!@:host([selected]) .container .stepper-item-icon*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-icon.sc-calcite-stepper-item{color:highlight}/*!@:host([layout=vertical][selected]) .container*/[layout=vertical][selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-color:highlight}}";
  31155. /**
  31156. * @slot - A slot for adding custom content.
  31157. */
  31158. class StepperItem {
  31159. constructor(hostRef) {
  31160. registerInstance(this, hostRef);
  31161. this.calciteInternalStepperItemKeyEvent = createEvent(this, "calciteInternalStepperItemKeyEvent", 6);
  31162. this.calciteInternalStepperItemSelect = createEvent(this, "calciteInternalStepperItemSelect", 6);
  31163. this.calciteInternalUserRequestedStepperItemSelect = createEvent(this, "calciteInternalUserRequestedStepperItemSelect", 6);
  31164. this.calciteInternalStepperItemRegister = createEvent(this, "calciteInternalStepperItemRegister", 6);
  31165. //--------------------------------------------------------------------------
  31166. //
  31167. // Public Properties
  31168. //
  31169. //--------------------------------------------------------------------------
  31170. /**
  31171. * When `true`, the component is selected.
  31172. *
  31173. * @deprecated Use `selected` instead.
  31174. */
  31175. this.active = false;
  31176. /**
  31177. * When `true`, the component is selected.
  31178. */
  31179. this.selected = false;
  31180. /** When `true`, the step has been completed. */
  31181. this.complete = false;
  31182. /** When `true`, the component contains an error that requires resolution from the user. */
  31183. this.error = false;
  31184. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  31185. this.disabled = false;
  31186. // internal props inherited from wrapping calcite-stepper
  31187. /** Defines the layout of the component. */
  31188. /** @internal */
  31189. this.layout = "horizontal";
  31190. /** When `true`, displays a status icon in the component's heading. */
  31191. /** @internal */
  31192. this.icon = false;
  31193. /** When `true`, displays the step number in the component's heading. */
  31194. /** @internal */
  31195. this.numbered = false;
  31196. /** Specifies the size of the component. */
  31197. /** @internal */
  31198. this.scale = "m";
  31199. //--------------------------------------------------------------------------
  31200. //
  31201. // Internal State/Props
  31202. //
  31203. //--------------------------------------------------------------------------
  31204. this.effectiveLocale = "";
  31205. //--------------------------------------------------------------------------
  31206. //
  31207. // Private Methods
  31208. //
  31209. //--------------------------------------------------------------------------
  31210. this.keyDownHandler = (event) => {
  31211. if (!this.disabled && event.target === this.el) {
  31212. switch (event.key) {
  31213. case " ":
  31214. case "Enter":
  31215. this.emitUserRequestedItem();
  31216. event.preventDefault();
  31217. break;
  31218. case "ArrowUp":
  31219. case "ArrowDown":
  31220. case "ArrowLeft":
  31221. case "ArrowRight":
  31222. case "Home":
  31223. case "End":
  31224. this.calciteInternalStepperItemKeyEvent.emit({ item: event });
  31225. event.preventDefault();
  31226. break;
  31227. }
  31228. }
  31229. };
  31230. this.handleItemClick = (event) => {
  31231. if (this.layout === "horizontal" &&
  31232. event
  31233. .composedPath()
  31234. .some((el) => { var _a; return (_a = el.classList) === null || _a === void 0 ? void 0 : _a.contains("stepper-item-content"); })) {
  31235. return;
  31236. }
  31237. this.emitUserRequestedItem();
  31238. };
  31239. this.emitUserRequestedItem = () => {
  31240. this.emitRequestedItem();
  31241. if (!this.disabled) {
  31242. const position = this.itemPosition;
  31243. this.calciteInternalUserRequestedStepperItemSelect.emit({
  31244. position
  31245. });
  31246. }
  31247. };
  31248. this.emitRequestedItem = () => {
  31249. if (!this.disabled) {
  31250. const position = this.itemPosition;
  31251. this.calciteInternalStepperItemSelect.emit({
  31252. position
  31253. });
  31254. }
  31255. };
  31256. }
  31257. activeHandler(value) {
  31258. this.selected = value;
  31259. }
  31260. selectedHandler(value) {
  31261. this.active = value;
  31262. if (this.selected) {
  31263. this.emitRequestedItem();
  31264. }
  31265. }
  31266. // watch for removal of disabled to register step
  31267. disabledWatcher() {
  31268. this.registerStepperItem();
  31269. }
  31270. effectiveLocaleWatcher(locale) {
  31271. var _a;
  31272. numberStringFormatter.numberFormatOptions = {
  31273. locale,
  31274. numberingSystem: (_a = this.parentStepperEl) === null || _a === void 0 ? void 0 : _a.numberingSystem,
  31275. useGrouping: false
  31276. };
  31277. }
  31278. //--------------------------------------------------------------------------
  31279. //
  31280. // Lifecycle
  31281. //
  31282. //--------------------------------------------------------------------------
  31283. connectedCallback() {
  31284. connectLocalized(this);
  31285. const { selected, active } = this;
  31286. if (selected) {
  31287. this.active = selected;
  31288. }
  31289. else if (active) {
  31290. this.selected = active;
  31291. }
  31292. }
  31293. componentWillLoad() {
  31294. var _a;
  31295. this.icon = getElementProp(this.el, "icon", false);
  31296. this.numbered = getElementProp(this.el, "numbered", false);
  31297. this.layout = getElementProp(this.el, "layout", false);
  31298. this.scale = getElementProp(this.el, "scale", "m");
  31299. this.parentStepperEl = this.el.parentElement;
  31300. this.itemPosition = this.getItemPosition();
  31301. this.registerStepperItem();
  31302. if (this.selected) {
  31303. this.emitRequestedItem();
  31304. }
  31305. numberStringFormatter.numberFormatOptions = {
  31306. locale: this.effectiveLocale,
  31307. numberingSystem: (_a = this.parentStepperEl) === null || _a === void 0 ? void 0 : _a.numberingSystem,
  31308. useGrouping: false
  31309. };
  31310. }
  31311. componentDidRender() {
  31312. updateHostInteraction(this, true);
  31313. }
  31314. disconnectedCallback() {
  31315. disconnectLocalized(this);
  31316. }
  31317. render() {
  31318. return (hAsync(Host, { "aria-expanded": toAriaBoolean(this.active), onClick: this.handleItemClick, onKeyDown: this.keyDownHandler }, hAsync("div", { class: "container" }, hAsync("div", { class: "stepper-item-header", ref: (el) => (this.headerEl = el), tabIndex:
  31319. /* additional tab index logic needed because of display: contents */
  31320. this.layout === "horizontal" && !this.disabled ? 0 : null }, this.icon ? this.renderIcon() : null, this.numbered ? (hAsync("div", { class: "stepper-item-number" }, numberStringFormatter.numberFormatter.format(this.itemPosition + 1), ".")) : null, hAsync("div", { class: "stepper-item-header-text" }, hAsync("span", { class: "stepper-item-heading" }, this.heading || this.itemTitle), hAsync("span", { class: "stepper-item-description" }, this.description || this.itemSubtitle))), hAsync("div", { class: "stepper-item-content" }, hAsync("slot", null)))));
  31321. }
  31322. //--------------------------------------------------------------------------
  31323. //
  31324. // Event Listeners
  31325. //
  31326. //--------------------------------------------------------------------------
  31327. updateActiveItemOnChange(event) {
  31328. if (event.target === this.parentStepperEl ||
  31329. event.composedPath().includes(this.parentStepperEl)) {
  31330. this.selectedPosition = event.detail.position;
  31331. this.determineSelectedItem();
  31332. }
  31333. }
  31334. //--------------------------------------------------------------------------
  31335. //
  31336. // Public Methods
  31337. //
  31338. //--------------------------------------------------------------------------
  31339. async setFocus() {
  31340. var _a;
  31341. (_a = (this.layout === "vertical" ? this.el : this.headerEl)) === null || _a === void 0 ? void 0 : _a.focus();
  31342. }
  31343. renderIcon() {
  31344. const path = this.selected
  31345. ? "circleF"
  31346. : this.error
  31347. ? "exclamationMarkCircleF"
  31348. : this.complete
  31349. ? "checkCircleF"
  31350. : "circle";
  31351. return hAsync("calcite-icon", { class: "stepper-item-icon", icon: path, scale: "s" });
  31352. }
  31353. determineSelectedItem() {
  31354. this.selected = !this.disabled && this.itemPosition === this.selectedPosition;
  31355. }
  31356. registerStepperItem() {
  31357. this.calciteInternalStepperItemRegister.emit({
  31358. position: this.itemPosition
  31359. });
  31360. }
  31361. getItemPosition() {
  31362. var _a;
  31363. return Array.from((_a = this.parentStepperEl) === null || _a === void 0 ? void 0 : _a.querySelectorAll("calcite-stepper-item")).indexOf(this.el);
  31364. }
  31365. get el() { return getElement(this); }
  31366. static get watchers() { return {
  31367. "active": ["activeHandler"],
  31368. "selected": ["selectedHandler"],
  31369. "disabled": ["disabledWatcher"],
  31370. "effectiveLocale": ["effectiveLocaleWatcher"]
  31371. }; }
  31372. static get style() { return stepperItemCss; }
  31373. static get cmpMeta() { return {
  31374. "$flags$": 9,
  31375. "$tagName$": "calcite-stepper-item",
  31376. "$members$": {
  31377. "active": [1540],
  31378. "selected": [1540],
  31379. "complete": [516],
  31380. "error": [516],
  31381. "disabled": [516],
  31382. "itemTitle": [1, "item-title"],
  31383. "heading": [1],
  31384. "itemSubtitle": [1, "item-subtitle"],
  31385. "description": [1],
  31386. "layout": [1537],
  31387. "icon": [1028],
  31388. "numbered": [1028],
  31389. "scale": [1537],
  31390. "effectiveLocale": [32],
  31391. "setFocus": [64]
  31392. },
  31393. "$listeners$": [[16, "calciteInternalStepperItemChange", "updateActiveItemOnChange"]],
  31394. "$lazyBundleId$": "-",
  31395. "$attrsToReflect$": [["active", "active"], ["selected", "selected"], ["complete", "complete"], ["error", "error"], ["disabled", "disabled"], ["layout", "layout"], ["scale", "scale"]]
  31396. }; }
  31397. }
  31398. const switchCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-switch:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-switch{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-switch{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-switch{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-switch{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-switch{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-switch:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-switch:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-switch-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-switch-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([scale=s]) .container*/[scale=s].sc-calcite-switch-h .container.sc-calcite-switch{block-size:0.75rem}/*!@:host([scale=s]) .track*/[scale=s].sc-calcite-switch-h .track.sc-calcite-switch{block-size:0.75rem;inline-size:1.5rem}/*!@:host([scale=s]) .handle*/[scale=s].sc-calcite-switch-h .handle.sc-calcite-switch{block-size:0.5rem;inline-size:0.5rem}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-switch-h .container.sc-calcite-switch{block-size:1rem}/*!@:host([scale=m]) .track*/[scale=m].sc-calcite-switch-h .track.sc-calcite-switch{block-size:1rem;inline-size:2rem}/*!@:host([scale=m]) .handle*/[scale=m].sc-calcite-switch-h .handle.sc-calcite-switch{block-size:0.75rem;inline-size:0.75rem}/*!@:host([scale=l]) .container*/[scale=l].sc-calcite-switch-h .container.sc-calcite-switch{block-size:1.5rem}/*!@:host([scale=l]) .track*/[scale=l].sc-calcite-switch-h .track.sc-calcite-switch{block-size:1.5rem;inline-size:3rem}/*!@:host([scale=l]) .handle*/[scale=l].sc-calcite-switch-h .handle.sc-calcite-switch{block-size:1.25rem;inline-size:1.25rem}/*!@:host*/.sc-calcite-switch-h{position:relative;display:inline-block;inline-size:auto;cursor:pointer;-webkit-user-select:none;user-select:none;vertical-align:middle;tap-highlight-color:transparent}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-switch-h[disabled] .sc-calcite-switch-s>[calcite-hydrated][disabled],[disabled].sc-calcite-switch-h [calcite-hydrated][disabled].sc-calcite-switch{opacity:1}/*!@:host*/.sc-calcite-switch-h{inline-size:auto;outline-color:transparent}/*!@.track*/.track.sc-calcite-switch{pointer-events:none;position:relative;box-sizing:border-box;display:inline-block;border-radius:9999px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-2);background-color:var(--calcite-ui-foreground-2);vertical-align:top;transition-property:all;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@.handle*/.handle.sc-calcite-switch{pointer-events:none;position:absolute;display:block;border-radius:9999px;border-width:2px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);transition-property:all;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);inset-block-start:-1px;inset-inline:-1px auto}/*!@:host(:hover) .handle, \n:host(:focus) .handle*/.sc-calcite-switch-h:hover .handle.sc-calcite-switch,.sc-calcite-switch-h:focus .handle.sc-calcite-switch{border-color:var(--calcite-ui-brand);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand)}/*!@:host([checked]) .track*/[checked].sc-calcite-switch-h .track.sc-calcite-switch{border-color:var(--calcite-ui-brand-hover);background-color:var(--calcite-ui-brand)}/*!@:host([checked]) .handle*/[checked].sc-calcite-switch-h .handle.sc-calcite-switch{border-color:var(--calcite-ui-brand);inset-inline:auto -1px}/*!@:host([checked]:hover) .track*/[checked].sc-calcite-switch-h:hover .track.sc-calcite-switch{border-color:var(--calcite-ui-brand-hover);background-color:var(--calcite-ui-brand)}/*!@:host([checked]:hover) .handle*/[checked].sc-calcite-switch-h:hover .handle.sc-calcite-switch{border-color:var(--calcite-ui-brand-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand-hover)}@media (forced-colors: active){/*!@:host([checked]) .track*/[checked].sc-calcite-switch-h .track.sc-calcite-switch{background-color:canvasText}}/*!@.container:focus*/.container.sc-calcite-switch:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-switch-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  31399. class Switch {
  31400. constructor(hostRef) {
  31401. registerInstance(this, hostRef);
  31402. this.calciteSwitchChange = createEvent(this, "calciteSwitchChange", 6);
  31403. //--------------------------------------------------------------------------
  31404. //
  31405. // Properties
  31406. //
  31407. //--------------------------------------------------------------------------
  31408. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  31409. this.disabled = false;
  31410. /** Specifies the size of the component. */
  31411. this.scale = "m";
  31412. /**
  31413. * When `true`, the component is checked.
  31414. *
  31415. * @deprecated use `checked` instead.
  31416. */
  31417. this.switched = false;
  31418. /** When `true`, the component is checked. */
  31419. this.checked = false;
  31420. //--------------------------------------------------------------------------
  31421. //
  31422. // Private Methods
  31423. //
  31424. //--------------------------------------------------------------------------
  31425. this.keyDownHandler = (event) => {
  31426. if (!this.disabled && isActivationKey(event.key)) {
  31427. this.toggle();
  31428. event.preventDefault();
  31429. }
  31430. };
  31431. this.clickHandler = () => {
  31432. this.toggle();
  31433. };
  31434. this.setSwitchEl = (el) => {
  31435. this.switchEl = el;
  31436. };
  31437. }
  31438. switchedWatcher(switched) {
  31439. this.checked = switched;
  31440. }
  31441. //--------------------------------------------------------------------------
  31442. //
  31443. // Public Methods
  31444. //
  31445. //--------------------------------------------------------------------------
  31446. /** Sets focus on the component. */
  31447. async setFocus() {
  31448. focusElement(this.switchEl);
  31449. }
  31450. onLabelClick() {
  31451. if (!this.disabled) {
  31452. this.toggle();
  31453. this.setFocus();
  31454. }
  31455. }
  31456. toggle() {
  31457. this.checked = !this.checked;
  31458. this.calciteSwitchChange.emit({
  31459. switched: this.checked
  31460. });
  31461. }
  31462. //--------------------------------------------------------------------------
  31463. //
  31464. // Lifecycle
  31465. //
  31466. //--------------------------------------------------------------------------
  31467. connectedCallback() {
  31468. const initiallyChecked = this.checked || this.switched;
  31469. if (initiallyChecked) {
  31470. // if either prop is set, we ensure both are synced initially
  31471. this.switched = this.checked = initiallyChecked;
  31472. }
  31473. connectLabel(this);
  31474. connectForm(this);
  31475. }
  31476. disconnectedCallback() {
  31477. disconnectLabel(this);
  31478. disconnectForm(this);
  31479. }
  31480. componentDidRender() {
  31481. updateHostInteraction(this);
  31482. }
  31483. // --------------------------------------------------------------------------
  31484. //
  31485. // Render Methods
  31486. //
  31487. // --------------------------------------------------------------------------
  31488. render() {
  31489. return (hAsync(Host, { onClick: this.clickHandler, onKeyDown: this.keyDownHandler }, hAsync("div", { "aria-checked": toAriaBoolean(this.checked), "aria-label": getLabelText(this), class: "container", ref: this.setSwitchEl, role: "switch", tabIndex: 0 }, hAsync("div", { class: "track" }, hAsync("div", { class: "handle" })), hAsync(HiddenFormInputSlot, { component: this }))));
  31490. }
  31491. get el() { return getElement(this); }
  31492. static get watchers() { return {
  31493. "switched": ["switchedWatcher"]
  31494. }; }
  31495. static get style() { return switchCss; }
  31496. static get cmpMeta() { return {
  31497. "$flags$": 9,
  31498. "$tagName$": "calcite-switch",
  31499. "$members$": {
  31500. "disabled": [516],
  31501. "label": [1],
  31502. "name": [513],
  31503. "scale": [513],
  31504. "switched": [1540],
  31505. "checked": [1540],
  31506. "value": [8],
  31507. "setFocus": [64]
  31508. },
  31509. "$listeners$": undefined,
  31510. "$lazyBundleId$": "-",
  31511. "$attrsToReflect$": [["disabled", "disabled"], ["name", "name"], ["scale", "scale"], ["switched", "switched"], ["checked", "checked"]]
  31512. }; }
  31513. }
  31514. const tabCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tab:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tab{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tab{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tab{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tab{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tab{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tab:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tab:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tab-h{display:none}/*!@:host([selected]) section, \n:host([selected]) .container*/[selected].sc-calcite-tab-h section.sc-calcite-tab,[selected].sc-calcite-tab-h .container.sc-calcite-tab{display:block}/*!@:host*/.sc-calcite-tab-h{display:none;block-size:100%;inline-size:100%}/*!@:host([selected])*/[selected].sc-calcite-tab-h{display:block;block-size:100%;inline-size:100%;overflow:auto}/*!@section, \n.container*/section.sc-calcite-tab,.container.sc-calcite-tab{display:none;block-size:100%;inline-size:100%}/*!@:host([scale=s])*/[scale=s].sc-calcite-tab-h{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-tab-h{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-tab-h{padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}";
  31515. /**
  31516. * @slot - A slot for adding content to the component.
  31517. */
  31518. class Tab {
  31519. constructor(hostRef) {
  31520. registerInstance(this, hostRef);
  31521. this.calciteInternalTabRegister = createEvent(this, "calciteInternalTabRegister", 6);
  31522. /**
  31523. * When `true`, the component's contents are selected.
  31524. *
  31525. * Only one tab can be selected within the `calcite-tabs` parent.
  31526. *
  31527. * @deprecated Use `selected` instead.
  31528. */
  31529. this.active = false;
  31530. /**
  31531. * When `true`, the component's contents are selected.
  31532. *
  31533. * Only one tab can be selected within the `calcite-tabs` parent.
  31534. */
  31535. this.selected = false;
  31536. /**
  31537. * @internal
  31538. */
  31539. this.scale = "m";
  31540. this.guid = `calcite-tab-title-${guid()}`;
  31541. }
  31542. activeHandler(value) {
  31543. this.selected = value;
  31544. }
  31545. selectedHandler(value) {
  31546. this.active = value;
  31547. }
  31548. //--------------------------------------------------------------------------
  31549. //
  31550. // Lifecycle
  31551. //
  31552. //--------------------------------------------------------------------------
  31553. render() {
  31554. const id = this.el.id || this.guid;
  31555. return (hAsync(Host, { "aria-labelledby": this.labeledBy, id: id }, hAsync("div", { class: "container", role: "tabpanel", tabIndex: this.selected ? 0 : -1 }, hAsync("section", null, hAsync("slot", null)))));
  31556. }
  31557. connectedCallback() {
  31558. this.parentTabsEl = this.el.closest("calcite-tabs");
  31559. const isSelected = this.selected || this.active;
  31560. if (isSelected) {
  31561. this.activeHandler(isSelected);
  31562. this.selectedHandler(isSelected);
  31563. }
  31564. }
  31565. componentDidLoad() {
  31566. this.calciteInternalTabRegister.emit();
  31567. }
  31568. componentWillRender() {
  31569. var _a;
  31570. this.scale = (_a = this.parentTabsEl) === null || _a === void 0 ? void 0 : _a.scale;
  31571. }
  31572. disconnectedCallback() {
  31573. var _a;
  31574. // Dispatching to body in order to be listened by other elements that are still connected to the DOM.
  31575. (_a = document.body) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new CustomEvent("calciteTabUnregister", {
  31576. detail: this.el
  31577. }));
  31578. }
  31579. //--------------------------------------------------------------------------
  31580. //
  31581. // Event Listeners
  31582. //
  31583. //--------------------------------------------------------------------------
  31584. internalTabChangeHandler(event) {
  31585. const targetTabsEl = event
  31586. .composedPath()
  31587. .find((el) => el.tagName === "CALCITE-TABS");
  31588. // to allow `<calcite-tabs>` to be nested we need to make sure this
  31589. // `calciteTabChange` event was actually fired from a within the same
  31590. // `<calcite-tabs>` that is the a parent of this tab.
  31591. if (targetTabsEl !== this.parentTabsEl) {
  31592. return;
  31593. }
  31594. if (this.tab) {
  31595. this.selected = this.tab === event.detail.tab;
  31596. }
  31597. else {
  31598. this.getTabIndex().then((index) => {
  31599. this.selected = index === event.detail.tab;
  31600. });
  31601. }
  31602. event.stopPropagation();
  31603. }
  31604. //--------------------------------------------------------------------------
  31605. //
  31606. // Public Methods
  31607. //
  31608. //--------------------------------------------------------------------------
  31609. /**
  31610. * Returns the index of the component item within the tab array.
  31611. */
  31612. async getTabIndex() {
  31613. return Array.prototype.indexOf.call(nodeListToArray(this.el.parentElement.children).filter((el) => el.matches("calcite-tab")), this.el);
  31614. }
  31615. //--------------------------------------------------------------------------
  31616. //
  31617. // Private Methods
  31618. //
  31619. //--------------------------------------------------------------------------
  31620. /**
  31621. * @param tabIds
  31622. * @param titleIds
  31623. * @internal
  31624. */
  31625. async updateAriaInfo(tabIds = [], titleIds = []) {
  31626. this.labeledBy = titleIds[tabIds.indexOf(this.el.id)] || null;
  31627. }
  31628. get el() { return getElement(this); }
  31629. static get watchers() { return {
  31630. "active": ["activeHandler"],
  31631. "selected": ["selectedHandler"]
  31632. }; }
  31633. static get style() { return tabCss; }
  31634. static get cmpMeta() { return {
  31635. "$flags$": 9,
  31636. "$tagName$": "calcite-tab",
  31637. "$members$": {
  31638. "tab": [513],
  31639. "active": [1540],
  31640. "selected": [1540],
  31641. "scale": [1537],
  31642. "labeledBy": [32],
  31643. "getTabIndex": [64],
  31644. "updateAriaInfo": [64]
  31645. },
  31646. "$listeners$": [[16, "calciteInternalTabChange", "internalTabChangeHandler"]],
  31647. "$lazyBundleId$": "-",
  31648. "$attrsToReflect$": [["tab", "tab"], ["active", "active"], ["selected", "selected"], ["scale", "scale"]]
  31649. }; }
  31650. }
  31651. const tabNavCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tab-nav:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tab-nav{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tab-nav{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tab-nav{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tab-nav{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tab-nav{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tab-nav:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tab-nav:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tab-nav-h{display:none}/*!@:host*/.sc-calcite-tab-nav-h{position:relative;display:flex}/*!@:host([scale=s])*/[scale=s].sc-calcite-tab-nav-h{min-block-size:1.5rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-tab-nav-h{min-block-size:2rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-tab-nav-h{min-block-size:2.75rem}/*!@.tab-nav*/.tab-nav.sc-calcite-tab-nav{display:flex;inline-size:100%;justify-content:flex-start;overflow:auto}/*!@.tab-nav-active-indicator-container*/.tab-nav-active-indicator-container.sc-calcite-tab-nav{position:absolute;inset-inline:0px;inset-block-end:0px;block-size:0.125rem;inline-size:100%;overflow:hidden}/*!@.tab-nav-active-indicator*/.tab-nav-active-indicator.sc-calcite-tab-nav{position:absolute;inset-block-end:0px;display:block;block-size:0.125rem;background-color:var(--calcite-ui-brand);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}/*!@:host([position=below]) .tab-nav-active-indicator*/[position=below].sc-calcite-tab-nav-h .tab-nav-active-indicator.sc-calcite-tab-nav{inset-block-end:unset;inset-block-start:0px}/*!@:host([position=bottom]) .tab-nav-active-indicator*/[position=bottom].sc-calcite-tab-nav-h .tab-nav-active-indicator.sc-calcite-tab-nav{inset-block-end:unset;inset-block-start:0px}/*!@:host([position=below]) .tab-nav-active-indicator-container*/[position=below].sc-calcite-tab-nav-h .tab-nav-active-indicator-container.sc-calcite-tab-nav{inset-block-start:0px;inset-block-end:unset}/*!@:host([position=bottom]) .tab-nav-active-indicator-container*/[position=bottom].sc-calcite-tab-nav-h .tab-nav-active-indicator-container.sc-calcite-tab-nav{inset-block-end:unset;inset-block-start:0px}/*!@:host([bordered]) .tab-nav-active-indicator-container*/[bordered].sc-calcite-tab-nav-h .tab-nav-active-indicator-container.sc-calcite-tab-nav{inset-block-end:unset}/*!@:host([bordered][position=below]) .tab-nav-active-indicator-container*/[bordered][position=below].sc-calcite-tab-nav-h .tab-nav-active-indicator-container.sc-calcite-tab-nav{inset-block-end:0;inset-block-start:unset}/*!@:host([bordered][position=bottom]) .tab-nav-active-indicator-container*/[bordered][position=bottom].sc-calcite-tab-nav-h .tab-nav-active-indicator-container.sc-calcite-tab-nav{inset-block-end:0;inset-block-start:unset}@media (forced-colors: active){/*!@.tab-nav-active-indicator*/.tab-nav-active-indicator.sc-calcite-tab-nav{background-color:highlight}}";
  31652. /**
  31653. * @slot - A slot for adding `calcite-tab-title`s.
  31654. */
  31655. class TabNav {
  31656. constructor(hostRef) {
  31657. registerInstance(this, hostRef);
  31658. this.calciteTabChange = createEvent(this, "calciteTabChange", 6);
  31659. this.calciteInternalTabChange = createEvent(this, "calciteInternalTabChange", 6);
  31660. /**
  31661. * @internal
  31662. */
  31663. this.scale = "m";
  31664. /**
  31665. * @internal
  31666. */
  31667. this.layout = "inline";
  31668. /**
  31669. * @internal
  31670. */
  31671. this.position = "bottom";
  31672. /**
  31673. * @internal
  31674. */
  31675. this.bordered = false;
  31676. this.animationActiveDuration = 0.3;
  31677. this.resizeObserver = createObserver();
  31678. //--------------------------------------------------------------------------
  31679. //
  31680. // Private Methods
  31681. //
  31682. //--------------------------------------------------------------------------
  31683. this.handleContainerScroll = () => {
  31684. // remove active indicator transition duration while container is scrolling to prevent wobble
  31685. this.activeIndicatorEl.style.transitionDuration = "0s";
  31686. this.updateOffsetPosition();
  31687. };
  31688. }
  31689. async selectedTabChanged() {
  31690. if (localStorage &&
  31691. this.storageId &&
  31692. this.selectedTab !== undefined &&
  31693. this.selectedTab !== null) {
  31694. localStorage.setItem(`calcite-tab-nav-${this.storageId}`, JSON.stringify(this.selectedTab));
  31695. }
  31696. this.calciteInternalTabChange.emit({
  31697. tab: this.selectedTab
  31698. });
  31699. this.selectedTabEl = await this.getTabTitleById(this.selectedTab);
  31700. }
  31701. selectedTabElChanged() {
  31702. this.updateOffsetPosition();
  31703. this.updateActiveWidth();
  31704. // reset the animation time on tab selection
  31705. this.activeIndicatorEl.style.transitionDuration = `${this.animationActiveDuration}s`;
  31706. }
  31707. //--------------------------------------------------------------------------
  31708. //
  31709. // Lifecycle
  31710. //
  31711. //--------------------------------------------------------------------------
  31712. connectedCallback() {
  31713. var _a;
  31714. this.parentTabsEl = this.el.closest("calcite-tabs");
  31715. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el);
  31716. }
  31717. disconnectedCallback() {
  31718. var _a;
  31719. (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  31720. }
  31721. componentWillLoad() {
  31722. const storageKey = `calcite-tab-nav-${this.storageId}`;
  31723. if (localStorage && this.storageId && localStorage.getItem(storageKey)) {
  31724. const storedTab = JSON.parse(localStorage.getItem(storageKey));
  31725. this.selectedTab = storedTab;
  31726. }
  31727. }
  31728. componentWillRender() {
  31729. const { parentTabsEl } = this;
  31730. this.layout = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.layout;
  31731. this.position = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.position;
  31732. this.scale = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.scale;
  31733. this.bordered = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.bordered;
  31734. // fix issue with active tab-title not lining up with blue indicator
  31735. if (this.selectedTabEl) {
  31736. this.updateOffsetPosition();
  31737. }
  31738. }
  31739. componentDidRender() {
  31740. // if every tab title is active select the first tab.
  31741. if (this.tabTitles.length &&
  31742. this.tabTitles.every((title) => !title.active) &&
  31743. !this.selectedTab) {
  31744. this.tabTitles[0].getTabIdentifier().then((tab) => {
  31745. this.calciteInternalTabChange.emit({
  31746. tab
  31747. });
  31748. });
  31749. }
  31750. }
  31751. render() {
  31752. const dir = getElementDir(this.el);
  31753. const width = `${this.indicatorWidth}px`;
  31754. const offset = `${this.indicatorOffset}px`;
  31755. const indicatorStyle = dir !== "rtl" ? { width, left: offset } : { width, right: offset };
  31756. return (hAsync(Host, { role: "tablist" }, hAsync("div", { class: "tab-nav", onScroll: this.handleContainerScroll, ref: (el) => (this.tabNavEl = el) }, hAsync("div", { class: "tab-nav-active-indicator-container", ref: (el) => (this.activeIndicatorContainerEl = el) }, hAsync("div", { class: "tab-nav-active-indicator", ref: (el) => (this.activeIndicatorEl = el), style: indicatorStyle })), hAsync("slot", null))));
  31757. }
  31758. //--------------------------------------------------------------------------
  31759. //
  31760. // Event Listeners
  31761. //
  31762. //--------------------------------------------------------------------------
  31763. focusPreviousTabHandler(event) {
  31764. const currentIndex = this.getIndexOfTabTitle(event.target, this.enabledTabTitles);
  31765. const previousTab = this.enabledTabTitles[currentIndex - 1] ||
  31766. this.enabledTabTitles[this.enabledTabTitles.length - 1];
  31767. previousTab === null || previousTab === void 0 ? void 0 : previousTab.focus();
  31768. event.stopPropagation();
  31769. event.preventDefault();
  31770. }
  31771. focusNextTabHandler(event) {
  31772. const currentIndex = this.getIndexOfTabTitle(event.target, this.enabledTabTitles);
  31773. const nextTab = this.enabledTabTitles[currentIndex + 1] || this.enabledTabTitles[0];
  31774. nextTab === null || nextTab === void 0 ? void 0 : nextTab.focus();
  31775. event.stopPropagation();
  31776. event.preventDefault();
  31777. }
  31778. internalActivateTabHandler(event) {
  31779. this.selectedTab = event.detail.tab
  31780. ? event.detail.tab
  31781. : this.getIndexOfTabTitle(event.target);
  31782. event.stopPropagation();
  31783. event.preventDefault();
  31784. }
  31785. activateTabHandler(event) {
  31786. this.calciteTabChange.emit({
  31787. tab: this.selectedTab
  31788. });
  31789. event.stopPropagation();
  31790. event.preventDefault();
  31791. }
  31792. /**
  31793. * Check for active tabs on register and update selected
  31794. *
  31795. * @param event
  31796. */
  31797. updateTabTitles(event) {
  31798. if (event.target.active) {
  31799. this.selectedTab = event.detail;
  31800. }
  31801. }
  31802. globalInternalTabChangeHandler(event) {
  31803. if (this.syncId &&
  31804. event.target !== this.el &&
  31805. event.target.syncId === this.syncId &&
  31806. this.selectedTab !== event.detail.tab) {
  31807. this.selectedTab = event.detail.tab;
  31808. }
  31809. event.stopPropagation();
  31810. }
  31811. iconStartChangeHandler() {
  31812. this.updateActiveWidth();
  31813. }
  31814. updateOffsetPosition() {
  31815. var _a, _b, _c, _d, _e;
  31816. const dir = getElementDir(this.el);
  31817. const navWidth = (_a = this.activeIndicatorContainerEl) === null || _a === void 0 ? void 0 : _a.offsetWidth;
  31818. const tabLeft = (_b = this.selectedTabEl) === null || _b === void 0 ? void 0 : _b.offsetLeft;
  31819. const tabWidth = (_c = this.selectedTabEl) === null || _c === void 0 ? void 0 : _c.offsetWidth;
  31820. const offsetRight = navWidth - (tabLeft + tabWidth);
  31821. this.indicatorOffset =
  31822. dir !== "rtl" ? tabLeft - ((_d = this.tabNavEl) === null || _d === void 0 ? void 0 : _d.scrollLeft) : offsetRight + ((_e = this.tabNavEl) === null || _e === void 0 ? void 0 : _e.scrollLeft);
  31823. }
  31824. updateActiveWidth() {
  31825. var _a;
  31826. this.indicatorWidth = (_a = this.selectedTabEl) === null || _a === void 0 ? void 0 : _a.offsetWidth;
  31827. }
  31828. getIndexOfTabTitle(el, tabTitles = this.tabTitles) {
  31829. // In most cases, since these indexes correlate with tab contents, we want to consider all tab titles.
  31830. // However, when doing relative index operations, it makes sense to pass in this.enabledTabTitles as the 2nd arg.
  31831. return tabTitles.indexOf(el);
  31832. }
  31833. async getTabTitleById(id) {
  31834. return Promise.all(this.tabTitles.map((el) => el.getTabIdentifier())).then((ids) => {
  31835. return this.tabTitles[ids.indexOf(id)];
  31836. });
  31837. }
  31838. get tabTitles() {
  31839. return filterDirectChildren(this.el, "calcite-tab-title");
  31840. }
  31841. get enabledTabTitles() {
  31842. return filterDirectChildren(this.el, "calcite-tab-title:not([disabled])");
  31843. }
  31844. get el() { return getElement(this); }
  31845. static get watchers() { return {
  31846. "selectedTab": ["selectedTabChanged"],
  31847. "selectedTabEl": ["selectedTabElChanged"]
  31848. }; }
  31849. static get style() { return tabNavCss; }
  31850. static get cmpMeta() { return {
  31851. "$flags$": 9,
  31852. "$tagName$": "calcite-tab-nav",
  31853. "$members$": {
  31854. "storageId": [513, "storage-id"],
  31855. "syncId": [513, "sync-id"],
  31856. "scale": [1537],
  31857. "layout": [1537],
  31858. "position": [1537],
  31859. "bordered": [1540],
  31860. "indicatorOffset": [1026, "indicator-offset"],
  31861. "indicatorWidth": [1026, "indicator-width"],
  31862. "selectedTab": [32],
  31863. "selectedTabEl": [32]
  31864. },
  31865. "$listeners$": [[0, "calciteInternalTabsFocusPrevious", "focusPreviousTabHandler"], [0, "calciteInternalTabsFocusNext", "focusNextTabHandler"], [0, "calciteInternalTabsActivate", "internalActivateTabHandler"], [0, "calciteTabsActivate", "activateTabHandler"], [0, "calciteInternalTabTitleRegister", "updateTabTitles"], [16, "calciteInternalTabChange", "globalInternalTabChangeHandler"], [0, "calciteInternalTabIconChanged", "iconStartChangeHandler"]],
  31866. "$lazyBundleId$": "-",
  31867. "$attrsToReflect$": [["storageId", "storage-id"], ["syncId", "sync-id"], ["scale", "scale"], ["layout", "layout"], ["position", "position"], ["bordered", "bordered"]]
  31868. }; }
  31869. }
  31870. const tabTitleCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tab-title:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tab-title{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tab-title{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tab-title{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tab-title{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tab-title{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tab-title:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tab-title:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tab-title-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-tab-title-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-tab-title-h{display:block;flex:0 1 auto;outline:2px solid transparent;outline-offset:2px;margin-inline-start:0px;margin-inline-end:1.25rem}/*!@:host([layout=center])*/[layout=center].sc-calcite-tab-title-h{margin-block:0px;margin-inline:1.25rem;text-align:center;flex-basis:12rem;margin:auto}/*!@:host([position=below]) .container*/[position=below].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-end-width:0px;border-block-start-width:2px;border-block-start-color:transparent;border-block-start-style:solid}/*!@:host([position=bottom]) .container*/[position=bottom].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-end-width:0px;border-block-start-width:2px;border-block-start-color:transparent;border-block-start-style:solid}/*!@:host .container*/.sc-calcite-tab-title-h .container.sc-calcite-tab-title{outline-color:transparent}/*!@:host(:focus) .container*/.sc-calcite-tab-title-h:focus .container.sc-calcite-tab-title{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host(:active) a, \n:host(:focus) a, \n:host(:hover) a*/.sc-calcite-tab-title-h:active a.sc-calcite-tab-title,.sc-calcite-tab-title-h:focus a.sc-calcite-tab-title,.sc-calcite-tab-title-h:hover a.sc-calcite-tab-title{border-color:var(--calcite-ui-border-2);color:var(--calcite-ui-text-1);text-decoration-line:none}/*!@:host([selected]) .container*/[selected].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-color:transparent;color:var(--calcite-ui-text-1)}/*!@:host([disabled]) .container*/[disabled].sc-calcite-tab-title-h .container.sc-calcite-tab-title{pointer-events:none;opacity:0.5}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-tab-title-h[disabled] .sc-calcite-tab-title-s>[calcite-hydrated][disabled],[disabled].sc-calcite-tab-title-h [calcite-hydrated][disabled].sc-calcite-tab-title{opacity:1}/*!@:host([scale=s])*/[scale=s].sc-calcite-tab-title-h{margin-inline-end:1rem}/*!@:host([scale=s]) .container*/[scale=s].sc-calcite-tab-title-h .container.sc-calcite-tab-title{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-tab-title-h .container.sc-calcite-tab-title{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-tab-title-h{margin-inline-end:1.5rem}/*!@:host([scale=l]) .container*/[scale=l].sc-calcite-tab-title-h .container.sc-calcite-tab-title{padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@.container*/.container.sc-calcite-tab-title{box-sizing:border-box;display:flex;block-size:100%;inline-size:100%;cursor:pointer;-webkit-appearance:none;appearance:none;justify-content:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-block-end-width:2px;padding-inline:0px;padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-3);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-block-end-color:transparent;border-block-end-style:solid}/*!@.calcite-tab-title--icon*/.calcite-tab-title--icon.sc-calcite-tab-title{position:relative;margin:0px;display:inline-flex;align-self:center}/*!@.calcite-tab-title--icon svg*/.calcite-tab-title--icon.sc-calcite-tab-title svg.sc-calcite-tab-title{transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.container--has-text*/.container--has-text.sc-calcite-tab-title{padding:0.25rem}/*!@.container--has-text .calcite-tab-title--icon.icon-start*/.container--has-text.sc-calcite-tab-title .calcite-tab-title--icon.icon-start.sc-calcite-tab-title{margin-inline-end:0.5rem}/*!@.container--has-text .calcite-tab-title--icon.icon-end*/.container--has-text.sc-calcite-tab-title .calcite-tab-title--icon.icon-end.sc-calcite-tab-title{margin-inline-start:0.5rem}/*!@:host([icon-start][icon-end]) .calcite-tab-title--icon:first-child*/[icon-start][icon-end].sc-calcite-tab-title-h .calcite-tab-title--icon.sc-calcite-tab-title:first-child{margin-inline-end:0.5rem}/*!@:host([bordered])*/[bordered].sc-calcite-tab-title-h{margin-inline-end:0}/*!@:host([bordered][selected])*/[bordered][selected].sc-calcite-tab-title-h{box-shadow:inset 0px -2px var(--calcite-ui-foreground-1)}/*!@:host([bordered][selected][position=below])*/[bordered][selected][position=below].sc-calcite-tab-title-h{box-shadow:inset 0 2px 0 var(--calcite-ui-foreground-1)}/*!@:host([bordered][selected][position=bottom])*/[bordered][selected][position=bottom].sc-calcite-tab-title-h{box-shadow:inset 0 2px 0 var(--calcite-ui-foreground-1)}/*!@:host([bordered]:hover) .container, \n:host([bordered]:focus) .container, \n:host([bordered]:active) .container*/[bordered].sc-calcite-tab-title-h:hover .container.sc-calcite-tab-title,[bordered].sc-calcite-tab-title-h:focus .container.sc-calcite-tab-title,[bordered].sc-calcite-tab-title-h:active .container.sc-calcite-tab-title{position:relative}/*!@:host([bordered]:hover) .container*/[bordered].sc-calcite-tab-title-h:hover .container.sc-calcite-tab-title{background-color:var(--calcite-button-transparent-hover)}/*!@:host([bordered]) .container*/[bordered].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-end-style:unset;border-inline-start:1px solid transparent;border-inline-end:1px solid transparent}/*!@:host([bordered][position=below]) .container*/[bordered][position=below].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-start-style:unset}/*!@:host([bordered][position=bottom]) .container*/[bordered][position=bottom].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-start-style:unset}/*!@:host([selected][bordered]) .container*/[selected][bordered].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-inline-start-color:var(--calcite-ui-border-1);border-inline-end-color:var(--calcite-ui-border-1)}/*!@:host([bordered]) .container*/[bordered].sc-calcite-tab-title-h .container.sc-calcite-tab-title{padding-inline:0.75rem}/*!@:host([bordered][scale=s]) .container*/[bordered][scale=s].sc-calcite-tab-title-h .container.sc-calcite-tab-title{padding-inline:0.5rem}/*!@:host([bordered][scale=l]) .container*/[bordered][scale=l].sc-calcite-tab-title-h .container.sc-calcite-tab-title{padding-inline:1rem}@media (forced-colors: active){/*!@:host*/.sc-calcite-tab-title-h{outline-width:0;outline-offset:0}/*!@:host(:focus) .container*/.sc-calcite-tab-title-h:focus .container.sc-calcite-tab-title{outline-color:highlight}/*!@:host([bordered]) .container*/[bordered].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-end-style:solid}/*!@:host([bordered][position=below]) .container*/[bordered][position=below].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-start-style:solid}/*!@:host([bordered][position=bottom]) .container*/[bordered][position=bottom].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-start-style:solid}/*!@:host([bordered][selected]) .container*/[bordered][selected].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-end-style:none}/*!@:host([bordered][position=below][selected]) .container*/[bordered][position=below][selected].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-start-style:none}/*!@:host([bordered][position=bottom][selected]) .container*/[bordered][position=bottom][selected].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-start-style:none}}";
  31871. /**
  31872. * @slot - A slot for adding text.
  31873. */
  31874. class TabTitle {
  31875. constructor(hostRef) {
  31876. registerInstance(this, hostRef);
  31877. this.calciteTabsActivate = createEvent(this, "calciteTabsActivate", 6);
  31878. this.calciteInternalTabsActivate = createEvent(this, "calciteInternalTabsActivate", 6);
  31879. this.calciteInternalTabsFocusNext = createEvent(this, "calciteInternalTabsFocusNext", 6);
  31880. this.calciteInternalTabsFocusPrevious = createEvent(this, "calciteInternalTabsFocusPrevious", 6);
  31881. this.calciteInternalTabTitleRegister = createEvent(this, "calciteInternalTabTitleRegister", 6);
  31882. this.calciteInternalTabIconChanged = createEvent(this, "calciteInternalTabIconChanged", 6);
  31883. //--------------------------------------------------------------------------
  31884. //
  31885. // Properties
  31886. //
  31887. //--------------------------------------------------------------------------
  31888. /**
  31889. * When `true`, the component and its respective `calcite-tab` contents are selected.
  31890. *
  31891. * Only one tab can be selected within the `calcite-tabs` parent.
  31892. *
  31893. * @deprecated Use `selected` instead.
  31894. */
  31895. this.active = false;
  31896. /**
  31897. * When `true`, the component and its respective `calcite-tab` contents are selected.
  31898. *
  31899. * Only one tab can be selected within the `calcite-tabs` parent.
  31900. */
  31901. this.selected = false;
  31902. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  31903. this.disabled = false;
  31904. /**
  31905. * @internal
  31906. */
  31907. this.bordered = false;
  31908. //--------------------------------------------------------------------------
  31909. //
  31910. // Private State/Props
  31911. //
  31912. //--------------------------------------------------------------------------
  31913. /** watches for changing text content */
  31914. this.mutationObserver = createObserver();
  31915. /** determine if there is slotted text for styling purposes */
  31916. this.hasText = false;
  31917. this.resizeObserver = createObserver();
  31918. this.guid = `calcite-tab-title-${guid()}`;
  31919. }
  31920. activeHandler(value) {
  31921. this.selected = value;
  31922. }
  31923. selectedHandler(value) {
  31924. this.active = value;
  31925. if (this.selected) {
  31926. this.emitActiveTab(false);
  31927. }
  31928. }
  31929. //--------------------------------------------------------------------------
  31930. //
  31931. // Lifecycle
  31932. //
  31933. //--------------------------------------------------------------------------
  31934. connectedCallback() {
  31935. const { selected, active } = this;
  31936. if (selected) {
  31937. this.active = selected;
  31938. }
  31939. else if (active) {
  31940. this.activeHandler(active);
  31941. }
  31942. this.setupTextContentObserver();
  31943. this.parentTabNavEl = this.el.closest("calcite-tab-nav");
  31944. this.parentTabsEl = this.el.closest("calcite-tabs");
  31945. }
  31946. disconnectedCallback() {
  31947. var _a, _b, _c;
  31948. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  31949. // Dispatching to body in order to be listened by other elements that are still connected to the DOM.
  31950. (_b = document.body) === null || _b === void 0 ? void 0 : _b.dispatchEvent(new CustomEvent("calciteTabTitleUnregister", {
  31951. detail: this.el
  31952. }));
  31953. (_c = this.resizeObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
  31954. }
  31955. componentWillLoad() {
  31956. if (this.tab && this.selected) {
  31957. this.emitActiveTab(false);
  31958. }
  31959. }
  31960. componentWillRender() {
  31961. if (this.parentTabsEl) {
  31962. this.layout = this.parentTabsEl.layout;
  31963. this.position = this.parentTabsEl.position;
  31964. this.scale = this.parentTabsEl.scale;
  31965. this.bordered = this.parentTabsEl.bordered;
  31966. }
  31967. // handle case when tab-nav is only parent
  31968. if (!this.parentTabsEl && this.parentTabNavEl) {
  31969. this.position = getElementProp(this.parentTabNavEl, "position", this.position);
  31970. this.scale = getElementProp(this.parentTabNavEl, "scale", this.scale);
  31971. }
  31972. }
  31973. render() {
  31974. const id = this.el.id || this.guid;
  31975. const iconStartEl = (hAsync("calcite-icon", { class: "calcite-tab-title--icon icon-start", flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
  31976. const iconEndEl = (hAsync("calcite-icon", { class: "calcite-tab-title--icon icon-end", flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
  31977. return (hAsync(Host, { "aria-controls": this.controls, "aria-selected": toAriaBoolean(this.selected), id: id, role: "tab", tabIndex: this.selected ? 0 : -1 }, hAsync("div", { class: {
  31978. container: true,
  31979. "container--has-text": this.hasText
  31980. }, ref: (el) => { var _a; return (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(el); } }, this.iconStart ? iconStartEl : null, hAsync("slot", null), this.iconEnd ? iconEndEl : null)));
  31981. }
  31982. async componentDidLoad() {
  31983. this.calciteInternalTabTitleRegister.emit(await this.getTabIdentifier());
  31984. }
  31985. componentDidRender() {
  31986. updateHostInteraction(this, () => {
  31987. return this.selected;
  31988. });
  31989. }
  31990. //--------------------------------------------------------------------------
  31991. //
  31992. // Event Listeners
  31993. //
  31994. //--------------------------------------------------------------------------
  31995. internalTabChangeHandler(event) {
  31996. const targetTabsEl = event
  31997. .composedPath()
  31998. .find((el) => el.tagName === "CALCITE-TABS");
  31999. if (targetTabsEl !== this.parentTabsEl) {
  32000. return;
  32001. }
  32002. if (this.tab) {
  32003. this.selected = this.tab === event.detail.tab;
  32004. }
  32005. else {
  32006. this.getTabIndex().then((index) => {
  32007. this.selected = index === event.detail.tab;
  32008. });
  32009. }
  32010. event.stopPropagation();
  32011. }
  32012. onClick() {
  32013. this.emitActiveTab();
  32014. }
  32015. keyDownHandler(event) {
  32016. switch (event.key) {
  32017. case " ":
  32018. case "Enter":
  32019. this.emitActiveTab();
  32020. event.preventDefault();
  32021. break;
  32022. case "ArrowRight":
  32023. event.preventDefault();
  32024. if (getElementDir(this.el) === "ltr") {
  32025. this.calciteInternalTabsFocusNext.emit();
  32026. }
  32027. else {
  32028. this.calciteInternalTabsFocusPrevious.emit();
  32029. }
  32030. break;
  32031. case "ArrowLeft":
  32032. event.preventDefault();
  32033. if (getElementDir(this.el) === "ltr") {
  32034. this.calciteInternalTabsFocusPrevious.emit();
  32035. }
  32036. else {
  32037. this.calciteInternalTabsFocusNext.emit();
  32038. }
  32039. break;
  32040. }
  32041. }
  32042. //--------------------------------------------------------------------------
  32043. //
  32044. // Public Methods
  32045. //
  32046. //--------------------------------------------------------------------------
  32047. /**
  32048. * Returns the index of the title within the `calcite-tab-nav`.
  32049. */
  32050. async getTabIndex() {
  32051. return Array.prototype.indexOf.call(this.el.parentElement.querySelectorAll("calcite-tab-title"), this.el);
  32052. }
  32053. /**
  32054. * @internal
  32055. */
  32056. async getTabIdentifier() {
  32057. return this.tab ? this.tab : this.getTabIndex();
  32058. }
  32059. /**
  32060. * @param tabIds
  32061. * @param titleIds
  32062. * @internal
  32063. */
  32064. async updateAriaInfo(tabIds = [], titleIds = []) {
  32065. this.controls = tabIds[titleIds.indexOf(this.el.id)] || null;
  32066. }
  32067. updateHasText() {
  32068. this.hasText = this.el.textContent.trim().length > 0;
  32069. }
  32070. setupTextContentObserver() {
  32071. var _a;
  32072. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  32073. }
  32074. emitActiveTab(userTriggered = true) {
  32075. if (this.disabled) {
  32076. return;
  32077. }
  32078. const payload = { tab: this.tab };
  32079. this.calciteInternalTabsActivate.emit(payload);
  32080. if (userTriggered) {
  32081. this.calciteTabsActivate.emit(payload);
  32082. }
  32083. }
  32084. get el() { return getElement(this); }
  32085. static get watchers() { return {
  32086. "active": ["activeHandler"],
  32087. "selected": ["selectedHandler"]
  32088. }; }
  32089. static get style() { return tabTitleCss; }
  32090. static get cmpMeta() { return {
  32091. "$flags$": 9,
  32092. "$tagName$": "calcite-tab-title",
  32093. "$members$": {
  32094. "active": [1540],
  32095. "selected": [1540],
  32096. "disabled": [516],
  32097. "iconEnd": [513, "icon-end"],
  32098. "iconFlipRtl": [513, "icon-flip-rtl"],
  32099. "iconStart": [513, "icon-start"],
  32100. "layout": [1537],
  32101. "position": [1537],
  32102. "scale": [1537],
  32103. "bordered": [1540],
  32104. "tab": [513],
  32105. "controls": [32],
  32106. "hasText": [32],
  32107. "getTabIndex": [64],
  32108. "getTabIdentifier": [64],
  32109. "updateAriaInfo": [64]
  32110. },
  32111. "$listeners$": [[16, "calciteInternalTabChange", "internalTabChangeHandler"], [0, "click", "onClick"], [0, "keydown", "keyDownHandler"]],
  32112. "$lazyBundleId$": "-",
  32113. "$attrsToReflect$": [["active", "active"], ["selected", "selected"], ["disabled", "disabled"], ["iconEnd", "icon-end"], ["iconFlipRtl", "icon-flip-rtl"], ["iconStart", "icon-start"], ["layout", "layout"], ["position", "position"], ["scale", "scale"], ["bordered", "bordered"], ["tab", "tab"]]
  32114. }; }
  32115. }
  32116. const SLOTS$4 = {
  32117. tabNav: "tab-nav"
  32118. };
  32119. const tabsCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tabs:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tabs{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tabs{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tabs{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tabs{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tabs{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tabs:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tabs:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tabs-h{display:none}/*!@:host*/.sc-calcite-tabs-h{display:flex;flex-direction:column}/*!@:host([bordered])*/[bordered].sc-calcite-tabs-h{box-shadow:inset 0 1px 0 var(--calcite-ui-border-1);background-color:var(--calcite-ui-foreground-1)}/*!@:host([bordered]:not([position=below])) ::slotted(calcite-tab-nav)*/.sc-calcite-tabs-h[bordered]:not([position=below]) .sc-calcite-tabs-s>calcite-tab-nav{margin-block-end:-1px}/*!@:host([bordered]:not([position=bottom])) ::slotted(calcite-tab-nav)*/.sc-calcite-tabs-h[bordered]:not([position=bottom]) .sc-calcite-tabs-s>calcite-tab-nav{margin-block-end:-1px}/*!@:host([bordered][position=below]) ::slotted(calcite-tab-nav)*/.sc-calcite-tabs-h[bordered][position=below] .sc-calcite-tabs-s>calcite-tab-nav{margin-block-start:-1px}/*!@:host([bordered][position=below])*/[bordered][position=below].sc-calcite-tabs-h{box-shadow:inset 0 1px 0 var(--calcite-ui-border-1), inset 0 -1px 0 var(--calcite-ui-border-1)}/*!@:host([bordered][position=bottom])*/[bordered][position=bottom].sc-calcite-tabs-h{box-shadow:inset 0 1px 0 var(--calcite-ui-border-1), inset 0 -1px 0 var(--calcite-ui-border-1)}/*!@:host([bordered]) section*/[bordered].sc-calcite-tabs-h section.sc-calcite-tabs{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1)}/*!@:host([bordered][scale=s]) section*/[bordered][scale=s].sc-calcite-tabs-h section.sc-calcite-tabs{padding:0.75rem}/*!@:host([bordered][scale=m]) section*/[bordered][scale=m].sc-calcite-tabs-h section.sc-calcite-tabs{padding:0.5rem}/*!@:host([bordered][scale=l]) section*/[bordered][scale=l].sc-calcite-tabs-h section.sc-calcite-tabs{padding:1rem}/*!@:host([position=below])*/[position=below].sc-calcite-tabs-h{flex-direction:column-reverse}/*!@:host([position=bottom])*/[position=bottom].sc-calcite-tabs-h{flex-direction:column-reverse}/*!@section*/section.sc-calcite-tabs{display:flex;flex-grow:1;overflow:hidden;border-block-start-width:1px;border-block-start-color:var(--calcite-ui-border-1);border-block-start-style:solid}/*!@:host([position=below]) section*/[position=below].sc-calcite-tabs-h section.sc-calcite-tabs{flex-direction:column-reverse;border-block-start-width:0px;border-block-end-width:1px;border-block-end-color:var(--calcite-ui-border-1)}/*!@:host([position=bottom]) section*/[position=bottom].sc-calcite-tabs-h section.sc-calcite-tabs{flex-direction:column-reverse;border-block-start-width:0px;border-block-end-width:1px;border-block-end-color:var(--calcite-ui-border-1)}/*!@:host([position=below]:not([bordered])) section*/[position=below].sc-calcite-tabs-h:not([bordered]) section.sc-calcite-tabs{border-block-end-style:solid}/*!@:host([position=bottom]:not([bordered])) section*/[position=bottom].sc-calcite-tabs-h:not([bordered]) section.sc-calcite-tabs{border-block-end-style:solid}@media (forced-colors: active){/*!@:host([bordered]) section*/[bordered].sc-calcite-tabs-h section.sc-calcite-tabs{border-block-start-width:0px;border-block-end-width:1px}/*!@:host([position=below][bordered]) section*/[position=below][bordered].sc-calcite-tabs-h section.sc-calcite-tabs{border-block-start-width:1px;border-block-end-width:0px}/*!@:host([position=bottom][bordered]) section*/[position=bottom][bordered].sc-calcite-tabs-h section.sc-calcite-tabs{border-block-start-width:1px;border-block-end-width:0px}}";
  32120. /**
  32121. * @slot - A slot for adding `calcite-tab`s.
  32122. * @slot tab-nav - A slot for adding a `calcite-tab-nav`.
  32123. */
  32124. class Tabs {
  32125. constructor(hostRef) {
  32126. registerInstance(this, hostRef);
  32127. //--------------------------------------------------------------------------
  32128. //
  32129. // Public Properties
  32130. //
  32131. //--------------------------------------------------------------------------
  32132. /**
  32133. * Specifies the layout of the `calcite-tab-nav`, justifying the `calcite-tab-title`s to the start (`"inline"`), or across and centered (`"center"`).
  32134. */
  32135. this.layout = "inline";
  32136. /**
  32137. * Specifies the position of the component in relation to the `calcite-tab`s. The `"above"` and `"below"` values are deprecated.
  32138. *
  32139. */
  32140. this.position = "top";
  32141. /**
  32142. * Specifies the size of the component.
  32143. */
  32144. this.scale = "m";
  32145. /**
  32146. * When `true`, the component will display with a folder style menu.
  32147. */
  32148. this.bordered = false;
  32149. //--------------------------------------------------------------------------
  32150. //
  32151. // Events
  32152. //
  32153. //--------------------------------------------------------------------------
  32154. //--------------------------------------------------------------------------
  32155. //
  32156. // Private State/Props
  32157. //
  32158. //--------------------------------------------------------------------------
  32159. /**
  32160. *
  32161. * Stores an array of ids of `<calcite-tab-titles>`s to match up ARIA
  32162. * attributes.
  32163. */
  32164. this.titles = [];
  32165. /**
  32166. *
  32167. * Stores an array of ids of `<calcite-tab>`s to match up ARIA attributes.
  32168. */
  32169. this.tabs = [];
  32170. }
  32171. //--------------------------------------------------------------------------
  32172. //
  32173. // Lifecycle
  32174. //
  32175. //--------------------------------------------------------------------------
  32176. render() {
  32177. return (hAsync(Fragment, null, hAsync("slot", { name: SLOTS$4.tabNav }), hAsync("section", null, hAsync("slot", null))));
  32178. }
  32179. //--------------------------------------------------------------------------
  32180. //
  32181. // Event Listeners
  32182. //
  32183. //--------------------------------------------------------------------------
  32184. /**
  32185. * @param event
  32186. * @internal
  32187. */
  32188. calciteInternalTabTitleRegister(event) {
  32189. this.titles = [...this.titles, event.target];
  32190. this.registryHandler();
  32191. event.stopPropagation();
  32192. }
  32193. /**
  32194. * @param event
  32195. * @internal
  32196. */
  32197. calciteTabTitleUnregister(event) {
  32198. this.titles = this.titles.filter((el) => el !== event.detail);
  32199. this.registryHandler();
  32200. event.stopPropagation();
  32201. }
  32202. /**
  32203. * @param event
  32204. * @internal
  32205. */
  32206. calciteInternalTabRegister(event) {
  32207. this.tabs = [...this.tabs, event.target];
  32208. this.registryHandler();
  32209. event.stopPropagation();
  32210. }
  32211. /**
  32212. * @param event
  32213. * @internal
  32214. */
  32215. calciteTabUnregister(event) {
  32216. this.tabs = this.tabs.filter((el) => el !== event.detail);
  32217. this.registryHandler();
  32218. event.stopPropagation();
  32219. }
  32220. //--------------------------------------------------------------------------
  32221. //
  32222. // Private Methods
  32223. //
  32224. //--------------------------------------------------------------------------
  32225. /**
  32226. *
  32227. * Matches up elements from the internal `tabs` and `titles` to automatically
  32228. * update the ARIA attributes and link `<calcite-tab>` and
  32229. * `<calcite-tab-title>` components.
  32230. */
  32231. async registryHandler() {
  32232. let tabIds;
  32233. let titleIds;
  32234. // determine if we are using `tab` based or `index` based tab identifiers.
  32235. if (this.tabs.some((el) => el.tab) || this.titles.some((el) => el.tab)) {
  32236. // if we are using `tab` based identifiers sort by `tab` to account for
  32237. // possible out of order tabs and get the id of each tab
  32238. tabIds = this.tabs.sort((a, b) => a.tab.localeCompare(b.tab)).map((el) => el.id);
  32239. titleIds = this.titles.sort((a, b) => a.tab.localeCompare(b.tab)).map((el) => el.id);
  32240. }
  32241. else {
  32242. // if we are using index based tabs then the `<calcite-tab>` and
  32243. // `<calcite-tab-title>` might have been rendered out of order so the
  32244. // order of `this.tabs` and `this.titles` might not reflect the DOM state,
  32245. // and might not match each other so we need to get the index of all the
  32246. // tabs and titles in the DOM order to match them up as a source of truth
  32247. const tabDomIndexes = await Promise.all(this.tabs.map((el) => el.getTabIndex()));
  32248. const titleDomIndexes = await Promise.all(this.titles.map((el) => el.getTabIndex()));
  32249. // once we have the DOM order as a source of truth we can build the
  32250. // matching tabIds and titleIds arrays
  32251. tabIds = tabDomIndexes.reduce((ids, indexInDOM, registryIndex) => {
  32252. ids[indexInDOM] = this.tabs[registryIndex].id;
  32253. return ids;
  32254. }, []);
  32255. titleIds = titleDomIndexes.reduce((ids, indexInDOM, registryIndex) => {
  32256. ids[indexInDOM] = this.titles[registryIndex].id;
  32257. return ids;
  32258. }, []);
  32259. }
  32260. // pass all our new aria information to each `<calcite-tab>` and
  32261. // `<calcite-tab-title>` which will check if they can update their internal
  32262. // `controlled` or `labeledBy` states and re-render if necessary
  32263. this.tabs.forEach((el) => el.updateAriaInfo(tabIds, titleIds));
  32264. this.titles.forEach((el) => el.updateAriaInfo(tabIds, titleIds));
  32265. }
  32266. get el() { return getElement(this); }
  32267. static get style() { return tabsCss; }
  32268. static get cmpMeta() { return {
  32269. "$flags$": 9,
  32270. "$tagName$": "calcite-tabs",
  32271. "$members$": {
  32272. "layout": [513],
  32273. "position": [513],
  32274. "scale": [513],
  32275. "bordered": [1540],
  32276. "titles": [32],
  32277. "tabs": [32]
  32278. },
  32279. "$listeners$": [[0, "calciteInternalTabTitleRegister", "calciteInternalTabTitleRegister"], [16, "calciteTabTitleUnregister", "calciteTabTitleUnregister"], [0, "calciteInternalTabRegister", "calciteInternalTabRegister"], [16, "calciteTabUnregister", "calciteTabUnregister"]],
  32280. "$lazyBundleId$": "-",
  32281. "$attrsToReflect$": [["layout", "layout"], ["position", "position"], ["scale", "scale"], ["bordered", "bordered"]]
  32282. }; }
  32283. }
  32284. const SLOTS$3 = {
  32285. contentStart: "content-start",
  32286. contentEnd: "content-end"
  32287. };
  32288. const tileCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tile:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tile{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tile{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tile{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tile{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tile{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tile:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tile:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tile-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-tile-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-tile-h{box-sizing:border-box;display:inline-block;-webkit-user-select:none;user-select:none;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-3);transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host .container*/.sc-calcite-tile-h .container.sc-calcite-tile{pointer-events:none;display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));gap:0.5rem}/*!@:host .content*/.sc-calcite-tile-h .content.sc-calcite-tile{display:flex;flex:1 1 auto;flex-direction:column;justify-content:center;gap:0.5rem;inline-size:10%}/*!@:host .content-container*/.sc-calcite-tile-h .content-container.sc-calcite-tile{display:flex;inline-size:100%;flex:1 1 auto;align-items:stretch;padding:0px;color:var(--calcite-ui-text-2);outline-color:transparent}/*!@:host .content-slot-container*/.sc-calcite-tile-h .content-slot-container.sc-calcite-tile{display:flex;align-items:center;background-color:var(--calcite-ui-foreground-1)}/*!@:host .content-slot-container:first-child*/.sc-calcite-tile-h .content-slot-container.sc-calcite-tile:first-child{padding-inline:0 0.75rem}/*!@:host .content-slot-container:last-child*/.sc-calcite-tile-h .content-slot-container.sc-calcite-tile:last-child{padding-inline:0.75rem 0}/*!@:host .heading*/.sc-calcite-tile-h .heading.sc-calcite-tile{pointer-events:none;overflow-wrap:break-word;font-size:var(--calcite-font-size--1);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2);transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host .large-visual*/.sc-calcite-tile-h .large-visual.sc-calcite-tile{align-items:center;text-align:center;min-block-size:12rem}/*!@:host .large-visual .icon*/.sc-calcite-tile-h .large-visual.sc-calcite-tile .icon.sc-calcite-tile{display:flex;justify-content:center;align-self:flex-end}/*!@:host .large-visual .content-container*/.sc-calcite-tile-h .large-visual.sc-calcite-tile .content-container.sc-calcite-tile{align-self:center}/*!@:host .description*/.sc-calcite-tile-h .description.sc-calcite-tile{pointer-events:none;overflow-wrap:break-word;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-ui-text-3);transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host(:not([embed]))*/.sc-calcite-tile-h:not([embed]){padding:0.75rem;box-shadow:0 0 0 1px var(--calcite-ui-border-2)}/*!@:host(:not([embed])[href]:hover)*/.sc-calcite-tile-h:not([embed])[href]:hover{cursor:pointer;box-shadow:0 0 0 2px var(--calcite-ui-brand)}/*!@:host(:not([embed])[href]:active)*/.sc-calcite-tile-h:not([embed])[href]:active{box-shadow:0 0 0 3px var(--calcite-ui-brand)}/*!@:host([icon][heading]:not([description]):not([embed]))*/[icon][heading].sc-calcite-tile-h:not([description]):not([embed]){padding:0px}/*!@:host([icon][heading]:not([description])) .icon*/[icon][heading].sc-calcite-tile-h:not([description]) .icon.sc-calcite-tile{display:flex;justify-content:center}/*!@:host([icon][heading]:not([description])) .large-visual*/[icon][heading].sc-calcite-tile-h:not([description]) .large-visual.sc-calcite-tile{text-align:center}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-tile-h[disabled] .sc-calcite-tile-s>[calcite-hydrated][disabled],[disabled].sc-calcite-tile-h [calcite-hydrated][disabled].sc-calcite-tile{opacity:1}/*!@:host(:hover) .heading, \n:host([active]) .heading*/.sc-calcite-tile-h:hover .heading.sc-calcite-tile,[active].sc-calcite-tile-h .heading.sc-calcite-tile{color:var(--calcite-ui-text-1)}/*!@:host(:hover) .description, \n:host([active]) .description*/.sc-calcite-tile-h:hover .description.sc-calcite-tile,[active].sc-calcite-tile-h .description.sc-calcite-tile{color:var(--calcite-ui-text-2)}";
  32289. /**
  32290. * @slot content-start - A slot for adding non-actionable elements before the component's content.
  32291. * @slot content-end - A slot for adding non-actionable elements after the component's content.
  32292. */
  32293. class Tile {
  32294. constructor(hostRef) {
  32295. registerInstance(this, hostRef);
  32296. //--------------------------------------------------------------------------
  32297. //
  32298. // Properties
  32299. //
  32300. //--------------------------------------------------------------------------
  32301. /**
  32302. * When `true`, the component is active.
  32303. */
  32304. this.active = false;
  32305. /**
  32306. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  32307. */
  32308. this.disabled = false;
  32309. /**
  32310. * The component's embed mode.
  32311. *
  32312. * When `true`, renders without a border and padding for use by other components.
  32313. */
  32314. this.embed = false;
  32315. /**
  32316. * The focused state of the component.
  32317. *
  32318. * @internal
  32319. */
  32320. this.focused = false;
  32321. /** When `true`, the component is not displayed and is not focusable. */
  32322. this.hidden = false;
  32323. }
  32324. // --------------------------------------------------------------------------
  32325. //
  32326. // Lifecycle
  32327. //
  32328. // --------------------------------------------------------------------------
  32329. connectedCallback() {
  32330. connectConditionalSlotComponent(this);
  32331. }
  32332. disconnectedCallback() {
  32333. disconnectConditionalSlotComponent(this);
  32334. }
  32335. componentDidRender() {
  32336. updateHostInteraction(this);
  32337. }
  32338. // --------------------------------------------------------------------------
  32339. //
  32340. // Render Methods
  32341. //
  32342. // --------------------------------------------------------------------------
  32343. renderTile() {
  32344. const { icon, el, heading, description } = this;
  32345. const isLargeVisual = heading && icon && !description;
  32346. const iconStyle = isLargeVisual
  32347. ? {
  32348. height: "64px",
  32349. width: "64px"
  32350. }
  32351. : undefined;
  32352. return (hAsync("div", { class: { container: true, "large-visual": isLargeVisual } }, icon && (hAsync("div", { class: "icon" }, hAsync("calcite-icon", { icon: icon, scale: "l", style: iconStyle }))), hAsync("div", { class: "content-container" }, getSlotted(el, SLOTS$3.contentStart) ? (hAsync("div", { class: "content-slot-container" }, hAsync("slot", { name: SLOTS$3.contentStart }))) : null, hAsync("div", { class: "content" }, heading && hAsync("div", { class: "heading" }, heading), description && hAsync("div", { class: "description" }, description)), getSlotted(el, SLOTS$3.contentEnd) ? (hAsync("div", { class: "content-slot-container" }, hAsync("slot", { name: SLOTS$3.contentEnd }))) : null)));
  32353. }
  32354. render() {
  32355. return (hAsync(Fragment, null, this.href ? (hAsync("calcite-link", { disabled: this.disabled, href: this.href }, this.renderTile())) : (this.renderTile())));
  32356. }
  32357. get el() { return getElement(this); }
  32358. static get style() { return tileCss; }
  32359. static get cmpMeta() { return {
  32360. "$flags$": 9,
  32361. "$tagName$": "calcite-tile",
  32362. "$members$": {
  32363. "active": [516],
  32364. "description": [513],
  32365. "disabled": [516],
  32366. "embed": [516],
  32367. "focused": [516],
  32368. "heading": [513],
  32369. "hidden": [516],
  32370. "href": [513],
  32371. "icon": [513]
  32372. },
  32373. "$listeners$": undefined,
  32374. "$lazyBundleId$": "-",
  32375. "$attrsToReflect$": [["active", "active"], ["description", "description"], ["disabled", "disabled"], ["embed", "embed"], ["focused", "focused"], ["heading", "heading"], ["hidden", "hidden"], ["href", "href"], ["icon", "icon"]]
  32376. }; }
  32377. }
  32378. const CSS$6 = {
  32379. checked: "checked",
  32380. description: "description",
  32381. descriptionOnly: "description-only",
  32382. disabled: "disabled",
  32383. heading: "heading",
  32384. headingOnly: "heading-only",
  32385. icon: "icon",
  32386. iconOnly: "icon-only",
  32387. inputAlignmentEnd: "input-alignment-end",
  32388. inputAlignmentStart: "input-alignment-start",
  32389. inputEnabled: "input-enabled",
  32390. largeVisual: "large-visual",
  32391. widthAuto: "width-auto",
  32392. widthFull: "width-full"
  32393. };
  32394. const tileSelectCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tile-select:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tile-select{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tile-select{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tile-select{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tile-select{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tile-select{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tile-select:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tile-select:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tile-select-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-tile-select-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-tile-select-h{display:block}/*!@:host .container*/.sc-calcite-tile-select-h .container.sc-calcite-tile-select{background-color:var(--calcite-ui-foreground-1);box-shadow:0 0 0 1px var(--calcite-ui-border-2);box-sizing:border-box;cursor:pointer;display:inline-block;block-size:100%;max-inline-size:300px;padding:0.75rem;position:relative;vertical-align:top;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@:host .container.checked*/.sc-calcite-tile-select-h .container.checked.sc-calcite-tile-select{z-index:1;box-shadow:0 0 0 1px var(--calcite-ui-brand)}/*!@:host .container.heading-only*/.sc-calcite-tile-select-h .container.heading-only.sc-calcite-tile-select{align-items:center}/*!@:host .container:not(.input-enabled) ::slotted(calcite-checkbox), \n:host .container:not(.input-enabled) ::slotted(calcite-radio-button)*/.sc-calcite-tile-select-h .container:not(.input-enabled) .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container:not(.input-enabled) .sc-calcite-tile-select-s>calcite-radio-button{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}/*!@:host .container.focused*/.sc-calcite-tile-select-h .container.focused.sc-calcite-tile-select{outline-color:transparent}/*!@:host .container.focused:not(.disabled):not(.input-enabled)*/.sc-calcite-tile-select-h .container.focused.sc-calcite-tile-select:not(.disabled):not(.input-enabled){outline:2px solid var(--calcite-ui-brand);outline-offset:-4px;box-shadow:0 0 0 1px var(--calcite-ui-brand), inset 0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host .container.input-enabled.input-alignment-start.width-auto.heading-only, :host .container.input-enabled.input-alignment-start.width-auto.icon-only, :host .container.input-enabled.input-alignment-start.width-auto.description-only, :host .container.input-enabled.input-alignment-start.width-auto.heading.description, :host .container.input-enabled.input-alignment-start.width-auto.icon.description, :host .container.input-enabled.input-alignment-start.width-auto.heading.icon.description*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.width-auto.heading-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.width-auto.icon-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.width-auto.description-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.width-auto.heading.description.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.width-auto.icon.description.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.width-auto.heading.icon.description.sc-calcite-tile-select{display:inline-grid;grid-template-columns:max-content 1fr}/*!@:host .container.input-enabled.input-alignment-start.heading-only, :host .container.input-enabled.input-alignment-start.icon-only, :host .container.input-enabled.input-alignment-start.description-only, :host .container.input-enabled.input-alignment-start.heading.description, :host .container.input-enabled.input-alignment-start.icon.description, :host .container.input-enabled.input-alignment-start.heading.icon.description*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.heading-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.icon-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.description-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.heading.description.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.icon.description.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.heading.icon.description.sc-calcite-tile-select{gap:0.75rem}/*!@:host .container.input-enabled.input-alignment-start calcite-tile*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.sc-calcite-tile-select calcite-tile.sc-calcite-tile-select{order:1}/*!@:host .container.input-enabled.input-alignment-start.large-visual ::slotted(calcite-checkbox),\n:host .container.input-enabled.input-alignment-start.large-visual ::slotted(calcite-radio-button)*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.large-visual .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-start.large-visual .sc-calcite-tile-select-s>calcite-radio-button{position:absolute;inset-block-start:0.75rem;inset-inline-start:0.75rem}/*!@:host .container.input-enabled.input-alignment-end.width-auto.heading-only, :host .container.input-enabled.input-alignment-end.width-auto.icon-only*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.width-auto.heading-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.width-auto.icon-only.sc-calcite-tile-select{display:inline-grid;grid-gap:0.75rem;grid-template-columns:max-content 1fr}/*!@:host .container.input-enabled.input-alignment-end.heading-only, :host .container.input-enabled.input-alignment-end.icon-only*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.heading-only.sc-calcite-tile-select,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.icon-only.sc-calcite-tile-select{gap:0.75rem}/*!@:host .container.input-enabled.input-alignment-end.description-only ::slotted(calcite-checkbox),\n:host .container.input-enabled.input-alignment-end.description-only ::slotted(calcite-radio-button), :host .container.input-enabled.input-alignment-end.heading.description ::slotted(calcite-checkbox),\n:host .container.input-enabled.input-alignment-end.heading.description ::slotted(calcite-radio-button), :host .container.input-enabled.input-alignment-end.icon.description ::slotted(calcite-checkbox),\n:host .container.input-enabled.input-alignment-end.icon.description ::slotted(calcite-radio-button), :host .container.input-enabled.input-alignment-end.heading.icon.description ::slotted(calcite-checkbox),\n:host .container.input-enabled.input-alignment-end.heading.icon.description ::slotted(calcite-radio-button)*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.description-only .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.description-only .sc-calcite-tile-select-s>calcite-radio-button,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.heading.description .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.heading.description .sc-calcite-tile-select-s>calcite-radio-button,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.icon.description .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.icon.description .sc-calcite-tile-select-s>calcite-radio-button,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.heading.icon.description .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.heading.icon.description .sc-calcite-tile-select-s>calcite-radio-button{position:absolute;inset-block-start:0.75rem;inset-inline-end:0.75rem}/*!@:host .container.input-enabled.input-alignment-end.large-visual ::slotted(calcite-checkbox),\n:host .container.input-enabled.input-alignment-end.large-visual ::slotted(calcite-radio-button)*/.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.large-visual .sc-calcite-tile-select-s>calcite-checkbox,.sc-calcite-tile-select-h .container.input-enabled.input-alignment-end.large-visual .sc-calcite-tile-select-s>calcite-radio-button{position:absolute;inset-block-start:0.75rem;inset-inline-end:0.75rem}/*!@:host .container.width-full*/.sc-calcite-tile-select-h .container.width-full.sc-calcite-tile-select{display:flex;max-inline-size:none}/*!@:host .container.width-full calcite-tile*/.sc-calcite-tile-select-h .container.width-full.sc-calcite-tile-select calcite-tile.sc-calcite-tile-select{flex:1 1 auto}/*!@:host(:hover) .container:not(.input-enabled)*/.sc-calcite-tile-select-h:hover .container.sc-calcite-tile-select:not(.input-enabled){box-shadow:0 0 0 1px var(--calcite-ui-brand)}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-tile-select-h[disabled] .sc-calcite-tile-select-s>[calcite-hydrated][disabled],[disabled].sc-calcite-tile-select-h [calcite-hydrated][disabled].sc-calcite-tile-select{opacity:1}";
  32395. /**
  32396. * @slot - A slot for adding custom content.
  32397. */
  32398. class TileSelect {
  32399. constructor(hostRef) {
  32400. registerInstance(this, hostRef);
  32401. this.calciteTileSelectChange = createEvent(this, "calciteTileSelectChange", 6);
  32402. //--------------------------------------------------------------------------
  32403. //
  32404. // Properties
  32405. //
  32406. //--------------------------------------------------------------------------
  32407. /** When `true`, the component is checked. */
  32408. this.checked = false;
  32409. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  32410. this.disabled = false;
  32411. /** When `true`, the component is not displayed and is not focusable or checkable. */
  32412. this.hidden = false;
  32413. /** When `true`, displays an interactive input based on the `type` property. */
  32414. this.inputEnabled = false;
  32415. /** When `inputEnabled` is `true`, specifies the placement of the interactive input on the component. */
  32416. this.inputAlignment = "start";
  32417. /**
  32418. * The selection mode of the component.
  32419. *
  32420. * Use radio for single selection, and checkbox for multiple selections.
  32421. */
  32422. this.type = "radio";
  32423. /** Specifies the width of the component. */
  32424. this.width = "auto";
  32425. this.guid = `calcite-tile-select-${guid()}`;
  32426. //--------------------------------------------------------------------------
  32427. //
  32428. // State
  32429. //
  32430. //--------------------------------------------------------------------------
  32431. /** The focused state of the tile-select. */
  32432. this.focused = false;
  32433. }
  32434. checkedChanged(newChecked) {
  32435. this.input.checked = newChecked;
  32436. }
  32437. nameChanged(newName) {
  32438. this.input.name = newName;
  32439. }
  32440. //--------------------------------------------------------------------------
  32441. //
  32442. // Public Methods
  32443. //
  32444. //--------------------------------------------------------------------------
  32445. /** Sets focus on the component. */
  32446. async setFocus() {
  32447. var _a;
  32448. (_a = this.input) === null || _a === void 0 ? void 0 : _a.setFocus();
  32449. }
  32450. //--------------------------------------------------------------------------
  32451. //
  32452. // Event Listeners
  32453. //
  32454. //--------------------------------------------------------------------------
  32455. checkboxChangeHandler(event) {
  32456. const checkbox = event.target;
  32457. if (checkbox === this.input) {
  32458. this.checked = checkbox.checked;
  32459. }
  32460. event.stopPropagation();
  32461. this.calciteTileSelectChange.emit();
  32462. }
  32463. checkboxFocusBlurHandler(event) {
  32464. const checkbox = event.target;
  32465. if (checkbox === this.input) {
  32466. this.focused = event.detail;
  32467. }
  32468. event.stopPropagation();
  32469. }
  32470. radioButtonChangeHandler(event) {
  32471. const radioButton = event.target;
  32472. if (radioButton === this.input) {
  32473. this.checked = radioButton.checked;
  32474. }
  32475. event.stopPropagation();
  32476. this.calciteTileSelectChange.emit();
  32477. }
  32478. radioButtonCheckedChangeHandler(event) {
  32479. const radioButton = event.target;
  32480. if (radioButton === this.input) {
  32481. this.checked = radioButton.checked;
  32482. }
  32483. event.stopPropagation();
  32484. }
  32485. radioButtonFocusBlurHandler(event) {
  32486. const radioButton = event.target;
  32487. if (radioButton === this.input) {
  32488. this.focused = radioButton.focused;
  32489. }
  32490. event.stopPropagation();
  32491. }
  32492. click(event) {
  32493. const target = event.target;
  32494. const targets = ["calcite-tile", "calcite-tile-select"];
  32495. if (targets.includes(target.localName)) {
  32496. this.input.click();
  32497. }
  32498. }
  32499. mouseenter() {
  32500. if (this.input.localName === "calcite-radio-button") {
  32501. this.input.hovered = true;
  32502. }
  32503. if (this.input.localName === "calcite-checkbox") {
  32504. this.input.hovered = true;
  32505. }
  32506. }
  32507. mouseleave() {
  32508. if (this.input.localName === "calcite-radio-button") {
  32509. this.input.hovered = false;
  32510. }
  32511. if (this.input.localName === "calcite-checkbox") {
  32512. this.input.hovered = false;
  32513. }
  32514. }
  32515. //--------------------------------------------------------------------------
  32516. //
  32517. // Lifecycle
  32518. //
  32519. //--------------------------------------------------------------------------
  32520. connectedCallback() {
  32521. this.renderInput();
  32522. }
  32523. disconnectedCallback() {
  32524. this.input.parentNode.removeChild(this.input);
  32525. }
  32526. componentDidRender() {
  32527. updateHostInteraction(this);
  32528. }
  32529. // --------------------------------------------------------------------------
  32530. //
  32531. // Render Methods
  32532. //
  32533. // --------------------------------------------------------------------------
  32534. renderInput() {
  32535. this.input = document.createElement(this.type === "radio" ? "calcite-radio-button" : "calcite-checkbox");
  32536. this.input.checked = this.checked;
  32537. this.input.disabled = this.disabled;
  32538. this.input.hidden = this.hidden;
  32539. this.input.id = this.guid;
  32540. this.input.label = this.heading || this.name || "";
  32541. if (this.name) {
  32542. this.input.name = this.name;
  32543. }
  32544. if (this.value) {
  32545. this.input.value = this.value != null ? this.value.toString() : "";
  32546. }
  32547. this.el.insertAdjacentElement("beforeend", this.input);
  32548. }
  32549. render() {
  32550. const { checked, description, disabled, focused, heading, icon, inputAlignment, inputEnabled, width } = this;
  32551. return (hAsync("div", { class: {
  32552. checked,
  32553. container: true,
  32554. [CSS$6.description]: Boolean(description),
  32555. [CSS$6.descriptionOnly]: Boolean(!heading && !icon && description),
  32556. disabled,
  32557. focused,
  32558. [CSS$6.heading]: Boolean(heading),
  32559. [CSS$6.headingOnly]: heading && !icon && !description,
  32560. [CSS$6.icon]: Boolean(icon),
  32561. [CSS$6.iconOnly]: !heading && icon && !description,
  32562. [CSS$6.inputAlignmentEnd]: inputAlignment === "end",
  32563. [CSS$6.inputAlignmentStart]: inputAlignment === "start",
  32564. [CSS$6.inputEnabled]: inputEnabled,
  32565. [CSS$6.largeVisual]: heading && icon && !description,
  32566. [CSS$6.widthAuto]: width === "auto",
  32567. [CSS$6.widthFull]: width === "full"
  32568. } }, hAsync("calcite-tile", { active: checked, description: description, embed: true, heading: heading, icon: icon }), hAsync("slot", null)));
  32569. }
  32570. get el() { return getElement(this); }
  32571. static get watchers() { return {
  32572. "checked": ["checkedChanged"],
  32573. "name": ["nameChanged"]
  32574. }; }
  32575. static get style() { return tileSelectCss; }
  32576. static get cmpMeta() { return {
  32577. "$flags$": 9,
  32578. "$tagName$": "calcite-tile-select",
  32579. "$members$": {
  32580. "checked": [1540],
  32581. "description": [513],
  32582. "disabled": [516],
  32583. "heading": [513],
  32584. "hidden": [516],
  32585. "icon": [513],
  32586. "name": [520],
  32587. "inputEnabled": [516, "input-enabled"],
  32588. "inputAlignment": [513, "input-alignment"],
  32589. "type": [513],
  32590. "value": [8],
  32591. "width": [513],
  32592. "focused": [32],
  32593. "setFocus": [64]
  32594. },
  32595. "$listeners$": [[0, "calciteCheckboxChange", "checkboxChangeHandler"], [0, "calciteInternalCheckboxFocus", "checkboxFocusBlurHandler"], [0, "calciteInternalCheckboxBlur", "checkboxFocusBlurHandler"], [0, "calciteRadioButtonChange", "radioButtonChangeHandler"], [0, "calciteInternalRadioButtonCheckedChange", "radioButtonCheckedChangeHandler"], [0, "calciteInternalRadioButtonFocus", "radioButtonFocusBlurHandler"], [0, "calciteInternalRadioButtonBlur", "radioButtonFocusBlurHandler"], [0, "click", "click"], [1, "pointerenter", "mouseenter"], [1, "pointerleave", "mouseleave"]],
  32596. "$lazyBundleId$": "-",
  32597. "$attrsToReflect$": [["checked", "checked"], ["description", "description"], ["disabled", "disabled"], ["heading", "heading"], ["hidden", "hidden"], ["icon", "icon"], ["name", "name"], ["inputEnabled", "input-enabled"], ["inputAlignment", "input-alignment"], ["type", "type"], ["width", "width"]]
  32598. }; }
  32599. }
  32600. const tileSelectGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tile-select-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tile-select-group{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tile-select-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tile-select-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tile-select-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tile-select-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tile-select-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tile-select-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tile-select-group-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-tile-select-group-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-tile-select-group-h{display:flex;flex-wrap:wrap}/*!@:host ::slotted(calcite-tile-select)*/.sc-calcite-tile-select-group-h .sc-calcite-tile-select-group-s>calcite-tile-select{margin-block-end:1px;margin-inline-end:1px}/*!@:host([layout=vertical])*/[layout=vertical].sc-calcite-tile-select-group-h{flex-direction:column}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-tile-select-group-h[disabled] .sc-calcite-tile-select-group-s>[calcite-hydrated][disabled],[disabled].sc-calcite-tile-select-group-h [calcite-hydrated][disabled].sc-calcite-tile-select-group{opacity:1}";
  32601. /**
  32602. * @slot - A slot for adding `calcite-tile-select`s.
  32603. */
  32604. class TileSelectGroup {
  32605. constructor(hostRef) {
  32606. registerInstance(this, hostRef);
  32607. //--------------------------------------------------------------------------
  32608. //
  32609. // Properties
  32610. //
  32611. //--------------------------------------------------------------------------
  32612. /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
  32613. this.disabled = false;
  32614. /**
  32615. * Defines the layout of the component.
  32616. *
  32617. * Use `"horizontal"` for rows, and `"vertical"` for a single column.
  32618. */
  32619. this.layout = "horizontal";
  32620. }
  32621. //--------------------------------------------------------------------------
  32622. //
  32623. // Lifecycle
  32624. //
  32625. //--------------------------------------------------------------------------
  32626. componentDidRender() {
  32627. updateHostInteraction(this);
  32628. }
  32629. render() {
  32630. return hAsync("slot", null);
  32631. }
  32632. get el() { return getElement(this); }
  32633. static get style() { return tileSelectGroupCss; }
  32634. static get cmpMeta() { return {
  32635. "$flags$": 9,
  32636. "$tagName$": "calcite-tile-select-group",
  32637. "$members$": {
  32638. "disabled": [516],
  32639. "layout": [513]
  32640. },
  32641. "$listeners$": undefined,
  32642. "$lazyBundleId$": "-",
  32643. "$attrsToReflect$": [["disabled", "disabled"], ["layout", "layout"]]
  32644. }; }
  32645. }
  32646. const CSS$5 = {
  32647. button: "button",
  32648. buttonBottomLeft: "button--bottom-left",
  32649. buttonBottomRight: "button--bottom-right",
  32650. buttonHourDown: "button--hour-down",
  32651. buttonHourUp: "button--hour-up",
  32652. buttonMeridiemDown: "button--meridiem-down",
  32653. buttonMeridiemUp: "button--meridiem-up",
  32654. buttonMinuteDown: "button--minute-down",
  32655. buttonMinuteUp: "button--minute-up",
  32656. buttonSecondDown: "button--second-down",
  32657. buttonSecondUp: "button--second-up",
  32658. buttonTopLeft: "button--top-left",
  32659. buttonTopRight: "button--top-right",
  32660. column: "column",
  32661. delimiter: "delimiter",
  32662. hour: "hour",
  32663. input: "input",
  32664. meridiem: "meridiem",
  32665. minute: "minute",
  32666. second: "second",
  32667. showMeridiem: "show-meridiem",
  32668. showSecond: "show-second",
  32669. "scale-s": "scale-s",
  32670. "scale-m": "scale-m",
  32671. "scale-l": "scale-l",
  32672. timePicker: "time-picker",
  32673. meridiemStart: "meridiem--start"
  32674. };
  32675. const TEXT$2 = {
  32676. hour: "Hour",
  32677. hourDown: "Decrease hour",
  32678. hourUp: "Increase hour",
  32679. meridiem: "AM/PM",
  32680. meridiemDown: "Decrease AM/PM",
  32681. meridiemUp: "Increase AM/PM",
  32682. minute: "Minute",
  32683. minuteDown: "Decrease minute",
  32684. minuteUp: "Increase minute",
  32685. second: "Second",
  32686. secondDown: "Decrease second",
  32687. secondUp: "Increase second"
  32688. };
  32689. const timePickerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-time-picker:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-time-picker{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-time-picker{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-time-picker{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-time-picker{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-time-picker{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-time-picker:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-time-picker:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-time-picker-h{display:none}/*!@:host*/.sc-calcite-time-picker-h{display:inline-block}/*!@.time-picker*/.time-picker.sc-calcite-time-picker{display:flex;-webkit-user-select:none;user-select:none;align-items:center;background-color:var(--calcite-ui-foreground-1);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-radius:var(--calcite-border-radius)}/*!@.time-picker .column*/.time-picker.sc-calcite-time-picker .column.sc-calcite-time-picker{display:flex;flex-direction:column}/*!@.time-picker .meridiem--start*/.time-picker.sc-calcite-time-picker .meridiem--start.sc-calcite-time-picker{order:-1}/*!@.time-picker .button*/.time-picker.sc-calcite-time-picker .button.sc-calcite-time-picker{display:inline-flex;cursor:pointer;align-items:center;justify-content:center;background-color:var(--calcite-ui-foreground-1)}/*!@.time-picker .button:hover, .time-picker .button:focus*/.time-picker.sc-calcite-time-picker .button.sc-calcite-time-picker:hover,.time-picker.sc-calcite-time-picker .button.sc-calcite-time-picker:focus{background-color:var(--calcite-ui-foreground-2);outline:2px solid transparent;outline-offset:2px}/*!@.time-picker .button:active*/.time-picker.sc-calcite-time-picker .button.sc-calcite-time-picker:active{background-color:var(--calcite-ui-foreground-3)}/*!@.time-picker .button.top-left*/.time-picker.sc-calcite-time-picker .button.top-left.sc-calcite-time-picker{border-start-start-radius:var(--calcite-border-radius)}/*!@.time-picker .button.bottom-left*/.time-picker.sc-calcite-time-picker .button.bottom-left.sc-calcite-time-picker{border-end-start-radius:var(--calcite-border-radius)}/*!@.time-picker .button.top-right*/.time-picker.sc-calcite-time-picker .button.top-right.sc-calcite-time-picker{border-start-end-radius:var(--calcite-border-radius)}/*!@.time-picker .button.bottom-right*/.time-picker.sc-calcite-time-picker .button.bottom-right.sc-calcite-time-picker{border-end-end-radius:var(--calcite-border-radius)}/*!@.time-picker .button calcite-icon*/.time-picker.sc-calcite-time-picker .button.sc-calcite-time-picker calcite-icon.sc-calcite-time-picker{color:var(--calcite-ui-text-3)}/*!@.time-picker .input*/.time-picker.sc-calcite-time-picker .input.sc-calcite-time-picker{display:inline-flex;cursor:pointer;align-items:center;justify-content:center;background-color:var(--calcite-ui-foreground-1);font-weight:var(--calcite-font-weight-medium)}/*!@.time-picker .input:hover*/.time-picker.sc-calcite-time-picker .input.sc-calcite-time-picker:hover{box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-2)}/*!@.time-picker .input:focus, .time-picker .input:hover:focus*/.time-picker.sc-calcite-time-picker .input.sc-calcite-time-picker:focus,.time-picker.sc-calcite-time-picker .input.sc-calcite-time-picker:hover:focus{outline:2px solid transparent;outline-offset:2px;box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@.time-picker.scale-s*/.time-picker.scale-s.sc-calcite-time-picker{font-size:var(--calcite-font-size--1)}/*!@.time-picker.scale-s .button, \n.time-picker.scale-s .input*/.time-picker.scale-s.sc-calcite-time-picker .button.sc-calcite-time-picker,.time-picker.scale-s.sc-calcite-time-picker .input.sc-calcite-time-picker{padding-inline:0.75rem;padding-block:0.25rem}/*!@.time-picker.scale-s:not(.show-meridiem) .delimiter:last-child*/.time-picker.scale-s.sc-calcite-time-picker:not(.show-meridiem) .delimiter.sc-calcite-time-picker:last-child{padding-inline-end:0.75rem}/*!@.time-picker.scale-m*/.time-picker.scale-m.sc-calcite-time-picker{font-size:var(--calcite-font-size-0)}/*!@.time-picker.scale-m .button, \n.time-picker.scale-m .input*/.time-picker.scale-m.sc-calcite-time-picker .button.sc-calcite-time-picker,.time-picker.scale-m.sc-calcite-time-picker .input.sc-calcite-time-picker{padding-inline:1rem;padding-block:0.5rem}/*!@.time-picker.scale-m:not(.show-meridiem) .delimiter:last-child*/.time-picker.scale-m.sc-calcite-time-picker:not(.show-meridiem) .delimiter.sc-calcite-time-picker:last-child{padding-inline-end:1rem}/*!@.time-picker.scale-l*/.time-picker.scale-l.sc-calcite-time-picker{font-size:var(--calcite-font-size-1)}/*!@.time-picker.scale-l .button, \n.time-picker.scale-l .input*/.time-picker.scale-l.sc-calcite-time-picker .button.sc-calcite-time-picker,.time-picker.scale-l.sc-calcite-time-picker .input.sc-calcite-time-picker{padding-inline:1.25rem;padding-block:0.75rem}/*!@.time-picker.scale-l:not(.show-meridiem) .delimiter:last-child*/.time-picker.scale-l.sc-calcite-time-picker:not(.show-meridiem) .delimiter.sc-calcite-time-picker:last-child{padding-inline-end:1.25rem}";
  32690. function capitalize(str) {
  32691. return str.charAt(0).toUpperCase() + str.slice(1);
  32692. }
  32693. class TimePicker {
  32694. constructor(hostRef) {
  32695. registerInstance(this, hostRef);
  32696. this.calciteInternalTimePickerBlur = createEvent(this, "calciteInternalTimePickerBlur", 6);
  32697. this.calciteInternalTimePickerChange = createEvent(this, "calciteInternalTimePickerChange", 6);
  32698. this.calciteInternalTimePickerFocus = createEvent(this, "calciteInternalTimePickerFocus", 6);
  32699. //--------------------------------------------------------------------------
  32700. //
  32701. // Properties
  32702. //
  32703. //--------------------------------------------------------------------------
  32704. /**
  32705. * Accessible name for the component's hour input.
  32706. *
  32707. * @default "Hour"
  32708. */
  32709. this.intlHour = TEXT$2.hour;
  32710. /**
  32711. * Accessible name for the component's hour down button.
  32712. *
  32713. * @default "Decrease hour"
  32714. */
  32715. this.intlHourDown = TEXT$2.hourDown;
  32716. /**
  32717. * Accessible name for the component's hour up button.
  32718. *
  32719. * @default "Increase hour"
  32720. */
  32721. this.intlHourUp = TEXT$2.hourUp;
  32722. /**
  32723. * Accessible name for the component's meridiem (AM/PM) input.
  32724. *
  32725. * @default "AM/PM"
  32726. */
  32727. this.intlMeridiem = TEXT$2.meridiem;
  32728. /**
  32729. * Accessible name for the component's meridiem (AM/PM) down button.
  32730. *
  32731. * @default "Decrease AM/PM"
  32732. */
  32733. this.intlMeridiemDown = TEXT$2.meridiemDown;
  32734. /**
  32735. * Accessible name for the component's meridiem (AM/PM) up button.
  32736. *
  32737. * @default "Increase AM/PM"
  32738. */
  32739. this.intlMeridiemUp = TEXT$2.meridiemUp;
  32740. /**
  32741. * Accessible name for the component's minute input.
  32742. *
  32743. * @default "Minute"
  32744. */
  32745. this.intlMinute = TEXT$2.minute;
  32746. /**
  32747. * Accessible name for the component's minute down button.
  32748. *
  32749. * @default "Decrease minute"
  32750. */
  32751. this.intlMinuteDown = TEXT$2.minuteDown;
  32752. /**
  32753. * Accessible name for the component's minute up button.
  32754. *
  32755. * @default "Increase minute"
  32756. */
  32757. this.intlMinuteUp = TEXT$2.minuteUp;
  32758. /**
  32759. * Accessible name for the component's second input.
  32760. *
  32761. * @default "Second"
  32762. */
  32763. this.intlSecond = TEXT$2.second;
  32764. /**
  32765. * Accessible name for the component's second down button.
  32766. *
  32767. * @default "Decrease second"
  32768. */
  32769. this.intlSecondDown = TEXT$2.secondDown;
  32770. /**
  32771. * Accessible name for the component's second up button.
  32772. *
  32773. * @default "Increase second"
  32774. */
  32775. this.intlSecondUp = TEXT$2.secondUp;
  32776. /** Specifies the size of the component. */
  32777. this.scale = "m";
  32778. /** Specifies the granularity the `value` must adhere to (in seconds). */
  32779. this.step = 60;
  32780. /** The component's value in UTC (always 24-hour format). */
  32781. this.value = null;
  32782. // --------------------------------------------------------------------------
  32783. //
  32784. // State
  32785. //
  32786. // --------------------------------------------------------------------------
  32787. this.effectiveLocale = "";
  32788. this.showSecond = this.step < 60;
  32789. this.decrementHour = () => {
  32790. const newHour = !this.hour ? 0 : this.hour === "00" ? 23 : parseInt(this.hour) - 1;
  32791. this.setValuePart("hour", newHour);
  32792. };
  32793. this.decrementMeridiem = () => {
  32794. const newMeridiem = this.meridiem === "PM" ? "AM" : "PM";
  32795. this.setValuePart("meridiem", newMeridiem);
  32796. };
  32797. this.decrementMinuteOrSecond = (key) => {
  32798. let newValue;
  32799. if (isValidNumber(this[key])) {
  32800. const valueAsNumber = parseInt(this[key]);
  32801. newValue = valueAsNumber === 0 ? 59 : valueAsNumber - 1;
  32802. }
  32803. else {
  32804. newValue = 59;
  32805. }
  32806. this.setValuePart(key, newValue);
  32807. };
  32808. this.decrementMinute = () => {
  32809. this.decrementMinuteOrSecond("minute");
  32810. };
  32811. this.decrementSecond = () => {
  32812. this.decrementMinuteOrSecond("second");
  32813. };
  32814. this.focusHandler = (event) => {
  32815. this.activeEl = event.currentTarget;
  32816. };
  32817. this.hourDownButtonKeyDownHandler = (event) => {
  32818. if (this.buttonActivated(event)) {
  32819. this.decrementHour();
  32820. }
  32821. };
  32822. this.hourKeyDownHandler = (event) => {
  32823. const { key } = event;
  32824. if (numberKeys.includes(key)) {
  32825. const keyAsNumber = parseInt(key);
  32826. let newHour;
  32827. if (isValidNumber(this.hour)) {
  32828. switch (this.hourCycle) {
  32829. case "12":
  32830. newHour =
  32831. this.hour === "01" && keyAsNumber >= 0 && keyAsNumber <= 2
  32832. ? `1${keyAsNumber}`
  32833. : keyAsNumber;
  32834. break;
  32835. case "24":
  32836. if (this.hour === "01") {
  32837. newHour = `1${keyAsNumber}`;
  32838. }
  32839. else if (this.hour === "02" && keyAsNumber >= 0 && keyAsNumber <= 3) {
  32840. newHour = `2${keyAsNumber}`;
  32841. }
  32842. else {
  32843. newHour = keyAsNumber;
  32844. }
  32845. break;
  32846. }
  32847. }
  32848. else {
  32849. newHour = keyAsNumber;
  32850. }
  32851. this.setValuePart("hour", newHour);
  32852. }
  32853. else {
  32854. switch (key) {
  32855. case "Backspace":
  32856. case "Delete":
  32857. this.setValuePart("hour", null);
  32858. break;
  32859. case "ArrowDown":
  32860. event.preventDefault();
  32861. this.decrementHour();
  32862. break;
  32863. case "ArrowUp":
  32864. event.preventDefault();
  32865. this.incrementHour();
  32866. break;
  32867. case " ":
  32868. event.preventDefault();
  32869. break;
  32870. }
  32871. }
  32872. };
  32873. this.hourUpButtonKeyDownHandler = (event) => {
  32874. if (this.buttonActivated(event)) {
  32875. this.incrementHour();
  32876. }
  32877. };
  32878. this.incrementMeridiem = () => {
  32879. const newMeridiem = this.meridiem === "AM" ? "PM" : "AM";
  32880. this.setValuePart("meridiem", newMeridiem);
  32881. };
  32882. this.incrementHour = () => {
  32883. const newHour = isValidNumber(this.hour)
  32884. ? this.hour === "23"
  32885. ? 0
  32886. : parseInt(this.hour) + 1
  32887. : 1;
  32888. this.setValuePart("hour", newHour);
  32889. };
  32890. this.incrementMinuteOrSecond = (key) => {
  32891. const newValue = isValidNumber(this[key])
  32892. ? this[key] === "59"
  32893. ? 0
  32894. : parseInt(this[key]) + 1
  32895. : 0;
  32896. this.setValuePart(key, newValue);
  32897. };
  32898. this.incrementMinute = () => {
  32899. this.incrementMinuteOrSecond("minute");
  32900. };
  32901. this.incrementSecond = () => {
  32902. this.incrementMinuteOrSecond("second");
  32903. };
  32904. this.meridiemDownButtonKeyDownHandler = (event) => {
  32905. if (this.buttonActivated(event)) {
  32906. this.decrementMeridiem();
  32907. }
  32908. };
  32909. this.meridiemKeyDownHandler = (event) => {
  32910. switch (event.key) {
  32911. case "a":
  32912. this.setValuePart("meridiem", "AM");
  32913. break;
  32914. case "p":
  32915. this.setValuePart("meridiem", "PM");
  32916. break;
  32917. case "Backspace":
  32918. case "Delete":
  32919. this.setValuePart("meridiem", null);
  32920. break;
  32921. case "ArrowUp":
  32922. event.preventDefault();
  32923. this.incrementMeridiem();
  32924. break;
  32925. case "ArrowDown":
  32926. event.preventDefault();
  32927. this.decrementMeridiem();
  32928. break;
  32929. case " ":
  32930. event.preventDefault();
  32931. break;
  32932. }
  32933. };
  32934. this.meridiemUpButtonKeyDownHandler = (event) => {
  32935. if (this.buttonActivated(event)) {
  32936. this.incrementMeridiem();
  32937. }
  32938. };
  32939. this.minuteDownButtonKeyDownHandler = (event) => {
  32940. if (this.buttonActivated(event)) {
  32941. this.decrementMinute();
  32942. }
  32943. };
  32944. this.minuteKeyDownHandler = (event) => {
  32945. const { key } = event;
  32946. if (numberKeys.includes(key)) {
  32947. const keyAsNumber = parseInt(key);
  32948. let newMinute;
  32949. if (isValidNumber(this.minute) && this.minute.startsWith("0")) {
  32950. const minuteAsNumber = parseInt(this.minute);
  32951. newMinute =
  32952. minuteAsNumber > maxTenthForMinuteAndSecond
  32953. ? keyAsNumber
  32954. : `${minuteAsNumber}${keyAsNumber}`;
  32955. }
  32956. else {
  32957. newMinute = keyAsNumber;
  32958. }
  32959. this.setValuePart("minute", newMinute);
  32960. }
  32961. else {
  32962. switch (key) {
  32963. case "Backspace":
  32964. case "Delete":
  32965. this.setValuePart("minute", null);
  32966. break;
  32967. case "ArrowDown":
  32968. event.preventDefault();
  32969. this.decrementMinute();
  32970. break;
  32971. case "ArrowUp":
  32972. event.preventDefault();
  32973. this.incrementMinute();
  32974. break;
  32975. case " ":
  32976. event.preventDefault();
  32977. break;
  32978. }
  32979. }
  32980. };
  32981. this.minuteUpButtonKeyDownHandler = (event) => {
  32982. if (this.buttonActivated(event)) {
  32983. this.incrementMinute();
  32984. }
  32985. };
  32986. this.secondDownButtonKeyDownHandler = (event) => {
  32987. if (this.buttonActivated(event)) {
  32988. this.decrementSecond();
  32989. }
  32990. };
  32991. this.secondKeyDownHandler = (event) => {
  32992. const { key } = event;
  32993. if (numberKeys.includes(key)) {
  32994. const keyAsNumber = parseInt(key);
  32995. let newSecond;
  32996. if (isValidNumber(this.second) && this.second.startsWith("0")) {
  32997. const secondAsNumber = parseInt(this.second);
  32998. newSecond =
  32999. secondAsNumber > maxTenthForMinuteAndSecond
  33000. ? keyAsNumber
  33001. : `${secondAsNumber}${keyAsNumber}`;
  33002. }
  33003. else {
  33004. newSecond = keyAsNumber;
  33005. }
  33006. this.setValuePart("second", newSecond);
  33007. }
  33008. else {
  33009. switch (key) {
  33010. case "Backspace":
  33011. case "Delete":
  33012. this.setValuePart("second", null);
  33013. break;
  33014. case "ArrowDown":
  33015. event.preventDefault();
  33016. this.decrementSecond();
  33017. break;
  33018. case "ArrowUp":
  33019. event.preventDefault();
  33020. this.incrementSecond();
  33021. break;
  33022. case " ":
  33023. event.preventDefault();
  33024. break;
  33025. }
  33026. }
  33027. };
  33028. this.secondUpButtonKeyDownHandler = (event) => {
  33029. if (this.buttonActivated(event)) {
  33030. this.incrementSecond();
  33031. }
  33032. };
  33033. this.setHourEl = (el) => (this.hourEl = el);
  33034. this.setMeridiemEl = (el) => (this.meridiemEl = el);
  33035. this.setMinuteEl = (el) => (this.minuteEl = el);
  33036. this.setSecondEl = (el) => (this.secondEl = el);
  33037. this.setValue = (value, emit = true) => {
  33038. if (isValidTime(value)) {
  33039. const { hour, minute, second } = parseTimeString(value);
  33040. const { effectiveLocale: locale, numberingSystem } = this;
  33041. const { localizedHour, localizedHourSuffix, localizedMinute, localizedMinuteSuffix, localizedSecond, localizedSecondSuffix, localizedMeridiem } = localizeTimeStringToParts({ value, locale, numberingSystem });
  33042. this.localizedHour = localizedHour;
  33043. this.localizedHourSuffix = localizedHourSuffix;
  33044. this.localizedMinute = localizedMinute;
  33045. this.localizedMinuteSuffix = localizedMinuteSuffix;
  33046. this.localizedSecond = localizedSecond;
  33047. this.localizedSecondSuffix = localizedSecondSuffix;
  33048. this.hour = hour;
  33049. this.minute = minute;
  33050. this.second = second;
  33051. if (localizedMeridiem) {
  33052. this.localizedMeridiem = localizedMeridiem;
  33053. this.meridiem = getMeridiem(this.hour);
  33054. const formatParts = getTimeParts({ value, locale, numberingSystem });
  33055. this.meridiemOrder = this.getMeridiemOrder(formatParts);
  33056. }
  33057. }
  33058. else {
  33059. this.hour = null;
  33060. this.localizedHour = null;
  33061. this.localizedHourSuffix = null;
  33062. this.localizedMeridiem = null;
  33063. this.localizedMinute = null;
  33064. this.localizedMinuteSuffix = null;
  33065. this.localizedSecond = null;
  33066. this.localizedSecondSuffix = null;
  33067. this.meridiem = null;
  33068. this.minute = null;
  33069. this.second = null;
  33070. this.value = null;
  33071. }
  33072. if (emit) {
  33073. this.calciteInternalTimePickerChange.emit();
  33074. }
  33075. };
  33076. this.setValuePart = (key, value, emit = true) => {
  33077. var _a;
  33078. const { effectiveLocale: locale, numberingSystem } = this;
  33079. if (key === "meridiem") {
  33080. this.meridiem = value;
  33081. if (isValidNumber(this.hour)) {
  33082. const hourAsNumber = parseInt(this.hour);
  33083. switch (value) {
  33084. case "AM":
  33085. if (hourAsNumber >= 12) {
  33086. this.hour = formatTimePart(hourAsNumber - 12);
  33087. }
  33088. break;
  33089. case "PM":
  33090. if (hourAsNumber < 12) {
  33091. this.hour = formatTimePart(hourAsNumber + 12);
  33092. }
  33093. break;
  33094. }
  33095. this.localizedHour = localizeTimePart({
  33096. value: this.hour,
  33097. part: "hour",
  33098. locale,
  33099. numberingSystem
  33100. });
  33101. }
  33102. }
  33103. else {
  33104. this[key] = typeof value === "number" ? formatTimePart(value) : value;
  33105. this[`localized${capitalize(key)}`] = localizeTimePart({
  33106. value: this[key],
  33107. part: key,
  33108. locale,
  33109. numberingSystem
  33110. });
  33111. }
  33112. if (this.hour && this.minute) {
  33113. const showSeconds = this.second && this.showSecond;
  33114. this.value = `${this.hour}:${this.minute}:${showSeconds ? this.second : "00"}`;
  33115. }
  33116. else {
  33117. this.value = null;
  33118. }
  33119. this.localizedMeridiem = this.value
  33120. ? ((_a = localizeTimeStringToParts({ value: this.value, locale, numberingSystem })) === null || _a === void 0 ? void 0 : _a.localizedMeridiem) || null
  33121. : localizeTimePart({ value: this.meridiem, part: "meridiem", locale, numberingSystem });
  33122. if (emit) {
  33123. this.calciteInternalTimePickerChange.emit();
  33124. }
  33125. };
  33126. }
  33127. localeChanged() {
  33128. updateEffectiveLocale(this);
  33129. }
  33130. valueWatcher(newValue) {
  33131. this.setValue(newValue, false);
  33132. }
  33133. effectiveLocaleWatcher() {
  33134. this.updateLocale();
  33135. }
  33136. //--------------------------------------------------------------------------
  33137. //
  33138. // Event Listeners
  33139. //
  33140. //--------------------------------------------------------------------------
  33141. hostBlurHandler() {
  33142. this.calciteInternalTimePickerBlur.emit();
  33143. }
  33144. hostFocusHandler() {
  33145. this.calciteInternalTimePickerFocus.emit();
  33146. }
  33147. keyDownHandler(event) {
  33148. const { defaultPrevented, key } = event;
  33149. if (defaultPrevented) {
  33150. return;
  33151. }
  33152. switch (this.activeEl) {
  33153. case this.hourEl:
  33154. if (key === "ArrowRight") {
  33155. this.setFocus("minute");
  33156. event.preventDefault();
  33157. }
  33158. break;
  33159. case this.minuteEl:
  33160. switch (key) {
  33161. case "ArrowLeft":
  33162. this.setFocus("hour");
  33163. event.preventDefault();
  33164. break;
  33165. case "ArrowRight":
  33166. if (this.step !== 60) {
  33167. this.setFocus("second");
  33168. event.preventDefault();
  33169. }
  33170. else if (this.hourCycle === "12") {
  33171. this.setFocus("meridiem");
  33172. event.preventDefault();
  33173. }
  33174. break;
  33175. }
  33176. break;
  33177. case this.secondEl:
  33178. switch (key) {
  33179. case "ArrowLeft":
  33180. this.setFocus("minute");
  33181. event.preventDefault();
  33182. break;
  33183. case "ArrowRight":
  33184. if (this.hourCycle === "12") {
  33185. this.setFocus("meridiem");
  33186. event.preventDefault();
  33187. }
  33188. break;
  33189. }
  33190. break;
  33191. case this.meridiemEl:
  33192. switch (key) {
  33193. case "ArrowLeft":
  33194. if (this.step !== 60) {
  33195. this.setFocus("second");
  33196. event.preventDefault();
  33197. }
  33198. else {
  33199. this.setFocus("minute");
  33200. event.preventDefault();
  33201. }
  33202. break;
  33203. }
  33204. break;
  33205. }
  33206. }
  33207. //--------------------------------------------------------------------------
  33208. //
  33209. // Public Methods
  33210. //
  33211. //--------------------------------------------------------------------------
  33212. /**
  33213. * Sets focus on the component.
  33214. *
  33215. * @param target
  33216. */
  33217. async setFocus(target) {
  33218. var _a;
  33219. (_a = this[`${target || "hour"}El`]) === null || _a === void 0 ? void 0 : _a.focus();
  33220. }
  33221. // --------------------------------------------------------------------------
  33222. //
  33223. // Private Methods
  33224. //
  33225. // --------------------------------------------------------------------------
  33226. buttonActivated(event) {
  33227. const { key } = event;
  33228. if (key === " ") {
  33229. event.preventDefault();
  33230. }
  33231. return isActivationKey(key);
  33232. }
  33233. getMeridiemOrder(formatParts) {
  33234. const locale = this.effectiveLocale;
  33235. const isRTLKind = locale === "ar" || locale === "he";
  33236. if (formatParts && !isRTLKind) {
  33237. const index = formatParts.findIndex((parts) => {
  33238. return parts.value === this.localizedMeridiem;
  33239. });
  33240. return index;
  33241. }
  33242. return 0;
  33243. }
  33244. updateLocale() {
  33245. this.hourCycle = getLocaleHourCycle(this.effectiveLocale, this.numberingSystem);
  33246. this.setValue(this.value, false);
  33247. }
  33248. // --------------------------------------------------------------------------
  33249. //
  33250. // Lifecycle
  33251. //
  33252. // --------------------------------------------------------------------------
  33253. connectedCallback() {
  33254. connectLocalized(this);
  33255. this.updateLocale();
  33256. this.meridiemOrder = this.getMeridiemOrder(getTimeParts({
  33257. value: "0:00:00",
  33258. locale: this.effectiveLocale,
  33259. numberingSystem: this.numberingSystem
  33260. }));
  33261. }
  33262. disconnectedCallback() {
  33263. disconnectLocalized(this);
  33264. }
  33265. // --------------------------------------------------------------------------
  33266. //
  33267. // Render Methods
  33268. //
  33269. // --------------------------------------------------------------------------
  33270. render() {
  33271. const hourIsNumber = isValidNumber(this.hour);
  33272. const iconScale = this.scale === "s" || this.scale === "m" ? "s" : "m";
  33273. const minuteIsNumber = isValidNumber(this.minute);
  33274. const secondIsNumber = isValidNumber(this.second);
  33275. const showMeridiem = this.hourCycle === "12";
  33276. return (hAsync("div", { class: {
  33277. [CSS$5.timePicker]: true,
  33278. [CSS$5.showMeridiem]: showMeridiem,
  33279. [CSS$5.showSecond]: this.showSecond,
  33280. [CSS$5[`scale-${this.scale}`]]: true
  33281. }, dir: "ltr" }, hAsync("div", { class: CSS$5.column, role: "group" }, hAsync("span", { "aria-label": this.intlHourUp, class: {
  33282. [CSS$5.button]: true,
  33283. [CSS$5.buttonHourUp]: true,
  33284. [CSS$5.buttonTopLeft]: true
  33285. }, onClick: this.incrementHour, onKeyDown: this.hourUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-up", scale: iconScale })), hAsync("span", { "aria-label": this.intlHour, "aria-valuemax": "23", "aria-valuemin": "1", "aria-valuenow": (hourIsNumber && parseInt(this.hour)) || "0", "aria-valuetext": this.hour, class: {
  33286. [CSS$5.input]: true,
  33287. [CSS$5.hour]: true
  33288. }, onFocus: this.focusHandler, onKeyDown: this.hourKeyDownHandler, ref: this.setHourEl, role: "spinbutton", tabIndex: 0 }, this.localizedHour || "--"), hAsync("span", { "aria-label": this.intlHourDown, class: {
  33289. [CSS$5.button]: true,
  33290. [CSS$5.buttonHourDown]: true,
  33291. [CSS$5.buttonBottomLeft]: true
  33292. }, onClick: this.decrementHour, onKeyDown: this.hourDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-down", scale: iconScale }))), hAsync("span", { class: CSS$5.delimiter }, this.localizedHourSuffix), hAsync("div", { class: CSS$5.column, role: "group" }, hAsync("span", { "aria-label": this.intlMinuteUp, class: {
  33293. [CSS$5.button]: true,
  33294. [CSS$5.buttonMinuteUp]: true
  33295. }, onClick: this.incrementMinute, onKeyDown: this.minuteUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-up", scale: iconScale })), hAsync("span", { "aria-label": this.intlMinute, "aria-valuemax": "12", "aria-valuemin": "1", "aria-valuenow": (minuteIsNumber && parseInt(this.minute)) || "0", "aria-valuetext": this.minute, class: {
  33296. [CSS$5.input]: true,
  33297. [CSS$5.minute]: true
  33298. }, onFocus: this.focusHandler, onKeyDown: this.minuteKeyDownHandler, ref: this.setMinuteEl, role: "spinbutton", tabIndex: 0 }, this.localizedMinute || "--"), hAsync("span", { "aria-label": this.intlMinuteDown, class: {
  33299. [CSS$5.button]: true,
  33300. [CSS$5.buttonMinuteDown]: true
  33301. }, onClick: this.decrementMinute, onKeyDown: this.minuteDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-down", scale: iconScale }))), this.showSecond && hAsync("span", { class: CSS$5.delimiter }, this.localizedMinuteSuffix), this.showSecond && (hAsync("div", { class: CSS$5.column, role: "group" }, hAsync("span", { "aria-label": this.intlSecondUp, class: {
  33302. [CSS$5.button]: true,
  33303. [CSS$5.buttonSecondUp]: true
  33304. }, onClick: this.incrementSecond, onKeyDown: this.secondUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-up", scale: iconScale })), hAsync("span", { "aria-label": this.intlSecond, "aria-valuemax": "59", "aria-valuemin": "0", "aria-valuenow": (secondIsNumber && parseInt(this.second)) || "0", "aria-valuetext": this.second, class: {
  33305. [CSS$5.input]: true,
  33306. [CSS$5.second]: true
  33307. }, onFocus: this.focusHandler, onKeyDown: this.secondKeyDownHandler, ref: this.setSecondEl, role: "spinbutton", tabIndex: 0 }, this.localizedSecond || "--"), hAsync("span", { "aria-label": this.intlSecondDown, class: {
  33308. [CSS$5.button]: true,
  33309. [CSS$5.buttonSecondDown]: true
  33310. }, onClick: this.decrementSecond, onKeyDown: this.secondDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-down", scale: iconScale })))), this.localizedSecondSuffix && (hAsync("span", { class: CSS$5.delimiter }, this.localizedSecondSuffix)), showMeridiem && (hAsync("div", { class: {
  33311. [CSS$5.column]: true,
  33312. [CSS$5.meridiemStart]: this.meridiemOrder === 0
  33313. }, role: "group" }, hAsync("span", { "aria-label": this.intlMeridiemUp, class: {
  33314. [CSS$5.button]: true,
  33315. [CSS$5.buttonMeridiemUp]: true,
  33316. [CSS$5.buttonTopRight]: true
  33317. }, onClick: this.incrementMeridiem, onKeyDown: this.meridiemUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-up", scale: iconScale })), hAsync("span", { "aria-label": this.intlMeridiem, "aria-valuemax": "2", "aria-valuemin": "1", "aria-valuenow": (this.meridiem === "PM" && "2") || "1", "aria-valuetext": this.meridiem, class: {
  33318. [CSS$5.input]: true,
  33319. [CSS$5.meridiem]: true
  33320. }, onFocus: this.focusHandler, onKeyDown: this.meridiemKeyDownHandler, ref: this.setMeridiemEl, role: "spinbutton", tabIndex: 0 }, this.localizedMeridiem || "--"), hAsync("span", { "aria-label": this.intlMeridiemDown, class: {
  33321. [CSS$5.button]: true,
  33322. [CSS$5.buttonMeridiemDown]: true,
  33323. [CSS$5.buttonBottomRight]: true
  33324. }, onClick: this.decrementMeridiem, onKeyDown: this.meridiemDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-down", scale: iconScale }))))));
  33325. }
  33326. get el() { return getElement(this); }
  33327. static get watchers() { return {
  33328. "locale": ["localeChanged"],
  33329. "value": ["valueWatcher"],
  33330. "effectiveLocale": ["effectiveLocaleWatcher"]
  33331. }; }
  33332. static get style() { return timePickerCss; }
  33333. static get cmpMeta() { return {
  33334. "$flags$": 9,
  33335. "$tagName$": "calcite-time-picker",
  33336. "$members$": {
  33337. "intlHour": [1, "intl-hour"],
  33338. "intlHourDown": [1, "intl-hour-down"],
  33339. "intlHourUp": [1, "intl-hour-up"],
  33340. "intlMeridiem": [1, "intl-meridiem"],
  33341. "intlMeridiemDown": [1, "intl-meridiem-down"],
  33342. "intlMeridiemUp": [1, "intl-meridiem-up"],
  33343. "intlMinute": [1, "intl-minute"],
  33344. "intlMinuteDown": [1, "intl-minute-down"],
  33345. "intlMinuteUp": [1, "intl-minute-up"],
  33346. "intlSecond": [1, "intl-second"],
  33347. "intlSecondDown": [1, "intl-second-down"],
  33348. "intlSecondUp": [1, "intl-second-up"],
  33349. "locale": [1025],
  33350. "scale": [513],
  33351. "step": [514],
  33352. "numberingSystem": [1, "numbering-system"],
  33353. "value": [1025],
  33354. "effectiveLocale": [32],
  33355. "hour": [32],
  33356. "hourCycle": [32],
  33357. "localizedHour": [32],
  33358. "localizedHourSuffix": [32],
  33359. "localizedMeridiem": [32],
  33360. "localizedMinute": [32],
  33361. "localizedMinuteSuffix": [32],
  33362. "localizedSecond": [32],
  33363. "localizedSecondSuffix": [32],
  33364. "meridiem": [32],
  33365. "minute": [32],
  33366. "second": [32],
  33367. "showSecond": [32],
  33368. "setFocus": [64]
  33369. },
  33370. "$listeners$": [[0, "blur", "hostBlurHandler"], [0, "focus", "hostFocusHandler"], [0, "keydown", "keyDownHandler"]],
  33371. "$lazyBundleId$": "-",
  33372. "$attrsToReflect$": [["scale", "scale"], ["step", "step"]]
  33373. }; }
  33374. }
  33375. const CSS$4 = {
  33376. header: "header",
  33377. heading: "heading",
  33378. close: "close",
  33379. container: "container",
  33380. tipContainer: "tip-container",
  33381. tipContainerAdvancing: "tip-container--advancing",
  33382. tipContainerRetreating: "tip-container--retreating",
  33383. pagination: "pagination",
  33384. pagePosition: "page-position",
  33385. pageNext: "page-next",
  33386. pagePrevious: "page-previous"
  33387. };
  33388. const ICONS$3 = {
  33389. chevronLeft: "chevron-left",
  33390. chevronRight: "chevron-right",
  33391. close: "x"
  33392. };
  33393. const TEXT$1 = {
  33394. defaultGroupTitle: "Tips",
  33395. defaultPaginationLabel: "Tip",
  33396. close: "Close",
  33397. previous: "Previous",
  33398. next: "Next"
  33399. };
  33400. const HEADING_LEVEL$1 = 2;
  33401. const CSS$3 = {
  33402. container: "container",
  33403. header: "header",
  33404. heading: "heading",
  33405. close: "close",
  33406. imageFrame: "image-frame",
  33407. content: "content",
  33408. info: "info"
  33409. };
  33410. const ICONS$2 = {
  33411. close: "x"
  33412. };
  33413. const SLOTS$2 = {
  33414. thumbnail: "thumbnail"
  33415. };
  33416. const TEXT = {
  33417. close: "Close"
  33418. };
  33419. const HEADING_LEVEL = (HEADING_LEVEL$1 + 1);
  33420. const tipCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tip:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tip{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tip{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tip{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tip{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tip{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tip:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tip:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tip-h{display:none}/*!@:host*/.sc-calcite-tip-h{position:relative;margin:1rem;box-sizing:border-box;display:flex;flex-direction:row;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-2);background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}/*!@:host **/.sc-calcite-tip-h *.sc-calcite-tip{box-sizing:border-box}/*!@.container*/.container.sc-calcite-tip{inline-size:100%;padding:1rem}/*!@:host([dismissed]), \n:host([dismissed]) .container*/[dismissed].sc-calcite-tip-h,[dismissed].sc-calcite-tip-h .container.sc-calcite-tip{display:none}/*!@:host([selected]) .container*/[selected].sc-calcite-tip-h .container.sc-calcite-tip{margin:0px;border-style:none;padding:0px}/*!@.header*/.header.sc-calcite-tip{margin:0px;display:flex;align-content:space-between;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}/*!@.heading*/.heading.sc-calcite-tip{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}/*!@.header .heading*/.header.sc-calcite-tip .heading.sc-calcite-tip{flex:1 1 auto;padding:0.5rem}/*!@.header*/.header.sc-calcite-tip{margin-block-end:0.5rem}/*!@.header .heading*/.header.sc-calcite-tip .heading.sc-calcite-tip{padding:0px;font-size:var(--calcite-font-size-0);line-height:1.25rem;color:var(--calcite-ui-text-1)}/*!@.container[hidden]*/.container[hidden].sc-calcite-tip{display:none}/*!@.content*/.content.sc-calcite-tip{display:flex}/*!@.info*/.info.sc-calcite-tip{padding-block:0px;padding-inline:1rem;inline-size:70%}/*!@.info:only-child*/.info.sc-calcite-tip:only-child{inline-size:100%;padding-inline:0px}/*!@::slotted(p)*/.sc-calcite-tip-s>p{margin-block-start:0px}/*!@::slotted(a)*/.sc-calcite-tip-s>a{outline-color:transparent;color:var(--calcite-ui-brand)}/*!@::slotted(a:focus)*/.sc-calcite-tip-s>a:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.image-frame*/.image-frame.sc-calcite-tip{inline-size:25%}/*!@.image-frame img*/.image-frame.sc-calcite-tip img.sc-calcite-tip{max-inline-size:100%}/*!@::slotted(img)*/.sc-calcite-tip-s>img{max-inline-size:100%}";
  33421. /**
  33422. * @slot - A slot for adding text and a hyperlink.
  33423. * @slot thumbnail - A slot for adding an HTML image element.
  33424. */
  33425. class Tip {
  33426. constructor(hostRef) {
  33427. registerInstance(this, hostRef);
  33428. this.calciteTipDismiss = createEvent(this, "calciteTipDismiss", 6);
  33429. // --------------------------------------------------------------------------
  33430. //
  33431. // Properties
  33432. //
  33433. // --------------------------------------------------------------------------
  33434. /**
  33435. * When `true`, the component does not display.
  33436. */
  33437. this.dismissed = false;
  33438. /**
  33439. * When `true`, the close button is not present on the component.
  33440. */
  33441. this.nonDismissible = false;
  33442. /**
  33443. * When `true`, the component is selected if it has a parent `calcite-tip-manager`.
  33444. *
  33445. * Only one tip can be selected within the `calcite-tip-manager` parent.
  33446. */
  33447. this.selected = false;
  33448. // --------------------------------------------------------------------------
  33449. //
  33450. // Private Methods
  33451. //
  33452. // --------------------------------------------------------------------------
  33453. this.hideTip = () => {
  33454. this.dismissed = true;
  33455. this.calciteTipDismiss.emit();
  33456. };
  33457. }
  33458. // --------------------------------------------------------------------------
  33459. //
  33460. // Lifecycle
  33461. //
  33462. // --------------------------------------------------------------------------
  33463. connectedCallback() {
  33464. connectConditionalSlotComponent(this);
  33465. }
  33466. disconnectedCallback() {
  33467. disconnectConditionalSlotComponent(this);
  33468. }
  33469. // --------------------------------------------------------------------------
  33470. //
  33471. // Render Methods
  33472. //
  33473. // --------------------------------------------------------------------------
  33474. renderHeader() {
  33475. var _a;
  33476. const { heading, headingLevel, el } = this;
  33477. const parentLevel = (_a = el.closest("calcite-tip-manager")) === null || _a === void 0 ? void 0 : _a.headingLevel;
  33478. const relativeLevel = parentLevel ? constrainHeadingLevel(parentLevel + 1) : null;
  33479. const level = headingLevel || relativeLevel || HEADING_LEVEL;
  33480. return heading ? (hAsync("header", { class: CSS$3.header }, hAsync(Heading, { class: CSS$3.heading, level: level }, heading))) : null;
  33481. }
  33482. renderDismissButton() {
  33483. const { nonDismissible, hideTip, intlClose } = this;
  33484. const text = intlClose || TEXT.close;
  33485. return !nonDismissible ? (hAsync("calcite-action", { class: CSS$3.close, icon: ICONS$2.close, onClick: hideTip, scale: "l", text: text })) : null;
  33486. }
  33487. renderImageFrame() {
  33488. const { el } = this;
  33489. return getSlotted(el, SLOTS$2.thumbnail) ? (hAsync("div", { class: CSS$3.imageFrame, key: "thumbnail" }, hAsync("slot", { name: SLOTS$2.thumbnail }))) : null;
  33490. }
  33491. renderInfoNode() {
  33492. return (hAsync("div", { class: CSS$3.info }, hAsync("slot", null)));
  33493. }
  33494. renderContent() {
  33495. return (hAsync("div", { class: CSS$3.content }, this.renderImageFrame(), this.renderInfoNode()));
  33496. }
  33497. render() {
  33498. return (hAsync(Fragment, null, hAsync("article", { class: CSS$3.container }, this.renderHeader(), this.renderContent()), this.renderDismissButton()));
  33499. }
  33500. get el() { return getElement(this); }
  33501. static get style() { return tipCss; }
  33502. static get cmpMeta() { return {
  33503. "$flags$": 9,
  33504. "$tagName$": "calcite-tip",
  33505. "$members$": {
  33506. "dismissed": [1540],
  33507. "nonDismissible": [516, "non-dismissible"],
  33508. "heading": [1],
  33509. "headingLevel": [514, "heading-level"],
  33510. "selected": [516],
  33511. "intlClose": [1, "intl-close"]
  33512. },
  33513. "$listeners$": undefined,
  33514. "$lazyBundleId$": "-",
  33515. "$attrsToReflect$": [["dismissed", "dismissed"], ["nonDismissible", "non-dismissible"], ["headingLevel", "heading-level"], ["selected", "selected"]]
  33516. }; }
  33517. }
  33518. const tipGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tip-group:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tip-group{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tip-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tip-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tip-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tip-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tip-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tip-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tip-group-h{display:none}/*!@:host*/.sc-calcite-tip-group-h{box-sizing:border-box;display:block;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}/*!@::slotted(calcite-tip)*/.sc-calcite-tip-group-s>calcite-tip{margin:0px;border-style:none}/*!@:host-context(calcite-tip-manager)*/calcite-tip-manager.sc-calcite-tip-group-h,calcite-tip-manager .sc-calcite-tip-group-h{margin-block:0.75rem}/*!@:host-context(calcite-tip-manager) ::slotted(calcite-tip)*/.sc-calcite-tip-group-hcalcite-tip-manager .sc-calcite-tip-group-s>calcite-tip,calcite-tip-manager .sc-calcite-tip-group-h .sc-calcite-tip-group-s>calcite-tip{padding:1rem}";
  33519. /**
  33520. * @slot - A slot for adding `calcite-tip`s.
  33521. */
  33522. class TipGroup {
  33523. constructor(hostRef) {
  33524. registerInstance(this, hostRef);
  33525. }
  33526. render() {
  33527. return hAsync("slot", null);
  33528. }
  33529. static get style() { return tipGroupCss; }
  33530. static get cmpMeta() { return {
  33531. "$flags$": 9,
  33532. "$tagName$": "calcite-tip-group",
  33533. "$members$": {
  33534. "groupTitle": [1, "group-title"]
  33535. },
  33536. "$listeners$": undefined,
  33537. "$lazyBundleId$": "-",
  33538. "$attrsToReflect$": []
  33539. }; }
  33540. }
  33541. const tipManagerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tip-manager:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tip-manager{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tip-manager{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tip-manager{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tip-manager{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tip-manager{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tip-manager:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tip-manager:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tip-manager-h{display:none}/*!@:host*/.sc-calcite-tip-manager-h{box-sizing:border-box;display:block;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2);--calcite-tip-manager-height:19vh}/*!@:host **/.sc-calcite-tip-manager-h *.sc-calcite-tip-manager{box-sizing:border-box}/*!@:host([closed])*/[closed].sc-calcite-tip-manager-h{display:none}/*!@.header*/.header.sc-calcite-tip-manager{margin:0px;display:flex;align-content:space-between;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}/*!@.heading*/.heading.sc-calcite-tip-manager{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}/*!@.header .heading*/.header.sc-calcite-tip-manager .heading.sc-calcite-tip-manager{flex:1 1 auto;padding:0.5rem}/*!@.header*/.header.sc-calcite-tip-manager{border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-block:0px;padding-inline-end:0px;padding-inline-start:1rem}/*!@.header .heading*/.header.sc-calcite-tip-manager .heading.sc-calcite-tip-manager{padding:0px;font-size:var(--calcite-font-size-1);line-height:1.5rem;font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-1)}/*!@.container*/.container.sc-calcite-tip-manager{position:relative;overflow:hidden;outline-color:transparent;min-block-size:150px}/*!@.container:focus*/.container.sc-calcite-tip-manager:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@.tip-container*/.tip-container.sc-calcite-tip-manager{margin-block-start:1px;display:flex;align-items:flex-start;justify-content:center;overflow:auto;outline-color:transparent;animation-name:none;animation-duration:var(--calcite-animation-timing);block-size:var(--calcite-tip-manager-height)}/*!@.tip-container:focus*/.tip-container.sc-calcite-tip-manager:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@::slotted(calcite-tip)*/.sc-calcite-tip-manager-s>calcite-tip{border-style:none;padding:0.75rem;max-inline-size:var(--calcite-tip-max-width)}/*!@.tip-container--advancing*/.tip-container--advancing.sc-calcite-tip-manager{animation-name:tip-advance}/*!@.tip-container--retreating*/.tip-container--retreating.sc-calcite-tip-manager{animation-name:tip-retreat}/*!@.pagination*/.pagination.sc-calcite-tip-manager{display:flex;align-items:center;justify-content:center;padding-inline:0px;padding-block:0.75rem 0.5rem}/*!@.page-position*/.page-position.sc-calcite-tip-manager{margin-block:0px;margin-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}@keyframes tip-advance{0%{opacity:0;transform:translate3d(50px, 0, 0) scale(0.99)}100%{opacity:1;transform:translate3d(0, 0, 0) scale(1)}}@keyframes tip-retreat{0%{opacity:0;transform:translate3d(-50px, 0, 0) scale(0.99)}100%{opacity:1;transform:translate3d(0, 0, 0) scale(1)}}";
  33542. /**
  33543. * @slot - A slot for adding `calcite-tip`s.
  33544. */
  33545. class TipManager {
  33546. constructor(hostRef) {
  33547. registerInstance(this, hostRef);
  33548. this.calciteTipManagerToggle = createEvent(this, "calciteTipManagerToggle", 6);
  33549. this.calciteTipManagerClose = createEvent(this, "calciteTipManagerClose", 6);
  33550. // --------------------------------------------------------------------------
  33551. //
  33552. // Properties
  33553. //
  33554. // --------------------------------------------------------------------------
  33555. /**
  33556. * When `true`, does not display or position the component.
  33557. */
  33558. this.closed = false;
  33559. this.mutationObserver = createObserver();
  33560. this.hideTipManager = () => {
  33561. this.closed = true;
  33562. this.calciteTipManagerToggle.emit();
  33563. this.calciteTipManagerClose.emit();
  33564. };
  33565. this.previousClicked = () => {
  33566. this.previousTip();
  33567. };
  33568. this.nextClicked = () => {
  33569. this.nextTip();
  33570. };
  33571. this.tipManagerKeyDownHandler = (event) => {
  33572. if (event.target !== this.container) {
  33573. return;
  33574. }
  33575. switch (event.key) {
  33576. case "ArrowRight":
  33577. event.preventDefault();
  33578. this.nextTip();
  33579. break;
  33580. case "ArrowLeft":
  33581. event.preventDefault();
  33582. this.previousTip();
  33583. break;
  33584. case "Home":
  33585. event.preventDefault();
  33586. this.selectedIndex = 0;
  33587. break;
  33588. case "End":
  33589. event.preventDefault();
  33590. this.selectedIndex = this.total - 1;
  33591. break;
  33592. }
  33593. };
  33594. this.storeContainerRef = (el) => {
  33595. this.container = el;
  33596. };
  33597. }
  33598. closedChangeHandler() {
  33599. this.direction = null;
  33600. this.calciteTipManagerToggle.emit();
  33601. }
  33602. selectedChangeHandler() {
  33603. this.showSelectedTip();
  33604. this.updateGroupTitle();
  33605. }
  33606. // --------------------------------------------------------------------------
  33607. //
  33608. // Lifecycle
  33609. //
  33610. // --------------------------------------------------------------------------
  33611. connectedCallback() {
  33612. var _a;
  33613. this.setUpTips();
  33614. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  33615. }
  33616. disconnectedCallback() {
  33617. var _a;
  33618. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  33619. }
  33620. // --------------------------------------------------------------------------
  33621. //
  33622. // Public Methods
  33623. //
  33624. // --------------------------------------------------------------------------
  33625. /** Selects the next `calcite-tip` to display. */
  33626. async nextTip() {
  33627. this.direction = "advancing";
  33628. const nextIndex = this.selectedIndex + 1;
  33629. this.selectedIndex = (nextIndex + this.total) % this.total;
  33630. }
  33631. /** Selects the previous `calcite-tip` to display. */
  33632. async previousTip() {
  33633. this.direction = "retreating";
  33634. const previousIndex = this.selectedIndex - 1;
  33635. this.selectedIndex = (previousIndex + this.total) % this.total;
  33636. }
  33637. // --------------------------------------------------------------------------
  33638. //
  33639. // Private Methods
  33640. //
  33641. // --------------------------------------------------------------------------
  33642. setUpTips() {
  33643. const tips = Array.from(this.el.querySelectorAll("calcite-tip"));
  33644. this.total = tips.length;
  33645. if (this.total === 0) {
  33646. return;
  33647. }
  33648. const selectedTip = this.el.querySelector("calcite-tip[selected]");
  33649. this.tips = tips;
  33650. this.selectedIndex = selectedTip ? tips.indexOf(selectedTip) : 0;
  33651. tips.forEach((tip) => {
  33652. tip.nonDismissible = true;
  33653. });
  33654. this.showSelectedTip();
  33655. this.updateGroupTitle();
  33656. }
  33657. showSelectedTip() {
  33658. this.tips.forEach((tip, index) => {
  33659. const isSelected = this.selectedIndex === index;
  33660. tip.selected = isSelected;
  33661. tip.hidden = !isSelected;
  33662. });
  33663. }
  33664. updateGroupTitle() {
  33665. const selectedTip = this.tips[this.selectedIndex];
  33666. const tipParent = selectedTip.closest("calcite-tip-group");
  33667. this.groupTitle = (tipParent === null || tipParent === void 0 ? void 0 : tipParent.groupTitle) || this.intlDefaultTitle || TEXT$1.defaultGroupTitle;
  33668. }
  33669. // --------------------------------------------------------------------------
  33670. //
  33671. // Render Methods
  33672. //
  33673. // --------------------------------------------------------------------------
  33674. renderPagination() {
  33675. const dir = getElementDir(this.el);
  33676. const { selectedIndex, tips, total, intlNext, intlPrevious, intlPaginationLabel } = this;
  33677. const nextLabel = intlNext || TEXT$1.next;
  33678. const previousLabel = intlPrevious || TEXT$1.previous;
  33679. const paginationLabel = intlPaginationLabel || TEXT$1.defaultPaginationLabel;
  33680. return tips.length > 1 ? (hAsync("footer", { class: CSS$4.pagination }, hAsync("calcite-action", { class: CSS$4.pagePrevious, icon: dir === "ltr" ? ICONS$3.chevronLeft : ICONS$3.chevronRight, onClick: this.previousClicked, scale: "m", text: previousLabel }), hAsync("span", { class: CSS$4.pagePosition }, `${paginationLabel} ${selectedIndex + 1}/${total}`), hAsync("calcite-action", { class: CSS$4.pageNext, icon: dir === "ltr" ? ICONS$3.chevronRight : ICONS$3.chevronLeft, onClick: this.nextClicked, scale: "m", text: nextLabel }))) : null;
  33681. }
  33682. render() {
  33683. const { closed, direction, headingLevel, groupTitle, selectedIndex, intlClose, total } = this;
  33684. const closeLabel = intlClose || TEXT$1.close;
  33685. if (total === 0) {
  33686. return null;
  33687. }
  33688. return (hAsync("section", { "aria-hidden": toAriaBoolean(closed), class: CSS$4.container, hidden: closed, onKeyDown: this.tipManagerKeyDownHandler, ref: this.storeContainerRef, tabIndex: 0 }, hAsync("header", { class: CSS$4.header }, hAsync(Heading, { class: CSS$4.heading, level: headingLevel || HEADING_LEVEL$1 }, groupTitle), hAsync("calcite-action", { class: CSS$4.close, onClick: this.hideTipManager, scale: "m", text: closeLabel }, hAsync("calcite-icon", { icon: ICONS$3.close, scale: "m" }))), hAsync("div", { class: {
  33689. [CSS$4.tipContainer]: true,
  33690. [CSS$4.tipContainerAdvancing]: !closed && direction === "advancing",
  33691. [CSS$4.tipContainerRetreating]: !closed && direction === "retreating"
  33692. }, key: selectedIndex, tabIndex: 0 }, hAsync("slot", null)), this.renderPagination()));
  33693. }
  33694. get el() { return getElement(this); }
  33695. static get watchers() { return {
  33696. "closed": ["closedChangeHandler"],
  33697. "selectedIndex": ["selectedChangeHandler"]
  33698. }; }
  33699. static get style() { return tipManagerCss; }
  33700. static get cmpMeta() { return {
  33701. "$flags$": 9,
  33702. "$tagName$": "calcite-tip-manager",
  33703. "$members$": {
  33704. "closed": [1540],
  33705. "headingLevel": [514, "heading-level"],
  33706. "intlClose": [1, "intl-close"],
  33707. "intlDefaultTitle": [1, "intl-default-title"],
  33708. "intlNext": [1, "intl-next"],
  33709. "intlPaginationLabel": [1, "intl-pagination-label"],
  33710. "intlPrevious": [1, "intl-previous"],
  33711. "selectedIndex": [32],
  33712. "tips": [32],
  33713. "total": [32],
  33714. "direction": [32],
  33715. "groupTitle": [32],
  33716. "nextTip": [64],
  33717. "previousTip": [64]
  33718. },
  33719. "$listeners$": undefined,
  33720. "$lazyBundleId$": "-",
  33721. "$attrsToReflect$": [["closed", "closed"], ["headingLevel", "heading-level"]]
  33722. }; }
  33723. }
  33724. const CSS$2 = {
  33725. container: "container",
  33726. arrow: "arrow"
  33727. };
  33728. const TOOLTIP_DELAY_MS = 500;
  33729. const ARIA_DESCRIBED_BY = "aria-describedby";
  33730. class TooltipManager$1 {
  33731. constructor() {
  33732. // --------------------------------------------------------------------------
  33733. //
  33734. // Private Properties
  33735. //
  33736. // --------------------------------------------------------------------------
  33737. this.registeredElements = new WeakMap();
  33738. this.hoverTimeouts = new WeakMap();
  33739. this.registeredElementCount = 0;
  33740. // --------------------------------------------------------------------------
  33741. //
  33742. // Private Methods
  33743. //
  33744. // --------------------------------------------------------------------------
  33745. this.queryTooltip = (composedPath) => {
  33746. const { registeredElements } = this;
  33747. const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
  33748. return registeredElements.get(registeredElement);
  33749. };
  33750. this.keyDownHandler = (event) => {
  33751. if (event.key === "Escape") {
  33752. const { activeTooltipEl } = this;
  33753. if (activeTooltipEl) {
  33754. this.clearHoverTimeout(activeTooltipEl);
  33755. this.toggleTooltip(activeTooltipEl, false);
  33756. }
  33757. }
  33758. };
  33759. this.mouseEnterShow = (event) => {
  33760. this.hoverEvent(event, true);
  33761. };
  33762. this.mouseLeaveHide = (event) => {
  33763. this.hoverEvent(event, false);
  33764. };
  33765. this.clickHandler = (event) => {
  33766. if (!isPrimaryPointerButton(event)) {
  33767. return;
  33768. }
  33769. const clickedTooltip = this.queryTooltip(event.composedPath());
  33770. this.clickedTooltip = clickedTooltip;
  33771. if (clickedTooltip === null || clickedTooltip === void 0 ? void 0 : clickedTooltip.closeOnClick) {
  33772. this.toggleTooltip(clickedTooltip, false);
  33773. this.clearHoverTimeout(clickedTooltip);
  33774. }
  33775. };
  33776. this.focusShow = (event) => {
  33777. this.focusEvent(event, true);
  33778. };
  33779. this.blurHide = (event) => {
  33780. this.focusEvent(event, false);
  33781. };
  33782. this.hoverToggle = (tooltip, value) => {
  33783. const { hoverTimeouts } = this;
  33784. hoverTimeouts.delete(tooltip);
  33785. if (value) {
  33786. this.closeExistingTooltip();
  33787. }
  33788. this.toggleTooltip(tooltip, value);
  33789. };
  33790. }
  33791. // --------------------------------------------------------------------------
  33792. //
  33793. // Public Methods
  33794. //
  33795. // --------------------------------------------------------------------------
  33796. registerElement(referenceEl, tooltip) {
  33797. this.registeredElementCount++;
  33798. this.registeredElements.set(referenceEl, tooltip);
  33799. if (this.registeredElementCount === 1) {
  33800. this.addListeners();
  33801. }
  33802. }
  33803. unregisterElement(referenceEl) {
  33804. if (this.registeredElements.delete(referenceEl)) {
  33805. this.registeredElementCount--;
  33806. }
  33807. if (this.registeredElementCount === 0) {
  33808. this.removeListeners();
  33809. }
  33810. }
  33811. addListeners() {
  33812. document.addEventListener("keydown", this.keyDownHandler);
  33813. document.addEventListener("pointerover", this.mouseEnterShow, { capture: true });
  33814. document.addEventListener("pointerout", this.mouseLeaveHide, { capture: true });
  33815. document.addEventListener("pointerdown", this.clickHandler, { capture: true });
  33816. document.addEventListener("focusin", this.focusShow, { capture: true });
  33817. document.addEventListener("focusout", this.blurHide, { capture: true });
  33818. }
  33819. removeListeners() {
  33820. document.removeEventListener("keydown", this.keyDownHandler);
  33821. document.removeEventListener("pointerover", this.mouseEnterShow, { capture: true });
  33822. document.removeEventListener("pointerout", this.mouseLeaveHide, { capture: true });
  33823. document.removeEventListener("pointerdown", this.clickHandler, { capture: true });
  33824. document.removeEventListener("focusin", this.focusShow, { capture: true });
  33825. document.removeEventListener("focusout", this.blurHide, { capture: true });
  33826. }
  33827. clearHoverTimeout(tooltip) {
  33828. const { hoverTimeouts } = this;
  33829. if (hoverTimeouts.has(tooltip)) {
  33830. window.clearTimeout(hoverTimeouts.get(tooltip));
  33831. hoverTimeouts.delete(tooltip);
  33832. }
  33833. }
  33834. closeExistingTooltip() {
  33835. const { activeTooltipEl } = this;
  33836. if (activeTooltipEl) {
  33837. this.toggleTooltip(activeTooltipEl, false);
  33838. }
  33839. }
  33840. focusTooltip(tooltip, value) {
  33841. this.closeExistingTooltip();
  33842. if (value) {
  33843. this.clearHoverTimeout(tooltip);
  33844. }
  33845. this.toggleTooltip(tooltip, value);
  33846. }
  33847. toggleTooltip(tooltip, value) {
  33848. tooltip.open = value;
  33849. if (value) {
  33850. this.activeTooltipEl = tooltip;
  33851. }
  33852. }
  33853. hoverTooltip(tooltip, value) {
  33854. this.clearHoverTimeout(tooltip);
  33855. const { hoverTimeouts } = this;
  33856. const timeoutId = window.setTimeout(() => this.hoverToggle(tooltip, value), TOOLTIP_DELAY_MS );
  33857. hoverTimeouts.set(tooltip, timeoutId);
  33858. }
  33859. activeTooltipHover(event) {
  33860. const { activeTooltipEl, hoverTimeouts } = this;
  33861. const { type } = event;
  33862. if (!activeTooltipEl) {
  33863. return;
  33864. }
  33865. if (type === "pointerover" && event.composedPath().includes(activeTooltipEl)) {
  33866. this.clearHoverTimeout(activeTooltipEl);
  33867. }
  33868. else if (type === "pointerout" && !hoverTimeouts.has(activeTooltipEl)) {
  33869. this.hoverTooltip(activeTooltipEl, false);
  33870. }
  33871. }
  33872. hoverEvent(event, value) {
  33873. const tooltip = this.queryTooltip(event.composedPath());
  33874. this.activeTooltipHover(event);
  33875. if (!tooltip) {
  33876. return;
  33877. }
  33878. this.hoverTooltip(tooltip, value);
  33879. }
  33880. focusEvent(event, value) {
  33881. const tooltip = this.queryTooltip(event.composedPath());
  33882. if (!tooltip || tooltip === this.clickedTooltip) {
  33883. this.clickedTooltip = null;
  33884. return;
  33885. }
  33886. this.focusTooltip(tooltip, value);
  33887. }
  33888. }
  33889. const tooltipCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tooltip:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tooltip{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tooltip{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tooltip{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tooltip{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tooltip{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tooltip:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tooltip:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tooltip-h{display:none}/*!@:host*/.sc-calcite-tooltip-h{display:block;position:absolute;z-index:999}/*!@.calcite-floating-ui-anim*/.calcite-floating-ui-anim.sc-calcite-tooltip{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}/*!@:host([data-placement^=bottom]) .calcite-floating-ui-anim*/[data-placement^=bottom].sc-calcite-tooltip-h .calcite-floating-ui-anim.sc-calcite-tooltip{transform:translateY(-5px)}/*!@:host([data-placement^=top]) .calcite-floating-ui-anim*/[data-placement^=top].sc-calcite-tooltip-h .calcite-floating-ui-anim.sc-calcite-tooltip{transform:translateY(5px)}/*!@:host([data-placement^=left]) .calcite-floating-ui-anim*/[data-placement^=left].sc-calcite-tooltip-h .calcite-floating-ui-anim.sc-calcite-tooltip{transform:translateX(5px)}/*!@:host([data-placement^=right]) .calcite-floating-ui-anim*/[data-placement^=right].sc-calcite-tooltip-h .calcite-floating-ui-anim.sc-calcite-tooltip{transform:translateX(-5px)}/*!@:host([data-placement]) .calcite-floating-ui-anim--active*/[data-placement].sc-calcite-tooltip-h .calcite-floating-ui-anim--active.sc-calcite-tooltip{opacity:1;visibility:visible;transform:translate(0)}/*!@:host([calcite-hydrated-hidden])*/[calcite-hydrated-hidden].sc-calcite-tooltip-h{visibility:hidden !important;pointer-events:none}/*!@.arrow,\n.arrow::before*/.arrow.sc-calcite-tooltip,.arrow.sc-calcite-tooltip::before{position:absolute;inline-size:8px;block-size:8px;z-index:-1}/*!@.arrow::before*/.arrow.sc-calcite-tooltip::before{content:\"\";--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transform:rotate(45deg);background:var(--calcite-ui-foreground-1)}/*!@:host([data-placement^=top]) .arrow*/[data-placement^=top].sc-calcite-tooltip-h .arrow.sc-calcite-tooltip{inset-block-end:-4px}/*!@:host([data-placement^=bottom]) .arrow*/[data-placement^=bottom].sc-calcite-tooltip-h .arrow.sc-calcite-tooltip{inset-block-start:-4px}/*!@:host([data-placement^=left]) .arrow*/[data-placement^=left].sc-calcite-tooltip-h .arrow.sc-calcite-tooltip{direction:ltr;inset-inline-end:-4px}/*!@:host([data-placement^=right]) .arrow*/[data-placement^=right].sc-calcite-tooltip-h .arrow.sc-calcite-tooltip{direction:ltr;inset-inline-start:-4px}/*!@.container*/.container.sc-calcite-tooltip{position:relative;overflow:hidden;border-radius:0.25rem;background-color:var(--calcite-ui-foreground-1);padding-block:0.75rem;padding-inline:1rem;font-size:var(--calcite-font-size--2);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);max-inline-size:20rem;max-block-size:20rem;text-align:start}/*!@.calcite-floating-ui-anim*/.calcite-floating-ui-anim.sc-calcite-tooltip{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}/*!@.arrow::before*/.arrow.sc-calcite-tooltip::before{outline:1px solid var(--calcite-ui-border-3)}";
  33890. const manager = new TooltipManager$1();
  33891. /**
  33892. * @slot - A slot for adding text.
  33893. */
  33894. class Tooltip {
  33895. constructor(hostRef) {
  33896. registerInstance(this, hostRef);
  33897. // --------------------------------------------------------------------------
  33898. //
  33899. // Properties
  33900. //
  33901. // --------------------------------------------------------------------------
  33902. /** Closes the component when the `referenceElement` is clicked. */
  33903. this.closeOnClick = false;
  33904. /**
  33905. * Offset the position of the component away from the `referenceElement`.
  33906. *
  33907. * @default 6
  33908. */
  33909. this.offsetDistance = defaultOffsetDistance;
  33910. /**
  33911. * Offset the position of the component along the `referenceElement`.
  33912. */
  33913. this.offsetSkidding = 0;
  33914. /**
  33915. * When `true`, the component is open.
  33916. */
  33917. this.open = false;
  33918. /**
  33919. * Determines the type of positioning to use for the overlaid content.
  33920. *
  33921. * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
  33922. *
  33923. * The `"fixed"` value should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
  33924. *
  33925. */
  33926. this.overlayPositioning = "absolute";
  33927. /**
  33928. * Determines where the component will be positioned relative to the `referenceElement`.
  33929. *
  33930. * @see [LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)
  33931. */
  33932. this.placement = "auto";
  33933. this.guid = `calcite-tooltip-${guid()}`;
  33934. this.hasLoaded = false;
  33935. // --------------------------------------------------------------------------
  33936. //
  33937. // Private Methods
  33938. //
  33939. // --------------------------------------------------------------------------
  33940. this.setUpReferenceElement = (warn = true) => {
  33941. this.removeReferences();
  33942. this.effectiveReferenceElement = this.getReferenceElement();
  33943. connectFloatingUI(this, this.effectiveReferenceElement, this.el);
  33944. const { el, referenceElement, effectiveReferenceElement } = this;
  33945. if (warn && referenceElement && !effectiveReferenceElement) {
  33946. console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
  33947. el
  33948. });
  33949. }
  33950. this.addReferences();
  33951. };
  33952. this.getId = () => {
  33953. return this.el.id || this.guid;
  33954. };
  33955. this.addReferences = () => {
  33956. const { effectiveReferenceElement } = this;
  33957. if (!effectiveReferenceElement) {
  33958. return;
  33959. }
  33960. const id = this.getId();
  33961. if ("setAttribute" in effectiveReferenceElement) {
  33962. effectiveReferenceElement.setAttribute(ARIA_DESCRIBED_BY, id);
  33963. }
  33964. manager.registerElement(effectiveReferenceElement, this.el);
  33965. };
  33966. this.removeReferences = () => {
  33967. const { effectiveReferenceElement } = this;
  33968. if (!effectiveReferenceElement) {
  33969. return;
  33970. }
  33971. if ("removeAttribute" in effectiveReferenceElement) {
  33972. effectiveReferenceElement.removeAttribute(ARIA_DESCRIBED_BY);
  33973. }
  33974. manager.unregisterElement(effectiveReferenceElement);
  33975. };
  33976. }
  33977. offsetDistanceOffsetHandler() {
  33978. this.reposition(true);
  33979. }
  33980. offsetSkiddingHandler() {
  33981. this.reposition(true);
  33982. }
  33983. openHandler(value) {
  33984. if (value) {
  33985. this.reposition(true);
  33986. }
  33987. else {
  33988. updateAfterClose(this.el);
  33989. }
  33990. }
  33991. overlayPositioningHandler() {
  33992. this.reposition(true);
  33993. }
  33994. placementHandler() {
  33995. this.reposition(true);
  33996. }
  33997. referenceElementHandler() {
  33998. this.setUpReferenceElement();
  33999. }
  34000. // --------------------------------------------------------------------------
  34001. //
  34002. // Lifecycle
  34003. //
  34004. // --------------------------------------------------------------------------
  34005. connectedCallback() {
  34006. this.setUpReferenceElement(this.hasLoaded);
  34007. }
  34008. componentDidLoad() {
  34009. if (this.referenceElement && !this.effectiveReferenceElement) {
  34010. this.setUpReferenceElement();
  34011. }
  34012. this.reposition(true);
  34013. this.hasLoaded = true;
  34014. }
  34015. disconnectedCallback() {
  34016. this.removeReferences();
  34017. disconnectFloatingUI(this, this.effectiveReferenceElement, this.el);
  34018. }
  34019. // --------------------------------------------------------------------------
  34020. //
  34021. // Public Methods
  34022. //
  34023. // --------------------------------------------------------------------------
  34024. /**
  34025. * Updates the position of the component.
  34026. *
  34027. * @param delayed
  34028. */
  34029. async reposition(delayed = false) {
  34030. const { el, effectiveReferenceElement, placement, overlayPositioning, offsetDistance, offsetSkidding, arrowEl } = this;
  34031. return reposition(this, {
  34032. floatingEl: el,
  34033. referenceEl: effectiveReferenceElement,
  34034. overlayPositioning,
  34035. placement,
  34036. offsetDistance,
  34037. offsetSkidding,
  34038. includeArrow: true,
  34039. arrowEl,
  34040. type: "tooltip"
  34041. }, delayed);
  34042. }
  34043. getReferenceElement() {
  34044. const { referenceElement, el } = this;
  34045. return ((typeof referenceElement === "string"
  34046. ? queryElementRoots(el, { id: referenceElement })
  34047. : referenceElement) || null);
  34048. }
  34049. // --------------------------------------------------------------------------
  34050. //
  34051. // Render Methods
  34052. //
  34053. // --------------------------------------------------------------------------
  34054. render() {
  34055. const { effectiveReferenceElement, label, open } = this;
  34056. const displayed = effectiveReferenceElement && open;
  34057. const hidden = !displayed;
  34058. return (hAsync(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "aria-live": "polite", "calcite-hydrated-hidden": hidden, id: this.getId(), role: "tooltip" }, hAsync("div", { class: {
  34059. [FloatingCSS.animation]: true,
  34060. [FloatingCSS.animationActive]: displayed
  34061. } }, hAsync("div", { class: CSS$2.arrow, ref: (arrowEl) => (this.arrowEl = arrowEl) }), hAsync("div", { class: CSS$2.container }, hAsync("slot", null)))));
  34062. }
  34063. get el() { return getElement(this); }
  34064. static get watchers() { return {
  34065. "offsetDistance": ["offsetDistanceOffsetHandler"],
  34066. "offsetSkidding": ["offsetSkiddingHandler"],
  34067. "open": ["openHandler"],
  34068. "overlayPositioning": ["overlayPositioningHandler"],
  34069. "placement": ["placementHandler"],
  34070. "referenceElement": ["referenceElementHandler"]
  34071. }; }
  34072. static get style() { return tooltipCss; }
  34073. static get cmpMeta() { return {
  34074. "$flags$": 9,
  34075. "$tagName$": "calcite-tooltip",
  34076. "$members$": {
  34077. "closeOnClick": [516, "close-on-click"],
  34078. "label": [1],
  34079. "offsetDistance": [514, "offset-distance"],
  34080. "offsetSkidding": [514, "offset-skidding"],
  34081. "open": [516],
  34082. "overlayPositioning": [513, "overlay-positioning"],
  34083. "placement": [513],
  34084. "referenceElement": [1, "reference-element"],
  34085. "effectiveReferenceElement": [32],
  34086. "reposition": [64]
  34087. },
  34088. "$listeners$": undefined,
  34089. "$lazyBundleId$": "-",
  34090. "$attrsToReflect$": [["closeOnClick", "close-on-click"], ["offsetDistance", "offset-distance"], ["offsetSkidding", "offset-skidding"], ["open", "open"], ["overlayPositioning", "overlay-positioning"], ["placement", "placement"]]
  34091. }; }
  34092. }
  34093. const tooltipManagerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tooltip-manager:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tooltip-manager{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tooltip-manager{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tooltip-manager{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tooltip-manager{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tooltip-manager{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tooltip-manager:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tooltip-manager:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tooltip-manager-h{display:none}/*!@:host*/.sc-calcite-tooltip-manager-h{position:relative;display:block}";
  34094. /**
  34095. * @slot - A slot for adding elements that reference a `calcite-tooltip` by the `selector` property.
  34096. * @deprecated No longer required for tooltip usage.
  34097. */
  34098. class TooltipManager {
  34099. constructor(hostRef) {
  34100. registerInstance(this, hostRef);
  34101. // --------------------------------------------------------------------------
  34102. //
  34103. // Properties
  34104. //
  34105. // --------------------------------------------------------------------------
  34106. /**
  34107. * CSS Selector to match reference elements for tooltips. Reference elements will be identified by this selector in order to open their associated tooltip.
  34108. *
  34109. * @default `[data-calcite-tooltip-reference]`
  34110. */
  34111. this.selector = "[data-calcite-tooltip-reference]";
  34112. }
  34113. // --------------------------------------------------------------------------
  34114. //
  34115. // Render Methods
  34116. //
  34117. // --------------------------------------------------------------------------
  34118. render() {
  34119. return hAsync("slot", null);
  34120. }
  34121. static get style() { return tooltipManagerCss; }
  34122. static get cmpMeta() { return {
  34123. "$flags$": 9,
  34124. "$tagName$": "calcite-tooltip-manager",
  34125. "$members$": {
  34126. "selector": [513]
  34127. },
  34128. "$listeners$": undefined,
  34129. "$lazyBundleId$": "-",
  34130. "$attrsToReflect$": [["selector", "selector"]]
  34131. }; }
  34132. }
  34133. var TreeSelectionMode;
  34134. (function (TreeSelectionMode) {
  34135. TreeSelectionMode["Single"] = "single";
  34136. TreeSelectionMode["Multi"] = "multi";
  34137. TreeSelectionMode["None"] = "none";
  34138. TreeSelectionMode["Children"] = "children";
  34139. TreeSelectionMode["MultiChildren"] = "multi-children";
  34140. TreeSelectionMode["Ancestors"] = "ancestors";
  34141. })(TreeSelectionMode || (TreeSelectionMode = {}));
  34142. function isTreeItem(element) {
  34143. return element === null || element === void 0 ? void 0 : element.matches("calcite-tree-item");
  34144. }
  34145. function getEnabledSiblingItem(el, direction) {
  34146. const directionProp = direction === "down" ? "nextElementSibling" : "previousElementSibling";
  34147. let currentEl = el;
  34148. let enabledEl = null;
  34149. while (isTreeItem(currentEl)) {
  34150. if (!currentEl.disabled) {
  34151. enabledEl = currentEl;
  34152. break;
  34153. }
  34154. currentEl = currentEl[directionProp];
  34155. }
  34156. return enabledEl;
  34157. }
  34158. const treeCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tree:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tree{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tree{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tree{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tree{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tree{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tree:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tree:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tree-h{display:none}/*!@:host*/.sc-calcite-tree-h{display:block}/*!@:host(:focus)*/.sc-calcite-tree-h:focus{outline:2px solid transparent;outline-offset:2px}";
  34159. /**
  34160. * @slot - A slot for `calcite-tree-item` elements.
  34161. */
  34162. class Tree {
  34163. constructor(hostRef) {
  34164. registerInstance(this, hostRef);
  34165. this.calciteTreeSelect = createEvent(this, "calciteTreeSelect", 6);
  34166. //--------------------------------------------------------------------------
  34167. //
  34168. // Properties
  34169. //
  34170. //--------------------------------------------------------------------------
  34171. /** Displays indentation guide lines. */
  34172. this.lines = false;
  34173. /**
  34174. * Display input
  34175. *
  34176. * @deprecated Use `selectionMode="ancestors"` for checkbox input.
  34177. */
  34178. this.inputEnabled = false;
  34179. /** Specifies the size of the component. */
  34180. this.scale = "m";
  34181. /**
  34182. * Customize how the component's selection works.
  34183. *
  34184. * @default "single"
  34185. * @see [TreeSelectionMode](https://github.com/Esri/calcite-components/blob/master/src/components/tree/interfaces.ts#L5)
  34186. */
  34187. this.selectionMode = TreeSelectionMode.Single;
  34188. }
  34189. //--------------------------------------------------------------------------
  34190. //
  34191. // Lifecycle
  34192. //
  34193. //--------------------------------------------------------------------------
  34194. componentWillRender() {
  34195. var _a;
  34196. const parent = (_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.closest("calcite-tree");
  34197. this.lines = parent ? parent.lines : this.lines;
  34198. this.scale = parent ? parent.scale : this.scale;
  34199. this.selectionMode = parent ? parent.selectionMode : this.selectionMode;
  34200. this.child = !!parent;
  34201. }
  34202. render() {
  34203. return (hAsync(Host, { "aria-multiselectable": this.child
  34204. ? undefined
  34205. : (this.selectionMode === TreeSelectionMode.Multi ||
  34206. this.selectionMode === TreeSelectionMode.MultiChildren).toString(), role: !this.child ? "tree" : undefined, tabIndex: this.getRootTabIndex() }, hAsync("slot", null)));
  34207. }
  34208. //--------------------------------------------------------------------------
  34209. //
  34210. // Event Listeners
  34211. //
  34212. //--------------------------------------------------------------------------
  34213. onFocus() {
  34214. if (!this.child) {
  34215. const focusTarget = this.el.querySelector("calcite-tree-item[selected]:not([disabled])") || this.el.querySelector("calcite-tree-item:not([disabled])");
  34216. focusElement(focusTarget);
  34217. }
  34218. }
  34219. onFocusIn(event) {
  34220. const focusedFromRootOrOutsideTree = event.relatedTarget === this.el || !this.el.contains(event.relatedTarget);
  34221. if (focusedFromRootOrOutsideTree) {
  34222. // gives user the ability to tab into external elements (modifying tabindex property will not work in firefox)
  34223. this.el.removeAttribute("tabindex");
  34224. }
  34225. }
  34226. onFocusOut(event) {
  34227. const willFocusOutsideTree = !this.el.contains(event.relatedTarget);
  34228. if (willFocusOutsideTree) {
  34229. this.el.tabIndex = this.getRootTabIndex();
  34230. }
  34231. }
  34232. onClick(event) {
  34233. const target = event.target;
  34234. const childItems = nodeListToArray(target.querySelectorAll("calcite-tree-item"));
  34235. if (this.child) {
  34236. return;
  34237. }
  34238. if (!this.child) {
  34239. event.preventDefault();
  34240. event.stopPropagation();
  34241. }
  34242. if (this.selectionMode === TreeSelectionMode.Ancestors && !this.child) {
  34243. this.updateAncestorTree(event);
  34244. return;
  34245. }
  34246. const isNoneSelectionMode = this.selectionMode === TreeSelectionMode.None;
  34247. const shouldSelect = this.selectionMode !== null &&
  34248. (!target.hasChildren ||
  34249. (target.hasChildren &&
  34250. (this.selectionMode === TreeSelectionMode.Children ||
  34251. this.selectionMode === TreeSelectionMode.MultiChildren)));
  34252. const shouldModifyToCurrentSelection = !isNoneSelectionMode &&
  34253. event.detail.modifyCurrentSelection &&
  34254. (this.selectionMode === TreeSelectionMode.Multi ||
  34255. this.selectionMode === TreeSelectionMode.MultiChildren);
  34256. const shouldSelectChildren = this.selectionMode === TreeSelectionMode.MultiChildren ||
  34257. this.selectionMode === TreeSelectionMode.Children;
  34258. const shouldClearCurrentSelection = !shouldModifyToCurrentSelection &&
  34259. (((this.selectionMode === TreeSelectionMode.Single ||
  34260. this.selectionMode === TreeSelectionMode.Multi) &&
  34261. childItems.length <= 0) ||
  34262. this.selectionMode === TreeSelectionMode.Children ||
  34263. this.selectionMode === TreeSelectionMode.MultiChildren);
  34264. const shouldExpandTarget = this.selectionMode === TreeSelectionMode.Children ||
  34265. this.selectionMode === TreeSelectionMode.MultiChildren;
  34266. if (!this.child) {
  34267. const targetItems = [];
  34268. if (shouldSelect) {
  34269. targetItems.push(target);
  34270. }
  34271. if (shouldSelectChildren) {
  34272. childItems.forEach((treeItem) => {
  34273. targetItems.push(treeItem);
  34274. });
  34275. }
  34276. if (shouldClearCurrentSelection) {
  34277. const selectedItems = nodeListToArray(this.el.querySelectorAll("calcite-tree-item[selected]"));
  34278. selectedItems.forEach((treeItem) => {
  34279. if (!targetItems.includes(treeItem)) {
  34280. treeItem.selected = false;
  34281. }
  34282. });
  34283. }
  34284. if (shouldExpandTarget && !event.detail.forceToggle) {
  34285. target.expanded = true;
  34286. }
  34287. if (shouldModifyToCurrentSelection) {
  34288. window.getSelection().removeAllRanges();
  34289. }
  34290. if ((shouldModifyToCurrentSelection && target.selected) ||
  34291. (shouldSelectChildren && event.detail.forceToggle)) {
  34292. targetItems.forEach((treeItem) => {
  34293. if (!treeItem.disabled) {
  34294. treeItem.selected = false;
  34295. }
  34296. });
  34297. }
  34298. else if (!isNoneSelectionMode) {
  34299. targetItems.forEach((treeItem) => {
  34300. if (!treeItem.disabled) {
  34301. treeItem.selected = true;
  34302. }
  34303. });
  34304. }
  34305. }
  34306. const selected = isNoneSelectionMode
  34307. ? [target]
  34308. : nodeListToArray(this.el.querySelectorAll("calcite-tree-item")).filter((i) => i.selected);
  34309. this.calciteTreeSelect.emit({ selected });
  34310. event.stopPropagation();
  34311. }
  34312. keyDownHandler(event) {
  34313. var _a;
  34314. const root = this.el.closest("calcite-tree:not([child])");
  34315. const target = event.target;
  34316. if (!(root === this.el && target.tagName === "CALCITE-TREE-ITEM" && this.el.contains(target))) {
  34317. return;
  34318. }
  34319. if (event.key === "ArrowDown") {
  34320. const next = getEnabledSiblingItem(target.nextElementSibling, "down");
  34321. if (next) {
  34322. next.focus();
  34323. event.preventDefault();
  34324. }
  34325. return;
  34326. }
  34327. if (event.key === "ArrowUp") {
  34328. const previous = getEnabledSiblingItem(target.previousElementSibling, "up");
  34329. if (previous) {
  34330. previous.focus();
  34331. event.preventDefault();
  34332. }
  34333. }
  34334. if (event.key === "ArrowLeft" && !target.disabled) {
  34335. // When focus is on an open node, closes the node.
  34336. if (target.hasChildren && target.expanded) {
  34337. target.expanded = false;
  34338. event.preventDefault();
  34339. return;
  34340. }
  34341. // When focus is on a child node that is also either an end node or a closed node, moves focus to its parent node.
  34342. const parentItem = target.parentElement.closest("calcite-tree-item");
  34343. if (parentItem && (!target.hasChildren || target.expanded === false)) {
  34344. parentItem.focus();
  34345. event.preventDefault();
  34346. return;
  34347. }
  34348. // When focus is on a root node that is also either an end node or a closed node, does nothing.
  34349. return;
  34350. }
  34351. if (event.key === "ArrowRight" && !target.disabled) {
  34352. if (target.hasChildren) {
  34353. if (target.expanded && getRootNode(this.el).activeElement === target) {
  34354. // When focus is on an open node, moves focus to the first child node.
  34355. (_a = getEnabledSiblingItem(target.querySelector("calcite-tree-item"), "down")) === null || _a === void 0 ? void 0 : _a.focus();
  34356. event.preventDefault();
  34357. }
  34358. else {
  34359. // When focus is on a closed node, opens the node; focus does not move.
  34360. target.expanded = true;
  34361. event.preventDefault();
  34362. }
  34363. }
  34364. return;
  34365. }
  34366. }
  34367. updateAncestorTree(event) {
  34368. const item = event.target;
  34369. if (item.disabled) {
  34370. return;
  34371. }
  34372. const ancestors = [];
  34373. let parent = item.parentElement.closest("calcite-tree-item");
  34374. while (parent) {
  34375. ancestors.push(parent);
  34376. parent = parent.parentElement.closest("calcite-tree-item");
  34377. }
  34378. const childItems = Array.from(item.querySelectorAll("calcite-tree-item:not([disabled])"));
  34379. const childItemsWithNoChildren = childItems.filter((child) => !child.hasChildren);
  34380. const childItemsWithChildren = childItems.filter((child) => child.hasChildren);
  34381. const futureSelected = item.hasChildren
  34382. ? !(item.selected || item.indeterminate)
  34383. : !item.selected;
  34384. childItemsWithNoChildren.forEach((el) => {
  34385. el.selected = futureSelected;
  34386. el.indeterminate = false;
  34387. });
  34388. function updateItemState(childItems, item) {
  34389. const selected = childItems.filter((child) => child.selected);
  34390. const unselected = childItems.filter((child) => !child.selected);
  34391. item.selected = selected.length === childItems.length;
  34392. item.indeterminate = selected.length > 0 && unselected.length > 0;
  34393. }
  34394. childItemsWithChildren.forEach((el) => {
  34395. const directChildItems = Array.from(el.querySelectorAll(":scope > calcite-tree > calcite-tree-item"));
  34396. updateItemState(directChildItems, el);
  34397. });
  34398. if (item.hasChildren) {
  34399. updateItemState(childItems, item);
  34400. }
  34401. else {
  34402. item.selected = futureSelected;
  34403. item.indeterminate = false;
  34404. }
  34405. ancestors.forEach((ancestor) => {
  34406. const descendants = nodeListToArray(ancestor.querySelectorAll("calcite-tree-item"));
  34407. const activeDescendants = descendants.filter((el) => el.selected);
  34408. if (activeDescendants.length === 0) {
  34409. ancestor.selected = false;
  34410. ancestor.indeterminate = false;
  34411. return;
  34412. }
  34413. const indeterminate = activeDescendants.length < descendants.length;
  34414. ancestor.indeterminate = indeterminate;
  34415. ancestor.selected = !indeterminate;
  34416. });
  34417. this.calciteTreeSelect.emit({
  34418. selected: nodeListToArray(this.el.querySelectorAll("calcite-tree-item")).filter((i) => i.selected)
  34419. });
  34420. }
  34421. // --------------------------------------------------------------------------
  34422. //
  34423. // Private Methods
  34424. //
  34425. //--------------------------------------------------------------------------
  34426. getRootTabIndex() {
  34427. return !this.child ? 0 : -1;
  34428. }
  34429. get el() { return getElement(this); }
  34430. static get style() { return treeCss; }
  34431. static get cmpMeta() { return {
  34432. "$flags$": 9,
  34433. "$tagName$": "calcite-tree",
  34434. "$members$": {
  34435. "lines": [1540],
  34436. "inputEnabled": [4, "input-enabled"],
  34437. "child": [1540],
  34438. "scale": [1537],
  34439. "selectionMode": [1537, "selection-mode"]
  34440. },
  34441. "$listeners$": [[0, "focus", "onFocus"], [0, "focusin", "onFocusIn"], [0, "focusout", "onFocusOut"], [0, "calciteInternalTreeItemSelect", "onClick"], [0, "keydown", "keyDownHandler"]],
  34442. "$lazyBundleId$": "-",
  34443. "$attrsToReflect$": [["lines", "lines"], ["child", "child"], ["scale", "scale"], ["selectionMode", "selection-mode"]]
  34444. }; }
  34445. }
  34446. const CSS$1 = {
  34447. checkboxLabel: "checkbox-label",
  34448. checkbox: "checkbox",
  34449. chevron: "chevron",
  34450. nodeContainer: "node-container",
  34451. childrenContainer: "children-container",
  34452. bulletPointIcon: "bullet-point",
  34453. checkmarkIcon: "checkmark"
  34454. };
  34455. const SLOTS$1 = {
  34456. children: "children"
  34457. };
  34458. const ICONS$1 = {
  34459. bulletPoint: "bullet-point",
  34460. checkmark: "check",
  34461. chevronRight: "chevron-right",
  34462. blank: "blank"
  34463. };
  34464. const treeItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-tree-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-tree-item{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tree-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tree-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tree-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tree-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tree-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tree-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tree-item-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-tree-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-tree-item-h{display:block;max-inline-size:100%;cursor:pointer;color:var(--calcite-ui-text-3)}/*!@:host([calcite-hydrated-hidden])*/[calcite-hydrated-hidden].sc-calcite-tree-item-h{visibility:hidden !important;pointer-events:none}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-tree-item-h[disabled] .sc-calcite-tree-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-tree-item-h [calcite-hydrated][disabled].sc-calcite-tree-item{opacity:1}/*!@:host([scale=s])*/[scale=s].sc-calcite-tree-item-h{font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=s]) .node-container*/[scale=s].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item{--calcite-tree-padding-y:0.25rem}/*!@:host([scale=s]) .node-container .checkbox,\n:host([scale=s]) .node-container .chevron,\n:host([scale=s]) .node-container .checkmark,\n:host([scale=s]) .node-container .bullet-point*/[scale=s].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .checkbox.sc-calcite-tree-item,[scale=s].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .chevron.sc-calcite-tree-item,[scale=s].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,[scale=s].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item{margin-inline:0.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-tree-item-h{font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=m]) .node-container*/[scale=m].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item{--calcite-tree-padding-y:0.5rem}/*!@:host([scale=m]) .node-container .checkbox,\n:host([scale=m]) .node-container .chevron,\n:host([scale=m]) .node-container .checkmark,\n:host([scale=m]) .node-container .bullet-point*/[scale=m].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .checkbox.sc-calcite-tree-item,[scale=m].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .chevron.sc-calcite-tree-item,[scale=m].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,[scale=m].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item{margin-inline:0.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-tree-item-h{font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l]) .node-container*/[scale=l].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item{--calcite-tree-padding-y:0.75rem}/*!@:host([scale=l]) .node-container .checkbox,\n:host([scale=l]) .node-container .chevron,\n:host([scale=l]) .node-container .checkmark,\n:host([scale=l]) .node-container .bullet-point*/[scale=l].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .checkbox.sc-calcite-tree-item,[scale=l].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .chevron.sc-calcite-tree-item,[scale=l].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,[scale=l].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item{margin-inline:0.75rem}/*!@:host([lines]) .children-container:after*/[lines].sc-calcite-tree-item-h .children-container.sc-calcite-tree-item:after{position:absolute;inset-block-start:0px;z-index:1;inline-size:1px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;block-size:96%;content:\"\";background-color:var(--calcite-ui-border-2)}/*!@:host(:not([lines])) .node-container:after*/.sc-calcite-tree-item-h:not([lines]) .node-container.sc-calcite-tree-item:after{display:none}/*!@::slotted(*)*/.sc-calcite-tree-item-s>*{min-inline-size:0px;max-inline-size:100%;overflow-wrap:break-word;color:inherit;text-decoration:none !important}/*!@::slotted(*):hover*/.sc-calcite-tree-item-s>*:hover{text-decoration:none !important}/*!@::slotted(a)*/.sc-calcite-tree-item-s>a{inline-size:100%;text-decoration-line:none}/*!@:host*/.sc-calcite-tree-item-h{outline-color:transparent}/*!@:host(:focus:not([disabled]))*/.sc-calcite-tree-item-h:focus:not([disabled]){outline:2px solid transparent;outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.checkbox*/.checkbox.sc-calcite-tree-item{line-height:0}/*!@.checkbox-label*/.checkbox-label.sc-calcite-tree-item{pointer-events:none;display:flex;align-items:center}/*!@.checkbox:focus*/.checkbox.sc-calcite-tree-item:focus{outline:2px solid transparent;outline-offset:2px}/*!@.children-container*/.children-container.sc-calcite-tree-item{position:relative;block-size:0px;overflow:hidden;margin-inline-start:1.25rem;transform:scaleY(0);opacity:0;transition:var(--calcite-animation-timing) cubic-bezier(0.215, 0.44, 0.42, 0.88), opacity var(--calcite-animation-timing) cubic-bezier(0.215, 0.44, 0.42, 0.88), all var(--calcite-animation-timing) ease-in-out;transform-origin:top}/*!@:host([expanded]) > .children-container*/[expanded].sc-calcite-tree-item-h>.children-container.sc-calcite-tree-item{transform:scaleY(1);opacity:1;block-size:auto}/*!@.node-container*/.node-container.sc-calcite-tree-item{position:relative;display:flex;align-items:center;padding-block:var(--calcite-tree-padding-y);padding-inline:0}/*!@.node-container .checkmark, \n.node-container .bullet-point*/.node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,.node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item{opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;color:var(--calcite-ui-border-1)}/*!@.node-container:hover .checkmark, \n.node-container:hover .bullet-point, \n:host([selected]) .node-container:hover .checkmark, \n:host([selected]) .node-container:hover .bullet-point, \n:host(:focus:not([disabled])) .node-container .checkmark, \n:host(:focus:not([disabled])) .node-container .bullet-point*/.node-container.sc-calcite-tree-item:hover .checkmark.sc-calcite-tree-item,.node-container.sc-calcite-tree-item:hover .bullet-point.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item:hover .checkmark.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h .node-container.sc-calcite-tree-item:hover .bullet-point.sc-calcite-tree-item,.sc-calcite-tree-item-h:focus:not([disabled]) .node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,.sc-calcite-tree-item-h:focus:not([disabled]) .node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item{opacity:1}/*!@:host([selected]) > .node-container, \n:host([selected]) > .node-container:hover*/[selected].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item:hover{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@:host([selected]) > .node-container .bullet-point, \n:host([selected]) > .node-container .checkmark, \n:host([selected]) > .node-container:hover .bullet-point, \n:host([selected]) > .node-container:hover .checkmark*/[selected].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item:hover .bullet-point.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item:hover .checkmark.sc-calcite-tree-item{opacity:1;color:var(--calcite-ui-brand)}/*!@:host([selection-mode=none]:not([has-children])):host([scale=s]) > .node-container*/[selection-mode=none].sc-calcite-tree-item-h:not([has-children]).sc-calcite-tree-item-h([scale=s])>.node-container.sc-calcite-tree-item{padding-inline-start:0.5rem}/*!@:host([selection-mode=none]:not([has-children])):host([scale=m]) > .node-container*/[selection-mode=none].sc-calcite-tree-item-h:not([has-children]).sc-calcite-tree-item-h([scale=m])>.node-container.sc-calcite-tree-item{padding-inline-start:1rem}/*!@:host([selection-mode=none]:not([has-children])):host([scale=l]) > .node-container*/[selection-mode=none].sc-calcite-tree-item-h:not([has-children]).sc-calcite-tree-item-h([scale=l])>.node-container.sc-calcite-tree-item{padding-inline-start:1.5rem}/*!@:host(:not([has-children])):host([scale=s]) > .node-container[data-selection-mode=ancestors] .checkbox*/.sc-calcite-tree-item-h:not([has-children]).sc-calcite-tree-item-h([scale=s])>.node-container[data-selection-mode=ancestors].sc-calcite-tree-item .checkbox.sc-calcite-tree-item{padding-inline-start:1.25rem}/*!@:host(:not([has-children])):host([scale=m]) > .node-container[data-selection-mode=ancestors] .checkbox*/.sc-calcite-tree-item-h:not([has-children]).sc-calcite-tree-item-h([scale=m])>.node-container[data-selection-mode=ancestors].sc-calcite-tree-item .checkbox.sc-calcite-tree-item{padding-inline-start:1.5rem}/*!@:host(:not([has-children])):host([scale=l]) > .node-container[data-selection-mode=ancestors] .checkbox*/.sc-calcite-tree-item-h:not([has-children]).sc-calcite-tree-item-h([scale=l])>.node-container[data-selection-mode=ancestors].sc-calcite-tree-item .checkbox.sc-calcite-tree-item{padding-inline-start:1.75rem}/*!@:host([has-children]) > .node-container[data-selection-mode=ancestors] .checkbox*/[has-children].sc-calcite-tree-item-h>.node-container[data-selection-mode=ancestors].sc-calcite-tree-item .checkbox.sc-calcite-tree-item{margin-inline-start:0}/*!@:host([has-children]) > .node-container .bullet-point, \n:host([has-children]) > .node-container .checkmark*/[has-children].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item,[has-children].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item{display:none}/*!@:host([has-children][expanded]:not([selected]):not([selection-mode=none])) > .node-container ::slotted(*)*/.sc-calcite-tree-item-h[has-children][expanded]:not([selected]):not([selection-mode=none])>.node-container .sc-calcite-tree-item-s>*{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}/*!@:host([has-children][selected]) > .node-container[data-selection-mode=children], :host([has-children][selected]) > .node-container[data-selection-mode=multi-children]*/[has-children][selected].sc-calcite-tree-item-h>.node-container[data-selection-mode=children].sc-calcite-tree-item,[has-children][selected].sc-calcite-tree-item-h>.node-container[data-selection-mode=multi-children].sc-calcite-tree-item{color:var(--calcite-ui-brand)}/*!@.chevron*/.chevron.sc-calcite-tree-item{position:relative;align-self:center;color:var(--calcite-ui-text-3);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;flex:0 0 auto;transform:rotate(0deg)}/*!@.calcite--rtl .chevron*/.calcite--rtl.sc-calcite-tree-item .chevron.sc-calcite-tree-item{transform:rotate(180deg)}/*!@:host([expanded]) > .node-container > .chevron*/[expanded].sc-calcite-tree-item-h>.node-container.sc-calcite-tree-item>.chevron.sc-calcite-tree-item{transform:rotate(90deg)}/*!@:host([selected]) .checkmark,\n:host([selected]) .bullet-point*/[selected].sc-calcite-tree-item-h .checkmark.sc-calcite-tree-item,[selected].sc-calcite-tree-item-h .bullet-point.sc-calcite-tree-item{color:var(--calcite-ui-brand)}";
  34465. /**
  34466. * @slot - A slot for adding the component's content.
  34467. * @slot children - A slot for adding nested `calcite-tree` elements.
  34468. */
  34469. class TreeItem {
  34470. constructor(hostRef) {
  34471. registerInstance(this, hostRef);
  34472. this.calciteInternalTreeItemSelect = createEvent(this, "calciteInternalTreeItemSelect", 6);
  34473. //--------------------------------------------------------------------------
  34474. //
  34475. // Properties
  34476. //
  34477. //--------------------------------------------------------------------------
  34478. /**
  34479. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  34480. */
  34481. this.disabled = false;
  34482. /** When `true`, the component is selected. */
  34483. this.selected = false;
  34484. /** When `true`, the component is expanded. */
  34485. this.expanded = false;
  34486. /**
  34487. * @internal
  34488. */
  34489. this.parentExpanded = false;
  34490. /**
  34491. * @internal
  34492. */
  34493. this.depth = -1;
  34494. /**
  34495. * @internal
  34496. */
  34497. this.hasChildren = null;
  34498. this.iconClickHandler = (event) => {
  34499. event.stopPropagation();
  34500. this.expanded = !this.expanded;
  34501. };
  34502. this.childrenClickHandler = (event) => event.stopPropagation();
  34503. //--------------------------------------------------------------------------
  34504. //
  34505. // Private Methods
  34506. //
  34507. //--------------------------------------------------------------------------
  34508. this.updateParentIsExpanded = (el, expanded) => {
  34509. const items = getSlotted(el, SLOTS$1.children, {
  34510. all: true,
  34511. selector: "calcite-tree-item"
  34512. });
  34513. items.forEach((item) => (item.parentExpanded = expanded));
  34514. };
  34515. this.updateAncestorTree = () => {
  34516. var _a;
  34517. if (this.selected && this.selectionMode === TreeSelectionMode.Ancestors) {
  34518. const ancestors = [];
  34519. let parent = this.parentTreeItem;
  34520. while (parent) {
  34521. ancestors.push(parent);
  34522. parent = (_a = parent.parentElement) === null || _a === void 0 ? void 0 : _a.closest("calcite-tree-item");
  34523. }
  34524. ancestors.forEach((item) => (item.indeterminate = true));
  34525. return;
  34526. }
  34527. };
  34528. }
  34529. expandedHandler(newValue) {
  34530. this.updateParentIsExpanded(this.el, newValue);
  34531. }
  34532. getselectionMode() {
  34533. this.isSelectionMultiLike =
  34534. this.selectionMode === TreeSelectionMode.Multi ||
  34535. this.selectionMode === TreeSelectionMode.MultiChildren;
  34536. }
  34537. //--------------------------------------------------------------------------
  34538. //
  34539. // Lifecycle
  34540. //
  34541. //--------------------------------------------------------------------------
  34542. connectedCallback() {
  34543. var _a;
  34544. this.parentTreeItem = (_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.closest("calcite-tree-item");
  34545. if (this.parentTreeItem) {
  34546. const { expanded } = this.parentTreeItem;
  34547. this.updateParentIsExpanded(this.parentTreeItem, expanded);
  34548. }
  34549. connectConditionalSlotComponent(this);
  34550. }
  34551. disconnectedCallback() {
  34552. disconnectConditionalSlotComponent(this);
  34553. }
  34554. componentWillRender() {
  34555. var _a;
  34556. this.hasChildren = !!this.el.querySelector("calcite-tree");
  34557. this.depth = 0;
  34558. let parentTree = this.el.closest("calcite-tree");
  34559. if (!parentTree) {
  34560. return;
  34561. }
  34562. this.selectionMode = parentTree.selectionMode;
  34563. this.scale = parentTree.scale || "m";
  34564. this.lines = parentTree.lines;
  34565. let nextParentTree;
  34566. while (parentTree) {
  34567. nextParentTree = (_a = parentTree.parentElement) === null || _a === void 0 ? void 0 : _a.closest("calcite-tree");
  34568. if (nextParentTree === parentTree) {
  34569. break;
  34570. }
  34571. else {
  34572. parentTree = nextParentTree;
  34573. this.depth = this.depth + 1;
  34574. }
  34575. }
  34576. }
  34577. componentDidLoad() {
  34578. this.updateAncestorTree();
  34579. }
  34580. componentDidRender() {
  34581. updateHostInteraction(this, () => this.parentExpanded || this.depth === 1);
  34582. }
  34583. render() {
  34584. const rtl = getElementDir(this.el) === "rtl";
  34585. const showBulletPoint = this.selectionMode === TreeSelectionMode.Single ||
  34586. this.selectionMode === TreeSelectionMode.Children;
  34587. const showCheckmark = this.selectionMode === TreeSelectionMode.Multi ||
  34588. this.selectionMode === TreeSelectionMode.MultiChildren;
  34589. const showBlank = this.selectionMode === TreeSelectionMode.None && !this.hasChildren;
  34590. const chevron = this.hasChildren ? (hAsync("calcite-icon", { class: {
  34591. [CSS$1.chevron]: true,
  34592. [CSS_UTILITY.rtl]: rtl
  34593. }, "data-test-id": "icon", icon: ICONS$1.chevronRight, onClick: this.iconClickHandler, scale: "s" })) : null;
  34594. const defaultSlotNode = hAsync("slot", { key: "default-slot" });
  34595. const checkbox = this.selectionMode === TreeSelectionMode.Ancestors ? (hAsync("label", { class: CSS$1.checkboxLabel, key: "checkbox-label" }, hAsync("calcite-checkbox", { checked: this.selected, class: CSS$1.checkbox, "data-test-id": "checkbox", indeterminate: this.hasChildren && this.indeterminate, scale: this.scale, tabIndex: -1 }), defaultSlotNode)) : null;
  34596. const selectedIcon = showBulletPoint
  34597. ? ICONS$1.bulletPoint
  34598. : showCheckmark
  34599. ? ICONS$1.checkmark
  34600. : showBlank
  34601. ? ICONS$1.blank
  34602. : null;
  34603. const itemIndicator = selectedIcon ? (hAsync("calcite-icon", { class: {
  34604. [CSS$1.bulletPointIcon]: selectedIcon === ICONS$1.bulletPoint,
  34605. [CSS$1.checkmarkIcon]: selectedIcon === ICONS$1.checkmark,
  34606. [CSS_UTILITY.rtl]: rtl
  34607. }, icon: selectedIcon, scale: "s" })) : null;
  34608. const hidden = !(this.parentExpanded || this.depth === 1);
  34609. return (hAsync(Host, { "aria-expanded": this.hasChildren ? toAriaBoolean(this.expanded) : undefined, "aria-hidden": toAriaBoolean(hidden), "aria-selected": this.selected ? "true" : showCheckmark ? "false" : undefined, "calcite-hydrated-hidden": hidden, role: "treeitem" }, hAsync("div", { class: {
  34610. [CSS$1.nodeContainer]: true,
  34611. [CSS_UTILITY.rtl]: rtl
  34612. }, "data-selection-mode": this.selectionMode, ref: (el) => (this.defaultSlotWrapper = el) }, chevron, itemIndicator, checkbox ? checkbox : defaultSlotNode), hAsync("div", { class: {
  34613. [CSS$1.childrenContainer]: true,
  34614. [CSS_UTILITY.rtl]: rtl
  34615. }, "data-test-id": "calcite-tree-children", onClick: this.childrenClickHandler, ref: (el) => (this.childrenSlotWrapper = el), role: this.hasChildren ? "group" : undefined }, hAsync("slot", { name: SLOTS$1.children }))));
  34616. }
  34617. //--------------------------------------------------------------------------
  34618. //
  34619. // Event Listeners
  34620. //
  34621. //--------------------------------------------------------------------------
  34622. onClick(event) {
  34623. // Solve for if the item is clicked somewhere outside the slotted anchor.
  34624. // Anchor is triggered anywhere you click
  34625. const [link] = filterDirectChildren(this.el, "a");
  34626. if (link && event.composedPath()[0].tagName.toLowerCase() !== "a") {
  34627. const target = link.target === "" ? "_self" : link.target;
  34628. window.open(link.href, target);
  34629. }
  34630. this.calciteInternalTreeItemSelect.emit({
  34631. modifyCurrentSelection: this.selectionMode === TreeSelectionMode.Ancestors || this.isSelectionMultiLike,
  34632. forceToggle: false
  34633. });
  34634. }
  34635. keyDownHandler(event) {
  34636. let root;
  34637. switch (event.key) {
  34638. case " ":
  34639. this.calciteInternalTreeItemSelect.emit({
  34640. modifyCurrentSelection: this.isSelectionMultiLike,
  34641. forceToggle: false
  34642. });
  34643. event.preventDefault();
  34644. break;
  34645. case "Enter":
  34646. // activates a node, i.e., performs its default action. For parent nodes, one possible default action is to open or close the node. In single-select trees where selection does not follow focus (see note below), the default action is typically to select the focused node.
  34647. const link = nodeListToArray(this.el.children).find((el) => el.matches("a"));
  34648. if (link) {
  34649. link.click();
  34650. this.selected = true;
  34651. }
  34652. else {
  34653. this.calciteInternalTreeItemSelect.emit({
  34654. modifyCurrentSelection: this.isSelectionMultiLike,
  34655. forceToggle: false
  34656. });
  34657. }
  34658. event.preventDefault();
  34659. break;
  34660. case "Home":
  34661. root = this.el.closest("calcite-tree:not([child])");
  34662. const firstNode = root.querySelector("calcite-tree-item");
  34663. firstNode === null || firstNode === void 0 ? void 0 : firstNode.focus();
  34664. break;
  34665. case "End":
  34666. root = this.el.closest("calcite-tree:not([child])");
  34667. let currentNode = root.children[root.children.length - 1]; // last child
  34668. let currentTree = nodeListToArray(currentNode.children).find((el) => el.matches("calcite-tree"));
  34669. while (currentTree) {
  34670. currentNode = currentTree.children[root.children.length - 1];
  34671. currentTree = nodeListToArray(currentNode.children).find((el) => el.matches("calcite-tree"));
  34672. }
  34673. currentNode === null || currentNode === void 0 ? void 0 : currentNode.focus();
  34674. break;
  34675. }
  34676. }
  34677. get el() { return getElement(this); }
  34678. static get watchers() { return {
  34679. "expanded": ["expandedHandler"],
  34680. "selectionMode": ["getselectionMode"]
  34681. }; }
  34682. static get style() { return treeItemCss; }
  34683. static get cmpMeta() { return {
  34684. "$flags$": 9,
  34685. "$tagName$": "calcite-tree-item",
  34686. "$members$": {
  34687. "disabled": [516],
  34688. "selected": [1540],
  34689. "expanded": [1540],
  34690. "parentExpanded": [4, "parent-expanded"],
  34691. "depth": [1538],
  34692. "hasChildren": [1540, "has-children"],
  34693. "lines": [1540],
  34694. "inputEnabled": [4, "input-enabled"],
  34695. "scale": [1537],
  34696. "indeterminate": [516],
  34697. "selectionMode": [1537, "selection-mode"]
  34698. },
  34699. "$listeners$": [[0, "click", "onClick"], [0, "keydown", "keyDownHandler"]],
  34700. "$lazyBundleId$": "-",
  34701. "$attrsToReflect$": [["disabled", "disabled"], ["selected", "selected"], ["expanded", "expanded"], ["depth", "depth"], ["hasChildren", "has-children"], ["lines", "lines"], ["scale", "scale"], ["indeterminate", "indeterminate"], ["selectionMode", "selection-mode"]]
  34702. }; }
  34703. }
  34704. const CSS = {
  34705. container: "container",
  34706. handle: "handle"
  34707. };
  34708. var ICON_TYPES;
  34709. (function (ICON_TYPES) {
  34710. ICON_TYPES["grip"] = "grip";
  34711. })(ICON_TYPES || (ICON_TYPES = {}));
  34712. function getScreenReaderText(item, status, valueList) {
  34713. const { items, intlDragHandleIdle, intlDragHandleActive, intlDragHandleChange, intlDragHandleCommit } = valueList;
  34714. const total = items.length;
  34715. const position = getItemIndex(valueList, item) + 1;
  34716. if (status === "idle") {
  34717. const idleText = intlDragHandleIdle
  34718. ? replacePlaceholders(intlDragHandleIdle, item.label, position, total)
  34719. : `${item.label}, press space and use arrow keys to reorder content. Current position ${position} of ${total}.`;
  34720. return idleText;
  34721. }
  34722. else if (status === "active") {
  34723. const activeText = intlDragHandleActive
  34724. ? replacePlaceholders(intlDragHandleActive, item.label, position, total)
  34725. : `Reordering ${item.label}, current position ${position} of ${total}.`;
  34726. return activeText;
  34727. }
  34728. else if (status === "change") {
  34729. const changeText = intlDragHandleChange
  34730. ? replacePlaceholders(intlDragHandleChange, item.label, position, total)
  34731. : `${item.label}, new position ${position} of ${total}. Press space to confirm.`;
  34732. return changeText;
  34733. }
  34734. else {
  34735. const commitText = intlDragHandleCommit
  34736. ? replacePlaceholders(intlDragHandleCommit, item.label, position, total)
  34737. : `${item.label}, current position ${position} of ${total}.`;
  34738. return commitText;
  34739. }
  34740. }
  34741. function getHandleAndItemElement(event) {
  34742. const handle = event
  34743. .composedPath()
  34744. .find((item) => { var _a; return ((_a = item.dataset) === null || _a === void 0 ? void 0 : _a.jsHandle) !== undefined; });
  34745. const item = event
  34746. .composedPath()
  34747. .find((item) => { var _a; return ((_a = item.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "calcite-value-list-item"; });
  34748. return { handle, item };
  34749. }
  34750. function replacePlaceholders(text, label, position, total) {
  34751. const replacePosition = text.replace("${position}", position.toString());
  34752. const replaceLabel = replacePosition.replace("${item.label}", label);
  34753. return replaceLabel.replace("${total}", total.toString());
  34754. }
  34755. const valueListCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-value-list:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-value-list{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-value-list{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-value-list{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-value-list{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-value-list{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-value-list:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-value-list:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-value-list-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-value-list-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-value-list-h{position:relative;box-sizing:border-box;display:flex;flex-shrink:0;flex-grow:0;flex-direction:column;align-items:stretch;background-color:transparent;font-size:var(--calcite-font-size--1);color:var(--calcite-ui-text-2)}/*!@:host **/.sc-calcite-value-list-h *.sc-calcite-value-list{box-sizing:border-box}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-value-list-h[disabled] .sc-calcite-value-list-s>[calcite-hydrated][disabled],[disabled].sc-calcite-value-list-h [calcite-hydrated][disabled].sc-calcite-value-list{opacity:1}/*!@calcite-value-list-item:last-of-type*/calcite-value-list-item.sc-calcite-value-list:last-of-type{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([filter-enabled]) header*/[filter-enabled].sc-calcite-value-list-h header.sc-calcite-value-list{margin-block-end:0.25rem;display:flex;align-items:center;justify-content:flex-end;background-color:var(--calcite-ui-foreground-1);--tw-shadow:0 1px 0 var(--calcite-ui-border-3);--tw-shadow-colored:0 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([filter-enabled]) header.sticky-pos*/[filter-enabled].sc-calcite-value-list-h header.sticky-pos.sc-calcite-value-list{position:sticky;inset-block-start:0px;z-index:300}/*!@calcite-filter*/calcite-filter.sc-calcite-value-list{margin-block-end:1px}";
  34756. /**
  34757. * @slot - A slot for adding `calcite-value-list-item` elements. List items are displayed as a vertical list.
  34758. * @slot menu-actions - A slot for adding a button and menu combination for performing actions, such as sorting.
  34759. */
  34760. class ValueList {
  34761. constructor(hostRef) {
  34762. registerInstance(this, hostRef);
  34763. this.calciteListChange = createEvent(this, "calciteListChange", 6);
  34764. this.calciteListOrderChange = createEvent(this, "calciteListOrderChange", 6);
  34765. // --------------------------------------------------------------------------
  34766. //
  34767. // Properties
  34768. //
  34769. // --------------------------------------------------------------------------
  34770. /**
  34771. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  34772. */
  34773. this.disabled = false;
  34774. /**
  34775. * When `true`, `calcite-value-list-item`s are sortable via a draggable button.
  34776. */
  34777. this.dragEnabled = false;
  34778. /**
  34779. * When `true`, an input appears at the top of the component that can be used by end users to filter list items.
  34780. */
  34781. this.filterEnabled = false;
  34782. /**
  34783. * When `true`, a busy indicator is displayed.
  34784. */
  34785. this.loading = false;
  34786. /**
  34787. * Similar to standard radio buttons and checkboxes.
  34788. * When `true`, a user can select multiple `calcite-value-list-item`s at a time.
  34789. * When `false`, only a single `calcite-value-list-item` can be selected at a time,
  34790. * and a new selection will deselect previous selections.
  34791. */
  34792. this.multiple = false;
  34793. /**
  34794. * When `true` and single-selection is enabled, the selection changes when navigating `calcite-value-list-item`s via keyboard.
  34795. */
  34796. this.selectionFollowsFocus = false;
  34797. // --------------------------------------------------------------------------
  34798. //
  34799. // Private Properties
  34800. //
  34801. // --------------------------------------------------------------------------
  34802. this.selectedValues = new Map();
  34803. this.dataForFilter = [];
  34804. this.lastSelectedItem = null;
  34805. this.mutationObserver = createObserver("mutation", mutationObserverCallback.bind(this));
  34806. this.setFilterEl = (el) => {
  34807. this.filterEl = el;
  34808. };
  34809. this.deselectRemovedItems = deselectRemovedItems.bind(this);
  34810. this.deselectSiblingItems = deselectSiblingItems.bind(this);
  34811. this.selectSiblings = selectSiblings.bind(this);
  34812. this.handleFilter = handleFilter.bind(this);
  34813. this.getItemData = getItemData.bind(this);
  34814. this.keyDownHandler = (event) => {
  34815. if (event.defaultPrevented) {
  34816. return;
  34817. }
  34818. const { handle, item } = getHandleAndItemElement(event);
  34819. if (handle && !item.handleActivated && event.key === " ") {
  34820. this.updateScreenReaderText(getScreenReaderText(item, "commit", this));
  34821. }
  34822. if (!handle || !item.handleActivated) {
  34823. keyDownHandler.call(this, event);
  34824. return;
  34825. }
  34826. const { items } = this;
  34827. if (event.key === " ") {
  34828. this.updateScreenReaderText(getScreenReaderText(item, "active", this));
  34829. }
  34830. if ((event.key !== "ArrowUp" && event.key !== "ArrowDown") || items.length <= 1) {
  34831. return;
  34832. }
  34833. event.preventDefault();
  34834. const { el } = this;
  34835. const nextIndex = moveItemIndex(this, item, event.key === "ArrowUp" ? "up" : "down");
  34836. if (nextIndex === items.length - 1) {
  34837. el.appendChild(item);
  34838. }
  34839. else {
  34840. const itemAtNextIndex = el.children[nextIndex];
  34841. const insertionReferenceItem = itemAtNextIndex === item.nextElementSibling
  34842. ? itemAtNextIndex.nextElementSibling
  34843. : itemAtNextIndex;
  34844. el.insertBefore(item, insertionReferenceItem);
  34845. }
  34846. this.items = this.getItems();
  34847. this.calciteListOrderChange.emit(this.items.map(({ value }) => value));
  34848. requestAnimationFrame(() => handle === null || handle === void 0 ? void 0 : handle.focus());
  34849. item.handleActivated = true;
  34850. this.updateHandleAriaLabel(handle, getScreenReaderText(item, "change", this));
  34851. };
  34852. this.storeAssistiveEl = (el) => {
  34853. this.assistiveTextEl = el;
  34854. };
  34855. this.handleFocusIn = (event) => {
  34856. const { handle, item } = getHandleAndItemElement(event);
  34857. if (!(item === null || item === void 0 ? void 0 : item.handleActivated) && item && handle) {
  34858. this.updateHandleAriaLabel(handle, getScreenReaderText(item, "idle", this));
  34859. }
  34860. };
  34861. }
  34862. // --------------------------------------------------------------------------
  34863. //
  34864. // Lifecycle
  34865. //
  34866. // --------------------------------------------------------------------------
  34867. connectedCallback() {
  34868. initialize.call(this);
  34869. initializeObserver.call(this);
  34870. }
  34871. componentDidLoad() {
  34872. this.setUpDragAndDrop();
  34873. }
  34874. componentDidRender() {
  34875. updateHostInteraction(this);
  34876. }
  34877. disconnectedCallback() {
  34878. cleanUpObserver.call(this);
  34879. this.cleanUpDragAndDrop();
  34880. }
  34881. calciteListFocusOutHandler(event) {
  34882. calciteListFocusOutHandler.call(this, event);
  34883. }
  34884. calciteListItemRemoveHandler(event) {
  34885. removeItem.call(this, event);
  34886. }
  34887. calciteListItemChangeHandler(event) {
  34888. calciteListItemChangeHandler.call(this, event);
  34889. }
  34890. calciteInternalListItemPropsChangeHandler(event) {
  34891. event.stopPropagation();
  34892. this.setUpFilter();
  34893. }
  34894. calciteInternalListItemValueChangeHandler(event) {
  34895. calciteInternalListItemValueChangeHandler.call(this, event);
  34896. event.stopPropagation();
  34897. }
  34898. // --------------------------------------------------------------------------
  34899. //
  34900. // Private Methods
  34901. //
  34902. // --------------------------------------------------------------------------
  34903. getItems() {
  34904. return Array.from(this.el.querySelectorAll("calcite-value-list-item"));
  34905. }
  34906. setUpItems() {
  34907. setUpItems.call(this, "calcite-value-list-item");
  34908. }
  34909. setUpFilter() {
  34910. if (this.filterEnabled) {
  34911. this.dataForFilter = this.getItemData();
  34912. }
  34913. }
  34914. setUpDragAndDrop() {
  34915. this.cleanUpDragAndDrop();
  34916. if (!this.dragEnabled) {
  34917. return;
  34918. }
  34919. this.sortable = Sortable.create(this.el, {
  34920. dataIdAttr: "id",
  34921. handle: `.${CSS.handle}`,
  34922. draggable: "calcite-value-list-item",
  34923. group: this.group,
  34924. onSort: () => {
  34925. this.items = Array.from(this.el.querySelectorAll("calcite-value-list-item"));
  34926. const values = this.items.map((item) => item.value);
  34927. this.calciteListOrderChange.emit(values);
  34928. }
  34929. });
  34930. }
  34931. cleanUpDragAndDrop() {
  34932. var _a;
  34933. (_a = this.sortable) === null || _a === void 0 ? void 0 : _a.destroy();
  34934. this.sortable = null;
  34935. }
  34936. handleBlur() {
  34937. if (this.dragEnabled) {
  34938. this.updateScreenReaderText("");
  34939. }
  34940. }
  34941. // --------------------------------------------------------------------------
  34942. //
  34943. // Public Methods
  34944. //
  34945. // --------------------------------------------------------------------------
  34946. /** Returns the currently selected items */
  34947. async getSelectedItems() {
  34948. return this.selectedValues;
  34949. }
  34950. /**
  34951. * Sets focus on the component.
  34952. *
  34953. * @param focusId
  34954. */
  34955. async setFocus(focusId) {
  34956. return setFocus.call(this, focusId);
  34957. }
  34958. // --------------------------------------------------------------------------
  34959. //
  34960. // Render Methods
  34961. //
  34962. // --------------------------------------------------------------------------
  34963. getIconType() {
  34964. let type = null;
  34965. if (this.dragEnabled) {
  34966. type = ICON_TYPES.grip;
  34967. }
  34968. return type;
  34969. }
  34970. updateScreenReaderText(text) {
  34971. this.assistiveTextEl.textContent = text;
  34972. }
  34973. updateHandleAriaLabel(handleElement, text) {
  34974. handleElement.ariaLabel = text;
  34975. }
  34976. render() {
  34977. return (hAsync(List, { onBlur: this.handleBlur, onFocusin: this.handleFocusIn, onKeyDown: this.keyDownHandler, props: this }));
  34978. }
  34979. get el() { return getElement(this); }
  34980. static get style() { return valueListCss; }
  34981. static get cmpMeta() { return {
  34982. "$flags$": 9,
  34983. "$tagName$": "calcite-value-list",
  34984. "$members$": {
  34985. "disabled": [516],
  34986. "dragEnabled": [516, "drag-enabled"],
  34987. "filterEnabled": [516, "filter-enabled"],
  34988. "filterPlaceholder": [513, "filter-placeholder"],
  34989. "group": [513],
  34990. "loading": [516],
  34991. "multiple": [516],
  34992. "selectionFollowsFocus": [516, "selection-follows-focus"],
  34993. "intlDragHandleIdle": [1, "intl-drag-handle-idle"],
  34994. "intlDragHandleActive": [1, "intl-drag-handle-active"],
  34995. "intlDragHandleChange": [1, "intl-drag-handle-change"],
  34996. "intlDragHandleCommit": [1, "intl-drag-handle-commit"],
  34997. "selectedValues": [32],
  34998. "dataForFilter": [32],
  34999. "getSelectedItems": [64],
  35000. "setFocus": [64]
  35001. },
  35002. "$listeners$": [[0, "focusout", "calciteListFocusOutHandler"], [0, "calciteListItemRemove", "calciteListItemRemoveHandler"], [0, "calciteListItemChange", "calciteListItemChangeHandler"], [0, "calciteInternalListItemPropsChange", "calciteInternalListItemPropsChangeHandler"], [0, "calciteInternalListItemValueChange", "calciteInternalListItemValueChangeHandler"]],
  35003. "$lazyBundleId$": "-",
  35004. "$attrsToReflect$": [["disabled", "disabled"], ["dragEnabled", "drag-enabled"], ["filterEnabled", "filter-enabled"], ["filterPlaceholder", "filter-placeholder"], ["group", "group"], ["loading", "loading"], ["multiple", "multiple"], ["selectionFollowsFocus", "selection-follows-focus"]]
  35005. }; }
  35006. }
  35007. const ICONS = {
  35008. drag: "drag"
  35009. };
  35010. const SLOTS = {
  35011. actionsEnd: "actions-end",
  35012. actionsStart: "actions-start"
  35013. };
  35014. const valueListItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-value-list-item:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}/*!@.calcite-animate*/.calcite-animate.sc-calcite-value-list-item{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-value-list-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-value-list-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-value-list-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-value-list-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-value-list-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-value-list-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-value-list-item-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-value-list-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-value-list-item-h{margin-block-end:1px;box-sizing:border-box;display:flex;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size--1);color:var(--calcite-ui-text-2);--tw-shadow:0 1px 0 var(--calcite-ui-border-3);--tw-shadow-colored:0 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition:background-color var(--calcite-animation-timing), box-shadow var(--calcite-animation-timing)}/*!@:host **/.sc-calcite-value-list-item-h *.sc-calcite-value-list-item{box-sizing:border-box}/*!@calcite-pick-list-item*/calcite-pick-list-item.sc-calcite-value-list-item{position:relative;margin:0px;flex-grow:1;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([active]), \n:host([selected])*/[active].sc-calcite-value-list-item-h,[selected].sc-calcite-value-list-item-h{--tw-shadow:0 0 0 1px var(--calcite-ui-brand);--tw-shadow-colored:0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@.handle*/.handle.sc-calcite-value-list-item{display:flex;cursor:move;align-items:center;justify-content:center;border-style:none;background-color:transparent;padding-block:0px;padding-inline:0.25rem;color:var(--calcite-ui-border-input);outline-color:transparent}/*!@.handle:hover*/.handle.sc-calcite-value-list-item:hover{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@.handle:focus*/.handle.sc-calcite-value-list-item:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.handle--activated*/.handle--activated.sc-calcite-value-list-item{background-color:var(--calcite-ui-foreground-3);color:var(--calcite-ui-text-1)}/*!@.handle calcite-icon*/.handle.sc-calcite-value-list-item calcite-icon.sc-calcite-value-list-item{color:inherit}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-value-list-item-h[disabled] .sc-calcite-value-list-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-value-list-item-h [calcite-hydrated][disabled].sc-calcite-value-list-item{opacity:1}";
  35015. /**
  35016. * @slot actions-end - A slot for adding actions or content to the end side of the component.
  35017. * @slot actions-start - A slot for adding actions or content to the start side of the component.
  35018. */
  35019. class ValueListItem {
  35020. constructor(hostRef) {
  35021. registerInstance(this, hostRef);
  35022. this.calciteListItemRemove = createEvent(this, "calciteListItemRemove", 7);
  35023. /**
  35024. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  35025. */
  35026. this.disabled = false;
  35027. /**
  35028. * @internal
  35029. */
  35030. this.disableDeselect = false;
  35031. /**
  35032. * When `true`, prevents the content of the component from user interaction.
  35033. */
  35034. this.nonInteractive = false;
  35035. /**
  35036. * @internal
  35037. */
  35038. this.handleActivated = false;
  35039. /**
  35040. * Determines the icon SVG symbol that will be shown. Options are circle, square, grip or null.
  35041. *
  35042. * @see [ICON_TYPES](https://github.com/Esri/calcite-components/blob/master/src/components/pick-list/resources.ts#L5)
  35043. */
  35044. this.icon = null;
  35045. /**
  35046. * When `true`, adds an action to remove the component.
  35047. */
  35048. this.removable = false;
  35049. /**
  35050. * When `true`, the component is selected.
  35051. */
  35052. this.selected = false;
  35053. this.pickListItem = null;
  35054. this.guid = `calcite-value-list-item-${guid()}`;
  35055. // --------------------------------------------------------------------------
  35056. //
  35057. // Private Methods
  35058. //
  35059. // --------------------------------------------------------------------------
  35060. this.getPickListRef = (el) => (this.pickListItem = el);
  35061. this.handleKeyDown = (event) => {
  35062. if (event.key === " ") {
  35063. this.handleActivated = !this.handleActivated;
  35064. }
  35065. };
  35066. this.handleBlur = () => {
  35067. this.handleActivated = false;
  35068. };
  35069. this.handleSelectChange = (event) => {
  35070. this.selected = event.detail.selected;
  35071. };
  35072. }
  35073. // --------------------------------------------------------------------------
  35074. //
  35075. // Lifecycle
  35076. //
  35077. // --------------------------------------------------------------------------
  35078. connectedCallback() {
  35079. connectConditionalSlotComponent(this);
  35080. }
  35081. disconnectedCallback() {
  35082. disconnectConditionalSlotComponent(this);
  35083. }
  35084. componentDidRender() {
  35085. updateHostInteraction(this, this.el.closest("calcite-value-list") ? "managed" : false);
  35086. }
  35087. // --------------------------------------------------------------------------
  35088. //
  35089. // Public Methods
  35090. //
  35091. // --------------------------------------------------------------------------
  35092. /**
  35093. * Toggle the selection state. By default this won't trigger an event.
  35094. * The first argument allows the value to be coerced, rather than swapping values.
  35095. *
  35096. * @param coerce
  35097. */
  35098. async toggleSelected(coerce) {
  35099. this.pickListItem.toggleSelected(coerce);
  35100. }
  35101. /** Set focus on the component. */
  35102. async setFocus() {
  35103. var _a;
  35104. (_a = this.pickListItem) === null || _a === void 0 ? void 0 : _a.setFocus();
  35105. }
  35106. calciteListItemChangeHandler(event) {
  35107. // adjust item payload from wrapped item before bubbling
  35108. event.detail.item = this.el;
  35109. }
  35110. // --------------------------------------------------------------------------
  35111. //
  35112. // Render Methods
  35113. //
  35114. // --------------------------------------------------------------------------
  35115. renderActionsEnd() {
  35116. const { el } = this;
  35117. const hasActionsEnd = getSlotted(el, SLOTS.actionsEnd);
  35118. return hasActionsEnd ? (hAsync("slot", { name: SLOTS.actionsEnd, slot: SLOTS$9.actionsEnd })) : null;
  35119. }
  35120. renderActionsStart() {
  35121. const { el } = this;
  35122. const hasActionsStart = getSlotted(el, SLOTS.actionsStart);
  35123. return hasActionsStart ? (hAsync("slot", { name: SLOTS.actionsStart, slot: SLOTS$9.actionsStart })) : null;
  35124. }
  35125. renderHandle() {
  35126. const { icon } = this;
  35127. if (icon === ICON_TYPES$1.grip) {
  35128. return (hAsync("span", { class: {
  35129. [CSS$i.handle]: true,
  35130. [CSS$i.handleActivated]: this.handleActivated
  35131. }, "data-js-handle": true, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, role: "button", tabindex: "0" }, hAsync("calcite-icon", { icon: ICONS.drag, scale: "s" })));
  35132. }
  35133. }
  35134. render() {
  35135. return (hAsync(Host, { id: this.el.id || this.guid }, this.renderHandle(), hAsync("calcite-pick-list-item", { description: this.description, disableDeselect: this.disableDeselect, disabled: this.disabled, label: this.label, metadata: this.metadata, nonInteractive: this.nonInteractive, onCalciteListItemChange: this.handleSelectChange, ref: this.getPickListRef, removable: this.removable, selected: this.selected, value: this.value }, this.renderActionsStart(), this.renderActionsEnd())));
  35136. }
  35137. get el() { return getElement(this); }
  35138. static get style() { return valueListItemCss; }
  35139. static get cmpMeta() { return {
  35140. "$flags$": 9,
  35141. "$tagName$": "calcite-value-list-item",
  35142. "$members$": {
  35143. "description": [513],
  35144. "disabled": [516],
  35145. "disableDeselect": [4, "disable-deselect"],
  35146. "nonInteractive": [516, "non-interactive"],
  35147. "handleActivated": [1028, "handle-activated"],
  35148. "icon": [513],
  35149. "label": [513],
  35150. "metadata": [16],
  35151. "removable": [516],
  35152. "selected": [1540],
  35153. "value": [8],
  35154. "toggleSelected": [64],
  35155. "setFocus": [64]
  35156. },
  35157. "$listeners$": [[0, "calciteListItemChange", "calciteListItemChangeHandler"]],
  35158. "$lazyBundleId$": "-",
  35159. "$attrsToReflect$": [["description", "description"], ["disabled", "disabled"], ["nonInteractive", "non-interactive"], ["icon", "icon"], ["label", "label"], ["removable", "removable"], ["selected", "selected"]]
  35160. }; }
  35161. }
  35162. registerComponents([
  35163. Accordion,
  35164. AccordionItem,
  35165. Action,
  35166. ActionBar,
  35167. ActionGroup,
  35168. ActionMenu,
  35169. ActionPad,
  35170. Alert,
  35171. Avatar,
  35172. Block,
  35173. BlockSection,
  35174. Button,
  35175. Card,
  35176. Checkbox,
  35177. Chip,
  35178. ColorPicker,
  35179. ColorPickerHexInput,
  35180. ColorPickerSwatch,
  35181. Combobox,
  35182. ComboboxItem,
  35183. ComboboxItemGroup,
  35184. DatePicker,
  35185. DatePickerDay,
  35186. DatePickerMonth,
  35187. DatePickerMonthHeader,
  35188. Dropdown,
  35189. DropdownGroup,
  35190. DropdownItem,
  35191. Fab,
  35192. Filter,
  35193. Flow,
  35194. FlowItem,
  35195. Graph,
  35196. Handle,
  35197. Icon,
  35198. InlineEditable,
  35199. Input,
  35200. InputDatePicker,
  35201. InputMessage,
  35202. InputNumber,
  35203. InputText,
  35204. InputTimePicker,
  35205. Label,
  35206. Link,
  35207. List$1,
  35208. ListItem,
  35209. ListItemGroup,
  35210. Loader,
  35211. Modal,
  35212. Notice,
  35213. Option,
  35214. OptionGroup,
  35215. Pagination,
  35216. Panel,
  35217. PickList,
  35218. PickListGroup,
  35219. PickListItem,
  35220. Popover,
  35221. PopoverManager,
  35222. Progress,
  35223. RadioButton,
  35224. RadioButtonGroup,
  35225. RadioGroup,
  35226. RadioGroupItem,
  35227. Rating,
  35228. Scrim,
  35229. Select,
  35230. Shell,
  35231. ShellCenterRow,
  35232. ShellPanel,
  35233. Slider,
  35234. SortableList,
  35235. SplitButton,
  35236. Stepper,
  35237. StepperItem,
  35238. Switch,
  35239. Tab,
  35240. TabNav,
  35241. TabTitle,
  35242. Tabs,
  35243. Tile,
  35244. TileSelect,
  35245. TileSelectGroup,
  35246. TimePicker,
  35247. Tip,
  35248. TipGroup,
  35249. TipManager,
  35250. Tooltip,
  35251. TooltipManager,
  35252. Tree,
  35253. TreeItem,
  35254. ValueList,
  35255. ValueListItem,
  35256. ]);
  35257. exports.hydrateApp = hydrateApp;
  35258. /*hydrateAppClosure end*/
  35259. hydrateApp(window, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve);
  35260. }
  35261. hydrateAppClosure($stencilWindow);
  35262. }
  35263. function createWindowFromHtml(e, t) {
  35264. let r = templateWindows.get(t);
  35265. return null == r && (r = new MockWindow(e), templateWindows.set(t, r)), cloneWindow(r);
  35266. }
  35267. function inspectElement(e, t, r) {
  35268. const s = t.children;
  35269. for (let t = 0, n = s.length; t < n; t++) {
  35270. const n = s[t], o = n.nodeName.toLowerCase();
  35271. if (o.includes("-")) {
  35272. const t = e.components.find((e => e.tag === o));
  35273. null != t && (t.count++, r > t.depth && (t.depth = r));
  35274. } else switch (o) {
  35275. case "a":
  35276. const t = collectAttributes(n);
  35277. t.href = n.href, "string" == typeof t.href && (e.anchors.some((e => e.href === t.href)) || e.anchors.push(t));
  35278. break;
  35279. case "img":
  35280. const r = collectAttributes(n);
  35281. r.src = n.src, "string" == typeof r.src && (e.imgs.some((e => e.src === r.src)) || e.imgs.push(r));
  35282. break;
  35283. case "link":
  35284. const s = collectAttributes(n);
  35285. s.href = n.href, "string" == typeof s.rel && "stylesheet" === s.rel.toLowerCase() && "string" == typeof s.href && (e.styles.some((e => e.link === s.href)) || (delete s.rel,
  35286. delete s.type, e.styles.push(s)));
  35287. break;
  35288. case "script":
  35289. const o = collectAttributes(n);
  35290. if (n.hasAttribute("src")) o.src = n.src, "string" == typeof o.src && (e.scripts.some((e => e.src === o.src)) || e.scripts.push(o)); else {
  35291. const t = n.getAttribute("data-stencil-static");
  35292. t && e.staticData.push({
  35293. id: t,
  35294. type: n.getAttribute("type"),
  35295. content: n.textContent
  35296. });
  35297. }
  35298. }
  35299. inspectElement(e, n, ++r);
  35300. }
  35301. }
  35302. function collectAttributes(e) {
  35303. const t = {}, r = e.attributes;
  35304. for (let e = 0, s = r.length; e < s; e++) {
  35305. const s = r.item(e), n = s.nodeName.toLowerCase();
  35306. if (SKIP_ATTRS.has(n)) continue;
  35307. const o = s.nodeValue;
  35308. "class" === n && "" === o || (t[n] = o);
  35309. }
  35310. return t;
  35311. }
  35312. function patchDomImplementation(e, t) {
  35313. let r;
  35314. if (null != e.defaultView ? (t.destroyWindow = !0, patchWindow(e.defaultView), r = e.defaultView) : (t.destroyWindow = !0,
  35315. t.destroyDocument = !1, r = new MockWindow(!1)), r.document !== e && (r.document = e),
  35316. e.defaultView !== r && (e.defaultView = r), "function" != typeof e.documentElement.constructor.prototype.getRootNode && (e.createElement("unknown-element").constructor.prototype.getRootNode = getRootNode),
  35317. "function" == typeof e.createEvent) {
  35318. const t = e.createEvent("CustomEvent").constructor;
  35319. r.CustomEvent !== t && (r.CustomEvent = t);
  35320. }
  35321. try {
  35322. e.baseURI;
  35323. } catch (t) {
  35324. Object.defineProperty(e, "baseURI", {
  35325. get() {
  35326. const t = e.querySelector("base[href]");
  35327. return t ? new URL(t.getAttribute("href"), r.location.href).href : r.location.href;
  35328. }
  35329. });
  35330. }
  35331. return r;
  35332. }
  35333. function getRootNode(e) {
  35334. const t = null != e && !0 === e.composed;
  35335. let r = this;
  35336. for (;null != r.parentNode; ) r = r.parentNode, !0 === t && null == r.parentNode && null != r.host && (r = r.host);
  35337. return r;
  35338. }
  35339. function normalizeHydrateOptions(e) {
  35340. const t = Object.assign({
  35341. serializeToHtml: !1,
  35342. destroyWindow: !1,
  35343. destroyDocument: !1
  35344. }, e || {});
  35345. return "boolean" != typeof t.clientHydrateAnnotations && (t.clientHydrateAnnotations = !0),
  35346. "boolean" != typeof t.constrainTimeouts && (t.constrainTimeouts = !0), "number" != typeof t.maxHydrateCount && (t.maxHydrateCount = 300),
  35347. "boolean" != typeof t.runtimeLogging && (t.runtimeLogging = !1), "number" != typeof t.timeout && (t.timeout = 15e3),
  35348. Array.isArray(t.excludeComponents) ? t.excludeComponents = t.excludeComponents.filter(filterValidTags).map(mapValidTags) : t.excludeComponents = [],
  35349. Array.isArray(t.staticComponents) ? t.staticComponents = t.staticComponents.filter(filterValidTags).map(mapValidTags) : t.staticComponents = [],
  35350. t;
  35351. }
  35352. function filterValidTags(e) {
  35353. return "string" == typeof e && e.includes("-");
  35354. }
  35355. function mapValidTags(e) {
  35356. return e.trim().toLowerCase();
  35357. }
  35358. function generateHydrateResults(e) {
  35359. "string" != typeof e.url && (e.url = "https://hydrate.stenciljs.com/"), "string" != typeof e.buildId && (e.buildId = createHydrateBuildId());
  35360. const t = {
  35361. buildId: e.buildId,
  35362. diagnostics: [],
  35363. url: e.url,
  35364. host: null,
  35365. hostname: null,
  35366. href: null,
  35367. pathname: null,
  35368. port: null,
  35369. search: null,
  35370. hash: null,
  35371. html: null,
  35372. httpStatus: null,
  35373. hydratedCount: 0,
  35374. anchors: [],
  35375. components: [],
  35376. imgs: [],
  35377. scripts: [],
  35378. staticData: [],
  35379. styles: [],
  35380. title: null
  35381. };
  35382. try {
  35383. const r = new URL(e.url, "https://hydrate.stenciljs.com/");
  35384. t.url = r.href, t.host = r.host, t.hostname = r.hostname, t.href = r.href, t.port = r.port,
  35385. t.pathname = r.pathname, t.search = r.search, t.hash = r.hash;
  35386. } catch (e) {
  35387. renderCatchError(t, e);
  35388. }
  35389. return t;
  35390. }
  35391. function renderBuildDiagnostic(e, t, r, s) {
  35392. const n = {
  35393. level: t,
  35394. type: "build",
  35395. header: r,
  35396. messageText: s,
  35397. relFilePath: null,
  35398. absFilePath: null,
  35399. lines: []
  35400. };
  35401. return e.pathname ? "/" !== e.pathname && (n.header += ": " + e.pathname) : e.url && (n.header += ": " + e.url),
  35402. e.diagnostics.push(n), n;
  35403. }
  35404. function renderBuildError(e, t) {
  35405. return renderBuildDiagnostic(e, "error", "Hydrate Error", t);
  35406. }
  35407. function renderCatchError(e, t) {
  35408. const r = renderBuildError(e, null);
  35409. return null != t && (null != t.stack ? r.messageText = t.stack.toString() : null != t.message ? r.messageText = t.message.toString() : r.messageText = t.toString()),
  35410. r;
  35411. }
  35412. function runtimeLog(e, t, r) {
  35413. global.console[t].apply(global.console, [ `[ ${e} ${t} ] `, ...r ]);
  35414. }
  35415. function renderToString(e, t) {
  35416. const r = normalizeHydrateOptions(t);
  35417. return r.serializeToHtml = !0, new Promise((t => {
  35418. let s;
  35419. const n = generateHydrateResults(r);
  35420. if (hasError(n.diagnostics)) t(n); else if ("string" == typeof e) try {
  35421. r.destroyWindow = !0, r.destroyDocument = !0, s = new MockWindow(e), render(s, r, n, t);
  35422. } catch (e) {
  35423. s && s.close && s.close(), s = null, renderCatchError(n, e), t(n);
  35424. } else if (isValidDocument(e)) try {
  35425. r.destroyDocument = !1, s = patchDomImplementation(e, r), render(s, r, n, t);
  35426. } catch (e) {
  35427. s && s.close && s.close(), s = null, renderCatchError(n, e), t(n);
  35428. } else renderBuildError(n, 'Invalid html or document. Must be either a valid "html" string, or DOM "document".'),
  35429. t(n);
  35430. }));
  35431. }
  35432. function hydrateDocument(e, t) {
  35433. const r = normalizeHydrateOptions(t);
  35434. return r.serializeToHtml = !1, new Promise((t => {
  35435. let s;
  35436. const n = generateHydrateResults(r);
  35437. if (hasError(n.diagnostics)) t(n); else if ("string" == typeof e) try {
  35438. r.destroyWindow = !0, r.destroyDocument = !0, s = new MockWindow(e), render(s, r, n, t);
  35439. } catch (e) {
  35440. s && s.close && s.close(), s = null, renderCatchError(n, e), t(n);
  35441. } else if (isValidDocument(e)) try {
  35442. r.destroyDocument = !1, s = patchDomImplementation(e, r), render(s, r, n, t);
  35443. } catch (e) {
  35444. s && s.close && s.close(), s = null, renderCatchError(n, e), t(n);
  35445. } else renderBuildError(n, 'Invalid html or document. Must be either a valid "html" string, or DOM "document".'),
  35446. t(n);
  35447. }));
  35448. }
  35449. function render(e, t, r, s) {
  35450. if (process.__stencilErrors || (process.__stencilErrors = !0, process.on("unhandledRejection", (e => {
  35451. console.log("unhandledRejection", e);
  35452. }))), function n(e, t, r, s) {
  35453. try {
  35454. e.location.href = r.url;
  35455. } catch (e) {
  35456. renderCatchError(s, e);
  35457. }
  35458. if ("string" == typeof r.userAgent) try {
  35459. e.navigator.userAgent = r.userAgent;
  35460. } catch (e) {}
  35461. if ("string" == typeof r.cookie) try {
  35462. t.cookie = r.cookie;
  35463. } catch (e) {}
  35464. if ("string" == typeof r.referrer) try {
  35465. t.referrer = r.referrer;
  35466. } catch (e) {}
  35467. if ("string" == typeof r.direction) try {
  35468. t.documentElement.setAttribute("dir", r.direction);
  35469. } catch (e) {}
  35470. if ("string" == typeof r.language) try {
  35471. t.documentElement.setAttribute("lang", r.language);
  35472. } catch (e) {}
  35473. if ("string" == typeof r.buildId) try {
  35474. t.documentElement.setAttribute("data-stencil-build", r.buildId);
  35475. } catch (e) {}
  35476. try {
  35477. e.customElements = null;
  35478. } catch (e) {}
  35479. return r.constrainTimeouts && constrainTimeouts(e), function n(e, t, r) {
  35480. try {
  35481. const s = e.location.pathname;
  35482. e.console.error = (...e) => {
  35483. const n = e.reduce(((e, t) => {
  35484. if (t) {
  35485. if (null != t.stack) return e + " " + String(t.stack);
  35486. if (null != t.message) return e + " " + String(t.message);
  35487. }
  35488. return String(t);
  35489. }), "").trim();
  35490. "" !== n && (renderCatchError(r, n), t.runtimeLogging && runtimeLog(s, "error", [ n ]));
  35491. }, e.console.debug = (...e) => {
  35492. renderBuildDiagnostic(r, "debug", "Hydrate Debug", [ ...e ].join(", ")), t.runtimeLogging && runtimeLog(s, "debug", e);
  35493. }, t.runtimeLogging && [ "log", "warn", "assert", "info", "trace" ].forEach((t => {
  35494. e.console[t] = (...e) => {
  35495. runtimeLog(s, t, e);
  35496. };
  35497. }));
  35498. } catch (e) {
  35499. renderCatchError(r, e);
  35500. }
  35501. }(e, r, s), e;
  35502. }(e, e.document, t, r), "function" == typeof t.beforeHydrate) try {
  35503. const n = t.beforeHydrate(e.document);
  35504. isPromise(n) ? n.then((() => {
  35505. hydrateFactory(e, t, r, afterHydrate, s);
  35506. })) : hydrateFactory(e, t, r, afterHydrate, s);
  35507. } catch (n) {
  35508. renderCatchError(r, n), finalizeHydrate(e, e.document, t, r, s);
  35509. } else hydrateFactory(e, t, r, afterHydrate, s);
  35510. }
  35511. function afterHydrate(e, t, r, s) {
  35512. if ("function" == typeof t.afterHydrate) try {
  35513. const n = t.afterHydrate(e.document);
  35514. isPromise(n) ? n.then((() => {
  35515. finalizeHydrate(e, e.document, t, r, s);
  35516. })) : finalizeHydrate(e, e.document, t, r, s);
  35517. } catch (n) {
  35518. renderCatchError(r, n), finalizeHydrate(e, e.document, t, r, s);
  35519. } else finalizeHydrate(e, e.document, t, r, s);
  35520. }
  35521. function finalizeHydrate(e, t, r, s, n) {
  35522. try {
  35523. if (inspectElement(s, t.documentElement, 0), !1 !== r.removeUnusedStyles) try {
  35524. ((e, t) => {
  35525. try {
  35526. const r = e.head.querySelectorAll("style[data-styles]"), s = r.length;
  35527. if (s > 0) {
  35528. const n = (e => {
  35529. const t = {
  35530. attrs: new Set,
  35531. classNames: new Set,
  35532. ids: new Set,
  35533. tags: new Set
  35534. };
  35535. return collectUsedSelectors(t, e), t;
  35536. })(e.documentElement);
  35537. for (let e = 0; e < s; e++) removeUnusedStyleText(n, t, r[e]);
  35538. }
  35539. } catch (e) {
  35540. ((e, t, r) => {
  35541. const s = {
  35542. level: "error",
  35543. type: "build",
  35544. header: "Build Error",
  35545. messageText: "build error",
  35546. relFilePath: null,
  35547. absFilePath: null,
  35548. lines: []
  35549. };
  35550. null != t && (null != t.stack ? s.messageText = t.stack.toString() : null != t.message ? s.messageText = t.message.length ? t.message : "UNKNOWN ERROR" : s.messageText = t.toString()),
  35551. null == e || shouldIgnoreError(s.messageText) || e.push(s);
  35552. })(t, e);
  35553. }
  35554. })(t, s.diagnostics);
  35555. } catch (e) {
  35556. renderCatchError(s, e);
  35557. }
  35558. if ("string" == typeof r.title) try {
  35559. t.title = r.title;
  35560. } catch (e) {
  35561. renderCatchError(s, e);
  35562. }
  35563. s.title = t.title, r.removeScripts && removeScripts(t.documentElement);
  35564. try {
  35565. ((e, t) => {
  35566. let r = e.head.querySelector('link[rel="canonical"]');
  35567. "string" == typeof t ? (null == r && (r = e.createElement("link"), r.setAttribute("rel", "canonical"),
  35568. e.head.appendChild(r)), r.setAttribute("href", t)) : null != r && (r.getAttribute("href") || r.parentNode.removeChild(r));
  35569. })(t, r.canonicalUrl);
  35570. } catch (e) {
  35571. renderCatchError(s, e);
  35572. }
  35573. try {
  35574. (e => {
  35575. const t = e.head;
  35576. let r = t.querySelector("meta[charset]");
  35577. null == r ? (r = e.createElement("meta"), r.setAttribute("charset", "utf-8")) : r.remove(),
  35578. t.insertBefore(r, t.firstChild);
  35579. })(t);
  35580. } catch (e) {}
  35581. hasError(s.diagnostics) || (s.httpStatus = 200);
  35582. try {
  35583. const e = t.head.querySelector('meta[http-equiv="status"]');
  35584. if (null != e) {
  35585. const t = e.getAttribute("content");
  35586. t && t.length > 0 && (s.httpStatus = parseInt(t, 10));
  35587. }
  35588. } catch (e) {}
  35589. r.clientHydrateAnnotations && t.documentElement.classList.add("hydrated"), r.serializeToHtml && (s.html = serializeDocumentToString(t, r));
  35590. } catch (e) {
  35591. renderCatchError(s, e);
  35592. }
  35593. if (r.destroyWindow) try {
  35594. r.destroyDocument || (e.document = null, t.defaultView = null), e.close && e.close();
  35595. } catch (e) {
  35596. renderCatchError(s, e);
  35597. }
  35598. n(s);
  35599. }
  35600. function serializeDocumentToString(e, t) {
  35601. return serializeNodeToHtml(e, {
  35602. approximateLineWidth: t.approximateLineWidth,
  35603. outerHtml: !1,
  35604. prettyHtml: t.prettyHtml,
  35605. removeAttributeQuotes: t.removeAttributeQuotes,
  35606. removeBooleanAttributeQuotes: t.removeBooleanAttributeQuotes,
  35607. removeEmptyAttributes: t.removeEmptyAttributes,
  35608. removeHtmlComments: t.removeHtmlComments,
  35609. serializeShadowRoot: !1
  35610. });
  35611. }
  35612. function isValidDocument(e) {
  35613. return null != e && 9 === e.nodeType && null != e.documentElement && 1 === e.documentElement.nodeType && null != e.body && 1 === e.body.nodeType;
  35614. }
  35615. function removeScripts(e) {
  35616. const t = e.children;
  35617. for (let e = t.length - 1; e >= 0; e--) {
  35618. const r = t[e];
  35619. removeScripts(r), ("SCRIPT" === r.nodeName || "LINK" === r.nodeName && "modulepreload" === r.getAttribute("rel")) && r.remove();
  35620. }
  35621. }
  35622. const templateWindows = new Map, isPromise = e => !!e && ("object" == typeof e || "function" == typeof e) && "function" == typeof e.then, hasError = e => null != e && 0 !== e.length && e.some((e => "error" === e.level && "runtime" !== e.type)), shouldIgnoreError = e => e === TASK_CANCELED_MSG, TASK_CANCELED_MSG = "task canceled", parseCss = (e, t) => {
  35623. let r = 1, s = 1;
  35624. const n = [], o = e => {
  35625. const t = e.match(/\n/g);
  35626. t && (r += t.length);
  35627. const n = e.lastIndexOf("\n");
  35628. s = ~n ? e.length - n : s + e.length;
  35629. }, i = () => {
  35630. const e = {
  35631. line: r,
  35632. column: s
  35633. };
  35634. return t => (t.position = new z(e), m(), t);
  35635. }, a = o => {
  35636. const i = e.split("\n"), a = {
  35637. level: "error",
  35638. type: "css",
  35639. language: "css",
  35640. header: "CSS Parse",
  35641. messageText: o,
  35642. absFilePath: t,
  35643. lines: [ {
  35644. lineIndex: r - 1,
  35645. lineNumber: r,
  35646. errorCharStart: s,
  35647. text: e[r - 1]
  35648. } ]
  35649. };
  35650. if (r > 1) {
  35651. const t = {
  35652. lineIndex: r - 1,
  35653. lineNumber: r - 1,
  35654. text: e[r - 2],
  35655. errorCharStart: -1,
  35656. errorLength: -1
  35657. };
  35658. a.lines.unshift(t);
  35659. }
  35660. if (r + 2 < i.length) {
  35661. const e = {
  35662. lineIndex: r,
  35663. lineNumber: r + 1,
  35664. text: i[r],
  35665. errorCharStart: -1,
  35666. errorLength: -1
  35667. };
  35668. a.lines.push(e);
  35669. }
  35670. return n.push(a), null;
  35671. }, l = () => u(/^{\s*/), c = () => u(/^}/), u = t => {
  35672. const r = t.exec(e);
  35673. if (!r) return;
  35674. const s = r[0];
  35675. return o(s), e = e.slice(s.length), r;
  35676. }, d = () => {
  35677. let t;
  35678. const r = [];
  35679. for (m(), h(r); e.length && "}" !== e.charAt(0) && (t = w() || A()); ) !1 !== t && (r.push(t),
  35680. h(r));
  35681. return r;
  35682. }, m = () => u(/^\s*/), h = e => {
  35683. let t;
  35684. for (e = e || []; t = p(); ) !1 !== t && e.push(t);
  35685. return e;
  35686. }, p = () => {
  35687. const t = i();
  35688. if ("/" !== e.charAt(0) || "*" !== e.charAt(1)) return null;
  35689. let r = 2;
  35690. for (;"" !== e.charAt(r) && ("*" !== e.charAt(r) || "/" !== e.charAt(r + 1)); ) ++r;
  35691. if (r += 2, "" === e.charAt(r - 1)) return a("End of comment missing");
  35692. const n = e.slice(2, r - 2);
  35693. return s += 2, o(n), e = e.slice(r), s += 2, t({
  35694. type: 1,
  35695. comment: n
  35696. });
  35697. }, f = () => {
  35698. const e = u(/^([^{]+)/);
  35699. return e ? trim(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, "").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, (function(e) {
  35700. return e.replace(/,/g, "‌");
  35701. })).split(/\s*(?![^(]*\)),\s*/).map((function(e) {
  35702. return e.replace(/\u200C/g, ",");
  35703. })) : null;
  35704. }, g = () => {
  35705. const e = i();
  35706. let t = u(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
  35707. if (!t) return null;
  35708. if (t = trim(t[0]), !u(/^:\s*/)) return a("property missing ':'");
  35709. const r = u(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/), s = e({
  35710. type: 4,
  35711. property: t.replace(commentre, ""),
  35712. value: r ? trim(r[0]).replace(commentre, "") : ""
  35713. });
  35714. return u(/^[;\s]*/), s;
  35715. }, y = () => {
  35716. const e = [];
  35717. if (!l()) return a("missing '{'");
  35718. let t;
  35719. for (h(e); t = g(); ) !1 !== t && (e.push(t), h(e));
  35720. return c() ? e : a("missing '}'");
  35721. }, C = () => {
  35722. let e;
  35723. const t = [], r = i();
  35724. for (;e = u(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/); ) t.push(e[1]), u(/^,\s*/);
  35725. return t.length ? r({
  35726. type: 9,
  35727. values: t,
  35728. declarations: y()
  35729. }) : null;
  35730. }, S = (e, t) => {
  35731. const r = new RegExp("^@" + e + "\\s*([^;]+);");
  35732. return () => {
  35733. const s = i(), n = u(r);
  35734. if (!n) return null;
  35735. const o = {
  35736. type: t
  35737. };
  35738. return o[e] = n[1].trim(), s(o);
  35739. };
  35740. }, E = S("import", 7), b = S("charset", 0), T = S("namespace", 11), w = () => "@" !== e[0] ? null : (() => {
  35741. const e = i();
  35742. let t = u(/^@([-\w]+)?keyframes\s*/);
  35743. if (!t) return null;
  35744. const r = t[1];
  35745. if (t = u(/^([-\w]+)\s*/), !t) return a("@keyframes missing name");
  35746. const s = t[1];
  35747. if (!l()) return a("@keyframes missing '{'");
  35748. let n, o = h();
  35749. for (;n = C(); ) o.push(n), o = o.concat(h());
  35750. return c() ? e({
  35751. type: 8,
  35752. name: s,
  35753. vendor: r,
  35754. keyframes: o
  35755. }) : a("@keyframes missing '}'");
  35756. })() || (() => {
  35757. const e = i(), t = u(/^@media *([^{]+)/);
  35758. if (!t) return null;
  35759. const r = trim(t[1]);
  35760. if (!l()) return a("@media missing '{'");
  35761. const s = h().concat(d());
  35762. return c() ? e({
  35763. type: 10,
  35764. media: r,
  35765. rules: s
  35766. }) : a("@media missing '}'");
  35767. })() || (() => {
  35768. const e = i(), t = u(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
  35769. return t ? e({
  35770. type: 2,
  35771. name: trim(t[1]),
  35772. media: trim(t[2])
  35773. }) : null;
  35774. })() || (() => {
  35775. const e = i(), t = u(/^@supports *([^{]+)/);
  35776. if (!t) return null;
  35777. const r = trim(t[1]);
  35778. if (!l()) return a("@supports missing '{'");
  35779. const s = h().concat(d());
  35780. return c() ? e({
  35781. type: 15,
  35782. supports: r,
  35783. rules: s
  35784. }) : a("@supports missing '}'");
  35785. })() || E() || b() || T() || (() => {
  35786. const e = i(), t = u(/^@([-\w]+)?document *([^{]+)/);
  35787. if (!t) return null;
  35788. const r = trim(t[1]), s = trim(t[2]);
  35789. if (!l()) return a("@document missing '{'");
  35790. const n = h().concat(d());
  35791. return c() ? e({
  35792. type: 3,
  35793. document: s,
  35794. vendor: r,
  35795. rules: n
  35796. }) : a("@document missing '}'");
  35797. })() || (() => {
  35798. const e = i();
  35799. if (!u(/^@page */)) return null;
  35800. const t = f() || [];
  35801. if (!l()) return a("@page missing '{'");
  35802. let r, s = h();
  35803. for (;r = g(); ) s.push(r), s = s.concat(h());
  35804. return c() ? e({
  35805. type: 12,
  35806. selectors: t,
  35807. declarations: s
  35808. }) : a("@page missing '}'");
  35809. })() || (() => {
  35810. const e = i();
  35811. if (!u(/^@host\s*/)) return null;
  35812. if (!l()) return a("@host missing '{'");
  35813. const t = h().concat(d());
  35814. return c() ? e({
  35815. type: 6,
  35816. rules: t
  35817. }) : a("@host missing '}'");
  35818. })() || (() => {
  35819. const e = i();
  35820. if (!u(/^@font-face\s*/)) return null;
  35821. if (!l()) return a("@font-face missing '{'");
  35822. let t, r = h();
  35823. for (;t = g(); ) r.push(t), r = r.concat(h());
  35824. return c() ? e({
  35825. type: 5,
  35826. declarations: r
  35827. }) : a("@font-face missing '}'");
  35828. })(), A = () => {
  35829. const e = i(), t = f();
  35830. return t ? (h(), e({
  35831. type: 13,
  35832. selectors: t,
  35833. declarations: y()
  35834. })) : a("selector missing");
  35835. };
  35836. class z {
  35837. constructor(e) {
  35838. this.start = e, this.end = {
  35839. line: r,
  35840. column: s
  35841. }, this.source = t;
  35842. }
  35843. }
  35844. return z.prototype.content = e, {
  35845. diagnostics: n,
  35846. ...addParent((() => {
  35847. const e = d();
  35848. return {
  35849. type: 14,
  35850. stylesheet: {
  35851. source: t,
  35852. rules: e
  35853. }
  35854. };
  35855. })())
  35856. };
  35857. }, trim = e => e ? e.trim() : "", addParent = (e, t) => {
  35858. const r = e && "string" == typeof e.type, s = r ? e : t;
  35859. for (const t in e) {
  35860. const r = e[t];
  35861. Array.isArray(r) ? r.forEach((function(e) {
  35862. addParent(e, s);
  35863. })) : r && "object" == typeof r && addParent(r, s);
  35864. }
  35865. return r && Object.defineProperty(e, "parent", {
  35866. configurable: !0,
  35867. writable: !0,
  35868. enumerable: !1,
  35869. value: t || null
  35870. }), e;
  35871. }, commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g, getCssSelectors = e => {
  35872. SELECTORS.all.length = SELECTORS.tags.length = SELECTORS.classNames.length = SELECTORS.ids.length = SELECTORS.attrs.length = 0;
  35873. const t = (e = e.replace(/\./g, " .").replace(/\#/g, " #").replace(/\[/g, " [").replace(/\>/g, " > ").replace(/\+/g, " + ").replace(/\~/g, " ~ ").replace(/\*/g, " * ").replace(/\:not\((.*?)\)/g, " ")).split(" ");
  35874. for (let e = 0, r = t.length; e < r; e++) t[e] = t[e].split(":")[0], 0 !== t[e].length && ("." === t[e].charAt(0) ? SELECTORS.classNames.push(t[e].slice(1)) : "#" === t[e].charAt(0) ? SELECTORS.ids.push(t[e].slice(1)) : "[" === t[e].charAt(0) ? (t[e] = t[e].slice(1).split("=")[0].split("]")[0].trim(),
  35875. SELECTORS.attrs.push(t[e].toLowerCase())) : /[a-z]/g.test(t[e].charAt(0)) && SELECTORS.tags.push(t[e].toLowerCase()));
  35876. return SELECTORS.classNames = SELECTORS.classNames.sort(((e, t) => e.length < t.length ? -1 : e.length > t.length ? 1 : 0)),
  35877. SELECTORS;
  35878. }, SELECTORS = {
  35879. all: [],
  35880. tags: [],
  35881. classNames: [],
  35882. ids: [],
  35883. attrs: []
  35884. }, serializeCssVisitNode = (e, t, r, s) => {
  35885. const n = t.type;
  35886. return 4 === n ? serializeCssDeclaration(t, r, s) : 13 === n ? serializeCssRule(e, t) : 1 === n ? "!" === t.comment[0] ? `/*${t.comment}*/` : "" : 10 === n ? serializeCssMedia(e, t) : 8 === n ? serializeCssKeyframes(e, t) : 9 === n ? serializeCssKeyframe(e, t) : 5 === n ? serializeCssFontFace(e, t) : 15 === n ? serializeCssSupports(e, t) : 7 === n ? "@import " + t.import + ";" : 0 === n ? "@charset " + t.charset + ";" : 12 === n ? serializeCssPage(e, t) : 6 === n ? "@host{" + serializeCssMapVisit(e, t.rules) + "}" : 2 === n ? "@custom-media " + t.name + " " + t.media + ";" : 3 === n ? serializeCssDocument(e, t) : 11 === n ? "@namespace " + t.namespace + ";" : "";
  35887. }, serializeCssRule = (e, t) => {
  35888. const r = t.declarations, s = e.usedSelectors, n = t.selectors.slice();
  35889. if (null == r || 0 === r.length) return "";
  35890. if (s) {
  35891. let t, r, o = !0;
  35892. for (t = n.length - 1; t >= 0; t--) {
  35893. const i = getCssSelectors(n[t]);
  35894. o = !0;
  35895. let a = i.classNames.length;
  35896. if (a > 0 && e.hasUsedClassNames) for (r = 0; r < a; r++) if (!s.classNames.has(i.classNames[r])) {
  35897. o = !1;
  35898. break;
  35899. }
  35900. if (o && e.hasUsedTags && (a = i.tags.length, a > 0)) for (r = 0; r < a; r++) if (!s.tags.has(i.tags[r])) {
  35901. o = !1;
  35902. break;
  35903. }
  35904. if (o && e.hasUsedAttrs && (a = i.attrs.length, a > 0)) for (r = 0; r < a; r++) if (!s.attrs.has(i.attrs[r])) {
  35905. o = !1;
  35906. break;
  35907. }
  35908. if (o && e.hasUsedIds && (a = i.ids.length, a > 0)) for (r = 0; r < a; r++) if (!s.ids.has(i.ids[r])) {
  35909. o = !1;
  35910. break;
  35911. }
  35912. o || n.splice(t, 1);
  35913. }
  35914. }
  35915. if (0 === n.length) return "";
  35916. const o = [];
  35917. let i = "";
  35918. for (const e of t.selectors) i = removeSelectorWhitespace(e), o.includes(i) || o.push(i);
  35919. return `${o}{${serializeCssMapVisit(e, r)}}`;
  35920. }, serializeCssDeclaration = (e, t, r) => "" === e.value ? "" : r - 1 === t ? e.property + ":" + e.value : e.property + ":" + e.value + ";", serializeCssMedia = (e, t) => {
  35921. const r = serializeCssMapVisit(e, t.rules);
  35922. return "" === r ? "" : "@media " + removeMediaWhitespace(t.media) + "{" + r + "}";
  35923. }, serializeCssKeyframes = (e, t) => {
  35924. const r = serializeCssMapVisit(e, t.keyframes);
  35925. return "" === r ? "" : "@" + (t.vendor || "") + "keyframes " + t.name + "{" + r + "}";
  35926. }, serializeCssKeyframe = (e, t) => t.values.join(",") + "{" + serializeCssMapVisit(e, t.declarations) + "}", serializeCssFontFace = (e, t) => {
  35927. const r = serializeCssMapVisit(e, t.declarations);
  35928. return "" === r ? "" : "@font-face{" + r + "}";
  35929. }, serializeCssSupports = (e, t) => {
  35930. const r = serializeCssMapVisit(e, t.rules);
  35931. return "" === r ? "" : "@supports " + t.supports + "{" + r + "}";
  35932. }, serializeCssPage = (e, t) => "@page " + t.selectors.join(", ") + "{" + serializeCssMapVisit(e, t.declarations) + "}", serializeCssDocument = (e, t) => {
  35933. const r = serializeCssMapVisit(e, t.rules), s = "@" + (t.vendor || "") + "document " + t.document;
  35934. return "" === r ? "" : s + "{" + r + "}";
  35935. }, serializeCssMapVisit = (e, t) => {
  35936. let r = "";
  35937. if (t) for (let s = 0, n = t.length; s < n; s++) r += serializeCssVisitNode(e, t[s], s, n);
  35938. return r;
  35939. }, removeSelectorWhitespace = e => {
  35940. let t = "", r = "", s = !1;
  35941. for (let n = 0, o = (e = e.trim()).length; n < o; n++) if (r = e[n], "[" === r && "\\" !== t[t.length - 1] ? s = !0 : "]" === r && "\\" !== t[t.length - 1] && (s = !1),
  35942. !s && CSS_WS_REG.test(r)) {
  35943. if (CSS_NEXT_CHAR_REG.test(e[n + 1])) continue;
  35944. if (CSS_PREV_CHAR_REG.test(t[t.length - 1])) continue;
  35945. t += " ";
  35946. } else t += r;
  35947. return t;
  35948. }, removeMediaWhitespace = e => {
  35949. let t = "", r = "";
  35950. for (let s = 0, n = (e = e.trim()).length; s < n; s++) if (r = e[s], CSS_WS_REG.test(r)) {
  35951. if (CSS_WS_REG.test(t[t.length - 1])) continue;
  35952. t += " ";
  35953. } else t += r;
  35954. return t;
  35955. }, CSS_WS_REG = /\s/, CSS_NEXT_CHAR_REG = /[>\(\)\~\,\+\s]/, CSS_PREV_CHAR_REG = /[>\(\~\,\+]/, collectUsedSelectors = (e, t) => {
  35956. if (null != t && 1 === t.nodeType) {
  35957. const r = t.children, s = t.nodeName.toLowerCase();
  35958. e.tags.add(s);
  35959. const n = t.attributes;
  35960. for (let r = 0, s = n.length; r < s; r++) {
  35961. const s = n.item(r), o = s.name.toLowerCase();
  35962. if (e.attrs.add(o), "class" === o) {
  35963. const r = t.classList;
  35964. for (let t = 0, s = r.length; t < s; t++) e.classNames.add(r.item(t));
  35965. } else "id" === o && e.ids.add(s.value);
  35966. }
  35967. if (r) for (let t = 0, s = r.length; t < s; t++) collectUsedSelectors(e, r[t]);
  35968. }
  35969. }, removeUnusedStyleText = (e, t, r) => {
  35970. try {
  35971. const s = parseCss(r.innerHTML);
  35972. if (t.push(...s.diagnostics), hasError(t)) return;
  35973. try {
  35974. r.innerHTML = ((e, t) => {
  35975. const r = t.usedSelectors || null, s = {
  35976. usedSelectors: r || null,
  35977. hasUsedAttrs: !!r && r.attrs.size > 0,
  35978. hasUsedClassNames: !!r && r.classNames.size > 0,
  35979. hasUsedIds: !!r && r.ids.size > 0,
  35980. hasUsedTags: !!r && r.tags.size > 0
  35981. }, n = e.rules;
  35982. if (!n) return "";
  35983. const o = n.length, i = [];
  35984. for (let e = 0; e < o; e++) i.push(serializeCssVisitNode(s, n[e], e, o));
  35985. return i.join("");
  35986. })(s.stylesheet, {
  35987. usedSelectors: e
  35988. });
  35989. } catch (e) {
  35990. t.push({
  35991. level: "warn",
  35992. type: "css",
  35993. header: "CSS Stringify",
  35994. messageText: e
  35995. });
  35996. }
  35997. } catch (e) {
  35998. t.push({
  35999. level: "warn",
  36000. type: "css",
  36001. header: "CSS Parse",
  36002. messageText: e
  36003. });
  36004. }
  36005. }, SKIP_ATTRS = new Set([ "s-id", "c-id" ]), createHydrateBuildId = () => {
  36006. let e = "abcdefghijklmnopqrstuvwxyz", t = "";
  36007. for (;t.length < 8; ) t += e[Math.floor(Math.random() * e.length)], 1 === t.length && (e += "0123456789");
  36008. return t;
  36009. };
  36010. exports.createWindowFromHtml = createWindowFromHtml;
  36011. exports.hydrateDocument = hydrateDocument;
  36012. exports.renderToString = renderToString;
  36013. exports.serializeDocumentToString = serializeDocumentToString;