Нет описания

components.js 2.3MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624
  1. /******/ (function() { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ({
  3. /***/ 5096:
  4. /***/ (function(module) {
  5. "use strict";
  6. function noop() {
  7. return null;
  8. }
  9. noop.isRequired = noop;
  10. function noopThunk() {
  11. return noop;
  12. }
  13. module.exports = {
  14. and: noopThunk,
  15. between: noopThunk,
  16. booleanSome: noopThunk,
  17. childrenHavePropXorChildren: noopThunk,
  18. childrenOf: noopThunk,
  19. childrenOfType: noopThunk,
  20. childrenSequenceOf: noopThunk,
  21. componentWithName: noopThunk,
  22. disallowedIf: noopThunk,
  23. elementType: noopThunk,
  24. empty: noopThunk,
  25. explicitNull: noopThunk,
  26. forbidExtraProps: Object,
  27. integer: noopThunk,
  28. keysOf: noopThunk,
  29. mutuallyExclusiveProps: noopThunk,
  30. mutuallyExclusiveTrueProps: noopThunk,
  31. nChildren: noopThunk,
  32. nonNegativeInteger: noop,
  33. nonNegativeNumber: noopThunk,
  34. numericString: noopThunk,
  35. object: noopThunk,
  36. or: noopThunk,
  37. predicate: noopThunk,
  38. range: noopThunk,
  39. ref: noopThunk,
  40. requiredBy: noopThunk,
  41. restrictedProp: noopThunk,
  42. sequenceOf: noopThunk,
  43. shape: noopThunk,
  44. stringEndsWith: noopThunk,
  45. stringStartsWith: noopThunk,
  46. uniqueArray: noopThunk,
  47. uniqueArrayOf: noopThunk,
  48. valuesOf: noopThunk,
  49. withShape: noopThunk
  50. };
  51. /***/ }),
  52. /***/ 4882:
  53. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  54. module.exports = true ? __webpack_require__(5096) : 0;
  55. /***/ }),
  56. /***/ 4485:
  57. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  58. "use strict";
  59. var ArraySpeciesCreate = __webpack_require__(1539);
  60. var FlattenIntoArray = __webpack_require__(6739);
  61. var Get = __webpack_require__(6448);
  62. var ToIntegerOrInfinity = __webpack_require__(1723);
  63. var ToLength = __webpack_require__(6840);
  64. var ToObject = __webpack_require__(1283);
  65. module.exports = function flat() {
  66. var O = ToObject(this);
  67. var sourceLen = ToLength(Get(O, 'length'));
  68. var depthNum = 1;
  69. if (arguments.length > 0 && typeof arguments[0] !== 'undefined') {
  70. depthNum = ToIntegerOrInfinity(arguments[0]);
  71. }
  72. var A = ArraySpeciesCreate(O, 0);
  73. FlattenIntoArray(A, O, sourceLen, 0, depthNum);
  74. return A;
  75. };
  76. /***/ }),
  77. /***/ 116:
  78. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  79. "use strict";
  80. var define = __webpack_require__(9170);
  81. var callBind = __webpack_require__(9961);
  82. var implementation = __webpack_require__(4485);
  83. var getPolyfill = __webpack_require__(616);
  84. var polyfill = getPolyfill();
  85. var shim = __webpack_require__(2059);
  86. var boundFlat = callBind(polyfill);
  87. define(boundFlat, {
  88. getPolyfill: getPolyfill,
  89. implementation: implementation,
  90. shim: shim
  91. });
  92. module.exports = boundFlat;
  93. /***/ }),
  94. /***/ 9630:
  95. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  96. "use strict";
  97. var GetIntrinsic = __webpack_require__(1801);
  98. var callBind = __webpack_require__(9961);
  99. var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
  100. module.exports = function callBoundIntrinsic(name, allowMissing) {
  101. var intrinsic = GetIntrinsic(name, !!allowMissing);
  102. if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
  103. return callBind(intrinsic);
  104. }
  105. return intrinsic;
  106. };
  107. /***/ }),
  108. /***/ 9961:
  109. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  110. "use strict";
  111. var bind = __webpack_require__(1930);
  112. var GetIntrinsic = __webpack_require__(1801);
  113. var $apply = GetIntrinsic('%Function.prototype.apply%');
  114. var $call = GetIntrinsic('%Function.prototype.call%');
  115. var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
  116. var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
  117. var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
  118. var $max = GetIntrinsic('%Math.max%');
  119. if ($defineProperty) {
  120. try {
  121. $defineProperty({}, 'a', { value: 1 });
  122. } catch (e) {
  123. // IE 8 has a broken defineProperty
  124. $defineProperty = null;
  125. }
  126. }
  127. module.exports = function callBind(originalFunction) {
  128. var func = $reflectApply(bind, $call, arguments);
  129. if ($gOPD && $defineProperty) {
  130. var desc = $gOPD(func, 'length');
  131. if (desc.configurable) {
  132. // original length, plus the receiver, minus any additional arguments (after the receiver)
  133. $defineProperty(
  134. func,
  135. 'length',
  136. { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
  137. );
  138. }
  139. }
  140. return func;
  141. };
  142. var applyBind = function applyBind() {
  143. return $reflectApply(bind, $apply, arguments);
  144. };
  145. if ($defineProperty) {
  146. $defineProperty(module.exports, 'apply', { value: applyBind });
  147. } else {
  148. module.exports.apply = applyBind;
  149. }
  150. /***/ }),
  151. /***/ 4219:
  152. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  153. "use strict";
  154. var undefined;
  155. var $SyntaxError = SyntaxError;
  156. var $Function = Function;
  157. var $TypeError = TypeError;
  158. // eslint-disable-next-line consistent-return
  159. var getEvalledConstructor = function (expressionSyntax) {
  160. try {
  161. return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
  162. } catch (e) {}
  163. };
  164. var $gOPD = Object.getOwnPropertyDescriptor;
  165. if ($gOPD) {
  166. try {
  167. $gOPD({}, '');
  168. } catch (e) {
  169. $gOPD = null; // this is IE 8, which has a broken gOPD
  170. }
  171. }
  172. var throwTypeError = function () {
  173. throw new $TypeError();
  174. };
  175. var ThrowTypeError = $gOPD
  176. ? (function () {
  177. try {
  178. // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
  179. arguments.callee; // IE 8 does not throw here
  180. return throwTypeError;
  181. } catch (calleeThrows) {
  182. try {
  183. // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
  184. return $gOPD(arguments, 'callee').get;
  185. } catch (gOPDthrows) {
  186. return throwTypeError;
  187. }
  188. }
  189. }())
  190. : throwTypeError;
  191. var hasSymbols = __webpack_require__(9828)();
  192. var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
  193. var needsEval = {};
  194. var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
  195. var INTRINSICS = {
  196. '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
  197. '%Array%': Array,
  198. '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
  199. '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
  200. '%AsyncFromSyncIteratorPrototype%': undefined,
  201. '%AsyncFunction%': needsEval,
  202. '%AsyncGenerator%': needsEval,
  203. '%AsyncGeneratorFunction%': needsEval,
  204. '%AsyncIteratorPrototype%': needsEval,
  205. '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
  206. '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
  207. '%Boolean%': Boolean,
  208. '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
  209. '%Date%': Date,
  210. '%decodeURI%': decodeURI,
  211. '%decodeURIComponent%': decodeURIComponent,
  212. '%encodeURI%': encodeURI,
  213. '%encodeURIComponent%': encodeURIComponent,
  214. '%Error%': Error,
  215. '%eval%': eval, // eslint-disable-line no-eval
  216. '%EvalError%': EvalError,
  217. '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
  218. '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
  219. '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
  220. '%Function%': $Function,
  221. '%GeneratorFunction%': needsEval,
  222. '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
  223. '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
  224. '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
  225. '%isFinite%': isFinite,
  226. '%isNaN%': isNaN,
  227. '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
  228. '%JSON%': typeof JSON === 'object' ? JSON : undefined,
  229. '%Map%': typeof Map === 'undefined' ? undefined : Map,
  230. '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
  231. '%Math%': Math,
  232. '%Number%': Number,
  233. '%Object%': Object,
  234. '%parseFloat%': parseFloat,
  235. '%parseInt%': parseInt,
  236. '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
  237. '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
  238. '%RangeError%': RangeError,
  239. '%ReferenceError%': ReferenceError,
  240. '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
  241. '%RegExp%': RegExp,
  242. '%Set%': typeof Set === 'undefined' ? undefined : Set,
  243. '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
  244. '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
  245. '%String%': String,
  246. '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
  247. '%Symbol%': hasSymbols ? Symbol : undefined,
  248. '%SyntaxError%': $SyntaxError,
  249. '%ThrowTypeError%': ThrowTypeError,
  250. '%TypedArray%': TypedArray,
  251. '%TypeError%': $TypeError,
  252. '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
  253. '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
  254. '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
  255. '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
  256. '%URIError%': URIError,
  257. '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
  258. '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
  259. '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
  260. };
  261. var doEval = function doEval(name) {
  262. var value;
  263. if (name === '%AsyncFunction%') {
  264. value = getEvalledConstructor('async function () {}');
  265. } else if (name === '%GeneratorFunction%') {
  266. value = getEvalledConstructor('function* () {}');
  267. } else if (name === '%AsyncGeneratorFunction%') {
  268. value = getEvalledConstructor('async function* () {}');
  269. } else if (name === '%AsyncGenerator%') {
  270. var fn = doEval('%AsyncGeneratorFunction%');
  271. if (fn) {
  272. value = fn.prototype;
  273. }
  274. } else if (name === '%AsyncIteratorPrototype%') {
  275. var gen = doEval('%AsyncGenerator%');
  276. if (gen) {
  277. value = getProto(gen.prototype);
  278. }
  279. }
  280. INTRINSICS[name] = value;
  281. return value;
  282. };
  283. var LEGACY_ALIASES = {
  284. '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
  285. '%ArrayPrototype%': ['Array', 'prototype'],
  286. '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
  287. '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
  288. '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
  289. '%ArrayProto_values%': ['Array', 'prototype', 'values'],
  290. '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
  291. '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
  292. '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
  293. '%BooleanPrototype%': ['Boolean', 'prototype'],
  294. '%DataViewPrototype%': ['DataView', 'prototype'],
  295. '%DatePrototype%': ['Date', 'prototype'],
  296. '%ErrorPrototype%': ['Error', 'prototype'],
  297. '%EvalErrorPrototype%': ['EvalError', 'prototype'],
  298. '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
  299. '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
  300. '%FunctionPrototype%': ['Function', 'prototype'],
  301. '%Generator%': ['GeneratorFunction', 'prototype'],
  302. '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
  303. '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
  304. '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
  305. '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
  306. '%JSONParse%': ['JSON', 'parse'],
  307. '%JSONStringify%': ['JSON', 'stringify'],
  308. '%MapPrototype%': ['Map', 'prototype'],
  309. '%NumberPrototype%': ['Number', 'prototype'],
  310. '%ObjectPrototype%': ['Object', 'prototype'],
  311. '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
  312. '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
  313. '%PromisePrototype%': ['Promise', 'prototype'],
  314. '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
  315. '%Promise_all%': ['Promise', 'all'],
  316. '%Promise_reject%': ['Promise', 'reject'],
  317. '%Promise_resolve%': ['Promise', 'resolve'],
  318. '%RangeErrorPrototype%': ['RangeError', 'prototype'],
  319. '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
  320. '%RegExpPrototype%': ['RegExp', 'prototype'],
  321. '%SetPrototype%': ['Set', 'prototype'],
  322. '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
  323. '%StringPrototype%': ['String', 'prototype'],
  324. '%SymbolPrototype%': ['Symbol', 'prototype'],
  325. '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
  326. '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
  327. '%TypeErrorPrototype%': ['TypeError', 'prototype'],
  328. '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
  329. '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
  330. '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
  331. '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
  332. '%URIErrorPrototype%': ['URIError', 'prototype'],
  333. '%WeakMapPrototype%': ['WeakMap', 'prototype'],
  334. '%WeakSetPrototype%': ['WeakSet', 'prototype']
  335. };
  336. var bind = __webpack_require__(1930);
  337. var hasOwn = __webpack_require__(9284);
  338. var $concat = bind.call(Function.call, Array.prototype.concat);
  339. var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
  340. var $replace = bind.call(Function.call, String.prototype.replace);
  341. var $strSlice = bind.call(Function.call, String.prototype.slice);
  342. /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
  343. var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
  344. var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
  345. var stringToPath = function stringToPath(string) {
  346. var first = $strSlice(string, 0, 1);
  347. var last = $strSlice(string, -1);
  348. if (first === '%' && last !== '%') {
  349. throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
  350. } else if (last === '%' && first !== '%') {
  351. throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
  352. }
  353. var result = [];
  354. $replace(string, rePropName, function (match, number, quote, subString) {
  355. result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
  356. });
  357. return result;
  358. };
  359. /* end adaptation */
  360. var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
  361. var intrinsicName = name;
  362. var alias;
  363. if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
  364. alias = LEGACY_ALIASES[intrinsicName];
  365. intrinsicName = '%' + alias[0] + '%';
  366. }
  367. if (hasOwn(INTRINSICS, intrinsicName)) {
  368. var value = INTRINSICS[intrinsicName];
  369. if (value === needsEval) {
  370. value = doEval(intrinsicName);
  371. }
  372. if (typeof value === 'undefined' && !allowMissing) {
  373. throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
  374. }
  375. return {
  376. alias: alias,
  377. name: intrinsicName,
  378. value: value
  379. };
  380. }
  381. throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
  382. };
  383. module.exports = function GetIntrinsic(name, allowMissing) {
  384. if (typeof name !== 'string' || name.length === 0) {
  385. throw new $TypeError('intrinsic name must be a non-empty string');
  386. }
  387. if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
  388. throw new $TypeError('"allowMissing" argument must be a boolean');
  389. }
  390. var parts = stringToPath(name);
  391. var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
  392. var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
  393. var intrinsicRealName = intrinsic.name;
  394. var value = intrinsic.value;
  395. var skipFurtherCaching = false;
  396. var alias = intrinsic.alias;
  397. if (alias) {
  398. intrinsicBaseName = alias[0];
  399. $spliceApply(parts, $concat([0, 1], alias));
  400. }
  401. for (var i = 1, isOwn = true; i < parts.length; i += 1) {
  402. var part = parts[i];
  403. var first = $strSlice(part, 0, 1);
  404. var last = $strSlice(part, -1);
  405. if (
  406. (
  407. (first === '"' || first === "'" || first === '`')
  408. || (last === '"' || last === "'" || last === '`')
  409. )
  410. && first !== last
  411. ) {
  412. throw new $SyntaxError('property names with quotes must have matching quotes');
  413. }
  414. if (part === 'constructor' || !isOwn) {
  415. skipFurtherCaching = true;
  416. }
  417. intrinsicBaseName += '.' + part;
  418. intrinsicRealName = '%' + intrinsicBaseName + '%';
  419. if (hasOwn(INTRINSICS, intrinsicRealName)) {
  420. value = INTRINSICS[intrinsicRealName];
  421. } else if (value != null) {
  422. if (!(part in value)) {
  423. if (!allowMissing) {
  424. throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
  425. }
  426. return void undefined;
  427. }
  428. if ($gOPD && (i + 1) >= parts.length) {
  429. var desc = $gOPD(value, part);
  430. isOwn = !!desc;
  431. // By convention, when a data property is converted to an accessor
  432. // property to emulate a data property that does not suffer from
  433. // the override mistake, that accessor's getter is marked with
  434. // an `originalValue` property. Here, when we detect this, we
  435. // uphold the illusion by pretending to see that original data
  436. // property, i.e., returning the value rather than the getter
  437. // itself.
  438. if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
  439. value = desc.get;
  440. } else {
  441. value = value[part];
  442. }
  443. } else {
  444. isOwn = hasOwn(value, part);
  445. value = value[part];
  446. }
  447. if (isOwn && !skipFurtherCaching) {
  448. INTRINSICS[intrinsicRealName] = value;
  449. }
  450. }
  451. }
  452. return value;
  453. };
  454. /***/ }),
  455. /***/ 9828:
  456. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  457. "use strict";
  458. var origSymbol = typeof Symbol !== 'undefined' && Symbol;
  459. var hasSymbolSham = __webpack_require__(5960);
  460. module.exports = function hasNativeSymbols() {
  461. if (typeof origSymbol !== 'function') { return false; }
  462. if (typeof Symbol !== 'function') { return false; }
  463. if (typeof origSymbol('foo') !== 'symbol') { return false; }
  464. if (typeof Symbol('bar') !== 'symbol') { return false; }
  465. return hasSymbolSham();
  466. };
  467. /***/ }),
  468. /***/ 5960:
  469. /***/ (function(module) {
  470. "use strict";
  471. /* eslint complexity: [2, 18], max-statements: [2, 33] */
  472. module.exports = function hasSymbols() {
  473. if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
  474. if (typeof Symbol.iterator === 'symbol') { return true; }
  475. var obj = {};
  476. var sym = Symbol('test');
  477. var symObj = Object(sym);
  478. if (typeof sym === 'string') { return false; }
  479. if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
  480. if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
  481. // temp disabled per https://github.com/ljharb/object.assign/issues/17
  482. // if (sym instanceof Symbol) { return false; }
  483. // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
  484. // if (!(symObj instanceof Symbol)) { return false; }
  485. // if (typeof Symbol.prototype.toString !== 'function') { return false; }
  486. // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
  487. var symVal = 42;
  488. obj[sym] = symVal;
  489. for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
  490. if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
  491. if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
  492. var syms = Object.getOwnPropertySymbols(obj);
  493. if (syms.length !== 1 || syms[0] !== sym) { return false; }
  494. if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
  495. if (typeof Object.getOwnPropertyDescriptor === 'function') {
  496. var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
  497. if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
  498. }
  499. return true;
  500. };
  501. /***/ }),
  502. /***/ 4363:
  503. /***/ (function(module) {
  504. "use strict";
  505. var fnToStr = Function.prototype.toString;
  506. var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
  507. var badArrayLike;
  508. var isCallableMarker;
  509. if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
  510. try {
  511. badArrayLike = Object.defineProperty({}, 'length', {
  512. get: function () {
  513. throw isCallableMarker;
  514. }
  515. });
  516. isCallableMarker = {};
  517. // eslint-disable-next-line no-throw-literal
  518. reflectApply(function () { throw 42; }, null, badArrayLike);
  519. } catch (_) {
  520. if (_ !== isCallableMarker) {
  521. reflectApply = null;
  522. }
  523. }
  524. } else {
  525. reflectApply = null;
  526. }
  527. var constructorRegex = /^\s*class\b/;
  528. var isES6ClassFn = function isES6ClassFunction(value) {
  529. try {
  530. var fnStr = fnToStr.call(value);
  531. return constructorRegex.test(fnStr);
  532. } catch (e) {
  533. return false; // not a function
  534. }
  535. };
  536. var tryFunctionObject = function tryFunctionToStr(value) {
  537. try {
  538. if (isES6ClassFn(value)) { return false; }
  539. fnToStr.call(value);
  540. return true;
  541. } catch (e) {
  542. return false;
  543. }
  544. };
  545. var toStr = Object.prototype.toString;
  546. var fnClass = '[object Function]';
  547. var genClass = '[object GeneratorFunction]';
  548. var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`
  549. /* globals document: false */
  550. var documentDotAll = typeof document === 'object' && typeof document.all === 'undefined' && document.all !== undefined ? document.all : {};
  551. module.exports = reflectApply
  552. ? function isCallable(value) {
  553. if (value === documentDotAll) { return true; }
  554. if (!value) { return false; }
  555. if (typeof value !== 'function' && typeof value !== 'object') { return false; }
  556. if (typeof value === 'function' && !value.prototype) { return true; }
  557. try {
  558. reflectApply(value, null, badArrayLike);
  559. } catch (e) {
  560. if (e !== isCallableMarker) { return false; }
  561. }
  562. return !isES6ClassFn(value);
  563. }
  564. : function isCallable(value) {
  565. if (value === documentDotAll) { return true; }
  566. if (!value) { return false; }
  567. if (typeof value !== 'function' && typeof value !== 'object') { return false; }
  568. if (typeof value === 'function' && !value.prototype) { return true; }
  569. if (hasToStringTag) { return tryFunctionObject(value); }
  570. if (isES6ClassFn(value)) { return false; }
  571. var strClass = toStr.call(value);
  572. return strClass === fnClass || strClass === genClass;
  573. };
  574. /***/ }),
  575. /***/ 4221:
  576. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  577. "use strict";
  578. var callBound = __webpack_require__(9630);
  579. var hasToStringTag = __webpack_require__(4111)();
  580. var has;
  581. var $exec;
  582. var isRegexMarker;
  583. var badStringifier;
  584. if (hasToStringTag) {
  585. has = callBound('Object.prototype.hasOwnProperty');
  586. $exec = callBound('RegExp.prototype.exec');
  587. isRegexMarker = {};
  588. var throwRegexMarker = function () {
  589. throw isRegexMarker;
  590. };
  591. badStringifier = {
  592. toString: throwRegexMarker,
  593. valueOf: throwRegexMarker
  594. };
  595. if (typeof Symbol.toPrimitive === 'symbol') {
  596. badStringifier[Symbol.toPrimitive] = throwRegexMarker;
  597. }
  598. }
  599. var $toString = callBound('Object.prototype.toString');
  600. var gOPD = Object.getOwnPropertyDescriptor;
  601. var regexClass = '[object RegExp]';
  602. module.exports = hasToStringTag
  603. // eslint-disable-next-line consistent-return
  604. ? function isRegex(value) {
  605. if (!value || typeof value !== 'object') {
  606. return false;
  607. }
  608. var descriptor = gOPD(value, 'lastIndex');
  609. var hasLastIndexDataProperty = descriptor && has(descriptor, 'value');
  610. if (!hasLastIndexDataProperty) {
  611. return false;
  612. }
  613. try {
  614. $exec(value, badStringifier);
  615. } catch (e) {
  616. return e === isRegexMarker;
  617. }
  618. }
  619. : function isRegex(value) {
  620. // In older browsers, typeof regex incorrectly returns 'function'
  621. if (!value || (typeof value !== 'object' && typeof value !== 'function')) {
  622. return false;
  623. }
  624. return $toString(value) === regexClass;
  625. };
  626. /***/ }),
  627. /***/ 3205:
  628. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  629. var hasMap = typeof Map === 'function' && Map.prototype;
  630. var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
  631. var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
  632. var mapForEach = hasMap && Map.prototype.forEach;
  633. var hasSet = typeof Set === 'function' && Set.prototype;
  634. var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
  635. var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
  636. var setForEach = hasSet && Set.prototype.forEach;
  637. var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
  638. var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
  639. var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
  640. var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
  641. var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
  642. var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
  643. var booleanValueOf = Boolean.prototype.valueOf;
  644. var objectToString = Object.prototype.toString;
  645. var functionToString = Function.prototype.toString;
  646. var $match = String.prototype.match;
  647. var $slice = String.prototype.slice;
  648. var $replace = String.prototype.replace;
  649. var $toUpperCase = String.prototype.toUpperCase;
  650. var $toLowerCase = String.prototype.toLowerCase;
  651. var $test = RegExp.prototype.test;
  652. var $concat = Array.prototype.concat;
  653. var $join = Array.prototype.join;
  654. var $arrSlice = Array.prototype.slice;
  655. var $floor = Math.floor;
  656. var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
  657. var gOPS = Object.getOwnPropertySymbols;
  658. var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
  659. var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
  660. // ie, `has-tostringtag/shams
  661. var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
  662. ? Symbol.toStringTag
  663. : null;
  664. var isEnumerable = Object.prototype.propertyIsEnumerable;
  665. var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
  666. [].__proto__ === Array.prototype // eslint-disable-line no-proto
  667. ? function (O) {
  668. return O.__proto__; // eslint-disable-line no-proto
  669. }
  670. : null
  671. );
  672. function addNumericSeparator(num, str) {
  673. if (
  674. num === Infinity
  675. || num === -Infinity
  676. || num !== num
  677. || (num && num > -1000 && num < 1000)
  678. || $test.call(/e/, str)
  679. ) {
  680. return str;
  681. }
  682. var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
  683. if (typeof num === 'number') {
  684. var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
  685. if (int !== num) {
  686. var intStr = String(int);
  687. var dec = $slice.call(str, intStr.length + 1);
  688. return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
  689. }
  690. }
  691. return $replace.call(str, sepRegex, '$&_');
  692. }
  693. var inspectCustom = (__webpack_require__(4080).custom);
  694. var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
  695. module.exports = function inspect_(obj, options, depth, seen) {
  696. var opts = options || {};
  697. if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
  698. throw new TypeError('option "quoteStyle" must be "single" or "double"');
  699. }
  700. if (
  701. has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
  702. ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
  703. : opts.maxStringLength !== null
  704. )
  705. ) {
  706. throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
  707. }
  708. var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
  709. if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
  710. throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
  711. }
  712. if (
  713. has(opts, 'indent')
  714. && opts.indent !== null
  715. && opts.indent !== '\t'
  716. && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
  717. ) {
  718. throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
  719. }
  720. if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
  721. throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
  722. }
  723. var numericSeparator = opts.numericSeparator;
  724. if (typeof obj === 'undefined') {
  725. return 'undefined';
  726. }
  727. if (obj === null) {
  728. return 'null';
  729. }
  730. if (typeof obj === 'boolean') {
  731. return obj ? 'true' : 'false';
  732. }
  733. if (typeof obj === 'string') {
  734. return inspectString(obj, opts);
  735. }
  736. if (typeof obj === 'number') {
  737. if (obj === 0) {
  738. return Infinity / obj > 0 ? '0' : '-0';
  739. }
  740. var str = String(obj);
  741. return numericSeparator ? addNumericSeparator(obj, str) : str;
  742. }
  743. if (typeof obj === 'bigint') {
  744. var bigIntStr = String(obj) + 'n';
  745. return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
  746. }
  747. var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
  748. if (typeof depth === 'undefined') { depth = 0; }
  749. if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
  750. return isArray(obj) ? '[Array]' : '[Object]';
  751. }
  752. var indent = getIndent(opts, depth);
  753. if (typeof seen === 'undefined') {
  754. seen = [];
  755. } else if (indexOf(seen, obj) >= 0) {
  756. return '[Circular]';
  757. }
  758. function inspect(value, from, noIndent) {
  759. if (from) {
  760. seen = $arrSlice.call(seen);
  761. seen.push(from);
  762. }
  763. if (noIndent) {
  764. var newOpts = {
  765. depth: opts.depth
  766. };
  767. if (has(opts, 'quoteStyle')) {
  768. newOpts.quoteStyle = opts.quoteStyle;
  769. }
  770. return inspect_(value, newOpts, depth + 1, seen);
  771. }
  772. return inspect_(value, opts, depth + 1, seen);
  773. }
  774. if (typeof obj === 'function') {
  775. var name = nameOf(obj);
  776. var keys = arrObjKeys(obj, inspect);
  777. return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
  778. }
  779. if (isSymbol(obj)) {
  780. var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
  781. return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
  782. }
  783. if (isElement(obj)) {
  784. var s = '<' + $toLowerCase.call(String(obj.nodeName));
  785. var attrs = obj.attributes || [];
  786. for (var i = 0; i < attrs.length; i++) {
  787. s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
  788. }
  789. s += '>';
  790. if (obj.childNodes && obj.childNodes.length) { s += '...'; }
  791. s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
  792. return s;
  793. }
  794. if (isArray(obj)) {
  795. if (obj.length === 0) { return '[]'; }
  796. var xs = arrObjKeys(obj, inspect);
  797. if (indent && !singleLineValues(xs)) {
  798. return '[' + indentedJoin(xs, indent) + ']';
  799. }
  800. return '[ ' + $join.call(xs, ', ') + ' ]';
  801. }
  802. if (isError(obj)) {
  803. var parts = arrObjKeys(obj, inspect);
  804. if ('cause' in obj && !isEnumerable.call(obj, 'cause')) {
  805. return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
  806. }
  807. if (parts.length === 0) { return '[' + String(obj) + ']'; }
  808. return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
  809. }
  810. if (typeof obj === 'object' && customInspect) {
  811. if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
  812. return obj[inspectSymbol]();
  813. } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
  814. return obj.inspect();
  815. }
  816. }
  817. if (isMap(obj)) {
  818. var mapParts = [];
  819. mapForEach.call(obj, function (value, key) {
  820. mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
  821. });
  822. return collectionOf('Map', mapSize.call(obj), mapParts, indent);
  823. }
  824. if (isSet(obj)) {
  825. var setParts = [];
  826. setForEach.call(obj, function (value) {
  827. setParts.push(inspect(value, obj));
  828. });
  829. return collectionOf('Set', setSize.call(obj), setParts, indent);
  830. }
  831. if (isWeakMap(obj)) {
  832. return weakCollectionOf('WeakMap');
  833. }
  834. if (isWeakSet(obj)) {
  835. return weakCollectionOf('WeakSet');
  836. }
  837. if (isWeakRef(obj)) {
  838. return weakCollectionOf('WeakRef');
  839. }
  840. if (isNumber(obj)) {
  841. return markBoxed(inspect(Number(obj)));
  842. }
  843. if (isBigInt(obj)) {
  844. return markBoxed(inspect(bigIntValueOf.call(obj)));
  845. }
  846. if (isBoolean(obj)) {
  847. return markBoxed(booleanValueOf.call(obj));
  848. }
  849. if (isString(obj)) {
  850. return markBoxed(inspect(String(obj)));
  851. }
  852. if (!isDate(obj) && !isRegExp(obj)) {
  853. var ys = arrObjKeys(obj, inspect);
  854. var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
  855. var protoTag = obj instanceof Object ? '' : 'null prototype';
  856. var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
  857. var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
  858. var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
  859. if (ys.length === 0) { return tag + '{}'; }
  860. if (indent) {
  861. return tag + '{' + indentedJoin(ys, indent) + '}';
  862. }
  863. return tag + '{ ' + $join.call(ys, ', ') + ' }';
  864. }
  865. return String(obj);
  866. };
  867. function wrapQuotes(s, defaultStyle, opts) {
  868. var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
  869. return quoteChar + s + quoteChar;
  870. }
  871. function quote(s) {
  872. return $replace.call(String(s), /"/g, '&quot;');
  873. }
  874. function isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  875. function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  876. function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  877. function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  878. function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  879. function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  880. function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  881. // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
  882. function isSymbol(obj) {
  883. if (hasShammedSymbols) {
  884. return obj && typeof obj === 'object' && obj instanceof Symbol;
  885. }
  886. if (typeof obj === 'symbol') {
  887. return true;
  888. }
  889. if (!obj || typeof obj !== 'object' || !symToString) {
  890. return false;
  891. }
  892. try {
  893. symToString.call(obj);
  894. return true;
  895. } catch (e) {}
  896. return false;
  897. }
  898. function isBigInt(obj) {
  899. if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
  900. return false;
  901. }
  902. try {
  903. bigIntValueOf.call(obj);
  904. return true;
  905. } catch (e) {}
  906. return false;
  907. }
  908. var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
  909. function has(obj, key) {
  910. return hasOwn.call(obj, key);
  911. }
  912. function toStr(obj) {
  913. return objectToString.call(obj);
  914. }
  915. function nameOf(f) {
  916. if (f.name) { return f.name; }
  917. var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
  918. if (m) { return m[1]; }
  919. return null;
  920. }
  921. function indexOf(xs, x) {
  922. if (xs.indexOf) { return xs.indexOf(x); }
  923. for (var i = 0, l = xs.length; i < l; i++) {
  924. if (xs[i] === x) { return i; }
  925. }
  926. return -1;
  927. }
  928. function isMap(x) {
  929. if (!mapSize || !x || typeof x !== 'object') {
  930. return false;
  931. }
  932. try {
  933. mapSize.call(x);
  934. try {
  935. setSize.call(x);
  936. } catch (s) {
  937. return true;
  938. }
  939. return x instanceof Map; // core-js workaround, pre-v2.5.0
  940. } catch (e) {}
  941. return false;
  942. }
  943. function isWeakMap(x) {
  944. if (!weakMapHas || !x || typeof x !== 'object') {
  945. return false;
  946. }
  947. try {
  948. weakMapHas.call(x, weakMapHas);
  949. try {
  950. weakSetHas.call(x, weakSetHas);
  951. } catch (s) {
  952. return true;
  953. }
  954. return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
  955. } catch (e) {}
  956. return false;
  957. }
  958. function isWeakRef(x) {
  959. if (!weakRefDeref || !x || typeof x !== 'object') {
  960. return false;
  961. }
  962. try {
  963. weakRefDeref.call(x);
  964. return true;
  965. } catch (e) {}
  966. return false;
  967. }
  968. function isSet(x) {
  969. if (!setSize || !x || typeof x !== 'object') {
  970. return false;
  971. }
  972. try {
  973. setSize.call(x);
  974. try {
  975. mapSize.call(x);
  976. } catch (m) {
  977. return true;
  978. }
  979. return x instanceof Set; // core-js workaround, pre-v2.5.0
  980. } catch (e) {}
  981. return false;
  982. }
  983. function isWeakSet(x) {
  984. if (!weakSetHas || !x || typeof x !== 'object') {
  985. return false;
  986. }
  987. try {
  988. weakSetHas.call(x, weakSetHas);
  989. try {
  990. weakMapHas.call(x, weakMapHas);
  991. } catch (s) {
  992. return true;
  993. }
  994. return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
  995. } catch (e) {}
  996. return false;
  997. }
  998. function isElement(x) {
  999. if (!x || typeof x !== 'object') { return false; }
  1000. if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
  1001. return true;
  1002. }
  1003. return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
  1004. }
  1005. function inspectString(str, opts) {
  1006. if (str.length > opts.maxStringLength) {
  1007. var remaining = str.length - opts.maxStringLength;
  1008. var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
  1009. return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
  1010. }
  1011. // eslint-disable-next-line no-control-regex
  1012. var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
  1013. return wrapQuotes(s, 'single', opts);
  1014. }
  1015. function lowbyte(c) {
  1016. var n = c.charCodeAt(0);
  1017. var x = {
  1018. 8: 'b',
  1019. 9: 't',
  1020. 10: 'n',
  1021. 12: 'f',
  1022. 13: 'r'
  1023. }[n];
  1024. if (x) { return '\\' + x; }
  1025. return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
  1026. }
  1027. function markBoxed(str) {
  1028. return 'Object(' + str + ')';
  1029. }
  1030. function weakCollectionOf(type) {
  1031. return type + ' { ? }';
  1032. }
  1033. function collectionOf(type, size, entries, indent) {
  1034. var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
  1035. return type + ' (' + size + ') {' + joinedEntries + '}';
  1036. }
  1037. function singleLineValues(xs) {
  1038. for (var i = 0; i < xs.length; i++) {
  1039. if (indexOf(xs[i], '\n') >= 0) {
  1040. return false;
  1041. }
  1042. }
  1043. return true;
  1044. }
  1045. function getIndent(opts, depth) {
  1046. var baseIndent;
  1047. if (opts.indent === '\t') {
  1048. baseIndent = '\t';
  1049. } else if (typeof opts.indent === 'number' && opts.indent > 0) {
  1050. baseIndent = $join.call(Array(opts.indent + 1), ' ');
  1051. } else {
  1052. return null;
  1053. }
  1054. return {
  1055. base: baseIndent,
  1056. prev: $join.call(Array(depth + 1), baseIndent)
  1057. };
  1058. }
  1059. function indentedJoin(xs, indent) {
  1060. if (xs.length === 0) { return ''; }
  1061. var lineJoiner = '\n' + indent.prev + indent.base;
  1062. return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
  1063. }
  1064. function arrObjKeys(obj, inspect) {
  1065. var isArr = isArray(obj);
  1066. var xs = [];
  1067. if (isArr) {
  1068. xs.length = obj.length;
  1069. for (var i = 0; i < obj.length; i++) {
  1070. xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
  1071. }
  1072. }
  1073. var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
  1074. var symMap;
  1075. if (hasShammedSymbols) {
  1076. symMap = {};
  1077. for (var k = 0; k < syms.length; k++) {
  1078. symMap['$' + syms[k]] = syms[k];
  1079. }
  1080. }
  1081. for (var key in obj) { // eslint-disable-line no-restricted-syntax
  1082. if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
  1083. if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
  1084. if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
  1085. // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
  1086. continue; // eslint-disable-line no-restricted-syntax, no-continue
  1087. } else if ($test.call(/[^\w$]/, key)) {
  1088. xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
  1089. } else {
  1090. xs.push(key + ': ' + inspect(obj[key], obj));
  1091. }
  1092. }
  1093. if (typeof gOPS === 'function') {
  1094. for (var j = 0; j < syms.length; j++) {
  1095. if (isEnumerable.call(obj, syms[j])) {
  1096. xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
  1097. }
  1098. }
  1099. }
  1100. return xs;
  1101. }
  1102. /***/ }),
  1103. /***/ 616:
  1104. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1105. "use strict";
  1106. var implementation = __webpack_require__(4485);
  1107. module.exports = function getPolyfill() {
  1108. return Array.prototype.flat || implementation;
  1109. };
  1110. /***/ }),
  1111. /***/ 2059:
  1112. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1113. "use strict";
  1114. var define = __webpack_require__(9170);
  1115. var shimUnscopables = __webpack_require__(2505);
  1116. var getPolyfill = __webpack_require__(616);
  1117. module.exports = function shimFlat() {
  1118. var polyfill = getPolyfill();
  1119. define(
  1120. Array.prototype,
  1121. { flat: polyfill },
  1122. { flat: function () { return Array.prototype.flat !== polyfill; } }
  1123. );
  1124. shimUnscopables('flat');
  1125. return polyfill;
  1126. };
  1127. /***/ }),
  1128. /***/ 7615:
  1129. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1130. "use strict";
  1131. var GetIntrinsic = __webpack_require__(1801);
  1132. var callBind = __webpack_require__(2550);
  1133. var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
  1134. module.exports = function callBoundIntrinsic(name, allowMissing) {
  1135. var intrinsic = GetIntrinsic(name, !!allowMissing);
  1136. if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
  1137. return callBind(intrinsic);
  1138. }
  1139. return intrinsic;
  1140. };
  1141. /***/ }),
  1142. /***/ 2550:
  1143. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1144. "use strict";
  1145. var bind = __webpack_require__(1930);
  1146. var GetIntrinsic = __webpack_require__(1801);
  1147. var $apply = GetIntrinsic('%Function.prototype.apply%');
  1148. var $call = GetIntrinsic('%Function.prototype.call%');
  1149. var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
  1150. var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
  1151. if ($defineProperty) {
  1152. try {
  1153. $defineProperty({}, 'a', { value: 1 });
  1154. } catch (e) {
  1155. // IE 8 has a broken defineProperty
  1156. $defineProperty = null;
  1157. }
  1158. }
  1159. module.exports = function callBind() {
  1160. return $reflectApply(bind, $call, arguments);
  1161. };
  1162. var applyBind = function applyBind() {
  1163. return $reflectApply(bind, $apply, arguments);
  1164. };
  1165. if ($defineProperty) {
  1166. $defineProperty(module.exports, 'apply', { value: applyBind });
  1167. } else {
  1168. module.exports.apply = applyBind;
  1169. }
  1170. /***/ }),
  1171. /***/ 4403:
  1172. /***/ (function(module, exports) {
  1173. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  1174. Copyright (c) 2018 Jed Watson.
  1175. Licensed under the MIT License (MIT), see
  1176. http://jedwatson.github.io/classnames
  1177. */
  1178. /* global define */
  1179. (function () {
  1180. 'use strict';
  1181. var hasOwn = {}.hasOwnProperty;
  1182. function classNames() {
  1183. var classes = [];
  1184. for (var i = 0; i < arguments.length; i++) {
  1185. var arg = arguments[i];
  1186. if (!arg) continue;
  1187. var argType = typeof arg;
  1188. if (argType === 'string' || argType === 'number') {
  1189. classes.push(arg);
  1190. } else if (Array.isArray(arg)) {
  1191. if (arg.length) {
  1192. var inner = classNames.apply(null, arg);
  1193. if (inner) {
  1194. classes.push(inner);
  1195. }
  1196. }
  1197. } else if (argType === 'object') {
  1198. if (arg.toString === Object.prototype.toString) {
  1199. for (var key in arg) {
  1200. if (hasOwn.call(arg, key) && arg[key]) {
  1201. classes.push(key);
  1202. }
  1203. }
  1204. } else {
  1205. classes.push(arg.toString());
  1206. }
  1207. }
  1208. }
  1209. return classes.join(' ');
  1210. }
  1211. if ( true && module.exports) {
  1212. classNames.default = classNames;
  1213. module.exports = classNames;
  1214. } else if (true) {
  1215. // register as 'classnames', consistent with npm package name
  1216. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  1217. return classNames;
  1218. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  1219. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1220. } else {}
  1221. }());
  1222. /***/ }),
  1223. /***/ 8495:
  1224. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1225. "use strict";
  1226. __webpack_require__.r(__webpack_exports__);
  1227. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1228. /* harmony export */ "addEventListener": function() { return /* binding */ addEventListener; }
  1229. /* harmony export */ });
  1230. var CAN_USE_DOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
  1231. // Adapted from Modernizr
  1232. // https://github.com/Modernizr/Modernizr/blob/acb3f0d9/feature-detects/dom/passiveeventlisteners.js#L26-L37
  1233. function testPassiveEventListeners() {
  1234. if (!CAN_USE_DOM) {
  1235. return false;
  1236. }
  1237. if (!window.addEventListener || !window.removeEventListener || !Object.defineProperty) {
  1238. return false;
  1239. }
  1240. var supportsPassiveOption = false;
  1241. try {
  1242. var opts = Object.defineProperty({}, 'passive', {
  1243. // eslint-disable-next-line getter-return
  1244. get: function () {
  1245. function get() {
  1246. supportsPassiveOption = true;
  1247. }
  1248. return get;
  1249. }()
  1250. });
  1251. var noop = function noop() {};
  1252. window.addEventListener('testPassiveEventSupport', noop, opts);
  1253. window.removeEventListener('testPassiveEventSupport', noop, opts);
  1254. } catch (e) {
  1255. // do nothing
  1256. }
  1257. return supportsPassiveOption;
  1258. }
  1259. var memoized = void 0;
  1260. function canUsePassiveEventListeners() {
  1261. if (memoized === undefined) {
  1262. memoized = testPassiveEventListeners();
  1263. }
  1264. return memoized;
  1265. }
  1266. function normalizeEventOptions(eventOptions) {
  1267. if (!eventOptions) {
  1268. return undefined;
  1269. }
  1270. if (!canUsePassiveEventListeners()) {
  1271. // If the browser does not support the passive option, then it is expecting
  1272. // a boolean for the options argument to specify whether it should use
  1273. // capture or not. In more modern browsers, this is passed via the `capture`
  1274. // option, so let's just hoist that value up.
  1275. return !!eventOptions.capture;
  1276. }
  1277. return eventOptions;
  1278. }
  1279. /* eslint-disable no-bitwise */
  1280. /**
  1281. * Generate a unique key for any set of event options
  1282. */
  1283. function eventOptionsKey(normalizedEventOptions) {
  1284. if (!normalizedEventOptions) {
  1285. return 0;
  1286. }
  1287. // If the browser does not support passive event listeners, the normalized
  1288. // event options will be a boolean.
  1289. if (normalizedEventOptions === true) {
  1290. return 100;
  1291. }
  1292. // At this point, the browser supports passive event listeners, so we expect
  1293. // the event options to be an object with possible properties of capture,
  1294. // passive, and once.
  1295. //
  1296. // We want to consistently return the same value, regardless of the order of
  1297. // these properties, so let's use binary maths to assign each property to a
  1298. // bit, and then add those together (with an offset to account for the
  1299. // booleans at the beginning of this function).
  1300. var capture = normalizedEventOptions.capture << 0;
  1301. var passive = normalizedEventOptions.passive << 1;
  1302. var once = normalizedEventOptions.once << 2;
  1303. return capture + passive + once;
  1304. }
  1305. function ensureCanMutateNextEventHandlers(eventHandlers) {
  1306. if (eventHandlers.handlers === eventHandlers.nextHandlers) {
  1307. // eslint-disable-next-line no-param-reassign
  1308. eventHandlers.nextHandlers = eventHandlers.handlers.slice();
  1309. }
  1310. }
  1311. function TargetEventHandlers(target) {
  1312. this.target = target;
  1313. this.events = {};
  1314. }
  1315. TargetEventHandlers.prototype.getEventHandlers = function () {
  1316. function getEventHandlers(eventName, options) {
  1317. var key = String(eventName) + ' ' + String(eventOptionsKey(options));
  1318. if (!this.events[key]) {
  1319. this.events[key] = {
  1320. handlers: [],
  1321. handleEvent: undefined
  1322. };
  1323. this.events[key].nextHandlers = this.events[key].handlers;
  1324. }
  1325. return this.events[key];
  1326. }
  1327. return getEventHandlers;
  1328. }();
  1329. TargetEventHandlers.prototype.handleEvent = function () {
  1330. function handleEvent(eventName, options, event) {
  1331. var eventHandlers = this.getEventHandlers(eventName, options);
  1332. eventHandlers.handlers = eventHandlers.nextHandlers;
  1333. eventHandlers.handlers.forEach(function (handler) {
  1334. if (handler) {
  1335. // We need to check for presence here because a handler function may
  1336. // cause later handlers to get removed. This can happen if you for
  1337. // instance have a waypoint that unmounts another waypoint as part of an
  1338. // onEnter/onLeave handler.
  1339. handler(event);
  1340. }
  1341. });
  1342. }
  1343. return handleEvent;
  1344. }();
  1345. TargetEventHandlers.prototype.add = function () {
  1346. function add(eventName, listener, options) {
  1347. var _this = this;
  1348. // options has already been normalized at this point.
  1349. var eventHandlers = this.getEventHandlers(eventName, options);
  1350. ensureCanMutateNextEventHandlers(eventHandlers);
  1351. if (eventHandlers.nextHandlers.length === 0) {
  1352. eventHandlers.handleEvent = this.handleEvent.bind(this, eventName, options);
  1353. this.target.addEventListener(eventName, eventHandlers.handleEvent, options);
  1354. }
  1355. eventHandlers.nextHandlers.push(listener);
  1356. var isSubscribed = true;
  1357. var unsubscribe = function () {
  1358. function unsubscribe() {
  1359. if (!isSubscribed) {
  1360. return;
  1361. }
  1362. isSubscribed = false;
  1363. ensureCanMutateNextEventHandlers(eventHandlers);
  1364. var index = eventHandlers.nextHandlers.indexOf(listener);
  1365. eventHandlers.nextHandlers.splice(index, 1);
  1366. if (eventHandlers.nextHandlers.length === 0) {
  1367. // All event handlers have been removed, so we want to remove the event
  1368. // listener from the target node.
  1369. if (_this.target) {
  1370. // There can be a race condition where the target may no longer exist
  1371. // when this function is called, e.g. when a React component is
  1372. // unmounting. Guarding against this prevents the following error:
  1373. //
  1374. // Cannot read property 'removeEventListener' of undefined
  1375. _this.target.removeEventListener(eventName, eventHandlers.handleEvent, options);
  1376. }
  1377. eventHandlers.handleEvent = undefined;
  1378. }
  1379. }
  1380. return unsubscribe;
  1381. }();
  1382. return unsubscribe;
  1383. }
  1384. return add;
  1385. }();
  1386. var EVENT_HANDLERS_KEY = '__consolidated_events_handlers__';
  1387. // eslint-disable-next-line import/prefer-default-export
  1388. function addEventListener(target, eventName, listener, options) {
  1389. if (!target[EVENT_HANDLERS_KEY]) {
  1390. // eslint-disable-next-line no-param-reassign
  1391. target[EVENT_HANDLERS_KEY] = new TargetEventHandlers(target);
  1392. }
  1393. var normalizedEventOptions = normalizeEventOptions(options);
  1394. return target[EVENT_HANDLERS_KEY].add(eventName, listener, normalizedEventOptions);
  1395. }
  1396. /***/ }),
  1397. /***/ 9170:
  1398. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1399. "use strict";
  1400. var keys = __webpack_require__(806);
  1401. var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
  1402. var toStr = Object.prototype.toString;
  1403. var concat = Array.prototype.concat;
  1404. var origDefineProperty = Object.defineProperty;
  1405. var isFunction = function (fn) {
  1406. return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
  1407. };
  1408. var arePropertyDescriptorsSupported = function () {
  1409. var obj = {};
  1410. try {
  1411. origDefineProperty(obj, 'x', { enumerable: false, value: obj });
  1412. // eslint-disable-next-line no-unused-vars, no-restricted-syntax
  1413. for (var _ in obj) { // jscs:ignore disallowUnusedVariables
  1414. return false;
  1415. }
  1416. return obj.x === obj;
  1417. } catch (e) { /* this is IE 8. */
  1418. return false;
  1419. }
  1420. };
  1421. var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
  1422. var defineProperty = function (object, name, value, predicate) {
  1423. if (name in object && (!isFunction(predicate) || !predicate())) {
  1424. return;
  1425. }
  1426. if (supportsDescriptors) {
  1427. origDefineProperty(object, name, {
  1428. configurable: true,
  1429. enumerable: false,
  1430. value: value,
  1431. writable: true
  1432. });
  1433. } else {
  1434. object[name] = value;
  1435. }
  1436. };
  1437. var defineProperties = function (object, map) {
  1438. var predicates = arguments.length > 2 ? arguments[2] : {};
  1439. var props = keys(map);
  1440. if (hasSymbols) {
  1441. props = concat.call(props, Object.getOwnPropertySymbols(map));
  1442. }
  1443. for (var i = 0; i < props.length; i += 1) {
  1444. defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
  1445. }
  1446. };
  1447. defineProperties.supportsDescriptors = !!supportsDescriptors;
  1448. module.exports = defineProperties;
  1449. /***/ }),
  1450. /***/ 8110:
  1451. /***/ (function(module) {
  1452. "use strict";
  1453. module.exports = function contains(other) {
  1454. if (arguments.length < 1) {
  1455. throw new TypeError('1 argument is required');
  1456. }
  1457. if (typeof other !== 'object') {
  1458. throw new TypeError('Argument 1 (”other“) to Node.contains must be an instance of Node');
  1459. }
  1460. var node = other;
  1461. do {
  1462. if (this === node) {
  1463. return true;
  1464. }
  1465. if (node) {
  1466. node = node.parentNode;
  1467. }
  1468. } while (node);
  1469. return false;
  1470. };
  1471. /***/ }),
  1472. /***/ 6789:
  1473. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1474. "use strict";
  1475. var define = __webpack_require__(9170);
  1476. var implementation = __webpack_require__(8110);
  1477. var getPolyfill = __webpack_require__(8267);
  1478. var polyfill = getPolyfill();
  1479. var shim = __webpack_require__(714);
  1480. var boundContains = function contains(node, other) {
  1481. return polyfill.apply(node, [other]);
  1482. };
  1483. define(boundContains, {
  1484. getPolyfill: getPolyfill,
  1485. implementation: implementation,
  1486. shim: shim
  1487. });
  1488. module.exports = boundContains;
  1489. /***/ }),
  1490. /***/ 8267:
  1491. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1492. "use strict";
  1493. var implementation = __webpack_require__(8110);
  1494. module.exports = function getPolyfill() {
  1495. if (typeof document !== 'undefined') {
  1496. if (document.contains) {
  1497. return document.contains;
  1498. }
  1499. if (document.body && document.body.contains) {
  1500. try {
  1501. if (typeof document.body.contains.call(document, '') === 'boolean') {
  1502. return document.body.contains;
  1503. }
  1504. } catch (e) { /**/ }
  1505. }
  1506. }
  1507. return implementation;
  1508. };
  1509. /***/ }),
  1510. /***/ 714:
  1511. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1512. "use strict";
  1513. var define = __webpack_require__(9170);
  1514. var getPolyfill = __webpack_require__(8267);
  1515. module.exports = function shimContains() {
  1516. var polyfill = getPolyfill();
  1517. if (typeof document !== 'undefined') {
  1518. define(
  1519. document,
  1520. { contains: polyfill },
  1521. { contains: function () { return document.contains !== polyfill; } }
  1522. );
  1523. if (typeof Element !== 'undefined') {
  1524. define(
  1525. Element.prototype,
  1526. { contains: polyfill },
  1527. { contains: function () { return Element.prototype.contains !== polyfill; } }
  1528. );
  1529. }
  1530. }
  1531. return polyfill;
  1532. };
  1533. /***/ }),
  1534. /***/ 1345:
  1535. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1536. "use strict";
  1537. var util = __webpack_require__(5022);
  1538. function scrollIntoView(elem, container, config) {
  1539. config = config || {};
  1540. // document 归一化到 window
  1541. if (container.nodeType === 9) {
  1542. container = util.getWindow(container);
  1543. }
  1544. var allowHorizontalScroll = config.allowHorizontalScroll;
  1545. var onlyScrollIfNeeded = config.onlyScrollIfNeeded;
  1546. var alignWithTop = config.alignWithTop;
  1547. var alignWithLeft = config.alignWithLeft;
  1548. var offsetTop = config.offsetTop || 0;
  1549. var offsetLeft = config.offsetLeft || 0;
  1550. var offsetBottom = config.offsetBottom || 0;
  1551. var offsetRight = config.offsetRight || 0;
  1552. allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;
  1553. var isWin = util.isWindow(container);
  1554. var elemOffset = util.offset(elem);
  1555. var eh = util.outerHeight(elem);
  1556. var ew = util.outerWidth(elem);
  1557. var containerOffset = undefined;
  1558. var ch = undefined;
  1559. var cw = undefined;
  1560. var containerScroll = undefined;
  1561. var diffTop = undefined;
  1562. var diffBottom = undefined;
  1563. var win = undefined;
  1564. var winScroll = undefined;
  1565. var ww = undefined;
  1566. var wh = undefined;
  1567. if (isWin) {
  1568. win = container;
  1569. wh = util.height(win);
  1570. ww = util.width(win);
  1571. winScroll = {
  1572. left: util.scrollLeft(win),
  1573. top: util.scrollTop(win)
  1574. };
  1575. // elem 相对 container 可视视窗的距离
  1576. diffTop = {
  1577. left: elemOffset.left - winScroll.left - offsetLeft,
  1578. top: elemOffset.top - winScroll.top - offsetTop
  1579. };
  1580. diffBottom = {
  1581. left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,
  1582. top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom
  1583. };
  1584. containerScroll = winScroll;
  1585. } else {
  1586. containerOffset = util.offset(container);
  1587. ch = container.clientHeight;
  1588. cw = container.clientWidth;
  1589. containerScroll = {
  1590. left: container.scrollLeft,
  1591. top: container.scrollTop
  1592. };
  1593. // elem 相对 container 可视视窗的距离
  1594. // 注意边框, offset 是边框到根节点
  1595. diffTop = {
  1596. left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,
  1597. top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop
  1598. };
  1599. diffBottom = {
  1600. left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,
  1601. top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom
  1602. };
  1603. }
  1604. if (diffTop.top < 0 || diffBottom.top > 0) {
  1605. // 强制向上
  1606. if (alignWithTop === true) {
  1607. util.scrollTop(container, containerScroll.top + diffTop.top);
  1608. } else if (alignWithTop === false) {
  1609. util.scrollTop(container, containerScroll.top + diffBottom.top);
  1610. } else {
  1611. // 自动调整
  1612. if (diffTop.top < 0) {
  1613. util.scrollTop(container, containerScroll.top + diffTop.top);
  1614. } else {
  1615. util.scrollTop(container, containerScroll.top + diffBottom.top);
  1616. }
  1617. }
  1618. } else {
  1619. if (!onlyScrollIfNeeded) {
  1620. alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;
  1621. if (alignWithTop) {
  1622. util.scrollTop(container, containerScroll.top + diffTop.top);
  1623. } else {
  1624. util.scrollTop(container, containerScroll.top + diffBottom.top);
  1625. }
  1626. }
  1627. }
  1628. if (allowHorizontalScroll) {
  1629. if (diffTop.left < 0 || diffBottom.left > 0) {
  1630. // 强制向上
  1631. if (alignWithLeft === true) {
  1632. util.scrollLeft(container, containerScroll.left + diffTop.left);
  1633. } else if (alignWithLeft === false) {
  1634. util.scrollLeft(container, containerScroll.left + diffBottom.left);
  1635. } else {
  1636. // 自动调整
  1637. if (diffTop.left < 0) {
  1638. util.scrollLeft(container, containerScroll.left + diffTop.left);
  1639. } else {
  1640. util.scrollLeft(container, containerScroll.left + diffBottom.left);
  1641. }
  1642. }
  1643. } else {
  1644. if (!onlyScrollIfNeeded) {
  1645. alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;
  1646. if (alignWithLeft) {
  1647. util.scrollLeft(container, containerScroll.left + diffTop.left);
  1648. } else {
  1649. util.scrollLeft(container, containerScroll.left + diffBottom.left);
  1650. }
  1651. }
  1652. }
  1653. }
  1654. }
  1655. module.exports = scrollIntoView;
  1656. /***/ }),
  1657. /***/ 5425:
  1658. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1659. "use strict";
  1660. module.exports = __webpack_require__(1345);
  1661. /***/ }),
  1662. /***/ 5022:
  1663. /***/ (function(module) {
  1664. "use strict";
  1665. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  1666. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
  1667. var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
  1668. function getClientPosition(elem) {
  1669. var box = undefined;
  1670. var x = undefined;
  1671. var y = undefined;
  1672. var doc = elem.ownerDocument;
  1673. var body = doc.body;
  1674. var docElem = doc && doc.documentElement;
  1675. // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式
  1676. box = elem.getBoundingClientRect();
  1677. // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop
  1678. // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确
  1679. // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin
  1680. x = box.left;
  1681. y = box.top;
  1682. // In IE, most of the time, 2 extra pixels are added to the top and left
  1683. // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and
  1684. // IE6 standards mode, this border can be overridden by setting the
  1685. // document element's border to zero -- thus, we cannot rely on the
  1686. // offset always being 2 pixels.
  1687. // In quirks mode, the offset can be determined by querying the body's
  1688. // clientLeft/clientTop, but in standards mode, it is found by querying
  1689. // the document element's clientLeft/clientTop. Since we already called
  1690. // getClientBoundingRect we have already forced a reflow, so it is not
  1691. // too expensive just to query them all.
  1692. // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的
  1693. // 窗口边框标准是设 documentElement ,quirks 时设置 body
  1694. // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去
  1695. // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置
  1696. // 标准 ie 下 docElem.clientTop 就是 border-top
  1697. // ie7 html 即窗口边框改变不了。永远为 2
  1698. // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0
  1699. x -= docElem.clientLeft || body.clientLeft || 0;
  1700. y -= docElem.clientTop || body.clientTop || 0;
  1701. return {
  1702. left: x,
  1703. top: y
  1704. };
  1705. }
  1706. function getScroll(w, top) {
  1707. var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
  1708. var method = 'scroll' + (top ? 'Top' : 'Left');
  1709. if (typeof ret !== 'number') {
  1710. var d = w.document;
  1711. // ie6,7,8 standard mode
  1712. ret = d.documentElement[method];
  1713. if (typeof ret !== 'number') {
  1714. // quirks mode
  1715. ret = d.body[method];
  1716. }
  1717. }
  1718. return ret;
  1719. }
  1720. function getScrollLeft(w) {
  1721. return getScroll(w);
  1722. }
  1723. function getScrollTop(w) {
  1724. return getScroll(w, true);
  1725. }
  1726. function getOffset(el) {
  1727. var pos = getClientPosition(el);
  1728. var doc = el.ownerDocument;
  1729. var w = doc.defaultView || doc.parentWindow;
  1730. pos.left += getScrollLeft(w);
  1731. pos.top += getScrollTop(w);
  1732. return pos;
  1733. }
  1734. function _getComputedStyle(elem, name, computedStyle_) {
  1735. var val = '';
  1736. var d = elem.ownerDocument;
  1737. var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);
  1738. // https://github.com/kissyteam/kissy/issues/61
  1739. if (computedStyle) {
  1740. val = computedStyle.getPropertyValue(name) || computedStyle[name];
  1741. }
  1742. return val;
  1743. }
  1744. var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
  1745. var RE_POS = /^(top|right|bottom|left)$/;
  1746. var CURRENT_STYLE = 'currentStyle';
  1747. var RUNTIME_STYLE = 'runtimeStyle';
  1748. var LEFT = 'left';
  1749. var PX = 'px';
  1750. function _getComputedStyleIE(elem, name) {
  1751. // currentStyle maybe null
  1752. // http://msdn.microsoft.com/en-us/library/ms535231.aspx
  1753. var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
  1754. // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值
  1755. // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19
  1756. // 在 ie 下不对,需要直接用 offset 方式
  1757. // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了
  1758. // From the awesome hack by Dean Edwards
  1759. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  1760. // If we're not dealing with a regular pixel number
  1761. // but a number that has a weird ending, we need to convert it to pixels
  1762. // exclude left right for relativity
  1763. if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
  1764. // Remember the original values
  1765. var style = elem.style;
  1766. var left = style[LEFT];
  1767. var rsLeft = elem[RUNTIME_STYLE][LEFT];
  1768. // prevent flashing of content
  1769. elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
  1770. // Put in the new values to get a computed value out
  1771. style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
  1772. ret = style.pixelLeft + PX;
  1773. // Revert the changed values
  1774. style[LEFT] = left;
  1775. elem[RUNTIME_STYLE][LEFT] = rsLeft;
  1776. }
  1777. return ret === '' ? 'auto' : ret;
  1778. }
  1779. var getComputedStyleX = undefined;
  1780. if (typeof window !== 'undefined') {
  1781. getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
  1782. }
  1783. function each(arr, fn) {
  1784. for (var i = 0; i < arr.length; i++) {
  1785. fn(arr[i]);
  1786. }
  1787. }
  1788. function isBorderBoxFn(elem) {
  1789. return getComputedStyleX(elem, 'boxSizing') === 'border-box';
  1790. }
  1791. var BOX_MODELS = ['margin', 'border', 'padding'];
  1792. var CONTENT_INDEX = -1;
  1793. var PADDING_INDEX = 2;
  1794. var BORDER_INDEX = 1;
  1795. var MARGIN_INDEX = 0;
  1796. function swap(elem, options, callback) {
  1797. var old = {};
  1798. var style = elem.style;
  1799. var name = undefined;
  1800. // Remember the old values, and insert the new ones
  1801. for (name in options) {
  1802. if (options.hasOwnProperty(name)) {
  1803. old[name] = style[name];
  1804. style[name] = options[name];
  1805. }
  1806. }
  1807. callback.call(elem);
  1808. // Revert the old values
  1809. for (name in options) {
  1810. if (options.hasOwnProperty(name)) {
  1811. style[name] = old[name];
  1812. }
  1813. }
  1814. }
  1815. function getPBMWidth(elem, props, which) {
  1816. var value = 0;
  1817. var prop = undefined;
  1818. var j = undefined;
  1819. var i = undefined;
  1820. for (j = 0; j < props.length; j++) {
  1821. prop = props[j];
  1822. if (prop) {
  1823. for (i = 0; i < which.length; i++) {
  1824. var cssProp = undefined;
  1825. if (prop === 'border') {
  1826. cssProp = prop + which[i] + 'Width';
  1827. } else {
  1828. cssProp = prop + which[i];
  1829. }
  1830. value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
  1831. }
  1832. }
  1833. }
  1834. return value;
  1835. }
  1836. /**
  1837. * A crude way of determining if an object is a window
  1838. * @member util
  1839. */
  1840. function isWindow(obj) {
  1841. // must use == for ie8
  1842. /* eslint eqeqeq:0 */
  1843. return obj != null && obj == obj.window;
  1844. }
  1845. var domUtils = {};
  1846. each(['Width', 'Height'], function (name) {
  1847. domUtils['doc' + name] = function (refWin) {
  1848. var d = refWin.document;
  1849. return Math.max(
  1850. // firefox chrome documentElement.scrollHeight< body.scrollHeight
  1851. // ie standard mode : documentElement.scrollHeight> body.scrollHeight
  1852. d.documentElement['scroll' + name],
  1853. // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?
  1854. d.body['scroll' + name], domUtils['viewport' + name](d));
  1855. };
  1856. domUtils['viewport' + name] = function (win) {
  1857. // pc browser includes scrollbar in window.innerWidth
  1858. var prop = 'client' + name;
  1859. var doc = win.document;
  1860. var body = doc.body;
  1861. var documentElement = doc.documentElement;
  1862. var documentElementProp = documentElement[prop];
  1863. // 标准模式取 documentElement
  1864. // backcompat 取 body
  1865. return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
  1866. };
  1867. });
  1868. /*
  1869. 得到元素的大小信息
  1870. @param elem
  1871. @param name
  1872. @param {String} [extra] 'padding' : (css width) + padding
  1873. 'border' : (css width) + padding + border
  1874. 'margin' : (css width) + padding + border + margin
  1875. */
  1876. function getWH(elem, name, extra) {
  1877. if (isWindow(elem)) {
  1878. return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
  1879. } else if (elem.nodeType === 9) {
  1880. return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
  1881. }
  1882. var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
  1883. var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;
  1884. var computedStyle = getComputedStyleX(elem);
  1885. var isBorderBox = isBorderBoxFn(elem, computedStyle);
  1886. var cssBoxValue = 0;
  1887. if (borderBoxValue == null || borderBoxValue <= 0) {
  1888. borderBoxValue = undefined;
  1889. // Fall back to computed then un computed css if necessary
  1890. cssBoxValue = getComputedStyleX(elem, name);
  1891. if (cssBoxValue == null || Number(cssBoxValue) < 0) {
  1892. cssBoxValue = elem.style[name] || 0;
  1893. }
  1894. // Normalize '', auto, and prepare for extra
  1895. cssBoxValue = parseFloat(cssBoxValue) || 0;
  1896. }
  1897. if (extra === undefined) {
  1898. extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
  1899. }
  1900. var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
  1901. var val = borderBoxValue || cssBoxValue;
  1902. if (extra === CONTENT_INDEX) {
  1903. if (borderBoxValueOrIsBorderBox) {
  1904. return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
  1905. }
  1906. return cssBoxValue;
  1907. }
  1908. if (borderBoxValueOrIsBorderBox) {
  1909. var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);
  1910. return val + (extra === BORDER_INDEX ? 0 : padding);
  1911. }
  1912. return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
  1913. }
  1914. var cssShow = {
  1915. position: 'absolute',
  1916. visibility: 'hidden',
  1917. display: 'block'
  1918. };
  1919. // fix #119 : https://github.com/kissyteam/kissy/issues/119
  1920. function getWHIgnoreDisplay(elem) {
  1921. var val = undefined;
  1922. var args = arguments;
  1923. // in case elem is window
  1924. // elem.offsetWidth === undefined
  1925. if (elem.offsetWidth !== 0) {
  1926. val = getWH.apply(undefined, args);
  1927. } else {
  1928. swap(elem, cssShow, function () {
  1929. val = getWH.apply(undefined, args);
  1930. });
  1931. }
  1932. return val;
  1933. }
  1934. function css(el, name, v) {
  1935. var value = v;
  1936. if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
  1937. for (var i in name) {
  1938. if (name.hasOwnProperty(i)) {
  1939. css(el, i, name[i]);
  1940. }
  1941. }
  1942. return undefined;
  1943. }
  1944. if (typeof value !== 'undefined') {
  1945. if (typeof value === 'number') {
  1946. value += 'px';
  1947. }
  1948. el.style[name] = value;
  1949. return undefined;
  1950. }
  1951. return getComputedStyleX(el, name);
  1952. }
  1953. each(['width', 'height'], function (name) {
  1954. var first = name.charAt(0).toUpperCase() + name.slice(1);
  1955. domUtils['outer' + first] = function (el, includeMargin) {
  1956. return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
  1957. };
  1958. var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
  1959. domUtils[name] = function (elem, val) {
  1960. if (val !== undefined) {
  1961. if (elem) {
  1962. var computedStyle = getComputedStyleX(elem);
  1963. var isBorderBox = isBorderBoxFn(elem);
  1964. if (isBorderBox) {
  1965. val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
  1966. }
  1967. return css(elem, name, val);
  1968. }
  1969. return undefined;
  1970. }
  1971. return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
  1972. };
  1973. });
  1974. // 设置 elem 相对 elem.ownerDocument 的坐标
  1975. function setOffset(elem, offset) {
  1976. // set position first, in-case top/left are set even on static elem
  1977. if (css(elem, 'position') === 'static') {
  1978. elem.style.position = 'relative';
  1979. }
  1980. var old = getOffset(elem);
  1981. var ret = {};
  1982. var current = undefined;
  1983. var key = undefined;
  1984. for (key in offset) {
  1985. if (offset.hasOwnProperty(key)) {
  1986. current = parseFloat(css(elem, key)) || 0;
  1987. ret[key] = current + offset[key] - old[key];
  1988. }
  1989. }
  1990. css(elem, ret);
  1991. }
  1992. module.exports = _extends({
  1993. getWindow: function getWindow(node) {
  1994. var doc = node.ownerDocument || node;
  1995. return doc.defaultView || doc.parentWindow;
  1996. },
  1997. offset: function offset(el, value) {
  1998. if (typeof value !== 'undefined') {
  1999. setOffset(el, value);
  2000. } else {
  2001. return getOffset(el);
  2002. }
  2003. },
  2004. isWindow: isWindow,
  2005. each: each,
  2006. css: css,
  2007. clone: function clone(obj) {
  2008. var ret = {};
  2009. for (var i in obj) {
  2010. if (obj.hasOwnProperty(i)) {
  2011. ret[i] = obj[i];
  2012. }
  2013. }
  2014. var overflow = obj.overflow;
  2015. if (overflow) {
  2016. for (var i in obj) {
  2017. if (obj.hasOwnProperty(i)) {
  2018. ret.overflow[i] = obj.overflow[i];
  2019. }
  2020. }
  2021. }
  2022. return ret;
  2023. },
  2024. scrollLeft: function scrollLeft(w, v) {
  2025. if (isWindow(w)) {
  2026. if (v === undefined) {
  2027. return getScrollLeft(w);
  2028. }
  2029. window.scrollTo(v, getScrollTop(w));
  2030. } else {
  2031. if (v === undefined) {
  2032. return w.scrollLeft;
  2033. }
  2034. w.scrollLeft = v;
  2035. }
  2036. },
  2037. scrollTop: function scrollTop(w, v) {
  2038. if (isWindow(w)) {
  2039. if (v === undefined) {
  2040. return getScrollTop(w);
  2041. }
  2042. window.scrollTo(getScrollLeft(w), v);
  2043. } else {
  2044. if (v === undefined) {
  2045. return w.scrollTop;
  2046. }
  2047. w.scrollTop = v;
  2048. }
  2049. },
  2050. viewportWidth: 0,
  2051. viewportHeight: 0
  2052. }, domUtils);
  2053. /***/ }),
  2054. /***/ 9214:
  2055. /***/ (function(__unused_webpack_module, exports) {
  2056. "use strict";
  2057. var __webpack_unused_export__;
  2058. /** @license React v17.0.2
  2059. * react-is.production.min.js
  2060. *
  2061. * Copyright (c) Facebook, Inc. and its affiliates.
  2062. *
  2063. * This source code is licensed under the MIT license found in the
  2064. * LICENSE file in the root directory of this source tree.
  2065. */
  2066. var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;
  2067. if("function"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x("react.element");c=x("react.portal");d=x("react.fragment");e=x("react.strict_mode");f=x("react.profiler");g=x("react.provider");h=x("react.context");k=x("react.forward_ref");l=x("react.suspense");m=x("react.suspense_list");n=x("react.memo");p=x("react.lazy");q=x("react.block");r=x("react.server.block");u=x("react.fundamental");v=x("react.debug_trace_mode");w=x("react.legacy_hidden")}
  2068. function y(a){if("object"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;__webpack_unused_export__=h;__webpack_unused_export__=z;__webpack_unused_export__=A;__webpack_unused_export__=B;__webpack_unused_export__=C;__webpack_unused_export__=D;__webpack_unused_export__=E;__webpack_unused_export__=F;__webpack_unused_export__=G;__webpack_unused_export__=H;
  2069. __webpack_unused_export__=I;__webpack_unused_export__=function(){return!1};__webpack_unused_export__=function(){return!1};__webpack_unused_export__=function(a){return y(a)===h};__webpack_unused_export__=function(a){return y(a)===g};__webpack_unused_export__=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};__webpack_unused_export__=function(a){return y(a)===k};__webpack_unused_export__=function(a){return y(a)===d};__webpack_unused_export__=function(a){return y(a)===p};__webpack_unused_export__=function(a){return y(a)===n};
  2070. __webpack_unused_export__=function(a){return y(a)===c};__webpack_unused_export__=function(a){return y(a)===f};__webpack_unused_export__=function(a){return y(a)===e};__webpack_unused_export__=function(a){return y(a)===l};__webpack_unused_export__=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||"object"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};
  2071. __webpack_unused_export__=y;
  2072. /***/ }),
  2073. /***/ 2797:
  2074. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  2075. "use strict";
  2076. if (true) {
  2077. /* unused reexport */ __webpack_require__(9214);
  2078. } else {}
  2079. /***/ }),
  2080. /***/ 2505:
  2081. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  2082. "use strict";
  2083. var has = __webpack_require__(9284);
  2084. var hasUnscopables = typeof Symbol === 'function' && typeof Symbol.unscopables === 'symbol';
  2085. var map = hasUnscopables && Array.prototype[Symbol.unscopables];
  2086. var $TypeError = TypeError;
  2087. module.exports = function shimUnscopables(method) {
  2088. if (typeof method !== 'string' || !method) {
  2089. throw new $TypeError('method must be a non-empty string');
  2090. }
  2091. if (!has(Array.prototype, method)) {
  2092. throw new $TypeError('method must be on Array.prototype');
  2093. }
  2094. if (hasUnscopables) {
  2095. map[method] = true;
  2096. }
  2097. };
  2098. /***/ }),
  2099. /***/ 5249:
  2100. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  2101. "use strict";
  2102. var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
  2103. var isPrimitive = __webpack_require__(3777);
  2104. var isCallable = __webpack_require__(5443);
  2105. var isDate = __webpack_require__(8659);
  2106. var isSymbol = __webpack_require__(3082);
  2107. var ordinaryToPrimitive = function OrdinaryToPrimitive(O, hint) {
  2108. if (typeof O === 'undefined' || O === null) {
  2109. throw new TypeError('Cannot call method on ' + O);
  2110. }
  2111. if (typeof hint !== 'string' || (hint !== 'number' && hint !== 'string')) {
  2112. throw new TypeError('hint must be "string" or "number"');
  2113. }
  2114. var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
  2115. var method, result, i;
  2116. for (i = 0; i < methodNames.length; ++i) {
  2117. method = O[methodNames[i]];
  2118. if (isCallable(method)) {
  2119. result = method.call(O);
  2120. if (isPrimitive(result)) {
  2121. return result;
  2122. }
  2123. }
  2124. }
  2125. throw new TypeError('No default value');
  2126. };
  2127. var GetMethod = function GetMethod(O, P) {
  2128. var func = O[P];
  2129. if (func !== null && typeof func !== 'undefined') {
  2130. if (!isCallable(func)) {
  2131. throw new TypeError(func + ' returned for property ' + P + ' of object ' + O + ' is not a function');
  2132. }
  2133. return func;
  2134. }
  2135. return void 0;
  2136. };
  2137. // http://www.ecma-international.org/ecma-262/6.0/#sec-toprimitive
  2138. module.exports = function ToPrimitive(input) {
  2139. if (isPrimitive(input)) {
  2140. return input;
  2141. }
  2142. var hint = 'default';
  2143. if (arguments.length > 1) {
  2144. if (arguments[1] === String) {
  2145. hint = 'string';
  2146. } else if (arguments[1] === Number) {
  2147. hint = 'number';
  2148. }
  2149. }
  2150. var exoticToPrim;
  2151. if (hasSymbols) {
  2152. if (Symbol.toPrimitive) {
  2153. exoticToPrim = GetMethod(input, Symbol.toPrimitive);
  2154. } else if (isSymbol(input)) {
  2155. exoticToPrim = Symbol.prototype.valueOf;
  2156. }
  2157. }
  2158. if (typeof exoticToPrim !== 'undefined') {
  2159. var result = exoticToPrim.call(input, hint);
  2160. if (isPrimitive(result)) {
  2161. return result;
  2162. }
  2163. throw new TypeError('unable to convert exotic object to primitive');
  2164. }
  2165. if (hint === 'default' && (isDate(input) || isSymbol(input))) {
  2166. hint = 'string';
  2167. }
  2168. return ordinaryToPrimitive(input, hint === 'default' ? 'number' : hint);
  2169. };
  2170. /***/ }),
  2171. /***/ 3777:
  2172. /***/ (function(module) {
  2173. "use strict";
  2174. module.exports = function isPrimitive(value) {
  2175. return value === null || (typeof value !== 'function' && typeof value !== 'object');
  2176. };
  2177. /***/ }),
  2178. /***/ 9930:
  2179. /***/ (function(module) {
  2180. "use strict";
  2181. /* eslint no-invalid-this: 1 */
  2182. var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
  2183. var slice = Array.prototype.slice;
  2184. var toStr = Object.prototype.toString;
  2185. var funcType = '[object Function]';
  2186. module.exports = function bind(that) {
  2187. var target = this;
  2188. if (typeof target !== 'function' || toStr.call(target) !== funcType) {
  2189. throw new TypeError(ERROR_MESSAGE + target);
  2190. }
  2191. var args = slice.call(arguments, 1);
  2192. var bound;
  2193. var binder = function () {
  2194. if (this instanceof bound) {
  2195. var result = target.apply(
  2196. this,
  2197. args.concat(slice.call(arguments))
  2198. );
  2199. if (Object(result) === result) {
  2200. return result;
  2201. }
  2202. return this;
  2203. } else {
  2204. return target.apply(
  2205. that,
  2206. args.concat(slice.call(arguments))
  2207. );
  2208. }
  2209. };
  2210. var boundLength = Math.max(0, target.length - args.length);
  2211. var boundArgs = [];
  2212. for (var i = 0; i < boundLength; i++) {
  2213. boundArgs.push('$' + i);
  2214. }
  2215. bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
  2216. if (target.prototype) {
  2217. var Empty = function Empty() {};
  2218. Empty.prototype = target.prototype;
  2219. bound.prototype = new Empty();
  2220. Empty.prototype = null;
  2221. }
  2222. return bound;
  2223. };
  2224. /***/ }),
  2225. /***/ 1930:
  2226. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  2227. "use strict";
  2228. var implementation = __webpack_require__(9930);
  2229. module.exports = Function.prototype.bind || implementation;
  2230. /***/ }),
  2231. /***/ 1801:
  2232. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  2233. "use strict";
  2234. /* globals
  2235. AggregateError,
  2236. Atomics,
  2237. FinalizationRegistry,
  2238. SharedArrayBuffer,
  2239. WeakRef,
  2240. */
  2241. var undefined;
  2242. var $SyntaxError = SyntaxError;
  2243. var $Function = Function;
  2244. var $TypeError = TypeError;
  2245. // eslint-disable-next-line consistent-return
  2246. var getEvalledConstructor = function (expressionSyntax) {
  2247. try {
  2248. // eslint-disable-next-line no-new-func
  2249. return Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
  2250. } catch (e) {}
  2251. };
  2252. var $gOPD = Object.getOwnPropertyDescriptor;
  2253. if ($gOPD) {
  2254. try {
  2255. $gOPD({}, '');
  2256. } catch (e) {
  2257. $gOPD = null; // this is IE 8, which has a broken gOPD
  2258. }
  2259. }
  2260. var throwTypeError = function () {
  2261. throw new $TypeError();
  2262. };
  2263. var ThrowTypeError = $gOPD
  2264. ? (function () {
  2265. try {
  2266. // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
  2267. arguments.callee; // IE 8 does not throw here
  2268. return throwTypeError;
  2269. } catch (calleeThrows) {
  2270. try {
  2271. // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
  2272. return $gOPD(arguments, 'callee').get;
  2273. } catch (gOPDthrows) {
  2274. return throwTypeError;
  2275. }
  2276. }
  2277. }())
  2278. : throwTypeError;
  2279. var hasSymbols = __webpack_require__(9905)();
  2280. var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
  2281. var asyncGenFunction = getEvalledConstructor('async function* () {}');
  2282. var asyncGenFunctionPrototype = asyncGenFunction ? asyncGenFunction.prototype : undefined;
  2283. var asyncGenPrototype = asyncGenFunctionPrototype ? asyncGenFunctionPrototype.prototype : undefined;
  2284. var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
  2285. var INTRINSICS = {
  2286. '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
  2287. '%Array%': Array,
  2288. '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
  2289. '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
  2290. '%AsyncFromSyncIteratorPrototype%': undefined,
  2291. '%AsyncFunction%': getEvalledConstructor('async function () {}'),
  2292. '%AsyncGenerator%': asyncGenFunctionPrototype,
  2293. '%AsyncGeneratorFunction%': asyncGenFunction,
  2294. '%AsyncIteratorPrototype%': asyncGenPrototype ? getProto(asyncGenPrototype) : undefined,
  2295. '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
  2296. '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
  2297. '%Boolean%': Boolean,
  2298. '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
  2299. '%Date%': Date,
  2300. '%decodeURI%': decodeURI,
  2301. '%decodeURIComponent%': decodeURIComponent,
  2302. '%encodeURI%': encodeURI,
  2303. '%encodeURIComponent%': encodeURIComponent,
  2304. '%Error%': Error,
  2305. '%eval%': eval, // eslint-disable-line no-eval
  2306. '%EvalError%': EvalError,
  2307. '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
  2308. '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
  2309. '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
  2310. '%Function%': $Function,
  2311. '%GeneratorFunction%': getEvalledConstructor('function* () {}'),
  2312. '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
  2313. '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
  2314. '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
  2315. '%isFinite%': isFinite,
  2316. '%isNaN%': isNaN,
  2317. '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
  2318. '%JSON%': typeof JSON === 'object' ? JSON : undefined,
  2319. '%Map%': typeof Map === 'undefined' ? undefined : Map,
  2320. '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
  2321. '%Math%': Math,
  2322. '%Number%': Number,
  2323. '%Object%': Object,
  2324. '%parseFloat%': parseFloat,
  2325. '%parseInt%': parseInt,
  2326. '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
  2327. '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
  2328. '%RangeError%': RangeError,
  2329. '%ReferenceError%': ReferenceError,
  2330. '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
  2331. '%RegExp%': RegExp,
  2332. '%Set%': typeof Set === 'undefined' ? undefined : Set,
  2333. '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
  2334. '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
  2335. '%String%': String,
  2336. '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
  2337. '%Symbol%': hasSymbols ? Symbol : undefined,
  2338. '%SyntaxError%': $SyntaxError,
  2339. '%ThrowTypeError%': ThrowTypeError,
  2340. '%TypedArray%': TypedArray,
  2341. '%TypeError%': $TypeError,
  2342. '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
  2343. '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
  2344. '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
  2345. '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
  2346. '%URIError%': URIError,
  2347. '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
  2348. '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
  2349. '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
  2350. };
  2351. var LEGACY_ALIASES = {
  2352. '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
  2353. '%ArrayPrototype%': ['Array', 'prototype'],
  2354. '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
  2355. '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
  2356. '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
  2357. '%ArrayProto_values%': ['Array', 'prototype', 'values'],
  2358. '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
  2359. '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
  2360. '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
  2361. '%BooleanPrototype%': ['Boolean', 'prototype'],
  2362. '%DataViewPrototype%': ['DataView', 'prototype'],
  2363. '%DatePrototype%': ['Date', 'prototype'],
  2364. '%ErrorPrototype%': ['Error', 'prototype'],
  2365. '%EvalErrorPrototype%': ['EvalError', 'prototype'],
  2366. '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
  2367. '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
  2368. '%FunctionPrototype%': ['Function', 'prototype'],
  2369. '%Generator%': ['GeneratorFunction', 'prototype'],
  2370. '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
  2371. '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
  2372. '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
  2373. '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
  2374. '%JSONParse%': ['JSON', 'parse'],
  2375. '%JSONStringify%': ['JSON', 'stringify'],
  2376. '%MapPrototype%': ['Map', 'prototype'],
  2377. '%NumberPrototype%': ['Number', 'prototype'],
  2378. '%ObjectPrototype%': ['Object', 'prototype'],
  2379. '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
  2380. '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
  2381. '%PromisePrototype%': ['Promise', 'prototype'],
  2382. '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
  2383. '%Promise_all%': ['Promise', 'all'],
  2384. '%Promise_reject%': ['Promise', 'reject'],
  2385. '%Promise_resolve%': ['Promise', 'resolve'],
  2386. '%RangeErrorPrototype%': ['RangeError', 'prototype'],
  2387. '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
  2388. '%RegExpPrototype%': ['RegExp', 'prototype'],
  2389. '%SetPrototype%': ['Set', 'prototype'],
  2390. '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
  2391. '%StringPrototype%': ['String', 'prototype'],
  2392. '%SymbolPrototype%': ['Symbol', 'prototype'],
  2393. '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
  2394. '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
  2395. '%TypeErrorPrototype%': ['TypeError', 'prototype'],
  2396. '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
  2397. '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
  2398. '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
  2399. '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
  2400. '%URIErrorPrototype%': ['URIError', 'prototype'],
  2401. '%WeakMapPrototype%': ['WeakMap', 'prototype'],
  2402. '%WeakSetPrototype%': ['WeakSet', 'prototype']
  2403. };
  2404. var bind = __webpack_require__(1930);
  2405. var hasOwn = __webpack_require__(9284);
  2406. var $concat = bind.call(Function.call, Array.prototype.concat);
  2407. var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
  2408. var $replace = bind.call(Function.call, String.prototype.replace);
  2409. var $strSlice = bind.call(Function.call, String.prototype.slice);
  2410. /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
  2411. var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
  2412. var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
  2413. var stringToPath = function stringToPath(string) {
  2414. var first = $strSlice(string, 0, 1);
  2415. var last = $strSlice(string, -1);
  2416. if (first === '%' && last !== '%') {
  2417. throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
  2418. } else if (last === '%' && first !== '%') {
  2419. throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
  2420. }
  2421. var result = [];
  2422. $replace(string, rePropName, function (match, number, quote, subString) {
  2423. result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
  2424. });
  2425. return result;
  2426. };
  2427. /* end adaptation */
  2428. var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
  2429. var intrinsicName = name;
  2430. var alias;
  2431. if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
  2432. alias = LEGACY_ALIASES[intrinsicName];
  2433. intrinsicName = '%' + alias[0] + '%';
  2434. }
  2435. if (hasOwn(INTRINSICS, intrinsicName)) {
  2436. var value = INTRINSICS[intrinsicName];
  2437. if (typeof value === 'undefined' && !allowMissing) {
  2438. throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
  2439. }
  2440. return {
  2441. alias: alias,
  2442. name: intrinsicName,
  2443. value: value
  2444. };
  2445. }
  2446. throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
  2447. };
  2448. module.exports = function GetIntrinsic(name, allowMissing) {
  2449. if (typeof name !== 'string' || name.length === 0) {
  2450. throw new $TypeError('intrinsic name must be a non-empty string');
  2451. }
  2452. if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
  2453. throw new $TypeError('"allowMissing" argument must be a boolean');
  2454. }
  2455. var parts = stringToPath(name);
  2456. var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
  2457. var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
  2458. var intrinsicRealName = intrinsic.name;
  2459. var value = intrinsic.value;
  2460. var skipFurtherCaching = false;
  2461. var alias = intrinsic.alias;
  2462. if (alias) {
  2463. intrinsicBaseName = alias[0];
  2464. $spliceApply(parts, $concat([0, 1], alias));
  2465. }
  2466. for (var i = 1, isOwn = true; i < parts.length; i += 1) {
  2467. var part = parts[i];
  2468. var first = $strSlice(part, 0, 1);
  2469. var last = $strSlice(part, -1);
  2470. if (
  2471. (
  2472. (first === '"' || first === "'" || first === '`')
  2473. || (last === '"' || last === "'" || last === '`')
  2474. )
  2475. && first !== last
  2476. ) {
  2477. throw new $SyntaxError('property names with quotes must have matching quotes');
  2478. }
  2479. if (part === 'constructor' || !isOwn) {
  2480. skipFurtherCaching = true;
  2481. }
  2482. intrinsicBaseName += '.' + part;
  2483. intrinsicRealName = '%' + intrinsicBaseName + '%';
  2484. if (hasOwn(INTRINSICS, intrinsicRealName)) {
  2485. value = INTRINSICS[intrinsicRealName];
  2486. } else if (value != null) {
  2487. if (!(part in value)) {
  2488. if (!allowMissing) {
  2489. throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
  2490. }
  2491. return void undefined;
  2492. }
  2493. if ($gOPD && (i + 1) >= parts.length) {
  2494. var desc = $gOPD(value, part);
  2495. isOwn = !!desc;
  2496. // By convention, when a data property is converted to an accessor
  2497. // property to emulate a data property that does not suffer from
  2498. // the override mistake, that accessor's getter is marked with
  2499. // an `originalValue` property. Here, when we detect this, we
  2500. // uphold the illusion by pretending to see that original data
  2501. // property, i.e., returning the value rather than the getter
  2502. // itself.
  2503. if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
  2504. value = desc.get;
  2505. } else {
  2506. value = value[part];
  2507. }
  2508. } else {
  2509. isOwn = hasOwn(value, part);
  2510. value = value[part];
  2511. }
  2512. if (isOwn && !skipFurtherCaching) {
  2513. INTRINSICS[intrinsicRealName] = value;
  2514. }
  2515. }
  2516. }
  2517. return value;
  2518. };
  2519. /***/ }),
  2520. /***/ 5371:
  2521. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  2522. "use strict";
  2523. var define = __webpack_require__(9170);
  2524. var isSymbol = __webpack_require__(3082);
  2525. var globalKey = '__ global cache key __';
  2526. /* istanbul ignore else */
  2527. // eslint-disable-next-line no-restricted-properties
  2528. if (typeof Symbol === 'function' && isSymbol(Symbol('foo')) && typeof Symbol['for'] === 'function') {
  2529. // eslint-disable-next-line no-restricted-properties
  2530. globalKey = Symbol['for'](globalKey);
  2531. }
  2532. var trueThunk = function () {
  2533. return true;
  2534. };
  2535. var ensureCache = function ensureCache() {
  2536. if (!__webpack_require__.g[globalKey]) {
  2537. var properties = {};
  2538. properties[globalKey] = {};
  2539. var predicates = {};
  2540. predicates[globalKey] = trueThunk;
  2541. define(__webpack_require__.g, properties, predicates);
  2542. }
  2543. return __webpack_require__.g[globalKey];
  2544. };
  2545. var cache = ensureCache();
  2546. var isPrimitive = function isPrimitive(val) {
  2547. return val === null || (typeof val !== 'object' && typeof val !== 'function');
  2548. };
  2549. var getPrimitiveKey = function getPrimitiveKey(val) {
  2550. if (isSymbol(val)) {
  2551. return Symbol.prototype.valueOf.call(val);
  2552. }
  2553. return typeof val + ' | ' + String(val);
  2554. };
  2555. var requirePrimitiveKey = function requirePrimitiveKey(val) {
  2556. if (!isPrimitive(val)) {
  2557. throw new TypeError('key must not be an object');
  2558. }
  2559. };
  2560. var globalCache = {
  2561. clear: function clear() {
  2562. delete __webpack_require__.g[globalKey];
  2563. cache = ensureCache();
  2564. },
  2565. 'delete': function deleteKey(key) {
  2566. requirePrimitiveKey(key);
  2567. delete cache[getPrimitiveKey(key)];
  2568. return !globalCache.has(key);
  2569. },
  2570. get: function get(key) {
  2571. requirePrimitiveKey(key);
  2572. return cache[getPrimitiveKey(key)];
  2573. },
  2574. has: function has(key) {
  2575. requirePrimitiveKey(key);
  2576. return getPrimitiveKey(key) in cache;
  2577. },
  2578. set: function set(key, value) {
  2579. requirePrimitiveKey(key);
  2580. var primitiveKey = getPrimitiveKey(key);
  2581. var props = {};
  2582. props[primitiveKey] = value;
  2583. var predicates = {};
  2584. predicates[primitiveKey] = trueThunk;
  2585. define(cache, props, predicates);
  2586. return globalCache.has(key);
  2587. },
  2588. setIfMissingThenGet: function setIfMissingThenGet(key, valueThunk) {
  2589. if (globalCache.has(key)) {
  2590. return globalCache.get(key);
  2591. }
  2592. var item = valueThunk();
  2593. globalCache.set(key, item);
  2594. return item;
  2595. }
  2596. };
  2597. module.exports = globalCache;
  2598. /***/ }),
  2599. /***/ 7115:
  2600. /***/ (function(__unused_webpack_module, exports) {
  2601. // Copyright (c) 2014 Rafael Caricio. All rights reserved.
  2602. // Use of this source code is governed by a BSD-style license that can be
  2603. // found in the LICENSE file.
  2604. var GradientParser = {};
  2605. GradientParser.parse = (function() {
  2606. var tokens = {
  2607. linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,
  2608. repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
  2609. radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
  2610. repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
  2611. sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
  2612. extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
  2613. positionKeywords: /^(left|center|right|top|bottom)/i,
  2614. pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
  2615. percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
  2616. emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
  2617. angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
  2618. startCall: /^\(/,
  2619. endCall: /^\)/,
  2620. comma: /^,/,
  2621. hexColor: /^\#([0-9a-fA-F]+)/,
  2622. literalColor: /^([a-zA-Z]+)/,
  2623. rgbColor: /^rgb/i,
  2624. rgbaColor: /^rgba/i,
  2625. number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
  2626. };
  2627. var input = '';
  2628. function error(msg) {
  2629. var err = new Error(input + ': ' + msg);
  2630. err.source = input;
  2631. throw err;
  2632. }
  2633. function getAST() {
  2634. var ast = matchListDefinitions();
  2635. if (input.length > 0) {
  2636. error('Invalid input not EOF');
  2637. }
  2638. return ast;
  2639. }
  2640. function matchListDefinitions() {
  2641. return matchListing(matchDefinition);
  2642. }
  2643. function matchDefinition() {
  2644. return matchGradient(
  2645. 'linear-gradient',
  2646. tokens.linearGradient,
  2647. matchLinearOrientation) ||
  2648. matchGradient(
  2649. 'repeating-linear-gradient',
  2650. tokens.repeatingLinearGradient,
  2651. matchLinearOrientation) ||
  2652. matchGradient(
  2653. 'radial-gradient',
  2654. tokens.radialGradient,
  2655. matchListRadialOrientations) ||
  2656. matchGradient(
  2657. 'repeating-radial-gradient',
  2658. tokens.repeatingRadialGradient,
  2659. matchListRadialOrientations);
  2660. }
  2661. function matchGradient(gradientType, pattern, orientationMatcher) {
  2662. return matchCall(pattern, function(captures) {
  2663. var orientation = orientationMatcher();
  2664. if (orientation) {
  2665. if (!scan(tokens.comma)) {
  2666. error('Missing comma before color stops');
  2667. }
  2668. }
  2669. return {
  2670. type: gradientType,
  2671. orientation: orientation,
  2672. colorStops: matchListing(matchColorStop)
  2673. };
  2674. });
  2675. }
  2676. function matchCall(pattern, callback) {
  2677. var captures = scan(pattern);
  2678. if (captures) {
  2679. if (!scan(tokens.startCall)) {
  2680. error('Missing (');
  2681. }
  2682. result = callback(captures);
  2683. if (!scan(tokens.endCall)) {
  2684. error('Missing )');
  2685. }
  2686. return result;
  2687. }
  2688. }
  2689. function matchLinearOrientation() {
  2690. return matchSideOrCorner() ||
  2691. matchAngle();
  2692. }
  2693. function matchSideOrCorner() {
  2694. return match('directional', tokens.sideOrCorner, 1);
  2695. }
  2696. function matchAngle() {
  2697. return match('angular', tokens.angleValue, 1);
  2698. }
  2699. function matchListRadialOrientations() {
  2700. var radialOrientations,
  2701. radialOrientation = matchRadialOrientation(),
  2702. lookaheadCache;
  2703. if (radialOrientation) {
  2704. radialOrientations = [];
  2705. radialOrientations.push(radialOrientation);
  2706. lookaheadCache = input;
  2707. if (scan(tokens.comma)) {
  2708. radialOrientation = matchRadialOrientation();
  2709. if (radialOrientation) {
  2710. radialOrientations.push(radialOrientation);
  2711. } else {
  2712. input = lookaheadCache;
  2713. }
  2714. }
  2715. }
  2716. return radialOrientations;
  2717. }
  2718. function matchRadialOrientation() {
  2719. var radialType = matchCircle() ||
  2720. matchEllipse();
  2721. if (radialType) {
  2722. radialType.at = matchAtPosition();
  2723. } else {
  2724. var defaultPosition = matchPositioning();
  2725. if (defaultPosition) {
  2726. radialType = {
  2727. type: 'default-radial',
  2728. at: defaultPosition
  2729. };
  2730. }
  2731. }
  2732. return radialType;
  2733. }
  2734. function matchCircle() {
  2735. var circle = match('shape', /^(circle)/i, 0);
  2736. if (circle) {
  2737. circle.style = matchLength() || matchExtentKeyword();
  2738. }
  2739. return circle;
  2740. }
  2741. function matchEllipse() {
  2742. var ellipse = match('shape', /^(ellipse)/i, 0);
  2743. if (ellipse) {
  2744. ellipse.style = matchDistance() || matchExtentKeyword();
  2745. }
  2746. return ellipse;
  2747. }
  2748. function matchExtentKeyword() {
  2749. return match('extent-keyword', tokens.extentKeywords, 1);
  2750. }
  2751. function matchAtPosition() {
  2752. if (match('position', /^at/, 0)) {
  2753. var positioning = matchPositioning();
  2754. if (!positioning) {
  2755. error('Missing positioning value');
  2756. }
  2757. return positioning;
  2758. }
  2759. }
  2760. function matchPositioning() {
  2761. var location = matchCoordinates();
  2762. if (location.x || location.y) {
  2763. return {
  2764. type: 'position',
  2765. value: location
  2766. };
  2767. }
  2768. }
  2769. function matchCoordinates() {
  2770. return {
  2771. x: matchDistance(),
  2772. y: matchDistance()
  2773. };
  2774. }
  2775. function matchListing(matcher) {
  2776. var captures = matcher(),
  2777. result = [];
  2778. if (captures) {
  2779. result.push(captures);
  2780. while (scan(tokens.comma)) {
  2781. captures = matcher();
  2782. if (captures) {
  2783. result.push(captures);
  2784. } else {
  2785. error('One extra comma');
  2786. }
  2787. }
  2788. }
  2789. return result;
  2790. }
  2791. function matchColorStop() {
  2792. var color = matchColor();
  2793. if (!color) {
  2794. error('Expected color definition');
  2795. }
  2796. color.length = matchDistance();
  2797. return color;
  2798. }
  2799. function matchColor() {
  2800. return matchHexColor() ||
  2801. matchRGBAColor() ||
  2802. matchRGBColor() ||
  2803. matchLiteralColor();
  2804. }
  2805. function matchLiteralColor() {
  2806. return match('literal', tokens.literalColor, 0);
  2807. }
  2808. function matchHexColor() {
  2809. return match('hex', tokens.hexColor, 1);
  2810. }
  2811. function matchRGBColor() {
  2812. return matchCall(tokens.rgbColor, function() {
  2813. return {
  2814. type: 'rgb',
  2815. value: matchListing(matchNumber)
  2816. };
  2817. });
  2818. }
  2819. function matchRGBAColor() {
  2820. return matchCall(tokens.rgbaColor, function() {
  2821. return {
  2822. type: 'rgba',
  2823. value: matchListing(matchNumber)
  2824. };
  2825. });
  2826. }
  2827. function matchNumber() {
  2828. return scan(tokens.number)[1];
  2829. }
  2830. function matchDistance() {
  2831. return match('%', tokens.percentageValue, 1) ||
  2832. matchPositionKeyword() ||
  2833. matchLength();
  2834. }
  2835. function matchPositionKeyword() {
  2836. return match('position-keyword', tokens.positionKeywords, 1);
  2837. }
  2838. function matchLength() {
  2839. return match('px', tokens.pixelValue, 1) ||
  2840. match('em', tokens.emValue, 1);
  2841. }
  2842. function match(type, pattern, captureIndex) {
  2843. var captures = scan(pattern);
  2844. if (captures) {
  2845. return {
  2846. type: type,
  2847. value: captures[captureIndex]
  2848. };
  2849. }
  2850. }
  2851. function scan(regexp) {
  2852. var captures,
  2853. blankCaptures;
  2854. blankCaptures = /^[\n\r\t\s]+/.exec(input);
  2855. if (blankCaptures) {
  2856. consume(blankCaptures[0].length);
  2857. }
  2858. captures = regexp.exec(input);
  2859. if (captures) {
  2860. consume(captures[0].length);
  2861. }
  2862. return captures;
  2863. }
  2864. function consume(size) {
  2865. input = input.substr(size);
  2866. }
  2867. return function(code) {
  2868. input = code.toString();
  2869. return getAST();
  2870. };
  2871. })();
  2872. exports.parse = (GradientParser || {}).parse;
  2873. /***/ }),
  2874. /***/ 8198:
  2875. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  2876. "use strict";
  2877. var GetIntrinsic = __webpack_require__(3010);
  2878. var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
  2879. var hasPropertyDescriptors = function hasPropertyDescriptors() {
  2880. if ($defineProperty) {
  2881. try {
  2882. $defineProperty({}, 'a', { value: 1 });
  2883. return true;
  2884. } catch (e) {
  2885. // IE 8 has a broken defineProperty
  2886. return false;
  2887. }
  2888. }
  2889. return false;
  2890. };
  2891. hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
  2892. // node v0.6 has a bug where array lengths can be Set but not Defined
  2893. if (!hasPropertyDescriptors()) {
  2894. return null;
  2895. }
  2896. try {
  2897. return $defineProperty([], 'length', { value: 1 }).length !== 1;
  2898. } catch (e) {
  2899. // In Firefox 4-22, defining length on an array throws an exception.
  2900. return true;
  2901. }
  2902. };
  2903. module.exports = hasPropertyDescriptors;
  2904. /***/ }),
  2905. /***/ 3010:
  2906. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  2907. "use strict";
  2908. var undefined;
  2909. var $SyntaxError = SyntaxError;
  2910. var $Function = Function;
  2911. var $TypeError = TypeError;
  2912. // eslint-disable-next-line consistent-return
  2913. var getEvalledConstructor = function (expressionSyntax) {
  2914. try {
  2915. return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
  2916. } catch (e) {}
  2917. };
  2918. var $gOPD = Object.getOwnPropertyDescriptor;
  2919. if ($gOPD) {
  2920. try {
  2921. $gOPD({}, '');
  2922. } catch (e) {
  2923. $gOPD = null; // this is IE 8, which has a broken gOPD
  2924. }
  2925. }
  2926. var throwTypeError = function () {
  2927. throw new $TypeError();
  2928. };
  2929. var ThrowTypeError = $gOPD
  2930. ? (function () {
  2931. try {
  2932. // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
  2933. arguments.callee; // IE 8 does not throw here
  2934. return throwTypeError;
  2935. } catch (calleeThrows) {
  2936. try {
  2937. // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
  2938. return $gOPD(arguments, 'callee').get;
  2939. } catch (gOPDthrows) {
  2940. return throwTypeError;
  2941. }
  2942. }
  2943. }())
  2944. : throwTypeError;
  2945. var hasSymbols = __webpack_require__(9905)();
  2946. var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
  2947. var needsEval = {};
  2948. var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
  2949. var INTRINSICS = {
  2950. '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
  2951. '%Array%': Array,
  2952. '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
  2953. '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
  2954. '%AsyncFromSyncIteratorPrototype%': undefined,
  2955. '%AsyncFunction%': needsEval,
  2956. '%AsyncGenerator%': needsEval,
  2957. '%AsyncGeneratorFunction%': needsEval,
  2958. '%AsyncIteratorPrototype%': needsEval,
  2959. '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
  2960. '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
  2961. '%Boolean%': Boolean,
  2962. '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
  2963. '%Date%': Date,
  2964. '%decodeURI%': decodeURI,
  2965. '%decodeURIComponent%': decodeURIComponent,
  2966. '%encodeURI%': encodeURI,
  2967. '%encodeURIComponent%': encodeURIComponent,
  2968. '%Error%': Error,
  2969. '%eval%': eval, // eslint-disable-line no-eval
  2970. '%EvalError%': EvalError,
  2971. '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
  2972. '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
  2973. '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
  2974. '%Function%': $Function,
  2975. '%GeneratorFunction%': needsEval,
  2976. '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
  2977. '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
  2978. '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
  2979. '%isFinite%': isFinite,
  2980. '%isNaN%': isNaN,
  2981. '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
  2982. '%JSON%': typeof JSON === 'object' ? JSON : undefined,
  2983. '%Map%': typeof Map === 'undefined' ? undefined : Map,
  2984. '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
  2985. '%Math%': Math,
  2986. '%Number%': Number,
  2987. '%Object%': Object,
  2988. '%parseFloat%': parseFloat,
  2989. '%parseInt%': parseInt,
  2990. '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
  2991. '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
  2992. '%RangeError%': RangeError,
  2993. '%ReferenceError%': ReferenceError,
  2994. '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
  2995. '%RegExp%': RegExp,
  2996. '%Set%': typeof Set === 'undefined' ? undefined : Set,
  2997. '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
  2998. '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
  2999. '%String%': String,
  3000. '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
  3001. '%Symbol%': hasSymbols ? Symbol : undefined,
  3002. '%SyntaxError%': $SyntaxError,
  3003. '%ThrowTypeError%': ThrowTypeError,
  3004. '%TypedArray%': TypedArray,
  3005. '%TypeError%': $TypeError,
  3006. '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
  3007. '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
  3008. '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
  3009. '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
  3010. '%URIError%': URIError,
  3011. '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
  3012. '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
  3013. '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
  3014. };
  3015. var doEval = function doEval(name) {
  3016. var value;
  3017. if (name === '%AsyncFunction%') {
  3018. value = getEvalledConstructor('async function () {}');
  3019. } else if (name === '%GeneratorFunction%') {
  3020. value = getEvalledConstructor('function* () {}');
  3021. } else if (name === '%AsyncGeneratorFunction%') {
  3022. value = getEvalledConstructor('async function* () {}');
  3023. } else if (name === '%AsyncGenerator%') {
  3024. var fn = doEval('%AsyncGeneratorFunction%');
  3025. if (fn) {
  3026. value = fn.prototype;
  3027. }
  3028. } else if (name === '%AsyncIteratorPrototype%') {
  3029. var gen = doEval('%AsyncGenerator%');
  3030. if (gen) {
  3031. value = getProto(gen.prototype);
  3032. }
  3033. }
  3034. INTRINSICS[name] = value;
  3035. return value;
  3036. };
  3037. var LEGACY_ALIASES = {
  3038. '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
  3039. '%ArrayPrototype%': ['Array', 'prototype'],
  3040. '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
  3041. '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
  3042. '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
  3043. '%ArrayProto_values%': ['Array', 'prototype', 'values'],
  3044. '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
  3045. '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
  3046. '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
  3047. '%BooleanPrototype%': ['Boolean', 'prototype'],
  3048. '%DataViewPrototype%': ['DataView', 'prototype'],
  3049. '%DatePrototype%': ['Date', 'prototype'],
  3050. '%ErrorPrototype%': ['Error', 'prototype'],
  3051. '%EvalErrorPrototype%': ['EvalError', 'prototype'],
  3052. '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
  3053. '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
  3054. '%FunctionPrototype%': ['Function', 'prototype'],
  3055. '%Generator%': ['GeneratorFunction', 'prototype'],
  3056. '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
  3057. '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
  3058. '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
  3059. '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
  3060. '%JSONParse%': ['JSON', 'parse'],
  3061. '%JSONStringify%': ['JSON', 'stringify'],
  3062. '%MapPrototype%': ['Map', 'prototype'],
  3063. '%NumberPrototype%': ['Number', 'prototype'],
  3064. '%ObjectPrototype%': ['Object', 'prototype'],
  3065. '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
  3066. '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
  3067. '%PromisePrototype%': ['Promise', 'prototype'],
  3068. '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
  3069. '%Promise_all%': ['Promise', 'all'],
  3070. '%Promise_reject%': ['Promise', 'reject'],
  3071. '%Promise_resolve%': ['Promise', 'resolve'],
  3072. '%RangeErrorPrototype%': ['RangeError', 'prototype'],
  3073. '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
  3074. '%RegExpPrototype%': ['RegExp', 'prototype'],
  3075. '%SetPrototype%': ['Set', 'prototype'],
  3076. '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
  3077. '%StringPrototype%': ['String', 'prototype'],
  3078. '%SymbolPrototype%': ['Symbol', 'prototype'],
  3079. '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
  3080. '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
  3081. '%TypeErrorPrototype%': ['TypeError', 'prototype'],
  3082. '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
  3083. '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
  3084. '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
  3085. '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
  3086. '%URIErrorPrototype%': ['URIError', 'prototype'],
  3087. '%WeakMapPrototype%': ['WeakMap', 'prototype'],
  3088. '%WeakSetPrototype%': ['WeakSet', 'prototype']
  3089. };
  3090. var bind = __webpack_require__(1930);
  3091. var hasOwn = __webpack_require__(9284);
  3092. var $concat = bind.call(Function.call, Array.prototype.concat);
  3093. var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
  3094. var $replace = bind.call(Function.call, String.prototype.replace);
  3095. var $strSlice = bind.call(Function.call, String.prototype.slice);
  3096. /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
  3097. var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
  3098. var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
  3099. var stringToPath = function stringToPath(string) {
  3100. var first = $strSlice(string, 0, 1);
  3101. var last = $strSlice(string, -1);
  3102. if (first === '%' && last !== '%') {
  3103. throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
  3104. } else if (last === '%' && first !== '%') {
  3105. throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
  3106. }
  3107. var result = [];
  3108. $replace(string, rePropName, function (match, number, quote, subString) {
  3109. result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
  3110. });
  3111. return result;
  3112. };
  3113. /* end adaptation */
  3114. var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
  3115. var intrinsicName = name;
  3116. var alias;
  3117. if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
  3118. alias = LEGACY_ALIASES[intrinsicName];
  3119. intrinsicName = '%' + alias[0] + '%';
  3120. }
  3121. if (hasOwn(INTRINSICS, intrinsicName)) {
  3122. var value = INTRINSICS[intrinsicName];
  3123. if (value === needsEval) {
  3124. value = doEval(intrinsicName);
  3125. }
  3126. if (typeof value === 'undefined' && !allowMissing) {
  3127. throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
  3128. }
  3129. return {
  3130. alias: alias,
  3131. name: intrinsicName,
  3132. value: value
  3133. };
  3134. }
  3135. throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
  3136. };
  3137. module.exports = function GetIntrinsic(name, allowMissing) {
  3138. if (typeof name !== 'string' || name.length === 0) {
  3139. throw new $TypeError('intrinsic name must be a non-empty string');
  3140. }
  3141. if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
  3142. throw new $TypeError('"allowMissing" argument must be a boolean');
  3143. }
  3144. var parts = stringToPath(name);
  3145. var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
  3146. var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
  3147. var intrinsicRealName = intrinsic.name;
  3148. var value = intrinsic.value;
  3149. var skipFurtherCaching = false;
  3150. var alias = intrinsic.alias;
  3151. if (alias) {
  3152. intrinsicBaseName = alias[0];
  3153. $spliceApply(parts, $concat([0, 1], alias));
  3154. }
  3155. for (var i = 1, isOwn = true; i < parts.length; i += 1) {
  3156. var part = parts[i];
  3157. var first = $strSlice(part, 0, 1);
  3158. var last = $strSlice(part, -1);
  3159. if (
  3160. (
  3161. (first === '"' || first === "'" || first === '`')
  3162. || (last === '"' || last === "'" || last === '`')
  3163. )
  3164. && first !== last
  3165. ) {
  3166. throw new $SyntaxError('property names with quotes must have matching quotes');
  3167. }
  3168. if (part === 'constructor' || !isOwn) {
  3169. skipFurtherCaching = true;
  3170. }
  3171. intrinsicBaseName += '.' + part;
  3172. intrinsicRealName = '%' + intrinsicBaseName + '%';
  3173. if (hasOwn(INTRINSICS, intrinsicRealName)) {
  3174. value = INTRINSICS[intrinsicRealName];
  3175. } else if (value != null) {
  3176. if (!(part in value)) {
  3177. if (!allowMissing) {
  3178. throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
  3179. }
  3180. return void undefined;
  3181. }
  3182. if ($gOPD && (i + 1) >= parts.length) {
  3183. var desc = $gOPD(value, part);
  3184. isOwn = !!desc;
  3185. // By convention, when a data property is converted to an accessor
  3186. // property to emulate a data property that does not suffer from
  3187. // the override mistake, that accessor's getter is marked with
  3188. // an `originalValue` property. Here, when we detect this, we
  3189. // uphold the illusion by pretending to see that original data
  3190. // property, i.e., returning the value rather than the getter
  3191. // itself.
  3192. if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
  3193. value = desc.get;
  3194. } else {
  3195. value = value[part];
  3196. }
  3197. } else {
  3198. isOwn = hasOwn(value, part);
  3199. value = value[part];
  3200. }
  3201. if (isOwn && !skipFurtherCaching) {
  3202. INTRINSICS[intrinsicRealName] = value;
  3203. }
  3204. }
  3205. }
  3206. return value;
  3207. };
  3208. /***/ }),
  3209. /***/ 9905:
  3210. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  3211. "use strict";
  3212. var origSymbol = __webpack_require__.g.Symbol;
  3213. var hasSymbolSham = __webpack_require__(5682);
  3214. module.exports = function hasNativeSymbols() {
  3215. if (typeof origSymbol !== 'function') { return false; }
  3216. if (typeof Symbol !== 'function') { return false; }
  3217. if (typeof origSymbol('foo') !== 'symbol') { return false; }
  3218. if (typeof Symbol('bar') !== 'symbol') { return false; }
  3219. return hasSymbolSham();
  3220. };
  3221. /***/ }),
  3222. /***/ 5682:
  3223. /***/ (function(module) {
  3224. "use strict";
  3225. /* eslint complexity: [2, 18], max-statements: [2, 33] */
  3226. module.exports = function hasSymbols() {
  3227. if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
  3228. if (typeof Symbol.iterator === 'symbol') { return true; }
  3229. var obj = {};
  3230. var sym = Symbol('test');
  3231. var symObj = Object(sym);
  3232. if (typeof sym === 'string') { return false; }
  3233. if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
  3234. if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
  3235. // temp disabled per https://github.com/ljharb/object.assign/issues/17
  3236. // if (sym instanceof Symbol) { return false; }
  3237. // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
  3238. // if (!(symObj instanceof Symbol)) { return false; }
  3239. // if (typeof Symbol.prototype.toString !== 'function') { return false; }
  3240. // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
  3241. var symVal = 42;
  3242. obj[sym] = symVal;
  3243. for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
  3244. if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
  3245. if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
  3246. var syms = Object.getOwnPropertySymbols(obj);
  3247. if (syms.length !== 1 || syms[0] !== sym) { return false; }
  3248. if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
  3249. if (typeof Object.getOwnPropertyDescriptor === 'function') {
  3250. var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
  3251. if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
  3252. }
  3253. return true;
  3254. };
  3255. /***/ }),
  3256. /***/ 81:
  3257. /***/ (function(module) {
  3258. "use strict";
  3259. /* eslint complexity: [2, 18], max-statements: [2, 33] */
  3260. module.exports = function hasSymbols() {
  3261. if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
  3262. if (typeof Symbol.iterator === 'symbol') { return true; }
  3263. var obj = {};
  3264. var sym = Symbol('test');
  3265. var symObj = Object(sym);
  3266. if (typeof sym === 'string') { return false; }
  3267. if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
  3268. if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
  3269. // temp disabled per https://github.com/ljharb/object.assign/issues/17
  3270. // if (sym instanceof Symbol) { return false; }
  3271. // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
  3272. // if (!(symObj instanceof Symbol)) { return false; }
  3273. // if (typeof Symbol.prototype.toString !== 'function') { return false; }
  3274. // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
  3275. var symVal = 42;
  3276. obj[sym] = symVal;
  3277. for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
  3278. if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
  3279. if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
  3280. var syms = Object.getOwnPropertySymbols(obj);
  3281. if (syms.length !== 1 || syms[0] !== sym) { return false; }
  3282. if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
  3283. if (typeof Object.getOwnPropertyDescriptor === 'function') {
  3284. var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
  3285. if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
  3286. }
  3287. return true;
  3288. };
  3289. /***/ }),
  3290. /***/ 4111:
  3291. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  3292. "use strict";
  3293. var hasSymbols = __webpack_require__(81);
  3294. module.exports = function hasToStringTagShams() {
  3295. return hasSymbols() && !!Symbol.toStringTag;
  3296. };
  3297. /***/ }),
  3298. /***/ 9284:
  3299. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  3300. "use strict";
  3301. var bind = __webpack_require__(1930);
  3302. module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
  3303. /***/ }),
  3304. /***/ 3138:
  3305. /***/ (function(module) {
  3306. module.exports =
  3307. /******/ (function(modules) { // webpackBootstrap
  3308. /******/ // The module cache
  3309. /******/ var installedModules = {};
  3310. /******/
  3311. /******/ // The require function
  3312. /******/ function __nested_webpack_require_187__(moduleId) {
  3313. /******/
  3314. /******/ // Check if module is in cache
  3315. /******/ if(installedModules[moduleId])
  3316. /******/ return installedModules[moduleId].exports;
  3317. /******/
  3318. /******/ // Create a new module (and put it into the cache)
  3319. /******/ var module = installedModules[moduleId] = {
  3320. /******/ exports: {},
  3321. /******/ id: moduleId,
  3322. /******/ loaded: false
  3323. /******/ };
  3324. /******/
  3325. /******/ // Execute the module function
  3326. /******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_187__);
  3327. /******/
  3328. /******/ // Flag the module as loaded
  3329. /******/ module.loaded = true;
  3330. /******/
  3331. /******/ // Return the exports of the module
  3332. /******/ return module.exports;
  3333. /******/ }
  3334. /******/
  3335. /******/
  3336. /******/ // expose the modules object (__webpack_modules__)
  3337. /******/ __nested_webpack_require_187__.m = modules;
  3338. /******/
  3339. /******/ // expose the module cache
  3340. /******/ __nested_webpack_require_187__.c = installedModules;
  3341. /******/
  3342. /******/ // __webpack_public_path__
  3343. /******/ __nested_webpack_require_187__.p = "";
  3344. /******/
  3345. /******/ // Load entry module and return exports
  3346. /******/ return __nested_webpack_require_187__(0);
  3347. /******/ })
  3348. /************************************************************************/
  3349. /******/ ([
  3350. /* 0 */
  3351. /***/ (function(module, exports, __nested_webpack_require_1468__) {
  3352. module.exports = __nested_webpack_require_1468__(1);
  3353. /***/ }),
  3354. /* 1 */
  3355. /***/ (function(module, exports, __nested_webpack_require_1587__) {
  3356. 'use strict';
  3357. Object.defineProperty(exports, "__esModule", {
  3358. value: true
  3359. });
  3360. var _utils = __nested_webpack_require_1587__(2);
  3361. Object.defineProperty(exports, 'combineChunks', {
  3362. enumerable: true,
  3363. get: function get() {
  3364. return _utils.combineChunks;
  3365. }
  3366. });
  3367. Object.defineProperty(exports, 'fillInChunks', {
  3368. enumerable: true,
  3369. get: function get() {
  3370. return _utils.fillInChunks;
  3371. }
  3372. });
  3373. Object.defineProperty(exports, 'findAll', {
  3374. enumerable: true,
  3375. get: function get() {
  3376. return _utils.findAll;
  3377. }
  3378. });
  3379. Object.defineProperty(exports, 'findChunks', {
  3380. enumerable: true,
  3381. get: function get() {
  3382. return _utils.findChunks;
  3383. }
  3384. });
  3385. /***/ }),
  3386. /* 2 */
  3387. /***/ (function(module, exports) {
  3388. 'use strict';
  3389. Object.defineProperty(exports, "__esModule", {
  3390. value: true
  3391. });
  3392. /**
  3393. * Creates an array of chunk objects representing both higlightable and non highlightable pieces of text that match each search word.
  3394. * @return Array of "chunks" (where a Chunk is { start:number, end:number, highlight:boolean })
  3395. */
  3396. var findAll = exports.findAll = function findAll(_ref) {
  3397. var autoEscape = _ref.autoEscape,
  3398. _ref$caseSensitive = _ref.caseSensitive,
  3399. caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive,
  3400. _ref$findChunks = _ref.findChunks,
  3401. findChunks = _ref$findChunks === undefined ? defaultFindChunks : _ref$findChunks,
  3402. sanitize = _ref.sanitize,
  3403. searchWords = _ref.searchWords,
  3404. textToHighlight = _ref.textToHighlight;
  3405. return fillInChunks({
  3406. chunksToHighlight: combineChunks({
  3407. chunks: findChunks({
  3408. autoEscape: autoEscape,
  3409. caseSensitive: caseSensitive,
  3410. sanitize: sanitize,
  3411. searchWords: searchWords,
  3412. textToHighlight: textToHighlight
  3413. })
  3414. }),
  3415. totalLength: textToHighlight ? textToHighlight.length : 0
  3416. });
  3417. };
  3418. /**
  3419. * Takes an array of {start:number, end:number} objects and combines chunks that overlap into single chunks.
  3420. * @return {start:number, end:number}[]
  3421. */
  3422. var combineChunks = exports.combineChunks = function combineChunks(_ref2) {
  3423. var chunks = _ref2.chunks;
  3424. chunks = chunks.sort(function (first, second) {
  3425. return first.start - second.start;
  3426. }).reduce(function (processedChunks, nextChunk) {
  3427. // First chunk just goes straight in the array...
  3428. if (processedChunks.length === 0) {
  3429. return [nextChunk];
  3430. } else {
  3431. // ... subsequent chunks get checked to see if they overlap...
  3432. var prevChunk = processedChunks.pop();
  3433. if (nextChunk.start <= prevChunk.end) {
  3434. // It may be the case that prevChunk completely surrounds nextChunk, so take the
  3435. // largest of the end indeces.
  3436. var endIndex = Math.max(prevChunk.end, nextChunk.end);
  3437. processedChunks.push({ highlight: false, start: prevChunk.start, end: endIndex });
  3438. } else {
  3439. processedChunks.push(prevChunk, nextChunk);
  3440. }
  3441. return processedChunks;
  3442. }
  3443. }, []);
  3444. return chunks;
  3445. };
  3446. /**
  3447. * Examine text for any matches.
  3448. * If we find matches, add them to the returned array as a "chunk" object ({start:number, end:number}).
  3449. * @return {start:number, end:number}[]
  3450. */
  3451. var defaultFindChunks = function defaultFindChunks(_ref3) {
  3452. var autoEscape = _ref3.autoEscape,
  3453. caseSensitive = _ref3.caseSensitive,
  3454. _ref3$sanitize = _ref3.sanitize,
  3455. sanitize = _ref3$sanitize === undefined ? defaultSanitize : _ref3$sanitize,
  3456. searchWords = _ref3.searchWords,
  3457. textToHighlight = _ref3.textToHighlight;
  3458. textToHighlight = sanitize(textToHighlight);
  3459. return searchWords.filter(function (searchWord) {
  3460. return searchWord;
  3461. }) // Remove empty words
  3462. .reduce(function (chunks, searchWord) {
  3463. searchWord = sanitize(searchWord);
  3464. if (autoEscape) {
  3465. searchWord = escapeRegExpFn(searchWord);
  3466. }
  3467. var regex = new RegExp(searchWord, caseSensitive ? 'g' : 'gi');
  3468. var match = void 0;
  3469. while (match = regex.exec(textToHighlight)) {
  3470. var _start = match.index;
  3471. var _end = regex.lastIndex;
  3472. // We do not return zero-length matches
  3473. if (_end > _start) {
  3474. chunks.push({ highlight: false, start: _start, end: _end });
  3475. }
  3476. // Prevent browsers like Firefox from getting stuck in an infinite loop
  3477. // See http://www.regexguru.com/2008/04/watch-out-for-zero-length-matches/
  3478. if (match.index === regex.lastIndex) {
  3479. regex.lastIndex++;
  3480. }
  3481. }
  3482. return chunks;
  3483. }, []);
  3484. };
  3485. // Allow the findChunks to be overridden in findAll,
  3486. // but for backwards compatibility we export as the old name
  3487. exports.findChunks = defaultFindChunks;
  3488. /**
  3489. * Given a set of chunks to highlight, create an additional set of chunks
  3490. * to represent the bits of text between the highlighted text.
  3491. * @param chunksToHighlight {start:number, end:number}[]
  3492. * @param totalLength number
  3493. * @return {start:number, end:number, highlight:boolean}[]
  3494. */
  3495. var fillInChunks = exports.fillInChunks = function fillInChunks(_ref4) {
  3496. var chunksToHighlight = _ref4.chunksToHighlight,
  3497. totalLength = _ref4.totalLength;
  3498. var allChunks = [];
  3499. var append = function append(start, end, highlight) {
  3500. if (end - start > 0) {
  3501. allChunks.push({
  3502. start: start,
  3503. end: end,
  3504. highlight: highlight
  3505. });
  3506. }
  3507. };
  3508. if (chunksToHighlight.length === 0) {
  3509. append(0, totalLength, false);
  3510. } else {
  3511. var lastIndex = 0;
  3512. chunksToHighlight.forEach(function (chunk) {
  3513. append(lastIndex, chunk.start, false);
  3514. append(chunk.start, chunk.end, true);
  3515. lastIndex = chunk.end;
  3516. });
  3517. append(lastIndex, totalLength, false);
  3518. }
  3519. return allChunks;
  3520. };
  3521. function defaultSanitize(string) {
  3522. return string;
  3523. }
  3524. function escapeRegExpFn(string) {
  3525. return string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
  3526. }
  3527. /***/ })
  3528. /******/ ]);
  3529. /***/ }),
  3530. /***/ 1281:
  3531. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  3532. "use strict";
  3533. var reactIs = __webpack_require__(338);
  3534. /**
  3535. * Copyright 2015, Yahoo! Inc.
  3536. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
  3537. */
  3538. var REACT_STATICS = {
  3539. childContextTypes: true,
  3540. contextType: true,
  3541. contextTypes: true,
  3542. defaultProps: true,
  3543. displayName: true,
  3544. getDefaultProps: true,
  3545. getDerivedStateFromError: true,
  3546. getDerivedStateFromProps: true,
  3547. mixins: true,
  3548. propTypes: true,
  3549. type: true
  3550. };
  3551. var KNOWN_STATICS = {
  3552. name: true,
  3553. length: true,
  3554. prototype: true,
  3555. caller: true,
  3556. callee: true,
  3557. arguments: true,
  3558. arity: true
  3559. };
  3560. var FORWARD_REF_STATICS = {
  3561. '$$typeof': true,
  3562. render: true,
  3563. defaultProps: true,
  3564. displayName: true,
  3565. propTypes: true
  3566. };
  3567. var MEMO_STATICS = {
  3568. '$$typeof': true,
  3569. compare: true,
  3570. defaultProps: true,
  3571. displayName: true,
  3572. propTypes: true,
  3573. type: true
  3574. };
  3575. var TYPE_STATICS = {};
  3576. TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
  3577. TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
  3578. function getStatics(component) {
  3579. // React v16.11 and below
  3580. if (reactIs.isMemo(component)) {
  3581. return MEMO_STATICS;
  3582. } // React v16.12 and above
  3583. return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
  3584. }
  3585. var defineProperty = Object.defineProperty;
  3586. var getOwnPropertyNames = Object.getOwnPropertyNames;
  3587. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  3588. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  3589. var getPrototypeOf = Object.getPrototypeOf;
  3590. var objectPrototype = Object.prototype;
  3591. function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
  3592. if (typeof sourceComponent !== 'string') {
  3593. // don't hoist over string (html) components
  3594. if (objectPrototype) {
  3595. var inheritedComponent = getPrototypeOf(sourceComponent);
  3596. if (inheritedComponent && inheritedComponent !== objectPrototype) {
  3597. hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
  3598. }
  3599. }
  3600. var keys = getOwnPropertyNames(sourceComponent);
  3601. if (getOwnPropertySymbols) {
  3602. keys = keys.concat(getOwnPropertySymbols(sourceComponent));
  3603. }
  3604. var targetStatics = getStatics(targetComponent);
  3605. var sourceStatics = getStatics(sourceComponent);
  3606. for (var i = 0; i < keys.length; ++i) {
  3607. var key = keys[i];
  3608. if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
  3609. var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
  3610. try {
  3611. // Avoid failures from read-only properties
  3612. defineProperty(targetComponent, key, descriptor);
  3613. } catch (e) {}
  3614. }
  3615. }
  3616. }
  3617. return targetComponent;
  3618. }
  3619. module.exports = hoistNonReactStatics;
  3620. /***/ }),
  3621. /***/ 5443:
  3622. /***/ (function(module) {
  3623. "use strict";
  3624. var fnToStr = Function.prototype.toString;
  3625. var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
  3626. var badArrayLike;
  3627. var isCallableMarker;
  3628. if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
  3629. try {
  3630. badArrayLike = Object.defineProperty({}, 'length', {
  3631. get: function () {
  3632. throw isCallableMarker;
  3633. }
  3634. });
  3635. isCallableMarker = {};
  3636. // eslint-disable-next-line no-throw-literal
  3637. reflectApply(function () { throw 42; }, null, badArrayLike);
  3638. } catch (_) {
  3639. if (_ !== isCallableMarker) {
  3640. reflectApply = null;
  3641. }
  3642. }
  3643. } else {
  3644. reflectApply = null;
  3645. }
  3646. var constructorRegex = /^\s*class\b/;
  3647. var isES6ClassFn = function isES6ClassFunction(value) {
  3648. try {
  3649. var fnStr = fnToStr.call(value);
  3650. return constructorRegex.test(fnStr);
  3651. } catch (e) {
  3652. return false; // not a function
  3653. }
  3654. };
  3655. var tryFunctionObject = function tryFunctionToStr(value) {
  3656. try {
  3657. if (isES6ClassFn(value)) { return false; }
  3658. fnToStr.call(value);
  3659. return true;
  3660. } catch (e) {
  3661. return false;
  3662. }
  3663. };
  3664. var toStr = Object.prototype.toString;
  3665. var fnClass = '[object Function]';
  3666. var genClass = '[object GeneratorFunction]';
  3667. var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
  3668. module.exports = reflectApply
  3669. ? function isCallable(value) {
  3670. if (!value) { return false; }
  3671. if (typeof value !== 'function' && typeof value !== 'object') { return false; }
  3672. if (typeof value === 'function' && !value.prototype) { return true; }
  3673. try {
  3674. reflectApply(value, null, badArrayLike);
  3675. } catch (e) {
  3676. if (e !== isCallableMarker) { return false; }
  3677. }
  3678. return !isES6ClassFn(value);
  3679. }
  3680. : function isCallable(value) {
  3681. if (!value) { return false; }
  3682. if (typeof value !== 'function' && typeof value !== 'object') { return false; }
  3683. if (typeof value === 'function' && !value.prototype) { return true; }
  3684. if (hasToStringTag) { return tryFunctionObject(value); }
  3685. if (isES6ClassFn(value)) { return false; }
  3686. var strClass = toStr.call(value);
  3687. return strClass === fnClass || strClass === genClass;
  3688. };
  3689. /***/ }),
  3690. /***/ 8659:
  3691. /***/ (function(module) {
  3692. "use strict";
  3693. var getDay = Date.prototype.getDay;
  3694. var tryDateObject = function tryDateGetDayCall(value) {
  3695. try {
  3696. getDay.call(value);
  3697. return true;
  3698. } catch (e) {
  3699. return false;
  3700. }
  3701. };
  3702. var toStr = Object.prototype.toString;
  3703. var dateClass = '[object Date]';
  3704. var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
  3705. module.exports = function isDateObject(value) {
  3706. if (typeof value !== 'object' || value === null) {
  3707. return false;
  3708. }
  3709. return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
  3710. };
  3711. /***/ }),
  3712. /***/ 3082:
  3713. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  3714. "use strict";
  3715. var toStr = Object.prototype.toString;
  3716. var hasSymbols = __webpack_require__(9905)();
  3717. if (hasSymbols) {
  3718. var symToStr = Symbol.prototype.toString;
  3719. var symStringRegex = /^Symbol\(.*\)$/;
  3720. var isSymbolObject = function isRealSymbolObject(value) {
  3721. if (typeof value.valueOf() !== 'symbol') {
  3722. return false;
  3723. }
  3724. return symStringRegex.test(symToStr.call(value));
  3725. };
  3726. module.exports = function isSymbol(value) {
  3727. if (typeof value === 'symbol') {
  3728. return true;
  3729. }
  3730. if (toStr.call(value) !== '[object Symbol]') {
  3731. return false;
  3732. }
  3733. try {
  3734. return isSymbolObject(value);
  3735. } catch (e) {
  3736. return false;
  3737. }
  3738. };
  3739. } else {
  3740. module.exports = function isSymbol(value) {
  3741. // this environment does not support Symbols.
  3742. return false && 0;
  3743. };
  3744. }
  3745. /***/ }),
  3746. /***/ 5834:
  3747. /***/ (function(module, exports) {
  3748. Object.defineProperty(exports, "__esModule", ({
  3749. value: true
  3750. }));
  3751. exports["default"] = isTouchDevice;
  3752. function isTouchDevice() {
  3753. return !!(typeof window !== 'undefined' && ('ontouchstart' in window || window.DocumentTouch && typeof document !== 'undefined' && document instanceof window.DocumentTouch)) || !!(typeof navigator !== 'undefined' && (navigator.maxTouchPoints || navigator.msMaxTouchPoints));
  3754. }
  3755. module.exports = exports['default'];
  3756. /***/ }),
  3757. /***/ 4937:
  3758. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  3759. var root = __webpack_require__(158);
  3760. /** Built-in value references. */
  3761. var Symbol = root.Symbol;
  3762. module.exports = Symbol;
  3763. /***/ }),
  3764. /***/ 194:
  3765. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  3766. var Symbol = __webpack_require__(4937),
  3767. getRawTag = __webpack_require__(5401),
  3768. objectToString = __webpack_require__(2445);
  3769. /** `Object#toString` result references. */
  3770. var nullTag = '[object Null]',
  3771. undefinedTag = '[object Undefined]';
  3772. /** Built-in value references. */
  3773. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  3774. /**
  3775. * The base implementation of `getTag` without fallbacks for buggy environments.
  3776. *
  3777. * @private
  3778. * @param {*} value The value to query.
  3779. * @returns {string} Returns the `toStringTag`.
  3780. */
  3781. function baseGetTag(value) {
  3782. if (value == null) {
  3783. return value === undefined ? undefinedTag : nullTag;
  3784. }
  3785. return (symToStringTag && symToStringTag in Object(value))
  3786. ? getRawTag(value)
  3787. : objectToString(value);
  3788. }
  3789. module.exports = baseGetTag;
  3790. /***/ }),
  3791. /***/ 2383:
  3792. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  3793. var trimmedEndIndex = __webpack_require__(8725);
  3794. /** Used to match leading whitespace. */
  3795. var reTrimStart = /^\s+/;
  3796. /**
  3797. * The base implementation of `_.trim`.
  3798. *
  3799. * @private
  3800. * @param {string} string The string to trim.
  3801. * @returns {string} Returns the trimmed string.
  3802. */
  3803. function baseTrim(string) {
  3804. return string
  3805. ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
  3806. : string;
  3807. }
  3808. module.exports = baseTrim;
  3809. /***/ }),
  3810. /***/ 4528:
  3811. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  3812. /** Detect free variable `global` from Node.js. */
  3813. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  3814. module.exports = freeGlobal;
  3815. /***/ }),
  3816. /***/ 5401:
  3817. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  3818. var Symbol = __webpack_require__(4937);
  3819. /** Used for built-in method references. */
  3820. var objectProto = Object.prototype;
  3821. /** Used to check objects for own properties. */
  3822. var hasOwnProperty = objectProto.hasOwnProperty;
  3823. /**
  3824. * Used to resolve the
  3825. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  3826. * of values.
  3827. */
  3828. var nativeObjectToString = objectProto.toString;
  3829. /** Built-in value references. */
  3830. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  3831. /**
  3832. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  3833. *
  3834. * @private
  3835. * @param {*} value The value to query.
  3836. * @returns {string} Returns the raw `toStringTag`.
  3837. */
  3838. function getRawTag(value) {
  3839. var isOwn = hasOwnProperty.call(value, symToStringTag),
  3840. tag = value[symToStringTag];
  3841. try {
  3842. value[symToStringTag] = undefined;
  3843. var unmasked = true;
  3844. } catch (e) {}
  3845. var result = nativeObjectToString.call(value);
  3846. if (unmasked) {
  3847. if (isOwn) {
  3848. value[symToStringTag] = tag;
  3849. } else {
  3850. delete value[symToStringTag];
  3851. }
  3852. }
  3853. return result;
  3854. }
  3855. module.exports = getRawTag;
  3856. /***/ }),
  3857. /***/ 2445:
  3858. /***/ (function(module) {
  3859. /** Used for built-in method references. */
  3860. var objectProto = Object.prototype;
  3861. /**
  3862. * Used to resolve the
  3863. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  3864. * of values.
  3865. */
  3866. var nativeObjectToString = objectProto.toString;
  3867. /**
  3868. * Converts `value` to a string using `Object.prototype.toString`.
  3869. *
  3870. * @private
  3871. * @param {*} value The value to convert.
  3872. * @returns {string} Returns the converted string.
  3873. */
  3874. function objectToString(value) {
  3875. return nativeObjectToString.call(value);
  3876. }
  3877. module.exports = objectToString;
  3878. /***/ }),
  3879. /***/ 158:
  3880. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  3881. var freeGlobal = __webpack_require__(4528);
  3882. /** Detect free variable `self`. */
  3883. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  3884. /** Used as a reference to the global object. */
  3885. var root = freeGlobal || freeSelf || Function('return this')();
  3886. module.exports = root;
  3887. /***/ }),
  3888. /***/ 8725:
  3889. /***/ (function(module) {
  3890. /** Used to match a single whitespace character. */
  3891. var reWhitespace = /\s/;
  3892. /**
  3893. * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
  3894. * character of `string`.
  3895. *
  3896. * @private
  3897. * @param {string} string The string to inspect.
  3898. * @returns {number} Returns the index of the last non-whitespace character.
  3899. */
  3900. function trimmedEndIndex(string) {
  3901. var index = string.length;
  3902. while (index-- && reWhitespace.test(string.charAt(index))) {}
  3903. return index;
  3904. }
  3905. module.exports = trimmedEndIndex;
  3906. /***/ }),
  3907. /***/ 6897:
  3908. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  3909. var isObject = __webpack_require__(3619),
  3910. now = __webpack_require__(8253),
  3911. toNumber = __webpack_require__(5053);
  3912. /** Error message constants. */
  3913. var FUNC_ERROR_TEXT = 'Expected a function';
  3914. /* Built-in method references for those with the same name as other `lodash` methods. */
  3915. var nativeMax = Math.max,
  3916. nativeMin = Math.min;
  3917. /**
  3918. * Creates a debounced function that delays invoking `func` until after `wait`
  3919. * milliseconds have elapsed since the last time the debounced function was
  3920. * invoked. The debounced function comes with a `cancel` method to cancel
  3921. * delayed `func` invocations and a `flush` method to immediately invoke them.
  3922. * Provide `options` to indicate whether `func` should be invoked on the
  3923. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  3924. * with the last arguments provided to the debounced function. Subsequent
  3925. * calls to the debounced function return the result of the last `func`
  3926. * invocation.
  3927. *
  3928. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  3929. * invoked on the trailing edge of the timeout only if the debounced function
  3930. * is invoked more than once during the `wait` timeout.
  3931. *
  3932. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  3933. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  3934. *
  3935. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  3936. * for details over the differences between `_.debounce` and `_.throttle`.
  3937. *
  3938. * @static
  3939. * @memberOf _
  3940. * @since 0.1.0
  3941. * @category Function
  3942. * @param {Function} func The function to debounce.
  3943. * @param {number} [wait=0] The number of milliseconds to delay.
  3944. * @param {Object} [options={}] The options object.
  3945. * @param {boolean} [options.leading=false]
  3946. * Specify invoking on the leading edge of the timeout.
  3947. * @param {number} [options.maxWait]
  3948. * The maximum time `func` is allowed to be delayed before it's invoked.
  3949. * @param {boolean} [options.trailing=true]
  3950. * Specify invoking on the trailing edge of the timeout.
  3951. * @returns {Function} Returns the new debounced function.
  3952. * @example
  3953. *
  3954. * // Avoid costly calculations while the window size is in flux.
  3955. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  3956. *
  3957. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  3958. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  3959. * 'leading': true,
  3960. * 'trailing': false
  3961. * }));
  3962. *
  3963. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  3964. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  3965. * var source = new EventSource('/stream');
  3966. * jQuery(source).on('message', debounced);
  3967. *
  3968. * // Cancel the trailing debounced invocation.
  3969. * jQuery(window).on('popstate', debounced.cancel);
  3970. */
  3971. function debounce(func, wait, options) {
  3972. var lastArgs,
  3973. lastThis,
  3974. maxWait,
  3975. result,
  3976. timerId,
  3977. lastCallTime,
  3978. lastInvokeTime = 0,
  3979. leading = false,
  3980. maxing = false,
  3981. trailing = true;
  3982. if (typeof func != 'function') {
  3983. throw new TypeError(FUNC_ERROR_TEXT);
  3984. }
  3985. wait = toNumber(wait) || 0;
  3986. if (isObject(options)) {
  3987. leading = !!options.leading;
  3988. maxing = 'maxWait' in options;
  3989. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  3990. trailing = 'trailing' in options ? !!options.trailing : trailing;
  3991. }
  3992. function invokeFunc(time) {
  3993. var args = lastArgs,
  3994. thisArg = lastThis;
  3995. lastArgs = lastThis = undefined;
  3996. lastInvokeTime = time;
  3997. result = func.apply(thisArg, args);
  3998. return result;
  3999. }
  4000. function leadingEdge(time) {
  4001. // Reset any `maxWait` timer.
  4002. lastInvokeTime = time;
  4003. // Start the timer for the trailing edge.
  4004. timerId = setTimeout(timerExpired, wait);
  4005. // Invoke the leading edge.
  4006. return leading ? invokeFunc(time) : result;
  4007. }
  4008. function remainingWait(time) {
  4009. var timeSinceLastCall = time - lastCallTime,
  4010. timeSinceLastInvoke = time - lastInvokeTime,
  4011. timeWaiting = wait - timeSinceLastCall;
  4012. return maxing
  4013. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  4014. : timeWaiting;
  4015. }
  4016. function shouldInvoke(time) {
  4017. var timeSinceLastCall = time - lastCallTime,
  4018. timeSinceLastInvoke = time - lastInvokeTime;
  4019. // Either this is the first call, activity has stopped and we're at the
  4020. // trailing edge, the system time has gone backwards and we're treating
  4021. // it as the trailing edge, or we've hit the `maxWait` limit.
  4022. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  4023. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  4024. }
  4025. function timerExpired() {
  4026. var time = now();
  4027. if (shouldInvoke(time)) {
  4028. return trailingEdge(time);
  4029. }
  4030. // Restart the timer.
  4031. timerId = setTimeout(timerExpired, remainingWait(time));
  4032. }
  4033. function trailingEdge(time) {
  4034. timerId = undefined;
  4035. // Only invoke if we have `lastArgs` which means `func` has been
  4036. // debounced at least once.
  4037. if (trailing && lastArgs) {
  4038. return invokeFunc(time);
  4039. }
  4040. lastArgs = lastThis = undefined;
  4041. return result;
  4042. }
  4043. function cancel() {
  4044. if (timerId !== undefined) {
  4045. clearTimeout(timerId);
  4046. }
  4047. lastInvokeTime = 0;
  4048. lastArgs = lastCallTime = lastThis = timerId = undefined;
  4049. }
  4050. function flush() {
  4051. return timerId === undefined ? result : trailingEdge(now());
  4052. }
  4053. function debounced() {
  4054. var time = now(),
  4055. isInvoking = shouldInvoke(time);
  4056. lastArgs = arguments;
  4057. lastThis = this;
  4058. lastCallTime = time;
  4059. if (isInvoking) {
  4060. if (timerId === undefined) {
  4061. return leadingEdge(lastCallTime);
  4062. }
  4063. if (maxing) {
  4064. // Handle invocations in a tight loop.
  4065. clearTimeout(timerId);
  4066. timerId = setTimeout(timerExpired, wait);
  4067. return invokeFunc(lastCallTime);
  4068. }
  4069. }
  4070. if (timerId === undefined) {
  4071. timerId = setTimeout(timerExpired, wait);
  4072. }
  4073. return result;
  4074. }
  4075. debounced.cancel = cancel;
  4076. debounced.flush = flush;
  4077. return debounced;
  4078. }
  4079. module.exports = debounce;
  4080. /***/ }),
  4081. /***/ 3619:
  4082. /***/ (function(module) {
  4083. /**
  4084. * Checks if `value` is the
  4085. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  4086. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  4087. *
  4088. * @static
  4089. * @memberOf _
  4090. * @since 0.1.0
  4091. * @category Lang
  4092. * @param {*} value The value to check.
  4093. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  4094. * @example
  4095. *
  4096. * _.isObject({});
  4097. * // => true
  4098. *
  4099. * _.isObject([1, 2, 3]);
  4100. * // => true
  4101. *
  4102. * _.isObject(_.noop);
  4103. * // => true
  4104. *
  4105. * _.isObject(null);
  4106. * // => false
  4107. */
  4108. function isObject(value) {
  4109. var type = typeof value;
  4110. return value != null && (type == 'object' || type == 'function');
  4111. }
  4112. module.exports = isObject;
  4113. /***/ }),
  4114. /***/ 1653:
  4115. /***/ (function(module) {
  4116. /**
  4117. * Checks if `value` is object-like. A value is object-like if it's not `null`
  4118. * and has a `typeof` result of "object".
  4119. *
  4120. * @static
  4121. * @memberOf _
  4122. * @since 4.0.0
  4123. * @category Lang
  4124. * @param {*} value The value to check.
  4125. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  4126. * @example
  4127. *
  4128. * _.isObjectLike({});
  4129. * // => true
  4130. *
  4131. * _.isObjectLike([1, 2, 3]);
  4132. * // => true
  4133. *
  4134. * _.isObjectLike(_.noop);
  4135. * // => false
  4136. *
  4137. * _.isObjectLike(null);
  4138. * // => false
  4139. */
  4140. function isObjectLike(value) {
  4141. return value != null && typeof value == 'object';
  4142. }
  4143. module.exports = isObjectLike;
  4144. /***/ }),
  4145. /***/ 1878:
  4146. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4147. var baseGetTag = __webpack_require__(194),
  4148. isObjectLike = __webpack_require__(1653);
  4149. /** `Object#toString` result references. */
  4150. var symbolTag = '[object Symbol]';
  4151. /**
  4152. * Checks if `value` is classified as a `Symbol` primitive or object.
  4153. *
  4154. * @static
  4155. * @memberOf _
  4156. * @since 4.0.0
  4157. * @category Lang
  4158. * @param {*} value The value to check.
  4159. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  4160. * @example
  4161. *
  4162. * _.isSymbol(Symbol.iterator);
  4163. * // => true
  4164. *
  4165. * _.isSymbol('abc');
  4166. * // => false
  4167. */
  4168. function isSymbol(value) {
  4169. return typeof value == 'symbol' ||
  4170. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  4171. }
  4172. module.exports = isSymbol;
  4173. /***/ }),
  4174. /***/ 8253:
  4175. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4176. var root = __webpack_require__(158);
  4177. /**
  4178. * Gets the timestamp of the number of milliseconds that have elapsed since
  4179. * the Unix epoch (1 January 1970 00:00:00 UTC).
  4180. *
  4181. * @static
  4182. * @memberOf _
  4183. * @since 2.4.0
  4184. * @category Date
  4185. * @returns {number} Returns the timestamp.
  4186. * @example
  4187. *
  4188. * _.defer(function(stamp) {
  4189. * console.log(_.now() - stamp);
  4190. * }, _.now());
  4191. * // => Logs the number of milliseconds it took for the deferred invocation.
  4192. */
  4193. var now = function() {
  4194. return root.Date.now();
  4195. };
  4196. module.exports = now;
  4197. /***/ }),
  4198. /***/ 8172:
  4199. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4200. var debounce = __webpack_require__(6897),
  4201. isObject = __webpack_require__(3619);
  4202. /** Error message constants. */
  4203. var FUNC_ERROR_TEXT = 'Expected a function';
  4204. /**
  4205. * Creates a throttled function that only invokes `func` at most once per
  4206. * every `wait` milliseconds. The throttled function comes with a `cancel`
  4207. * method to cancel delayed `func` invocations and a `flush` method to
  4208. * immediately invoke them. Provide `options` to indicate whether `func`
  4209. * should be invoked on the leading and/or trailing edge of the `wait`
  4210. * timeout. The `func` is invoked with the last arguments provided to the
  4211. * throttled function. Subsequent calls to the throttled function return the
  4212. * result of the last `func` invocation.
  4213. *
  4214. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  4215. * invoked on the trailing edge of the timeout only if the throttled function
  4216. * is invoked more than once during the `wait` timeout.
  4217. *
  4218. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  4219. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  4220. *
  4221. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  4222. * for details over the differences between `_.throttle` and `_.debounce`.
  4223. *
  4224. * @static
  4225. * @memberOf _
  4226. * @since 0.1.0
  4227. * @category Function
  4228. * @param {Function} func The function to throttle.
  4229. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  4230. * @param {Object} [options={}] The options object.
  4231. * @param {boolean} [options.leading=true]
  4232. * Specify invoking on the leading edge of the timeout.
  4233. * @param {boolean} [options.trailing=true]
  4234. * Specify invoking on the trailing edge of the timeout.
  4235. * @returns {Function} Returns the new throttled function.
  4236. * @example
  4237. *
  4238. * // Avoid excessively updating the position while scrolling.
  4239. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  4240. *
  4241. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  4242. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  4243. * jQuery(element).on('click', throttled);
  4244. *
  4245. * // Cancel the trailing throttled invocation.
  4246. * jQuery(window).on('popstate', throttled.cancel);
  4247. */
  4248. function throttle(func, wait, options) {
  4249. var leading = true,
  4250. trailing = true;
  4251. if (typeof func != 'function') {
  4252. throw new TypeError(FUNC_ERROR_TEXT);
  4253. }
  4254. if (isObject(options)) {
  4255. leading = 'leading' in options ? !!options.leading : leading;
  4256. trailing = 'trailing' in options ? !!options.trailing : trailing;
  4257. }
  4258. return debounce(func, wait, {
  4259. 'leading': leading,
  4260. 'maxWait': wait,
  4261. 'trailing': trailing
  4262. });
  4263. }
  4264. module.exports = throttle;
  4265. /***/ }),
  4266. /***/ 5053:
  4267. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4268. var baseTrim = __webpack_require__(2383),
  4269. isObject = __webpack_require__(3619),
  4270. isSymbol = __webpack_require__(1878);
  4271. /** Used as references for various `Number` constants. */
  4272. var NAN = 0 / 0;
  4273. /** Used to detect bad signed hexadecimal string values. */
  4274. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  4275. /** Used to detect binary string values. */
  4276. var reIsBinary = /^0b[01]+$/i;
  4277. /** Used to detect octal string values. */
  4278. var reIsOctal = /^0o[0-7]+$/i;
  4279. /** Built-in method references without a dependency on `root`. */
  4280. var freeParseInt = parseInt;
  4281. /**
  4282. * Converts `value` to a number.
  4283. *
  4284. * @static
  4285. * @memberOf _
  4286. * @since 4.0.0
  4287. * @category Lang
  4288. * @param {*} value The value to process.
  4289. * @returns {number} Returns the number.
  4290. * @example
  4291. *
  4292. * _.toNumber(3.2);
  4293. * // => 3.2
  4294. *
  4295. * _.toNumber(Number.MIN_VALUE);
  4296. * // => 5e-324
  4297. *
  4298. * _.toNumber(Infinity);
  4299. * // => Infinity
  4300. *
  4301. * _.toNumber('3.2');
  4302. * // => 3.2
  4303. */
  4304. function toNumber(value) {
  4305. if (typeof value == 'number') {
  4306. return value;
  4307. }
  4308. if (isSymbol(value)) {
  4309. return NAN;
  4310. }
  4311. if (isObject(value)) {
  4312. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  4313. value = isObject(other) ? (other + '') : other;
  4314. }
  4315. if (typeof value != 'string') {
  4316. return value === 0 ? value : +value;
  4317. }
  4318. value = baseTrim(value);
  4319. var isBinary = reIsBinary.test(value);
  4320. return (isBinary || reIsOctal.test(value))
  4321. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  4322. : (reIsBadHex.test(value) ? NAN : +value);
  4323. }
  4324. module.exports = toNumber;
  4325. /***/ }),
  4326. /***/ 9756:
  4327. /***/ (function(module) {
  4328. /**
  4329. * Memize options object.
  4330. *
  4331. * @typedef MemizeOptions
  4332. *
  4333. * @property {number} [maxSize] Maximum size of the cache.
  4334. */
  4335. /**
  4336. * Internal cache entry.
  4337. *
  4338. * @typedef MemizeCacheNode
  4339. *
  4340. * @property {?MemizeCacheNode|undefined} [prev] Previous node.
  4341. * @property {?MemizeCacheNode|undefined} [next] Next node.
  4342. * @property {Array<*>} args Function arguments for cache
  4343. * entry.
  4344. * @property {*} val Function result.
  4345. */
  4346. /**
  4347. * Properties of the enhanced function for controlling cache.
  4348. *
  4349. * @typedef MemizeMemoizedFunction
  4350. *
  4351. * @property {()=>void} clear Clear the cache.
  4352. */
  4353. /**
  4354. * Accepts a function to be memoized, and returns a new memoized function, with
  4355. * optional options.
  4356. *
  4357. * @template {Function} F
  4358. *
  4359. * @param {F} fn Function to memoize.
  4360. * @param {MemizeOptions} [options] Options object.
  4361. *
  4362. * @return {F & MemizeMemoizedFunction} Memoized function.
  4363. */
  4364. function memize( fn, options ) {
  4365. var size = 0;
  4366. /** @type {?MemizeCacheNode|undefined} */
  4367. var head;
  4368. /** @type {?MemizeCacheNode|undefined} */
  4369. var tail;
  4370. options = options || {};
  4371. function memoized( /* ...args */ ) {
  4372. var node = head,
  4373. len = arguments.length,
  4374. args, i;
  4375. searchCache: while ( node ) {
  4376. // Perform a shallow equality test to confirm that whether the node
  4377. // under test is a candidate for the arguments passed. Two arrays
  4378. // are shallowly equal if their length matches and each entry is
  4379. // strictly equal between the two sets. Avoid abstracting to a
  4380. // function which could incur an arguments leaking deoptimization.
  4381. // Check whether node arguments match arguments length
  4382. if ( node.args.length !== arguments.length ) {
  4383. node = node.next;
  4384. continue;
  4385. }
  4386. // Check whether node arguments match arguments values
  4387. for ( i = 0; i < len; i++ ) {
  4388. if ( node.args[ i ] !== arguments[ i ] ) {
  4389. node = node.next;
  4390. continue searchCache;
  4391. }
  4392. }
  4393. // At this point we can assume we've found a match
  4394. // Surface matched node to head if not already
  4395. if ( node !== head ) {
  4396. // As tail, shift to previous. Must only shift if not also
  4397. // head, since if both head and tail, there is no previous.
  4398. if ( node === tail ) {
  4399. tail = node.prev;
  4400. }
  4401. // Adjust siblings to point to each other. If node was tail,
  4402. // this also handles new tail's empty `next` assignment.
  4403. /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next;
  4404. if ( node.next ) {
  4405. node.next.prev = node.prev;
  4406. }
  4407. node.next = head;
  4408. node.prev = null;
  4409. /** @type {MemizeCacheNode} */ ( head ).prev = node;
  4410. head = node;
  4411. }
  4412. // Return immediately
  4413. return node.val;
  4414. }
  4415. // No cached value found. Continue to insertion phase:
  4416. // Create a copy of arguments (avoid leaking deoptimization)
  4417. args = new Array( len );
  4418. for ( i = 0; i < len; i++ ) {
  4419. args[ i ] = arguments[ i ];
  4420. }
  4421. node = {
  4422. args: args,
  4423. // Generate the result from original function
  4424. val: fn.apply( null, args ),
  4425. };
  4426. // Don't need to check whether node is already head, since it would
  4427. // have been returned above already if it was
  4428. // Shift existing head down list
  4429. if ( head ) {
  4430. head.prev = node;
  4431. node.next = head;
  4432. } else {
  4433. // If no head, follows that there's no tail (at initial or reset)
  4434. tail = node;
  4435. }
  4436. // Trim tail if we're reached max size and are pending cache insertion
  4437. if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) {
  4438. tail = /** @type {MemizeCacheNode} */ ( tail ).prev;
  4439. /** @type {MemizeCacheNode} */ ( tail ).next = null;
  4440. } else {
  4441. size++;
  4442. }
  4443. head = node;
  4444. return node.val;
  4445. }
  4446. memoized.clear = function() {
  4447. head = null;
  4448. tail = null;
  4449. size = 0;
  4450. };
  4451. if ( false ) {}
  4452. // Ignore reason: There's not a clear solution to create an intersection of
  4453. // the function with additional properties, where the goal is to retain the
  4454. // function signature of the incoming argument and add control properties
  4455. // on the return value.
  4456. // @ts-ignore
  4457. return memoized;
  4458. }
  4459. module.exports = memize;
  4460. /***/ }),
  4461. /***/ 8383:
  4462. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4463. "use strict";
  4464. var keysShim;
  4465. if (!Object.keys) {
  4466. // modified from https://github.com/es-shims/es5-shim
  4467. var has = Object.prototype.hasOwnProperty;
  4468. var toStr = Object.prototype.toString;
  4469. var isArgs = __webpack_require__(4418); // eslint-disable-line global-require
  4470. var isEnumerable = Object.prototype.propertyIsEnumerable;
  4471. var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
  4472. var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
  4473. var dontEnums = [
  4474. 'toString',
  4475. 'toLocaleString',
  4476. 'valueOf',
  4477. 'hasOwnProperty',
  4478. 'isPrototypeOf',
  4479. 'propertyIsEnumerable',
  4480. 'constructor'
  4481. ];
  4482. var equalsConstructorPrototype = function (o) {
  4483. var ctor = o.constructor;
  4484. return ctor && ctor.prototype === o;
  4485. };
  4486. var excludedKeys = {
  4487. $applicationCache: true,
  4488. $console: true,
  4489. $external: true,
  4490. $frame: true,
  4491. $frameElement: true,
  4492. $frames: true,
  4493. $innerHeight: true,
  4494. $innerWidth: true,
  4495. $onmozfullscreenchange: true,
  4496. $onmozfullscreenerror: true,
  4497. $outerHeight: true,
  4498. $outerWidth: true,
  4499. $pageXOffset: true,
  4500. $pageYOffset: true,
  4501. $parent: true,
  4502. $scrollLeft: true,
  4503. $scrollTop: true,
  4504. $scrollX: true,
  4505. $scrollY: true,
  4506. $self: true,
  4507. $webkitIndexedDB: true,
  4508. $webkitStorageInfo: true,
  4509. $window: true
  4510. };
  4511. var hasAutomationEqualityBug = (function () {
  4512. /* global window */
  4513. if (typeof window === 'undefined') { return false; }
  4514. for (var k in window) {
  4515. try {
  4516. if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
  4517. try {
  4518. equalsConstructorPrototype(window[k]);
  4519. } catch (e) {
  4520. return true;
  4521. }
  4522. }
  4523. } catch (e) {
  4524. return true;
  4525. }
  4526. }
  4527. return false;
  4528. }());
  4529. var equalsConstructorPrototypeIfNotBuggy = function (o) {
  4530. /* global window */
  4531. if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
  4532. return equalsConstructorPrototype(o);
  4533. }
  4534. try {
  4535. return equalsConstructorPrototype(o);
  4536. } catch (e) {
  4537. return false;
  4538. }
  4539. };
  4540. keysShim = function keys(object) {
  4541. var isObject = object !== null && typeof object === 'object';
  4542. var isFunction = toStr.call(object) === '[object Function]';
  4543. var isArguments = isArgs(object);
  4544. var isString = isObject && toStr.call(object) === '[object String]';
  4545. var theKeys = [];
  4546. if (!isObject && !isFunction && !isArguments) {
  4547. throw new TypeError('Object.keys called on a non-object');
  4548. }
  4549. var skipProto = hasProtoEnumBug && isFunction;
  4550. if (isString && object.length > 0 && !has.call(object, 0)) {
  4551. for (var i = 0; i < object.length; ++i) {
  4552. theKeys.push(String(i));
  4553. }
  4554. }
  4555. if (isArguments && object.length > 0) {
  4556. for (var j = 0; j < object.length; ++j) {
  4557. theKeys.push(String(j));
  4558. }
  4559. } else {
  4560. for (var name in object) {
  4561. if (!(skipProto && name === 'prototype') && has.call(object, name)) {
  4562. theKeys.push(String(name));
  4563. }
  4564. }
  4565. }
  4566. if (hasDontEnumBug) {
  4567. var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
  4568. for (var k = 0; k < dontEnums.length; ++k) {
  4569. if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
  4570. theKeys.push(dontEnums[k]);
  4571. }
  4572. }
  4573. }
  4574. return theKeys;
  4575. };
  4576. }
  4577. module.exports = keysShim;
  4578. /***/ }),
  4579. /***/ 806:
  4580. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4581. "use strict";
  4582. var slice = Array.prototype.slice;
  4583. var isArgs = __webpack_require__(4418);
  4584. var origKeys = Object.keys;
  4585. var keysShim = origKeys ? function keys(o) { return origKeys(o); } : __webpack_require__(8383);
  4586. var originalKeys = Object.keys;
  4587. keysShim.shim = function shimObjectKeys() {
  4588. if (Object.keys) {
  4589. var keysWorksWithArguments = (function () {
  4590. // Safari 5.0 bug
  4591. var args = Object.keys(arguments);
  4592. return args && args.length === arguments.length;
  4593. }(1, 2));
  4594. if (!keysWorksWithArguments) {
  4595. Object.keys = function keys(object) { // eslint-disable-line func-name-matching
  4596. if (isArgs(object)) {
  4597. return originalKeys(slice.call(object));
  4598. }
  4599. return originalKeys(object);
  4600. };
  4601. }
  4602. } else {
  4603. Object.keys = keysShim;
  4604. }
  4605. return Object.keys || keysShim;
  4606. };
  4607. module.exports = keysShim;
  4608. /***/ }),
  4609. /***/ 4418:
  4610. /***/ (function(module) {
  4611. "use strict";
  4612. var toStr = Object.prototype.toString;
  4613. module.exports = function isArguments(value) {
  4614. var str = toStr.call(value);
  4615. var isArgs = str === '[object Arguments]';
  4616. if (!isArgs) {
  4617. isArgs = str !== '[object Array]' &&
  4618. value !== null &&
  4619. typeof value === 'object' &&
  4620. typeof value.length === 'number' &&
  4621. value.length >= 0 &&
  4622. toStr.call(value.callee) === '[object Function]';
  4623. }
  4624. return isArgs;
  4625. };
  4626. /***/ }),
  4627. /***/ 2148:
  4628. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4629. "use strict";
  4630. // modified from https://github.com/es-shims/es6-shim
  4631. var keys = __webpack_require__(806);
  4632. var canBeObject = function (obj) {
  4633. return typeof obj !== 'undefined' && obj !== null;
  4634. };
  4635. var hasSymbols = __webpack_require__(5682)();
  4636. var callBound = __webpack_require__(7615);
  4637. var toObject = Object;
  4638. var $push = callBound('Array.prototype.push');
  4639. var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');
  4640. var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
  4641. // eslint-disable-next-line no-unused-vars
  4642. module.exports = function assign(target, source1) {
  4643. if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
  4644. var objTarget = toObject(target);
  4645. var s, source, i, props, syms, value, key;
  4646. for (s = 1; s < arguments.length; ++s) {
  4647. source = toObject(arguments[s]);
  4648. props = keys(source);
  4649. var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
  4650. if (getSymbols) {
  4651. syms = getSymbols(source);
  4652. for (i = 0; i < syms.length; ++i) {
  4653. key = syms[i];
  4654. if ($propIsEnumerable(source, key)) {
  4655. $push(props, key);
  4656. }
  4657. }
  4658. }
  4659. for (i = 0; i < props.length; ++i) {
  4660. key = props[i];
  4661. value = source[key];
  4662. if ($propIsEnumerable(source, key)) {
  4663. objTarget[key] = value;
  4664. }
  4665. }
  4666. }
  4667. return objTarget;
  4668. };
  4669. /***/ }),
  4670. /***/ 4011:
  4671. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4672. "use strict";
  4673. var defineProperties = __webpack_require__(9170);
  4674. var callBind = __webpack_require__(2550);
  4675. var implementation = __webpack_require__(2148);
  4676. var getPolyfill = __webpack_require__(293);
  4677. var shim = __webpack_require__(2666);
  4678. var polyfill = callBind.apply(getPolyfill());
  4679. // eslint-disable-next-line no-unused-vars
  4680. var bound = function assign(target, source1) {
  4681. return polyfill(Object, arguments);
  4682. };
  4683. defineProperties(bound, {
  4684. getPolyfill: getPolyfill,
  4685. implementation: implementation,
  4686. shim: shim
  4687. });
  4688. module.exports = bound;
  4689. /***/ }),
  4690. /***/ 293:
  4691. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4692. "use strict";
  4693. var implementation = __webpack_require__(2148);
  4694. var lacksProperEnumerationOrder = function () {
  4695. if (!Object.assign) {
  4696. return false;
  4697. }
  4698. /*
  4699. * v8, specifically in node 4.x, has a bug with incorrect property enumeration order
  4700. * note: this does not detect the bug unless there's 20 characters
  4701. */
  4702. var str = 'abcdefghijklmnopqrst';
  4703. var letters = str.split('');
  4704. var map = {};
  4705. for (var i = 0; i < letters.length; ++i) {
  4706. map[letters[i]] = letters[i];
  4707. }
  4708. var obj = Object.assign({}, map);
  4709. var actual = '';
  4710. for (var k in obj) {
  4711. actual += k;
  4712. }
  4713. return str !== actual;
  4714. };
  4715. var assignHasPendingExceptions = function () {
  4716. if (!Object.assign || !Object.preventExtensions) {
  4717. return false;
  4718. }
  4719. /*
  4720. * Firefox 37 still has "pending exception" logic in its Object.assign implementation,
  4721. * which is 72% slower than our shim, and Firefox 40's native implementation.
  4722. */
  4723. var thrower = Object.preventExtensions({ 1: 2 });
  4724. try {
  4725. Object.assign(thrower, 'xy');
  4726. } catch (e) {
  4727. return thrower[1] === 'y';
  4728. }
  4729. return false;
  4730. };
  4731. module.exports = function getPolyfill() {
  4732. if (!Object.assign) {
  4733. return implementation;
  4734. }
  4735. if (lacksProperEnumerationOrder()) {
  4736. return implementation;
  4737. }
  4738. if (assignHasPendingExceptions()) {
  4739. return implementation;
  4740. }
  4741. return Object.assign;
  4742. };
  4743. /***/ }),
  4744. /***/ 2666:
  4745. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4746. "use strict";
  4747. var define = __webpack_require__(9170);
  4748. var getPolyfill = __webpack_require__(293);
  4749. module.exports = function shimAssign() {
  4750. var polyfill = getPolyfill();
  4751. define(
  4752. Object,
  4753. { assign: polyfill },
  4754. { assign: function () { return Object.assign !== polyfill; } }
  4755. );
  4756. return polyfill;
  4757. };
  4758. /***/ }),
  4759. /***/ 1631:
  4760. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4761. "use strict";
  4762. var has = __webpack_require__(9284);
  4763. var RequireObjectCoercible = __webpack_require__(604);
  4764. var callBound = __webpack_require__(7615);
  4765. var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
  4766. module.exports = function values(O) {
  4767. var obj = RequireObjectCoercible(O);
  4768. var vals = [];
  4769. for (var key in obj) {
  4770. if (has(obj, key) && $isEnumerable(obj, key)) {
  4771. vals.push(obj[key]);
  4772. }
  4773. }
  4774. return vals;
  4775. };
  4776. /***/ }),
  4777. /***/ 5861:
  4778. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4779. "use strict";
  4780. var define = __webpack_require__(9170);
  4781. var callBind = __webpack_require__(2550);
  4782. var implementation = __webpack_require__(1631);
  4783. var getPolyfill = __webpack_require__(779);
  4784. var shim = __webpack_require__(7256);
  4785. var polyfill = callBind(getPolyfill(), Object);
  4786. define(polyfill, {
  4787. getPolyfill: getPolyfill,
  4788. implementation: implementation,
  4789. shim: shim
  4790. });
  4791. module.exports = polyfill;
  4792. /***/ }),
  4793. /***/ 604:
  4794. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4795. "use strict";
  4796. module.exports = __webpack_require__(2559);
  4797. /***/ }),
  4798. /***/ 2559:
  4799. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4800. "use strict";
  4801. var GetIntrinsic = __webpack_require__(6732);
  4802. var $TypeError = GetIntrinsic('%TypeError%');
  4803. // http://www.ecma-international.org/ecma-262/5.1/#sec-9.10
  4804. module.exports = function CheckObjectCoercible(value, optMessage) {
  4805. if (value == null) {
  4806. throw new $TypeError(optMessage || ('Cannot call method on ' + value));
  4807. }
  4808. return value;
  4809. };
  4810. /***/ }),
  4811. /***/ 6732:
  4812. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4813. "use strict";
  4814. /* globals
  4815. AggregateError,
  4816. Atomics,
  4817. FinalizationRegistry,
  4818. SharedArrayBuffer,
  4819. WeakRef,
  4820. */
  4821. var undefined;
  4822. var $SyntaxError = SyntaxError;
  4823. var $Function = Function;
  4824. var $TypeError = TypeError;
  4825. // eslint-disable-next-line consistent-return
  4826. var getEvalledConstructor = function (expressionSyntax) {
  4827. try {
  4828. // eslint-disable-next-line no-new-func
  4829. return Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
  4830. } catch (e) {}
  4831. };
  4832. var $gOPD = Object.getOwnPropertyDescriptor;
  4833. if ($gOPD) {
  4834. try {
  4835. $gOPD({}, '');
  4836. } catch (e) {
  4837. $gOPD = null; // this is IE 8, which has a broken gOPD
  4838. }
  4839. }
  4840. var throwTypeError = function () { throw new $TypeError(); };
  4841. var ThrowTypeError = $gOPD
  4842. ? (function () {
  4843. try {
  4844. // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
  4845. arguments.callee; // IE 8 does not throw here
  4846. return throwTypeError;
  4847. } catch (calleeThrows) {
  4848. try {
  4849. // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
  4850. return $gOPD(arguments, 'callee').get;
  4851. } catch (gOPDthrows) {
  4852. return throwTypeError;
  4853. }
  4854. }
  4855. }())
  4856. : throwTypeError;
  4857. var hasSymbols = __webpack_require__(9905)();
  4858. var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
  4859. var asyncGenFunction = getEvalledConstructor('async function* () {}');
  4860. var asyncGenFunctionPrototype = asyncGenFunction ? asyncGenFunction.prototype : undefined;
  4861. var asyncGenPrototype = asyncGenFunctionPrototype ? asyncGenFunctionPrototype.prototype : undefined;
  4862. var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
  4863. var INTRINSICS = {
  4864. '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
  4865. '%Array%': Array,
  4866. '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
  4867. '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
  4868. '%AsyncFromSyncIteratorPrototype%': undefined,
  4869. '%AsyncFunction%': getEvalledConstructor('async function () {}'),
  4870. '%AsyncGenerator%': asyncGenFunctionPrototype,
  4871. '%AsyncGeneratorFunction%': asyncGenFunction,
  4872. '%AsyncIteratorPrototype%': asyncGenPrototype ? getProto(asyncGenPrototype) : undefined,
  4873. '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
  4874. '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
  4875. '%Boolean%': Boolean,
  4876. '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
  4877. '%Date%': Date,
  4878. '%decodeURI%': decodeURI,
  4879. '%decodeURIComponent%': decodeURIComponent,
  4880. '%encodeURI%': encodeURI,
  4881. '%encodeURIComponent%': encodeURIComponent,
  4882. '%Error%': Error,
  4883. '%eval%': eval, // eslint-disable-line no-eval
  4884. '%EvalError%': EvalError,
  4885. '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
  4886. '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
  4887. '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
  4888. '%Function%': $Function,
  4889. '%GeneratorFunction%': getEvalledConstructor('function* () {}'),
  4890. '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
  4891. '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
  4892. '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
  4893. '%isFinite%': isFinite,
  4894. '%isNaN%': isNaN,
  4895. '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
  4896. '%JSON%': typeof JSON === 'object' ? JSON : undefined,
  4897. '%Map%': typeof Map === 'undefined' ? undefined : Map,
  4898. '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
  4899. '%Math%': Math,
  4900. '%Number%': Number,
  4901. '%Object%': Object,
  4902. '%parseFloat%': parseFloat,
  4903. '%parseInt%': parseInt,
  4904. '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
  4905. '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
  4906. '%RangeError%': RangeError,
  4907. '%ReferenceError%': ReferenceError,
  4908. '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
  4909. '%RegExp%': RegExp,
  4910. '%Set%': typeof Set === 'undefined' ? undefined : Set,
  4911. '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
  4912. '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
  4913. '%String%': String,
  4914. '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
  4915. '%Symbol%': hasSymbols ? Symbol : undefined,
  4916. '%SyntaxError%': $SyntaxError,
  4917. '%ThrowTypeError%': ThrowTypeError,
  4918. '%TypedArray%': TypedArray,
  4919. '%TypeError%': $TypeError,
  4920. '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
  4921. '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
  4922. '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
  4923. '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
  4924. '%URIError%': URIError,
  4925. '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
  4926. '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
  4927. '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
  4928. };
  4929. var LEGACY_ALIASES = {
  4930. '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
  4931. '%ArrayPrototype%': ['Array', 'prototype'],
  4932. '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
  4933. '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
  4934. '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
  4935. '%ArrayProto_values%': ['Array', 'prototype', 'values'],
  4936. '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
  4937. '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
  4938. '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
  4939. '%BooleanPrototype%': ['Boolean', 'prototype'],
  4940. '%DataViewPrototype%': ['DataView', 'prototype'],
  4941. '%DatePrototype%': ['Date', 'prototype'],
  4942. '%ErrorPrototype%': ['Error', 'prototype'],
  4943. '%EvalErrorPrototype%': ['EvalError', 'prototype'],
  4944. '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
  4945. '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
  4946. '%FunctionPrototype%': ['Function', 'prototype'],
  4947. '%Generator%': ['GeneratorFunction', 'prototype'],
  4948. '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
  4949. '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
  4950. '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
  4951. '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
  4952. '%JSONParse%': ['JSON', 'parse'],
  4953. '%JSONStringify%': ['JSON', 'stringify'],
  4954. '%MapPrototype%': ['Map', 'prototype'],
  4955. '%NumberPrototype%': ['Number', 'prototype'],
  4956. '%ObjectPrototype%': ['Object', 'prototype'],
  4957. '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
  4958. '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
  4959. '%PromisePrototype%': ['Promise', 'prototype'],
  4960. '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
  4961. '%Promise_all%': ['Promise', 'all'],
  4962. '%Promise_reject%': ['Promise', 'reject'],
  4963. '%Promise_resolve%': ['Promise', 'resolve'],
  4964. '%RangeErrorPrototype%': ['RangeError', 'prototype'],
  4965. '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
  4966. '%RegExpPrototype%': ['RegExp', 'prototype'],
  4967. '%SetPrototype%': ['Set', 'prototype'],
  4968. '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
  4969. '%StringPrototype%': ['String', 'prototype'],
  4970. '%SymbolPrototype%': ['Symbol', 'prototype'],
  4971. '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
  4972. '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
  4973. '%TypeErrorPrototype%': ['TypeError', 'prototype'],
  4974. '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
  4975. '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
  4976. '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
  4977. '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
  4978. '%URIErrorPrototype%': ['URIError', 'prototype'],
  4979. '%WeakMapPrototype%': ['WeakMap', 'prototype'],
  4980. '%WeakSetPrototype%': ['WeakSet', 'prototype']
  4981. };
  4982. var bind = __webpack_require__(1930);
  4983. var hasOwn = __webpack_require__(9284);
  4984. var $concat = bind.call(Function.call, Array.prototype.concat);
  4985. var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
  4986. var $replace = bind.call(Function.call, String.prototype.replace);
  4987. /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
  4988. var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
  4989. var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
  4990. var stringToPath = function stringToPath(string) {
  4991. var result = [];
  4992. $replace(string, rePropName, function (match, number, quote, subString) {
  4993. result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
  4994. });
  4995. return result;
  4996. };
  4997. /* end adaptation */
  4998. var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
  4999. var intrinsicName = name;
  5000. var alias;
  5001. if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
  5002. alias = LEGACY_ALIASES[intrinsicName];
  5003. intrinsicName = '%' + alias[0] + '%';
  5004. }
  5005. if (hasOwn(INTRINSICS, intrinsicName)) {
  5006. var value = INTRINSICS[intrinsicName];
  5007. if (typeof value === 'undefined' && !allowMissing) {
  5008. throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
  5009. }
  5010. return {
  5011. alias: alias,
  5012. name: intrinsicName,
  5013. value: value
  5014. };
  5015. }
  5016. throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
  5017. };
  5018. module.exports = function GetIntrinsic(name, allowMissing) {
  5019. if (typeof name !== 'string' || name.length === 0) {
  5020. throw new $TypeError('intrinsic name must be a non-empty string');
  5021. }
  5022. if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
  5023. throw new $TypeError('"allowMissing" argument must be a boolean');
  5024. }
  5025. var parts = stringToPath(name);
  5026. var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
  5027. var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
  5028. var intrinsicRealName = intrinsic.name;
  5029. var value = intrinsic.value;
  5030. var skipFurtherCaching = false;
  5031. var alias = intrinsic.alias;
  5032. if (alias) {
  5033. intrinsicBaseName = alias[0];
  5034. $spliceApply(parts, $concat([0, 1], alias));
  5035. }
  5036. for (var i = 1, isOwn = true; i < parts.length; i += 1) {
  5037. var part = parts[i];
  5038. if (part === 'constructor' || !isOwn) {
  5039. skipFurtherCaching = true;
  5040. }
  5041. intrinsicBaseName += '.' + part;
  5042. intrinsicRealName = '%' + intrinsicBaseName + '%';
  5043. if (hasOwn(INTRINSICS, intrinsicRealName)) {
  5044. value = INTRINSICS[intrinsicRealName];
  5045. } else if (value != null) {
  5046. if ($gOPD && (i + 1) >= parts.length) {
  5047. var desc = $gOPD(value, part);
  5048. isOwn = !!desc;
  5049. if (!allowMissing && !(part in value)) {
  5050. throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
  5051. }
  5052. // By convention, when a data property is converted to an accessor
  5053. // property to emulate a data property that does not suffer from
  5054. // the override mistake, that accessor's getter is marked with
  5055. // an `originalValue` property. Here, when we detect this, we
  5056. // uphold the illusion by pretending to see that original data
  5057. // property, i.e., returning the value rather than the getter
  5058. // itself.
  5059. if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
  5060. value = desc.get;
  5061. } else {
  5062. value = value[part];
  5063. }
  5064. } else {
  5065. isOwn = hasOwn(value, part);
  5066. value = value[part];
  5067. }
  5068. if (isOwn && !skipFurtherCaching) {
  5069. INTRINSICS[intrinsicRealName] = value;
  5070. }
  5071. }
  5072. }
  5073. return value;
  5074. };
  5075. /***/ }),
  5076. /***/ 779:
  5077. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  5078. "use strict";
  5079. var implementation = __webpack_require__(1631);
  5080. module.exports = function getPolyfill() {
  5081. return typeof Object.values === 'function' ? Object.values : implementation;
  5082. };
  5083. /***/ }),
  5084. /***/ 7256:
  5085. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  5086. "use strict";
  5087. var getPolyfill = __webpack_require__(779);
  5088. var define = __webpack_require__(9170);
  5089. module.exports = function shimValues() {
  5090. var polyfill = getPolyfill();
  5091. define(Object, { values: polyfill }, {
  5092. values: function testValues() {
  5093. return Object.values !== polyfill;
  5094. }
  5095. });
  5096. return polyfill;
  5097. };
  5098. /***/ }),
  5099. /***/ 5372:
  5100. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  5101. "use strict";
  5102. /**
  5103. * Copyright (c) 2013-present, Facebook, Inc.
  5104. *
  5105. * This source code is licensed under the MIT license found in the
  5106. * LICENSE file in the root directory of this source tree.
  5107. */
  5108. var ReactPropTypesSecret = __webpack_require__(9567);
  5109. function emptyFunction() {}
  5110. function emptyFunctionWithReset() {}
  5111. emptyFunctionWithReset.resetWarningCache = emptyFunction;
  5112. module.exports = function() {
  5113. function shim(props, propName, componentName, location, propFullName, secret) {
  5114. if (secret === ReactPropTypesSecret) {
  5115. // It is still safe when called from React.
  5116. return;
  5117. }
  5118. var err = new Error(
  5119. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  5120. 'Use PropTypes.checkPropTypes() to call them. ' +
  5121. 'Read more at http://fb.me/use-check-prop-types'
  5122. );
  5123. err.name = 'Invariant Violation';
  5124. throw err;
  5125. };
  5126. shim.isRequired = shim;
  5127. function getShim() {
  5128. return shim;
  5129. };
  5130. // Important!
  5131. // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
  5132. var ReactPropTypes = {
  5133. array: shim,
  5134. bigint: shim,
  5135. bool: shim,
  5136. func: shim,
  5137. number: shim,
  5138. object: shim,
  5139. string: shim,
  5140. symbol: shim,
  5141. any: shim,
  5142. arrayOf: getShim,
  5143. element: shim,
  5144. elementType: shim,
  5145. instanceOf: getShim,
  5146. node: shim,
  5147. objectOf: getShim,
  5148. oneOf: getShim,
  5149. oneOfType: getShim,
  5150. shape: getShim,
  5151. exact: getShim,
  5152. checkPropTypes: emptyFunctionWithReset,
  5153. resetWarningCache: emptyFunction
  5154. };
  5155. ReactPropTypes.PropTypes = ReactPropTypes;
  5156. return ReactPropTypes;
  5157. };
  5158. /***/ }),
  5159. /***/ 2652:
  5160. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  5161. /**
  5162. * Copyright (c) 2013-present, Facebook, Inc.
  5163. *
  5164. * This source code is licensed under the MIT license found in the
  5165. * LICENSE file in the root directory of this source tree.
  5166. */
  5167. if (false) { var throwOnDirectAccess, ReactIs; } else {
  5168. // By explicitly using `prop-types` you are opting into new production behavior.
  5169. // http://fb.me/prop-types-in-prod
  5170. module.exports = __webpack_require__(5372)();
  5171. }
  5172. /***/ }),
  5173. /***/ 9567:
  5174. /***/ (function(module) {
  5175. "use strict";
  5176. /**
  5177. * Copyright (c) 2013-present, Facebook, Inc.
  5178. *
  5179. * This source code is licensed under the MIT license found in the
  5180. * LICENSE file in the root directory of this source tree.
  5181. */
  5182. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  5183. module.exports = ReactPropTypesSecret;
  5184. /***/ }),
  5185. /***/ 2541:
  5186. /***/ (function(module) {
  5187. "use strict";
  5188. /**
  5189. * Copyright (c) 2013-present, Facebook, Inc.
  5190. *
  5191. * This source code is licensed under the MIT license found in the
  5192. * LICENSE file in the root directory of this source tree.
  5193. *
  5194. * @providesModule shallowCompare
  5195. */
  5196. var hasOwnProperty = Object.prototype.hasOwnProperty;
  5197. /**
  5198. * inlined Object.is polyfill to avoid requiring consumers ship their own
  5199. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  5200. */
  5201. function is(x, y) {
  5202. // SameValue algorithm
  5203. if (x === y) {
  5204. // Steps 1-5, 7-10
  5205. // Steps 6.b-6.e: +0 != -0
  5206. // Added the nonzero y check to make Flow happy, but it is redundant
  5207. return x !== 0 || y !== 0 || 1 / x === 1 / y;
  5208. } else {
  5209. // Step 6.a: NaN == NaN
  5210. return x !== x && y !== y;
  5211. }
  5212. }
  5213. /**
  5214. * Performs equality by iterating through keys on an object and returning false
  5215. * when any key has values which are not strictly equal between the arguments.
  5216. * Returns true when the values of all keys are strictly equal.
  5217. */
  5218. function shallowEqual(objA, objB) {
  5219. if (is(objA, objB)) {
  5220. return true;
  5221. }
  5222. if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
  5223. return false;
  5224. }
  5225. var keysA = Object.keys(objA);
  5226. var keysB = Object.keys(objB);
  5227. if (keysA.length !== keysB.length) {
  5228. return false;
  5229. }
  5230. // Test for A's keys different from B.
  5231. for (var i = 0; i < keysA.length; i++) {
  5232. if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
  5233. return false;
  5234. }
  5235. }
  5236. return true;
  5237. }
  5238. /**
  5239. * Does a shallow comparison for props and state.
  5240. * See ReactComponentWithPureRenderMixin
  5241. * See also https://facebook.github.io/react/docs/shallow-compare.html
  5242. */
  5243. function shallowCompare(instance, nextProps, nextState) {
  5244. return (
  5245. !shallowEqual(instance.props, nextProps) ||
  5246. !shallowEqual(instance.state, nextState)
  5247. );
  5248. }
  5249. module.exports = shallowCompare;
  5250. /***/ }),
  5251. /***/ 4185:
  5252. /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
  5253. // eslint-disable-next-line import/no-unresolved
  5254. __webpack_require__(17);
  5255. /***/ }),
  5256. /***/ 7617:
  5257. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  5258. "use strict";
  5259. Object.defineProperty(exports, "__esModule", ({
  5260. value: true
  5261. }));
  5262. exports.PureCalendarDay = undefined;
  5263. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  5264. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5265. var _object = __webpack_require__(4011);
  5266. var _object2 = _interopRequireDefault(_object);
  5267. var _react = __webpack_require__(9196);
  5268. var _react2 = _interopRequireDefault(_react);
  5269. var _propTypes = __webpack_require__(2652);
  5270. var _propTypes2 = _interopRequireDefault(_propTypes);
  5271. var _reactAddonsShallowCompare = __webpack_require__(2541);
  5272. var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
  5273. var _reactMomentProptypes = __webpack_require__(6150);
  5274. var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
  5275. var _airbnbPropTypes = __webpack_require__(4882);
  5276. var _reactWithStyles = __webpack_require__(3576);
  5277. var _moment = __webpack_require__(6292);
  5278. var _moment2 = _interopRequireDefault(_moment);
  5279. var _defaultPhrases = __webpack_require__(6030);
  5280. var _getPhrasePropTypes = __webpack_require__(2893);
  5281. var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
  5282. var _getCalendarDaySettings = __webpack_require__(7475);
  5283. var _getCalendarDaySettings2 = _interopRequireDefault(_getCalendarDaySettings);
  5284. var _ModifiersShape = __webpack_require__(6747);
  5285. var _ModifiersShape2 = _interopRequireDefault(_ModifiersShape);
  5286. var _constants = __webpack_require__(257);
  5287. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  5288. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5289. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5290. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5291. var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
  5292. day: _reactMomentProptypes2['default'].momentObj,
  5293. daySize: _airbnbPropTypes.nonNegativeInteger,
  5294. isOutsideDay: _propTypes2['default'].bool,
  5295. modifiers: _ModifiersShape2['default'],
  5296. isFocused: _propTypes2['default'].bool,
  5297. tabIndex: _propTypes2['default'].oneOf([0, -1]),
  5298. onDayClick: _propTypes2['default'].func,
  5299. onDayMouseEnter: _propTypes2['default'].func,
  5300. onDayMouseLeave: _propTypes2['default'].func,
  5301. renderDayContents: _propTypes2['default'].func,
  5302. ariaLabelFormat: _propTypes2['default'].string,
  5303. // internationalization
  5304. phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.CalendarDayPhrases))
  5305. }));
  5306. var defaultProps = {
  5307. day: (0, _moment2['default'])(),
  5308. daySize: _constants.DAY_SIZE,
  5309. isOutsideDay: false,
  5310. modifiers: new Set(),
  5311. isFocused: false,
  5312. tabIndex: -1,
  5313. onDayClick: function () {
  5314. function onDayClick() {}
  5315. return onDayClick;
  5316. }(),
  5317. onDayMouseEnter: function () {
  5318. function onDayMouseEnter() {}
  5319. return onDayMouseEnter;
  5320. }(),
  5321. onDayMouseLeave: function () {
  5322. function onDayMouseLeave() {}
  5323. return onDayMouseLeave;
  5324. }(),
  5325. renderDayContents: null,
  5326. ariaLabelFormat: 'dddd, LL',
  5327. // internationalization
  5328. phrases: _defaultPhrases.CalendarDayPhrases
  5329. };
  5330. var CalendarDay = function (_React$Component) {
  5331. _inherits(CalendarDay, _React$Component);
  5332. function CalendarDay() {
  5333. var _ref;
  5334. _classCallCheck(this, CalendarDay);
  5335. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  5336. args[_key] = arguments[_key];
  5337. }
  5338. var _this = _possibleConstructorReturn(this, (_ref = CalendarDay.__proto__ || Object.getPrototypeOf(CalendarDay)).call.apply(_ref, [this].concat(args)));
  5339. _this.setButtonRef = _this.setButtonRef.bind(_this);
  5340. return _this;
  5341. }
  5342. _createClass(CalendarDay, [{
  5343. key: 'shouldComponentUpdate',
  5344. value: function () {
  5345. function shouldComponentUpdate(nextProps, nextState) {
  5346. return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
  5347. }
  5348. return shouldComponentUpdate;
  5349. }()
  5350. }, {
  5351. key: 'componentDidUpdate',
  5352. value: function () {
  5353. function componentDidUpdate(prevProps) {
  5354. var _props = this.props,
  5355. isFocused = _props.isFocused,
  5356. tabIndex = _props.tabIndex;
  5357. if (tabIndex === 0) {
  5358. if (isFocused || tabIndex !== prevProps.tabIndex) {
  5359. this.buttonRef.focus();
  5360. }
  5361. }
  5362. }
  5363. return componentDidUpdate;
  5364. }()
  5365. }, {
  5366. key: 'onDayClick',
  5367. value: function () {
  5368. function onDayClick(day, e) {
  5369. var onDayClick = this.props.onDayClick;
  5370. onDayClick(day, e);
  5371. }
  5372. return onDayClick;
  5373. }()
  5374. }, {
  5375. key: 'onDayMouseEnter',
  5376. value: function () {
  5377. function onDayMouseEnter(day, e) {
  5378. var onDayMouseEnter = this.props.onDayMouseEnter;
  5379. onDayMouseEnter(day, e);
  5380. }
  5381. return onDayMouseEnter;
  5382. }()
  5383. }, {
  5384. key: 'onDayMouseLeave',
  5385. value: function () {
  5386. function onDayMouseLeave(day, e) {
  5387. var onDayMouseLeave = this.props.onDayMouseLeave;
  5388. onDayMouseLeave(day, e);
  5389. }
  5390. return onDayMouseLeave;
  5391. }()
  5392. }, {
  5393. key: 'onKeyDown',
  5394. value: function () {
  5395. function onKeyDown(day, e) {
  5396. var onDayClick = this.props.onDayClick;
  5397. var key = e.key;
  5398. if (key === 'Enter' || key === ' ') {
  5399. onDayClick(day, e);
  5400. }
  5401. }
  5402. return onKeyDown;
  5403. }()
  5404. }, {
  5405. key: 'setButtonRef',
  5406. value: function () {
  5407. function setButtonRef(ref) {
  5408. this.buttonRef = ref;
  5409. }
  5410. return setButtonRef;
  5411. }()
  5412. }, {
  5413. key: 'render',
  5414. value: function () {
  5415. function render() {
  5416. var _this2 = this;
  5417. var _props2 = this.props,
  5418. day = _props2.day,
  5419. ariaLabelFormat = _props2.ariaLabelFormat,
  5420. daySize = _props2.daySize,
  5421. isOutsideDay = _props2.isOutsideDay,
  5422. modifiers = _props2.modifiers,
  5423. renderDayContents = _props2.renderDayContents,
  5424. tabIndex = _props2.tabIndex,
  5425. styles = _props2.styles,
  5426. phrases = _props2.phrases;
  5427. if (!day) return _react2['default'].createElement('td', null);
  5428. var _getCalendarDaySettin = (0, _getCalendarDaySettings2['default'])(day, ariaLabelFormat, daySize, modifiers, phrases),
  5429. daySizeStyles = _getCalendarDaySettin.daySizeStyles,
  5430. useDefaultCursor = _getCalendarDaySettin.useDefaultCursor,
  5431. selected = _getCalendarDaySettin.selected,
  5432. hoveredSpan = _getCalendarDaySettin.hoveredSpan,
  5433. isOutsideRange = _getCalendarDaySettin.isOutsideRange,
  5434. ariaLabel = _getCalendarDaySettin.ariaLabel;
  5435. return _react2['default'].createElement(
  5436. 'td',
  5437. _extends({}, (0, _reactWithStyles.css)(styles.CalendarDay, useDefaultCursor && styles.CalendarDay__defaultCursor, styles.CalendarDay__default, isOutsideDay && styles.CalendarDay__outside, modifiers.has('today') && styles.CalendarDay__today, modifiers.has('first-day-of-week') && styles.CalendarDay__firstDayOfWeek, modifiers.has('last-day-of-week') && styles.CalendarDay__lastDayOfWeek, modifiers.has('hovered-offset') && styles.CalendarDay__hovered_offset, modifiers.has('highlighted-calendar') && styles.CalendarDay__highlighted_calendar, modifiers.has('blocked-minimum-nights') && styles.CalendarDay__blocked_minimum_nights, modifiers.has('blocked-calendar') && styles.CalendarDay__blocked_calendar, hoveredSpan && styles.CalendarDay__hovered_span, modifiers.has('selected-span') && styles.CalendarDay__selected_span, modifiers.has('last-in-range') && styles.CalendarDay__last_in_range, modifiers.has('selected-start') && styles.CalendarDay__selected_start, modifiers.has('selected-end') && styles.CalendarDay__selected_end, selected && styles.CalendarDay__selected, isOutsideRange && styles.CalendarDay__blocked_out_of_range, daySizeStyles), {
  5438. role: 'button' // eslint-disable-line jsx-a11y/no-noninteractive-element-to-interactive-role
  5439. , ref: this.setButtonRef,
  5440. 'aria-label': ariaLabel,
  5441. onMouseEnter: function () {
  5442. function onMouseEnter(e) {
  5443. _this2.onDayMouseEnter(day, e);
  5444. }
  5445. return onMouseEnter;
  5446. }(),
  5447. onMouseLeave: function () {
  5448. function onMouseLeave(e) {
  5449. _this2.onDayMouseLeave(day, e);
  5450. }
  5451. return onMouseLeave;
  5452. }(),
  5453. onMouseUp: function () {
  5454. function onMouseUp(e) {
  5455. e.currentTarget.blur();
  5456. }
  5457. return onMouseUp;
  5458. }(),
  5459. onClick: function () {
  5460. function onClick(e) {
  5461. _this2.onDayClick(day, e);
  5462. }
  5463. return onClick;
  5464. }(),
  5465. onKeyDown: function () {
  5466. function onKeyDown(e) {
  5467. _this2.onKeyDown(day, e);
  5468. }
  5469. return onKeyDown;
  5470. }(),
  5471. tabIndex: tabIndex
  5472. }),
  5473. renderDayContents ? renderDayContents(day, modifiers) : day.format('D')
  5474. );
  5475. }
  5476. return render;
  5477. }()
  5478. }]);
  5479. return CalendarDay;
  5480. }(_react2['default'].Component);
  5481. CalendarDay.propTypes = propTypes;
  5482. CalendarDay.defaultProps = defaultProps;
  5483. exports.PureCalendarDay = CalendarDay;
  5484. exports["default"] = (0, _reactWithStyles.withStyles)(function (_ref2) {
  5485. var _ref2$reactDates = _ref2.reactDates,
  5486. color = _ref2$reactDates.color,
  5487. font = _ref2$reactDates.font;
  5488. return {
  5489. CalendarDay: {
  5490. boxSizing: 'border-box',
  5491. cursor: 'pointer',
  5492. fontSize: font.size,
  5493. textAlign: 'center',
  5494. ':active': {
  5495. outline: 0
  5496. }
  5497. },
  5498. CalendarDay__defaultCursor: {
  5499. cursor: 'default'
  5500. },
  5501. CalendarDay__default: {
  5502. border: '1px solid ' + String(color.core.borderLight),
  5503. color: color.text,
  5504. background: color.background,
  5505. ':hover': {
  5506. background: color.core.borderLight,
  5507. border: '1px double ' + String(color.core.borderLight),
  5508. color: 'inherit'
  5509. }
  5510. },
  5511. CalendarDay__hovered_offset: {
  5512. background: color.core.borderBright,
  5513. border: '1px double ' + String(color.core.borderLight),
  5514. color: 'inherit'
  5515. },
  5516. CalendarDay__outside: {
  5517. border: 0,
  5518. background: color.outside.backgroundColor,
  5519. color: color.outside.color,
  5520. ':hover': {
  5521. border: 0
  5522. }
  5523. },
  5524. CalendarDay__blocked_minimum_nights: {
  5525. background: color.minimumNights.backgroundColor,
  5526. border: '1px solid ' + String(color.minimumNights.borderColor),
  5527. color: color.minimumNights.color,
  5528. ':hover': {
  5529. background: color.minimumNights.backgroundColor_hover,
  5530. color: color.minimumNights.color_active
  5531. },
  5532. ':active': {
  5533. background: color.minimumNights.backgroundColor_active,
  5534. color: color.minimumNights.color_active
  5535. }
  5536. },
  5537. CalendarDay__highlighted_calendar: {
  5538. background: color.highlighted.backgroundColor,
  5539. color: color.highlighted.color,
  5540. ':hover': {
  5541. background: color.highlighted.backgroundColor_hover,
  5542. color: color.highlighted.color_active
  5543. },
  5544. ':active': {
  5545. background: color.highlighted.backgroundColor_active,
  5546. color: color.highlighted.color_active
  5547. }
  5548. },
  5549. CalendarDay__selected_span: {
  5550. background: color.selectedSpan.backgroundColor,
  5551. border: '1px solid ' + String(color.selectedSpan.borderColor),
  5552. color: color.selectedSpan.color,
  5553. ':hover': {
  5554. background: color.selectedSpan.backgroundColor_hover,
  5555. border: '1px solid ' + String(color.selectedSpan.borderColor),
  5556. color: color.selectedSpan.color_active
  5557. },
  5558. ':active': {
  5559. background: color.selectedSpan.backgroundColor_active,
  5560. border: '1px solid ' + String(color.selectedSpan.borderColor),
  5561. color: color.selectedSpan.color_active
  5562. }
  5563. },
  5564. CalendarDay__last_in_range: {
  5565. borderRight: color.core.primary
  5566. },
  5567. CalendarDay__selected: {
  5568. background: color.selected.backgroundColor,
  5569. border: '1px solid ' + String(color.selected.borderColor),
  5570. color: color.selected.color,
  5571. ':hover': {
  5572. background: color.selected.backgroundColor_hover,
  5573. border: '1px solid ' + String(color.selected.borderColor),
  5574. color: color.selected.color_active
  5575. },
  5576. ':active': {
  5577. background: color.selected.backgroundColor_active,
  5578. border: '1px solid ' + String(color.selected.borderColor),
  5579. color: color.selected.color_active
  5580. }
  5581. },
  5582. CalendarDay__hovered_span: {
  5583. background: color.hoveredSpan.backgroundColor,
  5584. border: '1px solid ' + String(color.hoveredSpan.borderColor),
  5585. color: color.hoveredSpan.color,
  5586. ':hover': {
  5587. background: color.hoveredSpan.backgroundColor_hover,
  5588. border: '1px solid ' + String(color.hoveredSpan.borderColor),
  5589. color: color.hoveredSpan.color_active
  5590. },
  5591. ':active': {
  5592. background: color.hoveredSpan.backgroundColor_active,
  5593. border: '1px solid ' + String(color.hoveredSpan.borderColor),
  5594. color: color.hoveredSpan.color_active
  5595. }
  5596. },
  5597. CalendarDay__blocked_calendar: {
  5598. background: color.blocked_calendar.backgroundColor,
  5599. border: '1px solid ' + String(color.blocked_calendar.borderColor),
  5600. color: color.blocked_calendar.color,
  5601. ':hover': {
  5602. background: color.blocked_calendar.backgroundColor_hover,
  5603. border: '1px solid ' + String(color.blocked_calendar.borderColor),
  5604. color: color.blocked_calendar.color_active
  5605. },
  5606. ':active': {
  5607. background: color.blocked_calendar.backgroundColor_active,
  5608. border: '1px solid ' + String(color.blocked_calendar.borderColor),
  5609. color: color.blocked_calendar.color_active
  5610. }
  5611. },
  5612. CalendarDay__blocked_out_of_range: {
  5613. background: color.blocked_out_of_range.backgroundColor,
  5614. border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
  5615. color: color.blocked_out_of_range.color,
  5616. ':hover': {
  5617. background: color.blocked_out_of_range.backgroundColor_hover,
  5618. border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
  5619. color: color.blocked_out_of_range.color_active
  5620. },
  5621. ':active': {
  5622. background: color.blocked_out_of_range.backgroundColor_active,
  5623. border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
  5624. color: color.blocked_out_of_range.color_active
  5625. }
  5626. },
  5627. CalendarDay__selected_start: {},
  5628. CalendarDay__selected_end: {},
  5629. CalendarDay__today: {},
  5630. CalendarDay__firstDayOfWeek: {},
  5631. CalendarDay__lastDayOfWeek: {}
  5632. };
  5633. })(CalendarDay);
  5634. /***/ }),
  5635. /***/ 5986:
  5636. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  5637. "use strict";
  5638. Object.defineProperty(exports, "__esModule", ({
  5639. value: true
  5640. }));
  5641. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  5642. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5643. var _object = __webpack_require__(4011);
  5644. var _object2 = _interopRequireDefault(_object);
  5645. var _react = __webpack_require__(9196);
  5646. var _react2 = _interopRequireDefault(_react);
  5647. var _propTypes = __webpack_require__(2652);
  5648. var _propTypes2 = _interopRequireDefault(_propTypes);
  5649. var _reactAddonsShallowCompare = __webpack_require__(2541);
  5650. var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
  5651. var _reactMomentProptypes = __webpack_require__(6150);
  5652. var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
  5653. var _airbnbPropTypes = __webpack_require__(4882);
  5654. var _reactWithStyles = __webpack_require__(3576);
  5655. var _moment = __webpack_require__(6292);
  5656. var _moment2 = _interopRequireDefault(_moment);
  5657. var _defaultPhrases = __webpack_require__(6030);
  5658. var _getPhrasePropTypes = __webpack_require__(2893);
  5659. var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
  5660. var _CalendarWeek = __webpack_require__(4604);
  5661. var _CalendarWeek2 = _interopRequireDefault(_CalendarWeek);
  5662. var _CalendarDay = __webpack_require__(7617);
  5663. var _CalendarDay2 = _interopRequireDefault(_CalendarDay);
  5664. var _calculateDimension = __webpack_require__(8607);
  5665. var _calculateDimension2 = _interopRequireDefault(_calculateDimension);
  5666. var _getCalendarMonthWeeks = __webpack_require__(5644);
  5667. var _getCalendarMonthWeeks2 = _interopRequireDefault(_getCalendarMonthWeeks);
  5668. var _isSameDay = __webpack_require__(3923);
  5669. var _isSameDay2 = _interopRequireDefault(_isSameDay);
  5670. var _toISODateString = __webpack_require__(7310);
  5671. var _toISODateString2 = _interopRequireDefault(_toISODateString);
  5672. var _ModifiersShape = __webpack_require__(6747);
  5673. var _ModifiersShape2 = _interopRequireDefault(_ModifiersShape);
  5674. var _ScrollableOrientationShape = __webpack_require__(6553);
  5675. var _ScrollableOrientationShape2 = _interopRequireDefault(_ScrollableOrientationShape);
  5676. var _DayOfWeekShape = __webpack_require__(243);
  5677. var _DayOfWeekShape2 = _interopRequireDefault(_DayOfWeekShape);
  5678. var _constants = __webpack_require__(257);
  5679. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  5680. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5681. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5682. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint react/no-array-index-key: 0 */
  5683. var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
  5684. month: _reactMomentProptypes2['default'].momentObj,
  5685. horizontalMonthPadding: _airbnbPropTypes.nonNegativeInteger,
  5686. isVisible: _propTypes2['default'].bool,
  5687. enableOutsideDays: _propTypes2['default'].bool,
  5688. modifiers: _propTypes2['default'].objectOf(_ModifiersShape2['default']),
  5689. orientation: _ScrollableOrientationShape2['default'],
  5690. daySize: _airbnbPropTypes.nonNegativeInteger,
  5691. onDayClick: _propTypes2['default'].func,
  5692. onDayMouseEnter: _propTypes2['default'].func,
  5693. onDayMouseLeave: _propTypes2['default'].func,
  5694. onMonthSelect: _propTypes2['default'].func,
  5695. onYearSelect: _propTypes2['default'].func,
  5696. renderMonthText: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
  5697. renderCalendarDay: _propTypes2['default'].func,
  5698. renderDayContents: _propTypes2['default'].func,
  5699. renderMonthElement: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
  5700. firstDayOfWeek: _DayOfWeekShape2['default'],
  5701. setMonthTitleHeight: _propTypes2['default'].func,
  5702. verticalBorderSpacing: _airbnbPropTypes.nonNegativeInteger,
  5703. focusedDate: _reactMomentProptypes2['default'].momentObj, // indicates focusable day
  5704. isFocused: _propTypes2['default'].bool, // indicates whether or not to move focus to focusable day
  5705. // i18n
  5706. monthFormat: _propTypes2['default'].string,
  5707. phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.CalendarDayPhrases)),
  5708. dayAriaLabelFormat: _propTypes2['default'].string
  5709. }));
  5710. var defaultProps = {
  5711. month: (0, _moment2['default'])(),
  5712. horizontalMonthPadding: 13,
  5713. isVisible: true,
  5714. enableOutsideDays: false,
  5715. modifiers: {},
  5716. orientation: _constants.HORIZONTAL_ORIENTATION,
  5717. daySize: _constants.DAY_SIZE,
  5718. onDayClick: function () {
  5719. function onDayClick() {}
  5720. return onDayClick;
  5721. }(),
  5722. onDayMouseEnter: function () {
  5723. function onDayMouseEnter() {}
  5724. return onDayMouseEnter;
  5725. }(),
  5726. onDayMouseLeave: function () {
  5727. function onDayMouseLeave() {}
  5728. return onDayMouseLeave;
  5729. }(),
  5730. onMonthSelect: function () {
  5731. function onMonthSelect() {}
  5732. return onMonthSelect;
  5733. }(),
  5734. onYearSelect: function () {
  5735. function onYearSelect() {}
  5736. return onYearSelect;
  5737. }(),
  5738. renderMonthText: null,
  5739. renderCalendarDay: function () {
  5740. function renderCalendarDay(props) {
  5741. return _react2['default'].createElement(_CalendarDay2['default'], props);
  5742. }
  5743. return renderCalendarDay;
  5744. }(),
  5745. renderDayContents: null,
  5746. renderMonthElement: null,
  5747. firstDayOfWeek: null,
  5748. setMonthTitleHeight: null,
  5749. focusedDate: null,
  5750. isFocused: false,
  5751. // i18n
  5752. monthFormat: 'MMMM YYYY', // english locale
  5753. phrases: _defaultPhrases.CalendarDayPhrases,
  5754. dayAriaLabelFormat: undefined,
  5755. verticalBorderSpacing: undefined
  5756. };
  5757. var CalendarMonth = function (_React$Component) {
  5758. _inherits(CalendarMonth, _React$Component);
  5759. function CalendarMonth(props) {
  5760. _classCallCheck(this, CalendarMonth);
  5761. var _this = _possibleConstructorReturn(this, (CalendarMonth.__proto__ || Object.getPrototypeOf(CalendarMonth)).call(this, props));
  5762. _this.state = {
  5763. weeks: (0, _getCalendarMonthWeeks2['default'])(props.month, props.enableOutsideDays, props.firstDayOfWeek == null ? _moment2['default'].localeData().firstDayOfWeek() : props.firstDayOfWeek)
  5764. };
  5765. _this.setCaptionRef = _this.setCaptionRef.bind(_this);
  5766. _this.setMonthTitleHeight = _this.setMonthTitleHeight.bind(_this);
  5767. return _this;
  5768. }
  5769. _createClass(CalendarMonth, [{
  5770. key: 'componentDidMount',
  5771. value: function () {
  5772. function componentDidMount() {
  5773. this.setMonthTitleHeightTimeout = setTimeout(this.setMonthTitleHeight, 0);
  5774. }
  5775. return componentDidMount;
  5776. }()
  5777. }, {
  5778. key: 'componentWillReceiveProps',
  5779. value: function () {
  5780. function componentWillReceiveProps(nextProps) {
  5781. var month = nextProps.month,
  5782. enableOutsideDays = nextProps.enableOutsideDays,
  5783. firstDayOfWeek = nextProps.firstDayOfWeek;
  5784. var _props = this.props,
  5785. prevMonth = _props.month,
  5786. prevEnableOutsideDays = _props.enableOutsideDays,
  5787. prevFirstDayOfWeek = _props.firstDayOfWeek;
  5788. if (!month.isSame(prevMonth) || enableOutsideDays !== prevEnableOutsideDays || firstDayOfWeek !== prevFirstDayOfWeek) {
  5789. this.setState({
  5790. weeks: (0, _getCalendarMonthWeeks2['default'])(month, enableOutsideDays, firstDayOfWeek == null ? _moment2['default'].localeData().firstDayOfWeek() : firstDayOfWeek)
  5791. });
  5792. }
  5793. }
  5794. return componentWillReceiveProps;
  5795. }()
  5796. }, {
  5797. key: 'shouldComponentUpdate',
  5798. value: function () {
  5799. function shouldComponentUpdate(nextProps, nextState) {
  5800. return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
  5801. }
  5802. return shouldComponentUpdate;
  5803. }()
  5804. }, {
  5805. key: 'componentWillUnmount',
  5806. value: function () {
  5807. function componentWillUnmount() {
  5808. if (this.setMonthTitleHeightTimeout) {
  5809. clearTimeout(this.setMonthTitleHeightTimeout);
  5810. }
  5811. }
  5812. return componentWillUnmount;
  5813. }()
  5814. }, {
  5815. key: 'setMonthTitleHeight',
  5816. value: function () {
  5817. function setMonthTitleHeight() {
  5818. var setMonthTitleHeight = this.props.setMonthTitleHeight;
  5819. if (setMonthTitleHeight) {
  5820. var captionHeight = (0, _calculateDimension2['default'])(this.captionRef, 'height', true, true);
  5821. setMonthTitleHeight(captionHeight);
  5822. }
  5823. }
  5824. return setMonthTitleHeight;
  5825. }()
  5826. }, {
  5827. key: 'setCaptionRef',
  5828. value: function () {
  5829. function setCaptionRef(ref) {
  5830. this.captionRef = ref;
  5831. }
  5832. return setCaptionRef;
  5833. }()
  5834. }, {
  5835. key: 'render',
  5836. value: function () {
  5837. function render() {
  5838. var _props2 = this.props,
  5839. dayAriaLabelFormat = _props2.dayAriaLabelFormat,
  5840. daySize = _props2.daySize,
  5841. focusedDate = _props2.focusedDate,
  5842. horizontalMonthPadding = _props2.horizontalMonthPadding,
  5843. isFocused = _props2.isFocused,
  5844. isVisible = _props2.isVisible,
  5845. modifiers = _props2.modifiers,
  5846. month = _props2.month,
  5847. monthFormat = _props2.monthFormat,
  5848. onDayClick = _props2.onDayClick,
  5849. onDayMouseEnter = _props2.onDayMouseEnter,
  5850. onDayMouseLeave = _props2.onDayMouseLeave,
  5851. onMonthSelect = _props2.onMonthSelect,
  5852. onYearSelect = _props2.onYearSelect,
  5853. orientation = _props2.orientation,
  5854. phrases = _props2.phrases,
  5855. renderCalendarDay = _props2.renderCalendarDay,
  5856. renderDayContents = _props2.renderDayContents,
  5857. renderMonthElement = _props2.renderMonthElement,
  5858. renderMonthText = _props2.renderMonthText,
  5859. styles = _props2.styles,
  5860. verticalBorderSpacing = _props2.verticalBorderSpacing;
  5861. var weeks = this.state.weeks;
  5862. var monthTitle = renderMonthText ? renderMonthText(month) : month.format(monthFormat);
  5863. var verticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
  5864. return _react2['default'].createElement(
  5865. 'div',
  5866. _extends({}, (0, _reactWithStyles.css)(styles.CalendarMonth, { padding: '0 ' + String(horizontalMonthPadding) + 'px' }), {
  5867. 'data-visible': isVisible
  5868. }),
  5869. _react2['default'].createElement(
  5870. 'div',
  5871. _extends({
  5872. ref: this.setCaptionRef
  5873. }, (0, _reactWithStyles.css)(styles.CalendarMonth_caption, verticalScrollable && styles.CalendarMonth_caption__verticalScrollable)),
  5874. renderMonthElement ? renderMonthElement({ month: month, onMonthSelect: onMonthSelect, onYearSelect: onYearSelect }) : _react2['default'].createElement(
  5875. 'strong',
  5876. null,
  5877. monthTitle
  5878. )
  5879. ),
  5880. _react2['default'].createElement(
  5881. 'table',
  5882. _extends({}, (0, _reactWithStyles.css)(!verticalBorderSpacing && styles.CalendarMonth_table, verticalBorderSpacing && styles.CalendarMonth_verticalSpacing, verticalBorderSpacing && { borderSpacing: '0px ' + String(verticalBorderSpacing) + 'px' }), {
  5883. role: 'presentation'
  5884. }),
  5885. _react2['default'].createElement(
  5886. 'tbody',
  5887. null,
  5888. weeks.map(function (week, i) {
  5889. return _react2['default'].createElement(
  5890. _CalendarWeek2['default'],
  5891. { key: i },
  5892. week.map(function (day, dayOfWeek) {
  5893. return renderCalendarDay({
  5894. key: dayOfWeek,
  5895. day: day,
  5896. daySize: daySize,
  5897. isOutsideDay: !day || day.month() !== month.month(),
  5898. tabIndex: isVisible && (0, _isSameDay2['default'])(day, focusedDate) ? 0 : -1,
  5899. isFocused: isFocused,
  5900. onDayMouseEnter: onDayMouseEnter,
  5901. onDayMouseLeave: onDayMouseLeave,
  5902. onDayClick: onDayClick,
  5903. renderDayContents: renderDayContents,
  5904. phrases: phrases,
  5905. modifiers: modifiers[(0, _toISODateString2['default'])(day)],
  5906. ariaLabelFormat: dayAriaLabelFormat
  5907. });
  5908. })
  5909. );
  5910. })
  5911. )
  5912. )
  5913. );
  5914. }
  5915. return render;
  5916. }()
  5917. }]);
  5918. return CalendarMonth;
  5919. }(_react2['default'].Component);
  5920. CalendarMonth.propTypes = propTypes;
  5921. CalendarMonth.defaultProps = defaultProps;
  5922. exports["default"] = (0, _reactWithStyles.withStyles)(function (_ref) {
  5923. var _ref$reactDates = _ref.reactDates,
  5924. color = _ref$reactDates.color,
  5925. font = _ref$reactDates.font,
  5926. spacing = _ref$reactDates.spacing;
  5927. return {
  5928. CalendarMonth: {
  5929. background: color.background,
  5930. textAlign: 'center',
  5931. verticalAlign: 'top',
  5932. userSelect: 'none'
  5933. },
  5934. CalendarMonth_table: {
  5935. borderCollapse: 'collapse',
  5936. borderSpacing: 0
  5937. },
  5938. CalendarMonth_verticalSpacing: {
  5939. borderCollapse: 'separate'
  5940. },
  5941. CalendarMonth_caption: {
  5942. color: color.text,
  5943. fontSize: font.captionSize,
  5944. textAlign: 'center',
  5945. paddingTop: spacing.captionPaddingTop,
  5946. paddingBottom: spacing.captionPaddingBottom,
  5947. captionSide: 'initial'
  5948. },
  5949. CalendarMonth_caption__verticalScrollable: {
  5950. paddingTop: 12,
  5951. paddingBottom: 7
  5952. }
  5953. };
  5954. })(CalendarMonth);
  5955. /***/ }),
  5956. /***/ 7938:
  5957. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  5958. "use strict";
  5959. Object.defineProperty(exports, "__esModule", ({
  5960. value: true
  5961. }));
  5962. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  5963. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5964. var _object = __webpack_require__(4011);
  5965. var _object2 = _interopRequireDefault(_object);
  5966. var _react = __webpack_require__(9196);
  5967. var _react2 = _interopRequireDefault(_react);
  5968. var _propTypes = __webpack_require__(2652);
  5969. var _propTypes2 = _interopRequireDefault(_propTypes);
  5970. var _reactAddonsShallowCompare = __webpack_require__(2541);
  5971. var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
  5972. var _reactMomentProptypes = __webpack_require__(6150);
  5973. var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
  5974. var _airbnbPropTypes = __webpack_require__(4882);
  5975. var _reactWithStyles = __webpack_require__(3576);
  5976. var _moment = __webpack_require__(6292);
  5977. var _moment2 = _interopRequireDefault(_moment);
  5978. var _consolidatedEvents = __webpack_require__(8495);
  5979. var _defaultPhrases = __webpack_require__(6030);
  5980. var _getPhrasePropTypes = __webpack_require__(2893);
  5981. var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
  5982. var _CalendarMonth = __webpack_require__(5986);
  5983. var _CalendarMonth2 = _interopRequireDefault(_CalendarMonth);
  5984. var _isTransitionEndSupported = __webpack_require__(7978);
  5985. var _isTransitionEndSupported2 = _interopRequireDefault(_isTransitionEndSupported);
  5986. var _getTransformStyles = __webpack_require__(8304);
  5987. var _getTransformStyles2 = _interopRequireDefault(_getTransformStyles);
  5988. var _getCalendarMonthWidth = __webpack_require__(8964);
  5989. var _getCalendarMonthWidth2 = _interopRequireDefault(_getCalendarMonthWidth);
  5990. var _toISOMonthString = __webpack_require__(2705);
  5991. var _toISOMonthString2 = _interopRequireDefault(_toISOMonthString);
  5992. var _isPrevMonth = __webpack_require__(3858);
  5993. var _isPrevMonth2 = _interopRequireDefault(_isPrevMonth);
  5994. var _isNextMonth = __webpack_require__(1310);
  5995. var _isNextMonth2 = _interopRequireDefault(_isNextMonth);
  5996. var _ModifiersShape = __webpack_require__(6747);
  5997. var _ModifiersShape2 = _interopRequireDefault(_ModifiersShape);
  5998. var _ScrollableOrientationShape = __webpack_require__(6553);
  5999. var _ScrollableOrientationShape2 = _interopRequireDefault(_ScrollableOrientationShape);
  6000. var _DayOfWeekShape = __webpack_require__(243);
  6001. var _DayOfWeekShape2 = _interopRequireDefault(_DayOfWeekShape);
  6002. var _constants = __webpack_require__(257);
  6003. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  6004. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6005. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6006. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6007. var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
  6008. enableOutsideDays: _propTypes2['default'].bool,
  6009. firstVisibleMonthIndex: _propTypes2['default'].number,
  6010. horizontalMonthPadding: _airbnbPropTypes.nonNegativeInteger,
  6011. initialMonth: _reactMomentProptypes2['default'].momentObj,
  6012. isAnimating: _propTypes2['default'].bool,
  6013. numberOfMonths: _propTypes2['default'].number,
  6014. modifiers: _propTypes2['default'].objectOf(_propTypes2['default'].objectOf(_ModifiersShape2['default'])),
  6015. orientation: _ScrollableOrientationShape2['default'],
  6016. onDayClick: _propTypes2['default'].func,
  6017. onDayMouseEnter: _propTypes2['default'].func,
  6018. onDayMouseLeave: _propTypes2['default'].func,
  6019. onMonthTransitionEnd: _propTypes2['default'].func,
  6020. onMonthChange: _propTypes2['default'].func,
  6021. onYearChange: _propTypes2['default'].func,
  6022. renderMonthText: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
  6023. renderCalendarDay: _propTypes2['default'].func,
  6024. renderDayContents: _propTypes2['default'].func,
  6025. translationValue: _propTypes2['default'].number,
  6026. renderMonthElement: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
  6027. daySize: _airbnbPropTypes.nonNegativeInteger,
  6028. focusedDate: _reactMomentProptypes2['default'].momentObj, // indicates focusable day
  6029. isFocused: _propTypes2['default'].bool, // indicates whether or not to move focus to focusable day
  6030. firstDayOfWeek: _DayOfWeekShape2['default'],
  6031. setMonthTitleHeight: _propTypes2['default'].func,
  6032. isRTL: _propTypes2['default'].bool,
  6033. transitionDuration: _airbnbPropTypes.nonNegativeInteger,
  6034. verticalBorderSpacing: _airbnbPropTypes.nonNegativeInteger,
  6035. // i18n
  6036. monthFormat: _propTypes2['default'].string,
  6037. phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.CalendarDayPhrases)),
  6038. dayAriaLabelFormat: _propTypes2['default'].string
  6039. }));
  6040. var defaultProps = {
  6041. enableOutsideDays: false,
  6042. firstVisibleMonthIndex: 0,
  6043. horizontalMonthPadding: 13,
  6044. initialMonth: (0, _moment2['default'])(),
  6045. isAnimating: false,
  6046. numberOfMonths: 1,
  6047. modifiers: {},
  6048. orientation: _constants.HORIZONTAL_ORIENTATION,
  6049. onDayClick: function () {
  6050. function onDayClick() {}
  6051. return onDayClick;
  6052. }(),
  6053. onDayMouseEnter: function () {
  6054. function onDayMouseEnter() {}
  6055. return onDayMouseEnter;
  6056. }(),
  6057. onDayMouseLeave: function () {
  6058. function onDayMouseLeave() {}
  6059. return onDayMouseLeave;
  6060. }(),
  6061. onMonthChange: function () {
  6062. function onMonthChange() {}
  6063. return onMonthChange;
  6064. }(),
  6065. onYearChange: function () {
  6066. function onYearChange() {}
  6067. return onYearChange;
  6068. }(),
  6069. onMonthTransitionEnd: function () {
  6070. function onMonthTransitionEnd() {}
  6071. return onMonthTransitionEnd;
  6072. }(),
  6073. renderMonthText: null,
  6074. renderCalendarDay: undefined,
  6075. renderDayContents: null,
  6076. translationValue: null,
  6077. renderMonthElement: null,
  6078. daySize: _constants.DAY_SIZE,
  6079. focusedDate: null,
  6080. isFocused: false,
  6081. firstDayOfWeek: null,
  6082. setMonthTitleHeight: null,
  6083. isRTL: false,
  6084. transitionDuration: 200,
  6085. verticalBorderSpacing: undefined,
  6086. // i18n
  6087. monthFormat: 'MMMM YYYY', // english locale
  6088. phrases: _defaultPhrases.CalendarDayPhrases,
  6089. dayAriaLabelFormat: undefined
  6090. };
  6091. function getMonths(initialMonth, numberOfMonths, withoutTransitionMonths) {
  6092. var month = initialMonth.clone();
  6093. if (!withoutTransitionMonths) month = month.subtract(1, 'month');
  6094. var months = [];
  6095. for (var i = 0; i < (withoutTransitionMonths ? numberOfMonths : numberOfMonths + 2); i += 1) {
  6096. months.push(month);
  6097. month = month.clone().add(1, 'month');
  6098. }
  6099. return months;
  6100. }
  6101. var CalendarMonthGrid = function (_React$Component) {
  6102. _inherits(CalendarMonthGrid, _React$Component);
  6103. function CalendarMonthGrid(props) {
  6104. _classCallCheck(this, CalendarMonthGrid);
  6105. var _this = _possibleConstructorReturn(this, (CalendarMonthGrid.__proto__ || Object.getPrototypeOf(CalendarMonthGrid)).call(this, props));
  6106. var withoutTransitionMonths = props.orientation === _constants.VERTICAL_SCROLLABLE;
  6107. _this.state = {
  6108. months: getMonths(props.initialMonth, props.numberOfMonths, withoutTransitionMonths)
  6109. };
  6110. _this.isTransitionEndSupported = (0, _isTransitionEndSupported2['default'])();
  6111. _this.onTransitionEnd = _this.onTransitionEnd.bind(_this);
  6112. _this.setContainerRef = _this.setContainerRef.bind(_this);
  6113. _this.locale = _moment2['default'].locale();
  6114. _this.onMonthSelect = _this.onMonthSelect.bind(_this);
  6115. _this.onYearSelect = _this.onYearSelect.bind(_this);
  6116. return _this;
  6117. }
  6118. _createClass(CalendarMonthGrid, [{
  6119. key: 'componentDidMount',
  6120. value: function () {
  6121. function componentDidMount() {
  6122. this.removeEventListener = (0, _consolidatedEvents.addEventListener)(this.container, 'transitionend', this.onTransitionEnd);
  6123. }
  6124. return componentDidMount;
  6125. }()
  6126. }, {
  6127. key: 'componentWillReceiveProps',
  6128. value: function () {
  6129. function componentWillReceiveProps(nextProps) {
  6130. var _this2 = this;
  6131. var initialMonth = nextProps.initialMonth,
  6132. numberOfMonths = nextProps.numberOfMonths,
  6133. orientation = nextProps.orientation;
  6134. var months = this.state.months;
  6135. var _props = this.props,
  6136. prevInitialMonth = _props.initialMonth,
  6137. prevNumberOfMonths = _props.numberOfMonths;
  6138. var hasMonthChanged = !prevInitialMonth.isSame(initialMonth, 'month');
  6139. var hasNumberOfMonthsChanged = prevNumberOfMonths !== numberOfMonths;
  6140. var newMonths = months;
  6141. if (hasMonthChanged && !hasNumberOfMonthsChanged) {
  6142. if ((0, _isNextMonth2['default'])(prevInitialMonth, initialMonth)) {
  6143. newMonths = months.slice(1);
  6144. newMonths.push(months[months.length - 1].clone().add(1, 'month'));
  6145. } else if ((0, _isPrevMonth2['default'])(prevInitialMonth, initialMonth)) {
  6146. newMonths = months.slice(0, months.length - 1);
  6147. newMonths.unshift(months[0].clone().subtract(1, 'month'));
  6148. } else {
  6149. var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
  6150. newMonths = getMonths(initialMonth, numberOfMonths, withoutTransitionMonths);
  6151. }
  6152. }
  6153. if (hasNumberOfMonthsChanged) {
  6154. var _withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
  6155. newMonths = getMonths(initialMonth, numberOfMonths, _withoutTransitionMonths);
  6156. }
  6157. var momentLocale = _moment2['default'].locale();
  6158. if (this.locale !== momentLocale) {
  6159. this.locale = momentLocale;
  6160. newMonths = newMonths.map(function (m) {
  6161. return m.locale(_this2.locale);
  6162. });
  6163. }
  6164. this.setState({
  6165. months: newMonths
  6166. });
  6167. }
  6168. return componentWillReceiveProps;
  6169. }()
  6170. }, {
  6171. key: 'shouldComponentUpdate',
  6172. value: function () {
  6173. function shouldComponentUpdate(nextProps, nextState) {
  6174. return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
  6175. }
  6176. return shouldComponentUpdate;
  6177. }()
  6178. }, {
  6179. key: 'componentDidUpdate',
  6180. value: function () {
  6181. function componentDidUpdate() {
  6182. var _props2 = this.props,
  6183. isAnimating = _props2.isAnimating,
  6184. transitionDuration = _props2.transitionDuration,
  6185. onMonthTransitionEnd = _props2.onMonthTransitionEnd;
  6186. // For IE9, immediately call onMonthTransitionEnd instead of
  6187. // waiting for the animation to complete. Similarly, if transitionDuration
  6188. // is set to 0, also immediately invoke the onMonthTransitionEnd callback
  6189. if ((!this.isTransitionEndSupported || !transitionDuration) && isAnimating) {
  6190. onMonthTransitionEnd();
  6191. }
  6192. }
  6193. return componentDidUpdate;
  6194. }()
  6195. }, {
  6196. key: 'componentWillUnmount',
  6197. value: function () {
  6198. function componentWillUnmount() {
  6199. if (this.removeEventListener) this.removeEventListener();
  6200. }
  6201. return componentWillUnmount;
  6202. }()
  6203. }, {
  6204. key: 'onTransitionEnd',
  6205. value: function () {
  6206. function onTransitionEnd() {
  6207. var onMonthTransitionEnd = this.props.onMonthTransitionEnd;
  6208. onMonthTransitionEnd();
  6209. }
  6210. return onTransitionEnd;
  6211. }()
  6212. }, {
  6213. key: 'onMonthSelect',
  6214. value: function () {
  6215. function onMonthSelect(currentMonth, newMonthVal) {
  6216. var newMonth = currentMonth.clone();
  6217. var _props3 = this.props,
  6218. onMonthChange = _props3.onMonthChange,
  6219. orientation = _props3.orientation;
  6220. var months = this.state.months;
  6221. var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
  6222. var initialMonthSubtraction = months.indexOf(currentMonth);
  6223. if (!withoutTransitionMonths) {
  6224. initialMonthSubtraction -= 1;
  6225. }
  6226. newMonth.set('month', newMonthVal).subtract(initialMonthSubtraction, 'months');
  6227. onMonthChange(newMonth);
  6228. }
  6229. return onMonthSelect;
  6230. }()
  6231. }, {
  6232. key: 'onYearSelect',
  6233. value: function () {
  6234. function onYearSelect(currentMonth, newYearVal) {
  6235. var newMonth = currentMonth.clone();
  6236. var _props4 = this.props,
  6237. onYearChange = _props4.onYearChange,
  6238. orientation = _props4.orientation;
  6239. var months = this.state.months;
  6240. var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
  6241. var initialMonthSubtraction = months.indexOf(currentMonth);
  6242. if (!withoutTransitionMonths) {
  6243. initialMonthSubtraction -= 1;
  6244. }
  6245. newMonth.set('year', newYearVal).subtract(initialMonthSubtraction, 'months');
  6246. onYearChange(newMonth);
  6247. }
  6248. return onYearSelect;
  6249. }()
  6250. }, {
  6251. key: 'setContainerRef',
  6252. value: function () {
  6253. function setContainerRef(ref) {
  6254. this.container = ref;
  6255. }
  6256. return setContainerRef;
  6257. }()
  6258. }, {
  6259. key: 'render',
  6260. value: function () {
  6261. function render() {
  6262. var _this3 = this;
  6263. var _props5 = this.props,
  6264. enableOutsideDays = _props5.enableOutsideDays,
  6265. firstVisibleMonthIndex = _props5.firstVisibleMonthIndex,
  6266. horizontalMonthPadding = _props5.horizontalMonthPadding,
  6267. isAnimating = _props5.isAnimating,
  6268. modifiers = _props5.modifiers,
  6269. numberOfMonths = _props5.numberOfMonths,
  6270. monthFormat = _props5.monthFormat,
  6271. orientation = _props5.orientation,
  6272. translationValue = _props5.translationValue,
  6273. daySize = _props5.daySize,
  6274. onDayMouseEnter = _props5.onDayMouseEnter,
  6275. onDayMouseLeave = _props5.onDayMouseLeave,
  6276. onDayClick = _props5.onDayClick,
  6277. renderMonthText = _props5.renderMonthText,
  6278. renderCalendarDay = _props5.renderCalendarDay,
  6279. renderDayContents = _props5.renderDayContents,
  6280. renderMonthElement = _props5.renderMonthElement,
  6281. onMonthTransitionEnd = _props5.onMonthTransitionEnd,
  6282. firstDayOfWeek = _props5.firstDayOfWeek,
  6283. focusedDate = _props5.focusedDate,
  6284. isFocused = _props5.isFocused,
  6285. isRTL = _props5.isRTL,
  6286. styles = _props5.styles,
  6287. phrases = _props5.phrases,
  6288. dayAriaLabelFormat = _props5.dayAriaLabelFormat,
  6289. transitionDuration = _props5.transitionDuration,
  6290. verticalBorderSpacing = _props5.verticalBorderSpacing,
  6291. setMonthTitleHeight = _props5.setMonthTitleHeight;
  6292. var months = this.state.months;
  6293. var isVertical = orientation === _constants.VERTICAL_ORIENTATION;
  6294. var isVerticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
  6295. var isHorizontal = orientation === _constants.HORIZONTAL_ORIENTATION;
  6296. var calendarMonthWidth = (0, _getCalendarMonthWidth2['default'])(daySize, horizontalMonthPadding);
  6297. var width = isVertical || isVerticalScrollable ? calendarMonthWidth : (numberOfMonths + 2) * calendarMonthWidth;
  6298. var transformType = isVertical || isVerticalScrollable ? 'translateY' : 'translateX';
  6299. var transformValue = transformType + '(' + String(translationValue) + 'px)';
  6300. return _react2['default'].createElement(
  6301. 'div',
  6302. _extends({}, (0, _reactWithStyles.css)(styles.CalendarMonthGrid, isHorizontal && styles.CalendarMonthGrid__horizontal, isVertical && styles.CalendarMonthGrid__vertical, isVerticalScrollable && styles.CalendarMonthGrid__vertical_scrollable, isAnimating && styles.CalendarMonthGrid__animating, isAnimating && transitionDuration && {
  6303. transition: 'transform ' + String(transitionDuration) + 'ms ease-in-out'
  6304. }, (0, _object2['default'])({}, (0, _getTransformStyles2['default'])(transformValue), {
  6305. width: width
  6306. })), {
  6307. ref: this.setContainerRef,
  6308. onTransitionEnd: onMonthTransitionEnd
  6309. }),
  6310. months.map(function (month, i) {
  6311. var isVisible = i >= firstVisibleMonthIndex && i < firstVisibleMonthIndex + numberOfMonths;
  6312. var hideForAnimation = i === 0 && !isVisible;
  6313. var showForAnimation = i === 0 && isAnimating && isVisible;
  6314. var monthString = (0, _toISOMonthString2['default'])(month);
  6315. return _react2['default'].createElement(
  6316. 'div',
  6317. _extends({
  6318. key: monthString
  6319. }, (0, _reactWithStyles.css)(isHorizontal && styles.CalendarMonthGrid_month__horizontal, hideForAnimation && styles.CalendarMonthGrid_month__hideForAnimation, showForAnimation && !isVertical && !isRTL && {
  6320. position: 'absolute',
  6321. left: -calendarMonthWidth
  6322. }, showForAnimation && !isVertical && isRTL && {
  6323. position: 'absolute',
  6324. right: 0
  6325. }, showForAnimation && isVertical && {
  6326. position: 'absolute',
  6327. top: -translationValue
  6328. }, !isVisible && !isAnimating && styles.CalendarMonthGrid_month__hidden)),
  6329. _react2['default'].createElement(_CalendarMonth2['default'], {
  6330. month: month,
  6331. isVisible: isVisible,
  6332. enableOutsideDays: enableOutsideDays,
  6333. modifiers: modifiers[monthString],
  6334. monthFormat: monthFormat,
  6335. orientation: orientation,
  6336. onDayMouseEnter: onDayMouseEnter,
  6337. onDayMouseLeave: onDayMouseLeave,
  6338. onDayClick: onDayClick,
  6339. onMonthSelect: _this3.onMonthSelect,
  6340. onYearSelect: _this3.onYearSelect,
  6341. renderMonthText: renderMonthText,
  6342. renderCalendarDay: renderCalendarDay,
  6343. renderDayContents: renderDayContents,
  6344. renderMonthElement: renderMonthElement,
  6345. firstDayOfWeek: firstDayOfWeek,
  6346. daySize: daySize,
  6347. focusedDate: isVisible ? focusedDate : null,
  6348. isFocused: isFocused,
  6349. phrases: phrases,
  6350. setMonthTitleHeight: setMonthTitleHeight,
  6351. dayAriaLabelFormat: dayAriaLabelFormat,
  6352. verticalBorderSpacing: verticalBorderSpacing,
  6353. horizontalMonthPadding: horizontalMonthPadding
  6354. })
  6355. );
  6356. })
  6357. );
  6358. }
  6359. return render;
  6360. }()
  6361. }]);
  6362. return CalendarMonthGrid;
  6363. }(_react2['default'].Component);
  6364. CalendarMonthGrid.propTypes = propTypes;
  6365. CalendarMonthGrid.defaultProps = defaultProps;
  6366. exports["default"] = (0, _reactWithStyles.withStyles)(function (_ref) {
  6367. var _ref$reactDates = _ref.reactDates,
  6368. color = _ref$reactDates.color,
  6369. noScrollBarOnVerticalScrollable = _ref$reactDates.noScrollBarOnVerticalScrollable,
  6370. spacing = _ref$reactDates.spacing,
  6371. zIndex = _ref$reactDates.zIndex;
  6372. return {
  6373. CalendarMonthGrid: {
  6374. background: color.background,
  6375. textAlign: 'left',
  6376. zIndex: zIndex
  6377. },
  6378. CalendarMonthGrid__animating: {
  6379. zIndex: zIndex + 1
  6380. },
  6381. CalendarMonthGrid__horizontal: {
  6382. position: 'absolute',
  6383. left: spacing.dayPickerHorizontalPadding
  6384. },
  6385. CalendarMonthGrid__vertical: {
  6386. margin: '0 auto'
  6387. },
  6388. CalendarMonthGrid__vertical_scrollable: (0, _object2['default'])({
  6389. margin: '0 auto',
  6390. overflowY: 'scroll'
  6391. }, noScrollBarOnVerticalScrollable && {
  6392. '-webkitOverflowScrolling': 'touch',
  6393. '::-webkit-scrollbar': {
  6394. '-webkit-appearance': 'none',
  6395. display: 'none'
  6396. }
  6397. }),
  6398. CalendarMonthGrid_month__horizontal: {
  6399. display: 'inline-block',
  6400. verticalAlign: 'top',
  6401. minHeight: '100%'
  6402. },
  6403. CalendarMonthGrid_month__hideForAnimation: {
  6404. position: 'absolute',
  6405. zIndex: zIndex - 1,
  6406. opacity: 0,
  6407. pointerEvents: 'none'
  6408. },
  6409. CalendarMonthGrid_month__hidden: {
  6410. visibility: 'hidden'
  6411. }
  6412. };
  6413. })(CalendarMonthGrid);
  6414. /***/ }),
  6415. /***/ 4604:
  6416. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  6417. "use strict";
  6418. Object.defineProperty(exports, "__esModule", ({
  6419. value: true
  6420. }));
  6421. exports["default"] = CalendarWeek;
  6422. var _react = __webpack_require__(9196);
  6423. var _react2 = _interopRequireDefault(_react);
  6424. var _airbnbPropTypes = __webpack_require__(4882);
  6425. var _CalendarDay = __webpack_require__(7617);
  6426. var _CalendarDay2 = _interopRequireDefault(_CalendarDay);
  6427. var _CustomizableCalendarDay = __webpack_require__(6698);
  6428. var _CustomizableCalendarDay2 = _interopRequireDefault(_CustomizableCalendarDay);
  6429. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  6430. var propTypes = (0, _airbnbPropTypes.forbidExtraProps)({
  6431. children: (0, _airbnbPropTypes.or)([(0, _airbnbPropTypes.childrenOfType)(_CalendarDay2['default']), (0, _airbnbPropTypes.childrenOfType)(_CustomizableCalendarDay2['default'])]).isRequired
  6432. });
  6433. function CalendarWeek(_ref) {
  6434. var children = _ref.children;
  6435. return _react2['default'].createElement(
  6436. 'tr',
  6437. null,
  6438. children
  6439. );
  6440. }
  6441. CalendarWeek.propTypes = propTypes;
  6442. /***/ }),
  6443. /***/ 9588:
  6444. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  6445. "use strict";
  6446. Object.defineProperty(exports, "__esModule", ({
  6447. value: true
  6448. }));
  6449. var _react = __webpack_require__(9196);
  6450. var _react2 = _interopRequireDefault(_react);
  6451. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  6452. var ChevronDown = function () {
  6453. function ChevronDown(props) {
  6454. return _react2['default'].createElement(
  6455. 'svg',
  6456. props,
  6457. _react2['default'].createElement('path', {
  6458. d: 'M967.5 288.5L514.3 740.7c-11 11-21 11-32 0L29.1 288.5c-4-5-6-11-6-16 0-13 10-23 23-23 6 0 11 2 15 7l437.2 436.2 437.2-436.2c4-5 9-7 16-7 6 0 11 2 16 7 9 10.9 9 21 0 32z'
  6459. })
  6460. );
  6461. }
  6462. return ChevronDown;
  6463. }();
  6464. ChevronDown.defaultProps = {
  6465. viewBox: '0 0 1000 1000'
  6466. };
  6467. exports["default"] = ChevronDown;
  6468. /***/ }),
  6469. /***/ 1809:
  6470. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  6471. "use strict";
  6472. Object.defineProperty(exports, "__esModule", ({
  6473. value: true
  6474. }));
  6475. var _react = __webpack_require__(9196);
  6476. var _react2 = _interopRequireDefault(_react);
  6477. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  6478. var ChevronUp = function () {
  6479. function ChevronUp(props) {
  6480. return _react2['default'].createElement(
  6481. 'svg',
  6482. props,
  6483. _react2['default'].createElement('path', {
  6484. d: 'M32.1 712.6l453.2-452.2c11-11 21-11 32 0l453.2 452.2c4 5 6 10 6 16 0 13-10 23-22 23-7 0-12-2-16-7L501.3 308.5 64.1 744.7c-4 5-9 7-15 7-7 0-12-2-17-7-9-11-9-21 0-32.1z'
  6485. })
  6486. );
  6487. }
  6488. return ChevronUp;
  6489. }();
  6490. ChevronUp.defaultProps = {
  6491. viewBox: '0 0 1000 1000'
  6492. };
  6493. exports["default"] = ChevronUp;
  6494. /***/ }),
  6495. /***/ 6973:
  6496. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  6497. "use strict";
  6498. Object.defineProperty(exports, "__esModule", ({
  6499. value: true
  6500. }));
  6501. var _react = __webpack_require__(9196);
  6502. var _react2 = _interopRequireDefault(_react);
  6503. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  6504. var CloseButton = function () {
  6505. function CloseButton(props) {
  6506. return _react2['default'].createElement(
  6507. 'svg',
  6508. props,
  6509. _react2['default'].createElement('path', {
  6510. fillRule: 'evenodd',
  6511. d: 'M11.53.47a.75.75 0 0 0-1.061 0l-4.47 4.47L1.529.47A.75.75 0 1 0 .468 1.531l4.47 4.47-4.47 4.47a.75.75 0 1 0 1.061 1.061l4.47-4.47 4.47 4.47a.75.75 0 1 0 1.061-1.061l-4.47-4.47 4.47-4.47a.75.75 0 0 0 0-1.061z'
  6512. })
  6513. );
  6514. }
  6515. return CloseButton;
  6516. }();
  6517. CloseButton.defaultProps = {
  6518. viewBox: '0 0 12 12'
  6519. };
  6520. exports["default"] = CloseButton;
  6521. /***/ }),
  6522. /***/ 6698:
  6523. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  6524. "use strict";
  6525. Object.defineProperty(exports, "__esModule", ({
  6526. value: true
  6527. }));
  6528. exports.PureCustomizableCalendarDay = exports.selectedStyles = exports.lastInRangeStyles = exports.selectedSpanStyles = exports.hoveredSpanStyles = exports.blockedOutOfRangeStyles = exports.blockedCalendarStyles = exports.blockedMinNightsStyles = exports.highlightedCalendarStyles = exports.outsideStyles = exports.defaultStyles = undefined;
  6529. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  6530. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6531. var _object = __webpack_require__(4011);
  6532. var _object2 = _interopRequireDefault(_object);
  6533. var _react = __webpack_require__(9196);
  6534. var _react2 = _interopRequireDefault(_react);
  6535. var _propTypes = __webpack_require__(2652);
  6536. var _propTypes2 = _interopRequireDefault(_propTypes);
  6537. var _reactAddonsShallowCompare = __webpack_require__(2541);
  6538. var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
  6539. var _reactMomentProptypes = __webpack_require__(6150);
  6540. var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
  6541. var _airbnbPropTypes = __webpack_require__(4882);
  6542. var _reactWithStyles = __webpack_require__(3576);
  6543. var _moment = __webpack_require__(6292);
  6544. var _moment2 = _interopRequireDefault(_moment);
  6545. var _defaultPhrases = __webpack_require__(6030);
  6546. var _getPhrasePropTypes = __webpack_require__(2893);
  6547. var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
  6548. var _getCalendarDaySettings = __webpack_require__(7475);
  6549. var _getCalendarDaySettings2 = _interopRequireDefault(_getCalendarDaySettings);
  6550. var _constants = __webpack_require__(257);
  6551. var _DefaultTheme = __webpack_require__(8158);
  6552. var _DefaultTheme2 = _interopRequireDefault(_DefaultTheme);
  6553. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  6554. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6555. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6556. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6557. var color = _DefaultTheme2['default'].reactDates.color;
  6558. function getStyles(stylesObj, isHovered) {
  6559. if (!stylesObj) return null;
  6560. var hover = stylesObj.hover;
  6561. if (isHovered && hover) {
  6562. return hover;
  6563. }
  6564. return stylesObj;
  6565. }
  6566. var DayStyleShape = _propTypes2['default'].shape({
  6567. background: _propTypes2['default'].string,
  6568. border: (0, _airbnbPropTypes.or)([_propTypes2['default'].string, _propTypes2['default'].number]),
  6569. color: _propTypes2['default'].string,
  6570. hover: _propTypes2['default'].shape({
  6571. background: _propTypes2['default'].string,
  6572. border: (0, _airbnbPropTypes.or)([_propTypes2['default'].string, _propTypes2['default'].number]),
  6573. color: _propTypes2['default'].string
  6574. })
  6575. });
  6576. var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
  6577. day: _reactMomentProptypes2['default'].momentObj,
  6578. daySize: _airbnbPropTypes.nonNegativeInteger,
  6579. isOutsideDay: _propTypes2['default'].bool,
  6580. modifiers: _propTypes2['default'].instanceOf(Set),
  6581. isFocused: _propTypes2['default'].bool,
  6582. tabIndex: _propTypes2['default'].oneOf([0, -1]),
  6583. onDayClick: _propTypes2['default'].func,
  6584. onDayMouseEnter: _propTypes2['default'].func,
  6585. onDayMouseLeave: _propTypes2['default'].func,
  6586. renderDayContents: _propTypes2['default'].func,
  6587. ariaLabelFormat: _propTypes2['default'].string,
  6588. // style overrides
  6589. defaultStyles: DayStyleShape,
  6590. outsideStyles: DayStyleShape,
  6591. todayStyles: DayStyleShape,
  6592. firstDayOfWeekStyles: DayStyleShape,
  6593. lastDayOfWeekStyles: DayStyleShape,
  6594. highlightedCalendarStyles: DayStyleShape,
  6595. blockedMinNightsStyles: DayStyleShape,
  6596. blockedCalendarStyles: DayStyleShape,
  6597. blockedOutOfRangeStyles: DayStyleShape,
  6598. hoveredSpanStyles: DayStyleShape,
  6599. selectedSpanStyles: DayStyleShape,
  6600. lastInRangeStyles: DayStyleShape,
  6601. selectedStyles: DayStyleShape,
  6602. selectedStartStyles: DayStyleShape,
  6603. selectedEndStyles: DayStyleShape,
  6604. afterHoveredStartStyles: DayStyleShape,
  6605. // internationalization
  6606. phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.CalendarDayPhrases))
  6607. }));
  6608. var defaultStyles = exports.defaultStyles = {
  6609. border: '1px solid ' + String(color.core.borderLight),
  6610. color: color.text,
  6611. background: color.background,
  6612. hover: {
  6613. background: color.core.borderLight,
  6614. border: '1px double ' + String(color.core.borderLight),
  6615. color: 'inherit'
  6616. }
  6617. };
  6618. var outsideStyles = exports.outsideStyles = {
  6619. background: color.outside.backgroundColor,
  6620. border: 0,
  6621. color: color.outside.color
  6622. };
  6623. var highlightedCalendarStyles = exports.highlightedCalendarStyles = {
  6624. background: color.highlighted.backgroundColor,
  6625. color: color.highlighted.color,
  6626. hover: {
  6627. background: color.highlighted.backgroundColor_hover,
  6628. color: color.highlighted.color_active
  6629. }
  6630. };
  6631. var blockedMinNightsStyles = exports.blockedMinNightsStyles = {
  6632. background: color.minimumNights.backgroundColor,
  6633. border: '1px solid ' + String(color.minimumNights.borderColor),
  6634. color: color.minimumNights.color,
  6635. hover: {
  6636. background: color.minimumNights.backgroundColor_hover,
  6637. color: color.minimumNights.color_active
  6638. }
  6639. };
  6640. var blockedCalendarStyles = exports.blockedCalendarStyles = {
  6641. background: color.blocked_calendar.backgroundColor,
  6642. border: '1px solid ' + String(color.blocked_calendar.borderColor),
  6643. color: color.blocked_calendar.color,
  6644. hover: {
  6645. background: color.blocked_calendar.backgroundColor_hover,
  6646. border: '1px solid ' + String(color.blocked_calendar.borderColor),
  6647. color: color.blocked_calendar.color_active
  6648. }
  6649. };
  6650. var blockedOutOfRangeStyles = exports.blockedOutOfRangeStyles = {
  6651. background: color.blocked_out_of_range.backgroundColor,
  6652. border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
  6653. color: color.blocked_out_of_range.color,
  6654. hover: {
  6655. background: color.blocked_out_of_range.backgroundColor_hover,
  6656. border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
  6657. color: color.blocked_out_of_range.color_active
  6658. }
  6659. };
  6660. var hoveredSpanStyles = exports.hoveredSpanStyles = {
  6661. background: color.hoveredSpan.backgroundColor,
  6662. border: '1px solid ' + String(color.hoveredSpan.borderColor),
  6663. color: color.hoveredSpan.color,
  6664. hover: {
  6665. background: color.hoveredSpan.backgroundColor_hover,
  6666. border: '1px solid ' + String(color.hoveredSpan.borderColor),
  6667. color: color.hoveredSpan.color_active
  6668. }
  6669. };
  6670. var selectedSpanStyles = exports.selectedSpanStyles = {
  6671. background: color.selectedSpan.backgroundColor,
  6672. border: '1px solid ' + String(color.selectedSpan.borderColor),
  6673. color: color.selectedSpan.color,
  6674. hover: {
  6675. background: color.selectedSpan.backgroundColor_hover,
  6676. border: '1px solid ' + String(color.selectedSpan.borderColor),
  6677. color: color.selectedSpan.color_active
  6678. }
  6679. };
  6680. var lastInRangeStyles = exports.lastInRangeStyles = {
  6681. borderRight: color.core.primary
  6682. };
  6683. var selectedStyles = exports.selectedStyles = {
  6684. background: color.selected.backgroundColor,
  6685. border: '1px solid ' + String(color.selected.borderColor),
  6686. color: color.selected.color,
  6687. hover: {
  6688. background: color.selected.backgroundColor_hover,
  6689. border: '1px solid ' + String(color.selected.borderColor),
  6690. color: color.selected.color_active
  6691. }
  6692. };
  6693. var defaultProps = {
  6694. day: (0, _moment2['default'])(),
  6695. daySize: _constants.DAY_SIZE,
  6696. isOutsideDay: false,
  6697. modifiers: new Set(),
  6698. isFocused: false,
  6699. tabIndex: -1,
  6700. onDayClick: function () {
  6701. function onDayClick() {}
  6702. return onDayClick;
  6703. }(),
  6704. onDayMouseEnter: function () {
  6705. function onDayMouseEnter() {}
  6706. return onDayMouseEnter;
  6707. }(),
  6708. onDayMouseLeave: function () {
  6709. function onDayMouseLeave() {}
  6710. return onDayMouseLeave;
  6711. }(),
  6712. renderDayContents: null,
  6713. ariaLabelFormat: 'dddd, LL',
  6714. // style defaults
  6715. defaultStyles: defaultStyles,
  6716. outsideStyles: outsideStyles,
  6717. todayStyles: {},
  6718. highlightedCalendarStyles: highlightedCalendarStyles,
  6719. blockedMinNightsStyles: blockedMinNightsStyles,
  6720. blockedCalendarStyles: blockedCalendarStyles,
  6721. blockedOutOfRangeStyles: blockedOutOfRangeStyles,
  6722. hoveredSpanStyles: hoveredSpanStyles,
  6723. selectedSpanStyles: selectedSpanStyles,
  6724. lastInRangeStyles: lastInRangeStyles,
  6725. selectedStyles: selectedStyles,
  6726. selectedStartStyles: {},
  6727. selectedEndStyles: {},
  6728. afterHoveredStartStyles: {},
  6729. firstDayOfWeekStyles: {},
  6730. lastDayOfWeekStyles: {},
  6731. // internationalization
  6732. phrases: _defaultPhrases.CalendarDayPhrases
  6733. };
  6734. var CustomizableCalendarDay = function (_React$Component) {
  6735. _inherits(CustomizableCalendarDay, _React$Component);
  6736. function CustomizableCalendarDay() {
  6737. var _ref;
  6738. _classCallCheck(this, CustomizableCalendarDay);
  6739. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  6740. args[_key] = arguments[_key];
  6741. }
  6742. var _this = _possibleConstructorReturn(this, (_ref = CustomizableCalendarDay.__proto__ || Object.getPrototypeOf(CustomizableCalendarDay)).call.apply(_ref, [this].concat(args)));
  6743. _this.state = {
  6744. isHovered: false
  6745. };
  6746. _this.setButtonRef = _this.setButtonRef.bind(_this);
  6747. return _this;
  6748. }
  6749. _createClass(CustomizableCalendarDay, [{
  6750. key: 'shouldComponentUpdate',
  6751. value: function () {
  6752. function shouldComponentUpdate(nextProps, nextState) {
  6753. return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
  6754. }
  6755. return shouldComponentUpdate;
  6756. }()
  6757. }, {
  6758. key: 'componentDidUpdate',
  6759. value: function () {
  6760. function componentDidUpdate(prevProps) {
  6761. var _props = this.props,
  6762. isFocused = _props.isFocused,
  6763. tabIndex = _props.tabIndex;
  6764. if (tabIndex === 0) {
  6765. if (isFocused || tabIndex !== prevProps.tabIndex) {
  6766. this.buttonRef.focus();
  6767. }
  6768. }
  6769. }
  6770. return componentDidUpdate;
  6771. }()
  6772. }, {
  6773. key: 'onDayClick',
  6774. value: function () {
  6775. function onDayClick(day, e) {
  6776. var onDayClick = this.props.onDayClick;
  6777. onDayClick(day, e);
  6778. }
  6779. return onDayClick;
  6780. }()
  6781. }, {
  6782. key: 'onDayMouseEnter',
  6783. value: function () {
  6784. function onDayMouseEnter(day, e) {
  6785. var onDayMouseEnter = this.props.onDayMouseEnter;
  6786. this.setState({ isHovered: true });
  6787. onDayMouseEnter(day, e);
  6788. }
  6789. return onDayMouseEnter;
  6790. }()
  6791. }, {
  6792. key: 'onDayMouseLeave',
  6793. value: function () {
  6794. function onDayMouseLeave(day, e) {
  6795. var onDayMouseLeave = this.props.onDayMouseLeave;
  6796. this.setState({ isHovered: false });
  6797. onDayMouseLeave(day, e);
  6798. }
  6799. return onDayMouseLeave;
  6800. }()
  6801. }, {
  6802. key: 'onKeyDown',
  6803. value: function () {
  6804. function onKeyDown(day, e) {
  6805. var onDayClick = this.props.onDayClick;
  6806. var key = e.key;
  6807. if (key === 'Enter' || key === ' ') {
  6808. onDayClick(day, e);
  6809. }
  6810. }
  6811. return onKeyDown;
  6812. }()
  6813. }, {
  6814. key: 'setButtonRef',
  6815. value: function () {
  6816. function setButtonRef(ref) {
  6817. this.buttonRef = ref;
  6818. }
  6819. return setButtonRef;
  6820. }()
  6821. }, {
  6822. key: 'render',
  6823. value: function () {
  6824. function render() {
  6825. var _this2 = this;
  6826. var _props2 = this.props,
  6827. day = _props2.day,
  6828. ariaLabelFormat = _props2.ariaLabelFormat,
  6829. daySize = _props2.daySize,
  6830. isOutsideDay = _props2.isOutsideDay,
  6831. modifiers = _props2.modifiers,
  6832. tabIndex = _props2.tabIndex,
  6833. renderDayContents = _props2.renderDayContents,
  6834. styles = _props2.styles,
  6835. phrases = _props2.phrases,
  6836. defaultStylesWithHover = _props2.defaultStyles,
  6837. outsideStylesWithHover = _props2.outsideStyles,
  6838. todayStylesWithHover = _props2.todayStyles,
  6839. firstDayOfWeekStylesWithHover = _props2.firstDayOfWeekStyles,
  6840. lastDayOfWeekStylesWithHover = _props2.lastDayOfWeekStyles,
  6841. highlightedCalendarStylesWithHover = _props2.highlightedCalendarStyles,
  6842. blockedMinNightsStylesWithHover = _props2.blockedMinNightsStyles,
  6843. blockedCalendarStylesWithHover = _props2.blockedCalendarStyles,
  6844. blockedOutOfRangeStylesWithHover = _props2.blockedOutOfRangeStyles,
  6845. hoveredSpanStylesWithHover = _props2.hoveredSpanStyles,
  6846. selectedSpanStylesWithHover = _props2.selectedSpanStyles,
  6847. lastInRangeStylesWithHover = _props2.lastInRangeStyles,
  6848. selectedStylesWithHover = _props2.selectedStyles,
  6849. selectedStartStylesWithHover = _props2.selectedStartStyles,
  6850. selectedEndStylesWithHover = _props2.selectedEndStyles,
  6851. afterHoveredStartStylesWithHover = _props2.afterHoveredStartStyles;
  6852. var isHovered = this.state.isHovered;
  6853. if (!day) return _react2['default'].createElement('td', null);
  6854. var _getCalendarDaySettin = (0, _getCalendarDaySettings2['default'])(day, ariaLabelFormat, daySize, modifiers, phrases),
  6855. daySizeStyles = _getCalendarDaySettin.daySizeStyles,
  6856. useDefaultCursor = _getCalendarDaySettin.useDefaultCursor,
  6857. selected = _getCalendarDaySettin.selected,
  6858. hoveredSpan = _getCalendarDaySettin.hoveredSpan,
  6859. isOutsideRange = _getCalendarDaySettin.isOutsideRange,
  6860. ariaLabel = _getCalendarDaySettin.ariaLabel;
  6861. return _react2['default'].createElement(
  6862. 'td',
  6863. _extends({}, (0, _reactWithStyles.css)(styles.CalendarDay, useDefaultCursor && styles.CalendarDay__defaultCursor, daySizeStyles, getStyles(defaultStylesWithHover, isHovered), isOutsideDay && getStyles(outsideStylesWithHover, isHovered), modifiers.has('today') && getStyles(todayStylesWithHover, isHovered), modifiers.has('first-day-of-week') && getStyles(firstDayOfWeekStylesWithHover, isHovered), modifiers.has('last-day-of-week') && getStyles(lastDayOfWeekStylesWithHover, isHovered), modifiers.has('highlighted-calendar') && getStyles(highlightedCalendarStylesWithHover, isHovered), modifiers.has('blocked-minimum-nights') && getStyles(blockedMinNightsStylesWithHover, isHovered), modifiers.has('blocked-calendar') && getStyles(blockedCalendarStylesWithHover, isHovered), hoveredSpan && getStyles(hoveredSpanStylesWithHover, isHovered), modifiers.has('after-hovered-start') && getStyles(afterHoveredStartStylesWithHover, isHovered), modifiers.has('selected-span') && getStyles(selectedSpanStylesWithHover, isHovered), modifiers.has('last-in-range') && getStyles(lastInRangeStylesWithHover, isHovered), selected && getStyles(selectedStylesWithHover, isHovered), modifiers.has('selected-start') && getStyles(selectedStartStylesWithHover, isHovered), modifiers.has('selected-end') && getStyles(selectedEndStylesWithHover, isHovered), isOutsideRange && getStyles(blockedOutOfRangeStylesWithHover, isHovered)), {
  6864. role: 'button' // eslint-disable-line jsx-a11y/no-noninteractive-element-to-interactive-role
  6865. , ref: this.setButtonRef,
  6866. 'aria-label': ariaLabel,
  6867. onMouseEnter: function () {
  6868. function onMouseEnter(e) {
  6869. _this2.onDayMouseEnter(day, e);
  6870. }
  6871. return onMouseEnter;
  6872. }(),
  6873. onMouseLeave: function () {
  6874. function onMouseLeave(e) {
  6875. _this2.onDayMouseLeave(day, e);
  6876. }
  6877. return onMouseLeave;
  6878. }(),
  6879. onMouseUp: function () {
  6880. function onMouseUp(e) {
  6881. e.currentTarget.blur();
  6882. }
  6883. return onMouseUp;
  6884. }(),
  6885. onClick: function () {
  6886. function onClick(e) {
  6887. _this2.onDayClick(day, e);
  6888. }
  6889. return onClick;
  6890. }(),
  6891. onKeyDown: function () {
  6892. function onKeyDown(e) {
  6893. _this2.onKeyDown(day, e);
  6894. }
  6895. return onKeyDown;
  6896. }(),
  6897. tabIndex: tabIndex
  6898. }),
  6899. renderDayContents ? renderDayContents(day, modifiers) : day.format('D')
  6900. );
  6901. }
  6902. return render;
  6903. }()
  6904. }]);
  6905. return CustomizableCalendarDay;
  6906. }(_react2['default'].Component);
  6907. CustomizableCalendarDay.propTypes = propTypes;
  6908. CustomizableCalendarDay.defaultProps = defaultProps;
  6909. exports.PureCustomizableCalendarDay = CustomizableCalendarDay;
  6910. exports["default"] = (0, _reactWithStyles.withStyles)(function (_ref2) {
  6911. var font = _ref2.reactDates.font;
  6912. return {
  6913. CalendarDay: {
  6914. boxSizing: 'border-box',
  6915. cursor: 'pointer',
  6916. fontSize: font.size,
  6917. textAlign: 'center',
  6918. ':active': {
  6919. outline: 0
  6920. }
  6921. },
  6922. CalendarDay__defaultCursor: {
  6923. cursor: 'default'
  6924. }
  6925. };
  6926. })(CustomizableCalendarDay);
  6927. /***/ }),
  6928. /***/ 8665:
  6929. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  6930. "use strict";
  6931. Object.defineProperty(exports, "__esModule", ({
  6932. value: true
  6933. }));
  6934. exports.PureDayPicker = exports.defaultProps = undefined;
  6935. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  6936. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6937. var _object = __webpack_require__(4011);
  6938. var _object2 = _interopRequireDefault(_object);
  6939. var _react = __webpack_require__(9196);
  6940. var _react2 = _interopRequireDefault(_react);
  6941. var _propTypes = __webpack_require__(2652);
  6942. var _propTypes2 = _interopRequireDefault(_propTypes);
  6943. var _reactAddonsShallowCompare = __webpack_require__(2541);
  6944. var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
  6945. var _airbnbPropTypes = __webpack_require__(4882);
  6946. var _reactWithStyles = __webpack_require__(3576);
  6947. var _moment = __webpack_require__(6292);
  6948. var _moment2 = _interopRequireDefault(_moment);
  6949. var _throttle = __webpack_require__(8172);
  6950. var _throttle2 = _interopRequireDefault(_throttle);
  6951. var _isTouchDevice = __webpack_require__(5834);
  6952. var _isTouchDevice2 = _interopRequireDefault(_isTouchDevice);
  6953. var _reactOutsideClickHandler = __webpack_require__(6606);
  6954. var _reactOutsideClickHandler2 = _interopRequireDefault(_reactOutsideClickHandler);
  6955. var _defaultPhrases = __webpack_require__(6030);
  6956. var _getPhrasePropTypes = __webpack_require__(2893);
  6957. var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
  6958. var _CalendarMonthGrid = __webpack_require__(7938);
  6959. var _CalendarMonthGrid2 = _interopRequireDefault(_CalendarMonthGrid);
  6960. var _DayPickerNavigation = __webpack_require__(3895);
  6961. var _DayPickerNavigation2 = _interopRequireDefault(_DayPickerNavigation);
  6962. var _DayPickerKeyboardShortcuts = __webpack_require__(600);
  6963. var _DayPickerKeyboardShortcuts2 = _interopRequireDefault(_DayPickerKeyboardShortcuts);
  6964. var _getNumberOfCalendarMonthWeeks = __webpack_require__(4112);
  6965. var _getNumberOfCalendarMonthWeeks2 = _interopRequireDefault(_getNumberOfCalendarMonthWeeks);
  6966. var _getCalendarMonthWidth = __webpack_require__(8964);
  6967. var _getCalendarMonthWidth2 = _interopRequireDefault(_getCalendarMonthWidth);
  6968. var _calculateDimension = __webpack_require__(8607);
  6969. var _calculateDimension2 = _interopRequireDefault(_calculateDimension);
  6970. var _getActiveElement = __webpack_require__(5814);
  6971. var _getActiveElement2 = _interopRequireDefault(_getActiveElement);
  6972. var _isDayVisible = __webpack_require__(5713);
  6973. var _isDayVisible2 = _interopRequireDefault(_isDayVisible);
  6974. var _ModifiersShape = __webpack_require__(6747);
  6975. var _ModifiersShape2 = _interopRequireDefault(_ModifiersShape);
  6976. var _ScrollableOrientationShape = __webpack_require__(6553);
  6977. var _ScrollableOrientationShape2 = _interopRequireDefault(_ScrollableOrientationShape);
  6978. var _DayOfWeekShape = __webpack_require__(243);
  6979. var _DayOfWeekShape2 = _interopRequireDefault(_DayOfWeekShape);
  6980. var _CalendarInfoPositionShape = __webpack_require__(8182);
  6981. var _CalendarInfoPositionShape2 = _interopRequireDefault(_CalendarInfoPositionShape);
  6982. var _constants = __webpack_require__(257);
  6983. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  6984. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  6985. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6986. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6987. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6988. var MONTH_PADDING = 23;
  6989. var PREV_TRANSITION = 'prev';
  6990. var NEXT_TRANSITION = 'next';
  6991. var MONTH_SELECTION_TRANSITION = 'month_selection';
  6992. var YEAR_SELECTION_TRANSITION = 'year_selection';
  6993. var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
  6994. // calendar presentation props
  6995. enableOutsideDays: _propTypes2['default'].bool,
  6996. numberOfMonths: _propTypes2['default'].number,
  6997. orientation: _ScrollableOrientationShape2['default'],
  6998. withPortal: _propTypes2['default'].bool,
  6999. onOutsideClick: _propTypes2['default'].func,
  7000. hidden: _propTypes2['default'].bool,
  7001. initialVisibleMonth: _propTypes2['default'].func,
  7002. firstDayOfWeek: _DayOfWeekShape2['default'],
  7003. renderCalendarInfo: _propTypes2['default'].func,
  7004. calendarInfoPosition: _CalendarInfoPositionShape2['default'],
  7005. hideKeyboardShortcutsPanel: _propTypes2['default'].bool,
  7006. daySize: _airbnbPropTypes.nonNegativeInteger,
  7007. isRTL: _propTypes2['default'].bool,
  7008. verticalHeight: _airbnbPropTypes.nonNegativeInteger,
  7009. noBorder: _propTypes2['default'].bool,
  7010. transitionDuration: _airbnbPropTypes.nonNegativeInteger,
  7011. verticalBorderSpacing: _airbnbPropTypes.nonNegativeInteger,
  7012. horizontalMonthPadding: _airbnbPropTypes.nonNegativeInteger,
  7013. // navigation props
  7014. navPrev: _propTypes2['default'].node,
  7015. navNext: _propTypes2['default'].node,
  7016. noNavButtons: _propTypes2['default'].bool,
  7017. onPrevMonthClick: _propTypes2['default'].func,
  7018. onNextMonthClick: _propTypes2['default'].func,
  7019. onMonthChange: _propTypes2['default'].func,
  7020. onYearChange: _propTypes2['default'].func,
  7021. onMultiplyScrollableMonths: _propTypes2['default'].func, // VERTICAL_SCROLLABLE daypickers only
  7022. // month props
  7023. renderMonthText: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
  7024. renderMonthElement: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
  7025. // day props
  7026. modifiers: _propTypes2['default'].objectOf(_propTypes2['default'].objectOf(_ModifiersShape2['default'])),
  7027. renderCalendarDay: _propTypes2['default'].func,
  7028. renderDayContents: _propTypes2['default'].func,
  7029. onDayClick: _propTypes2['default'].func,
  7030. onDayMouseEnter: _propTypes2['default'].func,
  7031. onDayMouseLeave: _propTypes2['default'].func,
  7032. // accessibility props
  7033. isFocused: _propTypes2['default'].bool,
  7034. getFirstFocusableDay: _propTypes2['default'].func,
  7035. onBlur: _propTypes2['default'].func,
  7036. showKeyboardShortcuts: _propTypes2['default'].bool,
  7037. // internationalization
  7038. monthFormat: _propTypes2['default'].string,
  7039. weekDayFormat: _propTypes2['default'].string,
  7040. phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.DayPickerPhrases)),
  7041. dayAriaLabelFormat: _propTypes2['default'].string
  7042. }));
  7043. var defaultProps = exports.defaultProps = {
  7044. // calendar presentation props
  7045. enableOutsideDays: false,
  7046. numberOfMonths: 2,
  7047. orientation: _constants.HORIZONTAL_ORIENTATION,
  7048. withPortal: false,
  7049. onOutsideClick: function () {
  7050. function onOutsideClick() {}
  7051. return onOutsideClick;
  7052. }(),
  7053. hidden: false,
  7054. initialVisibleMonth: function () {
  7055. function initialVisibleMonth() {
  7056. return (0, _moment2['default'])();
  7057. }
  7058. return initialVisibleMonth;
  7059. }(),
  7060. firstDayOfWeek: null,
  7061. renderCalendarInfo: null,
  7062. calendarInfoPosition: _constants.INFO_POSITION_BOTTOM,
  7063. hideKeyboardShortcutsPanel: false,
  7064. daySize: _constants.DAY_SIZE,
  7065. isRTL: false,
  7066. verticalHeight: null,
  7067. noBorder: false,
  7068. transitionDuration: undefined,
  7069. verticalBorderSpacing: undefined,
  7070. horizontalMonthPadding: 13,
  7071. // navigation props
  7072. navPrev: null,
  7073. navNext: null,
  7074. noNavButtons: false,
  7075. onPrevMonthClick: function () {
  7076. function onPrevMonthClick() {}
  7077. return onPrevMonthClick;
  7078. }(),
  7079. onNextMonthClick: function () {
  7080. function onNextMonthClick() {}
  7081. return onNextMonthClick;
  7082. }(),
  7083. onMonthChange: function () {
  7084. function onMonthChange() {}
  7085. return onMonthChange;
  7086. }(),
  7087. onYearChange: function () {
  7088. function onYearChange() {}
  7089. return onYearChange;
  7090. }(),
  7091. onMultiplyScrollableMonths: function () {
  7092. function onMultiplyScrollableMonths() {}
  7093. return onMultiplyScrollableMonths;
  7094. }(),
  7095. // month props
  7096. renderMonthText: null,
  7097. renderMonthElement: null,
  7098. // day props
  7099. modifiers: {},
  7100. renderCalendarDay: undefined,
  7101. renderDayContents: null,
  7102. onDayClick: function () {
  7103. function onDayClick() {}
  7104. return onDayClick;
  7105. }(),
  7106. onDayMouseEnter: function () {
  7107. function onDayMouseEnter() {}
  7108. return onDayMouseEnter;
  7109. }(),
  7110. onDayMouseLeave: function () {
  7111. function onDayMouseLeave() {}
  7112. return onDayMouseLeave;
  7113. }(),
  7114. // accessibility props
  7115. isFocused: false,
  7116. getFirstFocusableDay: null,
  7117. onBlur: function () {
  7118. function onBlur() {}
  7119. return onBlur;
  7120. }(),
  7121. showKeyboardShortcuts: false,
  7122. // internationalization
  7123. monthFormat: 'MMMM YYYY',
  7124. weekDayFormat: 'dd',
  7125. phrases: _defaultPhrases.DayPickerPhrases,
  7126. dayAriaLabelFormat: undefined
  7127. };
  7128. var DayPicker = function (_React$Component) {
  7129. _inherits(DayPicker, _React$Component);
  7130. function DayPicker(props) {
  7131. _classCallCheck(this, DayPicker);
  7132. var _this = _possibleConstructorReturn(this, (DayPicker.__proto__ || Object.getPrototypeOf(DayPicker)).call(this, props));
  7133. var currentMonth = props.hidden ? (0, _moment2['default'])() : props.initialVisibleMonth();
  7134. var focusedDate = currentMonth.clone().startOf('month');
  7135. if (props.getFirstFocusableDay) {
  7136. focusedDate = props.getFirstFocusableDay(currentMonth);
  7137. }
  7138. var horizontalMonthPadding = props.horizontalMonthPadding;
  7139. var translationValue = props.isRTL && _this.isHorizontal() ? -(0, _getCalendarMonthWidth2['default'])(props.daySize, horizontalMonthPadding) : 0;
  7140. _this.hasSetInitialVisibleMonth = !props.hidden;
  7141. _this.state = {
  7142. currentMonth: currentMonth,
  7143. monthTransition: null,
  7144. translationValue: translationValue,
  7145. scrollableMonthMultiple: 1,
  7146. calendarMonthWidth: (0, _getCalendarMonthWidth2['default'])(props.daySize, horizontalMonthPadding),
  7147. focusedDate: !props.hidden || props.isFocused ? focusedDate : null,
  7148. nextFocusedDate: null,
  7149. showKeyboardShortcuts: props.showKeyboardShortcuts,
  7150. onKeyboardShortcutsPanelClose: function () {
  7151. function onKeyboardShortcutsPanelClose() {}
  7152. return onKeyboardShortcutsPanelClose;
  7153. }(),
  7154. isTouchDevice: (0, _isTouchDevice2['default'])(),
  7155. withMouseInteractions: true,
  7156. calendarInfoWidth: 0,
  7157. monthTitleHeight: null,
  7158. hasSetHeight: false
  7159. };
  7160. _this.setCalendarMonthWeeks(currentMonth);
  7161. _this.calendarMonthGridHeight = 0;
  7162. _this.setCalendarInfoWidthTimeout = null;
  7163. _this.onKeyDown = _this.onKeyDown.bind(_this);
  7164. _this.throttledKeyDown = (0, _throttle2['default'])(_this.onFinalKeyDown, 200, { trailing: false });
  7165. _this.onPrevMonthClick = _this.onPrevMonthClick.bind(_this);
  7166. _this.onNextMonthClick = _this.onNextMonthClick.bind(_this);
  7167. _this.onMonthChange = _this.onMonthChange.bind(_this);
  7168. _this.onYearChange = _this.onYearChange.bind(_this);
  7169. _this.multiplyScrollableMonths = _this.multiplyScrollableMonths.bind(_this);
  7170. _this.updateStateAfterMonthTransition = _this.updateStateAfterMonthTransition.bind(_this);
  7171. _this.openKeyboardShortcutsPanel = _this.openKeyboardShortcutsPanel.bind(_this);
  7172. _this.closeKeyboardShortcutsPanel = _this.closeKeyboardShortcutsPanel.bind(_this);
  7173. _this.setCalendarInfoRef = _this.setCalendarInfoRef.bind(_this);
  7174. _this.setContainerRef = _this.setContainerRef.bind(_this);
  7175. _this.setTransitionContainerRef = _this.setTransitionContainerRef.bind(_this);
  7176. _this.setMonthTitleHeight = _this.setMonthTitleHeight.bind(_this);
  7177. return _this;
  7178. }
  7179. _createClass(DayPicker, [{
  7180. key: 'componentDidMount',
  7181. value: function () {
  7182. function componentDidMount() {
  7183. var currentMonth = this.state.currentMonth;
  7184. if (this.calendarInfo) {
  7185. this.setState({
  7186. isTouchDevice: (0, _isTouchDevice2['default'])(),
  7187. calendarInfoWidth: (0, _calculateDimension2['default'])(this.calendarInfo, 'width', true, true)
  7188. });
  7189. } else {
  7190. this.setState({ isTouchDevice: (0, _isTouchDevice2['default'])() });
  7191. }
  7192. this.setCalendarMonthWeeks(currentMonth);
  7193. }
  7194. return componentDidMount;
  7195. }()
  7196. }, {
  7197. key: 'componentWillReceiveProps',
  7198. value: function () {
  7199. function componentWillReceiveProps(nextProps) {
  7200. var hidden = nextProps.hidden,
  7201. isFocused = nextProps.isFocused,
  7202. showKeyboardShortcuts = nextProps.showKeyboardShortcuts,
  7203. onBlur = nextProps.onBlur,
  7204. renderMonthText = nextProps.renderMonthText,
  7205. horizontalMonthPadding = nextProps.horizontalMonthPadding;
  7206. var currentMonth = this.state.currentMonth;
  7207. if (!hidden) {
  7208. if (!this.hasSetInitialVisibleMonth) {
  7209. this.hasSetInitialVisibleMonth = true;
  7210. this.setState({
  7211. currentMonth: nextProps.initialVisibleMonth()
  7212. });
  7213. }
  7214. }
  7215. var _props = this.props,
  7216. daySize = _props.daySize,
  7217. prevIsFocused = _props.isFocused,
  7218. prevRenderMonthText = _props.renderMonthText;
  7219. if (nextProps.daySize !== daySize) {
  7220. this.setState({
  7221. calendarMonthWidth: (0, _getCalendarMonthWidth2['default'])(nextProps.daySize, horizontalMonthPadding)
  7222. });
  7223. }
  7224. if (isFocused !== prevIsFocused) {
  7225. if (isFocused) {
  7226. var focusedDate = this.getFocusedDay(currentMonth);
  7227. var onKeyboardShortcutsPanelClose = this.state.onKeyboardShortcutsPanelClose;
  7228. if (nextProps.showKeyboardShortcuts) {
  7229. // the ? shortcut came from the input and we should return input there once it is close
  7230. onKeyboardShortcutsPanelClose = onBlur;
  7231. }
  7232. this.setState({
  7233. showKeyboardShortcuts: showKeyboardShortcuts,
  7234. onKeyboardShortcutsPanelClose: onKeyboardShortcutsPanelClose,
  7235. focusedDate: focusedDate,
  7236. withMouseInteractions: false
  7237. });
  7238. } else {
  7239. this.setState({ focusedDate: null });
  7240. }
  7241. }
  7242. if (renderMonthText !== prevRenderMonthText) {
  7243. this.setState({
  7244. monthTitleHeight: null
  7245. });
  7246. }
  7247. }
  7248. return componentWillReceiveProps;
  7249. }()
  7250. }, {
  7251. key: 'shouldComponentUpdate',
  7252. value: function () {
  7253. function shouldComponentUpdate(nextProps, nextState) {
  7254. return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
  7255. }
  7256. return shouldComponentUpdate;
  7257. }()
  7258. }, {
  7259. key: 'componentWillUpdate',
  7260. value: function () {
  7261. function componentWillUpdate() {
  7262. var _this2 = this;
  7263. var transitionDuration = this.props.transitionDuration;
  7264. // Calculating the dimensions trigger a DOM repaint which
  7265. // breaks the CSS transition.
  7266. // The setTimeout will wait until the transition ends.
  7267. if (this.calendarInfo) {
  7268. this.setCalendarInfoWidthTimeout = setTimeout(function () {
  7269. var calendarInfoWidth = _this2.state.calendarInfoWidth;
  7270. var calendarInfoPanelWidth = (0, _calculateDimension2['default'])(_this2.calendarInfo, 'width', true, true);
  7271. if (calendarInfoWidth !== calendarInfoPanelWidth) {
  7272. _this2.setState({
  7273. calendarInfoWidth: calendarInfoPanelWidth
  7274. });
  7275. }
  7276. }, transitionDuration);
  7277. }
  7278. }
  7279. return componentWillUpdate;
  7280. }()
  7281. }, {
  7282. key: 'componentDidUpdate',
  7283. value: function () {
  7284. function componentDidUpdate(prevProps) {
  7285. var _props2 = this.props,
  7286. orientation = _props2.orientation,
  7287. daySize = _props2.daySize,
  7288. isFocused = _props2.isFocused,
  7289. numberOfMonths = _props2.numberOfMonths;
  7290. var _state = this.state,
  7291. focusedDate = _state.focusedDate,
  7292. monthTitleHeight = _state.monthTitleHeight;
  7293. if (this.isHorizontal() && (orientation !== prevProps.orientation || daySize !== prevProps.daySize)) {
  7294. var visibleCalendarWeeks = this.calendarMonthWeeks.slice(1, numberOfMonths + 1);
  7295. var calendarMonthWeeksHeight = Math.max.apply(Math, [0].concat(_toConsumableArray(visibleCalendarWeeks))) * (daySize - 1);
  7296. var newMonthHeight = monthTitleHeight + calendarMonthWeeksHeight + 1;
  7297. this.adjustDayPickerHeight(newMonthHeight);
  7298. }
  7299. if (!prevProps.isFocused && isFocused && !focusedDate) {
  7300. this.container.focus();
  7301. }
  7302. }
  7303. return componentDidUpdate;
  7304. }()
  7305. }, {
  7306. key: 'componentWillUnmount',
  7307. value: function () {
  7308. function componentWillUnmount() {
  7309. clearTimeout(this.setCalendarInfoWidthTimeout);
  7310. }
  7311. return componentWillUnmount;
  7312. }()
  7313. }, {
  7314. key: 'onKeyDown',
  7315. value: function () {
  7316. function onKeyDown(e) {
  7317. e.stopPropagation();
  7318. if (!_constants.MODIFIER_KEY_NAMES.has(e.key)) {
  7319. this.throttledKeyDown(e);
  7320. }
  7321. }
  7322. return onKeyDown;
  7323. }()
  7324. }, {
  7325. key: 'onFinalKeyDown',
  7326. value: function () {
  7327. function onFinalKeyDown(e) {
  7328. this.setState({ withMouseInteractions: false });
  7329. var _props3 = this.props,
  7330. onBlur = _props3.onBlur,
  7331. isRTL = _props3.isRTL;
  7332. var _state2 = this.state,
  7333. focusedDate = _state2.focusedDate,
  7334. showKeyboardShortcuts = _state2.showKeyboardShortcuts;
  7335. if (!focusedDate) return;
  7336. var newFocusedDate = focusedDate.clone();
  7337. var didTransitionMonth = false;
  7338. // focus might be anywhere when the keyboard shortcuts panel is opened so we want to
  7339. // return it to wherever it was before when the panel was opened
  7340. var activeElement = (0, _getActiveElement2['default'])();
  7341. var onKeyboardShortcutsPanelClose = function () {
  7342. function onKeyboardShortcutsPanelClose() {
  7343. if (activeElement) activeElement.focus();
  7344. }
  7345. return onKeyboardShortcutsPanelClose;
  7346. }();
  7347. switch (e.key) {
  7348. case 'ArrowUp':
  7349. e.preventDefault();
  7350. newFocusedDate.subtract(1, 'week');
  7351. didTransitionMonth = this.maybeTransitionPrevMonth(newFocusedDate);
  7352. break;
  7353. case 'ArrowLeft':
  7354. e.preventDefault();
  7355. if (isRTL) {
  7356. newFocusedDate.add(1, 'day');
  7357. } else {
  7358. newFocusedDate.subtract(1, 'day');
  7359. }
  7360. didTransitionMonth = this.maybeTransitionPrevMonth(newFocusedDate);
  7361. break;
  7362. case 'Home':
  7363. e.preventDefault();
  7364. newFocusedDate.startOf('week');
  7365. didTransitionMonth = this.maybeTransitionPrevMonth(newFocusedDate);
  7366. break;
  7367. case 'PageUp':
  7368. e.preventDefault();
  7369. newFocusedDate.subtract(1, 'month');
  7370. didTransitionMonth = this.maybeTransitionPrevMonth(newFocusedDate);
  7371. break;
  7372. case 'ArrowDown':
  7373. e.preventDefault();
  7374. newFocusedDate.add(1, 'week');
  7375. didTransitionMonth = this.maybeTransitionNextMonth(newFocusedDate);
  7376. break;
  7377. case 'ArrowRight':
  7378. e.preventDefault();
  7379. if (isRTL) {
  7380. newFocusedDate.subtract(1, 'day');
  7381. } else {
  7382. newFocusedDate.add(1, 'day');
  7383. }
  7384. didTransitionMonth = this.maybeTransitionNextMonth(newFocusedDate);
  7385. break;
  7386. case 'End':
  7387. e.preventDefault();
  7388. newFocusedDate.endOf('week');
  7389. didTransitionMonth = this.maybeTransitionNextMonth(newFocusedDate);
  7390. break;
  7391. case 'PageDown':
  7392. e.preventDefault();
  7393. newFocusedDate.add(1, 'month');
  7394. didTransitionMonth = this.maybeTransitionNextMonth(newFocusedDate);
  7395. break;
  7396. case '?':
  7397. this.openKeyboardShortcutsPanel(onKeyboardShortcutsPanelClose);
  7398. break;
  7399. case 'Escape':
  7400. if (showKeyboardShortcuts) {
  7401. this.closeKeyboardShortcutsPanel();
  7402. } else {
  7403. onBlur();
  7404. }
  7405. break;
  7406. default:
  7407. break;
  7408. }
  7409. // If there was a month transition, do not update the focused date until the transition has
  7410. // completed. Otherwise, attempting to focus on a DOM node may interrupt the CSS animation. If
  7411. // didTransitionMonth is true, the focusedDate gets updated in #updateStateAfterMonthTransition
  7412. if (!didTransitionMonth) {
  7413. this.setState({
  7414. focusedDate: newFocusedDate
  7415. });
  7416. }
  7417. }
  7418. return onFinalKeyDown;
  7419. }()
  7420. }, {
  7421. key: 'onPrevMonthClick',
  7422. value: function () {
  7423. function onPrevMonthClick(nextFocusedDate, e) {
  7424. var _props4 = this.props,
  7425. daySize = _props4.daySize,
  7426. isRTL = _props4.isRTL,
  7427. numberOfMonths = _props4.numberOfMonths;
  7428. var _state3 = this.state,
  7429. calendarMonthWidth = _state3.calendarMonthWidth,
  7430. monthTitleHeight = _state3.monthTitleHeight;
  7431. if (e) e.preventDefault();
  7432. var translationValue = void 0;
  7433. if (this.isVertical()) {
  7434. var calendarMonthWeeksHeight = this.calendarMonthWeeks[0] * (daySize - 1);
  7435. translationValue = monthTitleHeight + calendarMonthWeeksHeight + 1;
  7436. } else if (this.isHorizontal()) {
  7437. translationValue = calendarMonthWidth;
  7438. if (isRTL) {
  7439. translationValue = -2 * calendarMonthWidth;
  7440. }
  7441. var visibleCalendarWeeks = this.calendarMonthWeeks.slice(0, numberOfMonths);
  7442. var _calendarMonthWeeksHeight = Math.max.apply(Math, [0].concat(_toConsumableArray(visibleCalendarWeeks))) * (daySize - 1);
  7443. var newMonthHeight = monthTitleHeight + _calendarMonthWeeksHeight + 1;
  7444. this.adjustDayPickerHeight(newMonthHeight);
  7445. }
  7446. this.setState({
  7447. monthTransition: PREV_TRANSITION,
  7448. translationValue: translationValue,
  7449. focusedDate: null,
  7450. nextFocusedDate: nextFocusedDate
  7451. });
  7452. }
  7453. return onPrevMonthClick;
  7454. }()
  7455. }, {
  7456. key: 'onMonthChange',
  7457. value: function () {
  7458. function onMonthChange(currentMonth) {
  7459. this.setCalendarMonthWeeks(currentMonth);
  7460. this.calculateAndSetDayPickerHeight();
  7461. // Translation value is a hack to force an invisible transition that
  7462. // properly rerenders the CalendarMonthGrid
  7463. this.setState({
  7464. monthTransition: MONTH_SELECTION_TRANSITION,
  7465. translationValue: 0.00001,
  7466. focusedDate: null,
  7467. nextFocusedDate: currentMonth,
  7468. currentMonth: currentMonth
  7469. });
  7470. }
  7471. return onMonthChange;
  7472. }()
  7473. }, {
  7474. key: 'onYearChange',
  7475. value: function () {
  7476. function onYearChange(currentMonth) {
  7477. this.setCalendarMonthWeeks(currentMonth);
  7478. this.calculateAndSetDayPickerHeight();
  7479. // Translation value is a hack to force an invisible transition that
  7480. // properly rerenders the CalendarMonthGrid
  7481. this.setState({
  7482. monthTransition: YEAR_SELECTION_TRANSITION,
  7483. translationValue: 0.0001,
  7484. focusedDate: null,
  7485. nextFocusedDate: currentMonth,
  7486. currentMonth: currentMonth
  7487. });
  7488. }
  7489. return onYearChange;
  7490. }()
  7491. }, {
  7492. key: 'onNextMonthClick',
  7493. value: function () {
  7494. function onNextMonthClick(nextFocusedDate, e) {
  7495. var _props5 = this.props,
  7496. isRTL = _props5.isRTL,
  7497. numberOfMonths = _props5.numberOfMonths,
  7498. daySize = _props5.daySize;
  7499. var _state4 = this.state,
  7500. calendarMonthWidth = _state4.calendarMonthWidth,
  7501. monthTitleHeight = _state4.monthTitleHeight;
  7502. if (e) e.preventDefault();
  7503. var translationValue = void 0;
  7504. if (this.isVertical()) {
  7505. var firstVisibleMonthWeeks = this.calendarMonthWeeks[1];
  7506. var calendarMonthWeeksHeight = firstVisibleMonthWeeks * (daySize - 1);
  7507. translationValue = -(monthTitleHeight + calendarMonthWeeksHeight + 1);
  7508. }
  7509. if (this.isHorizontal()) {
  7510. translationValue = -calendarMonthWidth;
  7511. if (isRTL) {
  7512. translationValue = 0;
  7513. }
  7514. var visibleCalendarWeeks = this.calendarMonthWeeks.slice(2, numberOfMonths + 2);
  7515. var _calendarMonthWeeksHeight2 = Math.max.apply(Math, [0].concat(_toConsumableArray(visibleCalendarWeeks))) * (daySize - 1);
  7516. var newMonthHeight = monthTitleHeight + _calendarMonthWeeksHeight2 + 1;
  7517. this.adjustDayPickerHeight(newMonthHeight);
  7518. }
  7519. this.setState({
  7520. monthTransition: NEXT_TRANSITION,
  7521. translationValue: translationValue,
  7522. focusedDate: null,
  7523. nextFocusedDate: nextFocusedDate
  7524. });
  7525. }
  7526. return onNextMonthClick;
  7527. }()
  7528. }, {
  7529. key: 'getFirstDayOfWeek',
  7530. value: function () {
  7531. function getFirstDayOfWeek() {
  7532. var firstDayOfWeek = this.props.firstDayOfWeek;
  7533. if (firstDayOfWeek == null) {
  7534. return _moment2['default'].localeData().firstDayOfWeek();
  7535. }
  7536. return firstDayOfWeek;
  7537. }
  7538. return getFirstDayOfWeek;
  7539. }()
  7540. }, {
  7541. key: 'getFirstVisibleIndex',
  7542. value: function () {
  7543. function getFirstVisibleIndex() {
  7544. var orientation = this.props.orientation;
  7545. var monthTransition = this.state.monthTransition;
  7546. if (orientation === _constants.VERTICAL_SCROLLABLE) return 0;
  7547. var firstVisibleMonthIndex = 1;
  7548. if (monthTransition === PREV_TRANSITION) {
  7549. firstVisibleMonthIndex -= 1;
  7550. } else if (monthTransition === NEXT_TRANSITION) {
  7551. firstVisibleMonthIndex += 1;
  7552. }
  7553. return firstVisibleMonthIndex;
  7554. }
  7555. return getFirstVisibleIndex;
  7556. }()
  7557. }, {
  7558. key: 'getFocusedDay',
  7559. value: function () {
  7560. function getFocusedDay(newMonth) {
  7561. var _props6 = this.props,
  7562. getFirstFocusableDay = _props6.getFirstFocusableDay,
  7563. numberOfMonths = _props6.numberOfMonths;
  7564. var focusedDate = void 0;
  7565. if (getFirstFocusableDay) {
  7566. focusedDate = getFirstFocusableDay(newMonth);
  7567. }
  7568. if (newMonth && (!focusedDate || !(0, _isDayVisible2['default'])(focusedDate, newMonth, numberOfMonths))) {
  7569. focusedDate = newMonth.clone().startOf('month');
  7570. }
  7571. return focusedDate;
  7572. }
  7573. return getFocusedDay;
  7574. }()
  7575. }, {
  7576. key: 'setMonthTitleHeight',
  7577. value: function () {
  7578. function setMonthTitleHeight(monthTitleHeight) {
  7579. var _this3 = this;
  7580. this.setState({
  7581. monthTitleHeight: monthTitleHeight
  7582. }, function () {
  7583. _this3.calculateAndSetDayPickerHeight();
  7584. });
  7585. }
  7586. return setMonthTitleHeight;
  7587. }()
  7588. }, {
  7589. key: 'setCalendarMonthWeeks',
  7590. value: function () {
  7591. function setCalendarMonthWeeks(currentMonth) {
  7592. var numberOfMonths = this.props.numberOfMonths;
  7593. this.calendarMonthWeeks = [];
  7594. var month = currentMonth.clone().subtract(1, 'months');
  7595. var firstDayOfWeek = this.getFirstDayOfWeek();
  7596. for (var i = 0; i < numberOfMonths + 2; i += 1) {
  7597. var numberOfWeeks = (0, _getNumberOfCalendarMonthWeeks2['default'])(month, firstDayOfWeek);
  7598. this.calendarMonthWeeks.push(numberOfWeeks);
  7599. month = month.add(1, 'months');
  7600. }
  7601. }
  7602. return setCalendarMonthWeeks;
  7603. }()
  7604. }, {
  7605. key: 'setContainerRef',
  7606. value: function () {
  7607. function setContainerRef(ref) {
  7608. this.container = ref;
  7609. }
  7610. return setContainerRef;
  7611. }()
  7612. }, {
  7613. key: 'setCalendarInfoRef',
  7614. value: function () {
  7615. function setCalendarInfoRef(ref) {
  7616. this.calendarInfo = ref;
  7617. }
  7618. return setCalendarInfoRef;
  7619. }()
  7620. }, {
  7621. key: 'setTransitionContainerRef',
  7622. value: function () {
  7623. function setTransitionContainerRef(ref) {
  7624. this.transitionContainer = ref;
  7625. }
  7626. return setTransitionContainerRef;
  7627. }()
  7628. }, {
  7629. key: 'maybeTransitionNextMonth',
  7630. value: function () {
  7631. function maybeTransitionNextMonth(newFocusedDate) {
  7632. var numberOfMonths = this.props.numberOfMonths;
  7633. var _state5 = this.state,
  7634. currentMonth = _state5.currentMonth,
  7635. focusedDate = _state5.focusedDate;
  7636. var newFocusedDateMonth = newFocusedDate.month();
  7637. var focusedDateMonth = focusedDate.month();
  7638. var isNewFocusedDateVisible = (0, _isDayVisible2['default'])(newFocusedDate, currentMonth, numberOfMonths);
  7639. if (newFocusedDateMonth !== focusedDateMonth && !isNewFocusedDateVisible) {
  7640. this.onNextMonthClick(newFocusedDate);
  7641. return true;
  7642. }
  7643. return false;
  7644. }
  7645. return maybeTransitionNextMonth;
  7646. }()
  7647. }, {
  7648. key: 'maybeTransitionPrevMonth',
  7649. value: function () {
  7650. function maybeTransitionPrevMonth(newFocusedDate) {
  7651. var numberOfMonths = this.props.numberOfMonths;
  7652. var _state6 = this.state,
  7653. currentMonth = _state6.currentMonth,
  7654. focusedDate = _state6.focusedDate;
  7655. var newFocusedDateMonth = newFocusedDate.month();
  7656. var focusedDateMonth = focusedDate.month();
  7657. var isNewFocusedDateVisible = (0, _isDayVisible2['default'])(newFocusedDate, currentMonth, numberOfMonths);
  7658. if (newFocusedDateMonth !== focusedDateMonth && !isNewFocusedDateVisible) {
  7659. this.onPrevMonthClick(newFocusedDate);
  7660. return true;
  7661. }
  7662. return false;
  7663. }
  7664. return maybeTransitionPrevMonth;
  7665. }()
  7666. }, {
  7667. key: 'multiplyScrollableMonths',
  7668. value: function () {
  7669. function multiplyScrollableMonths(e) {
  7670. var onMultiplyScrollableMonths = this.props.onMultiplyScrollableMonths;
  7671. if (e) e.preventDefault();
  7672. if (onMultiplyScrollableMonths) onMultiplyScrollableMonths(e);
  7673. this.setState(function (_ref) {
  7674. var scrollableMonthMultiple = _ref.scrollableMonthMultiple;
  7675. return {
  7676. scrollableMonthMultiple: scrollableMonthMultiple + 1
  7677. };
  7678. });
  7679. }
  7680. return multiplyScrollableMonths;
  7681. }()
  7682. }, {
  7683. key: 'isHorizontal',
  7684. value: function () {
  7685. function isHorizontal() {
  7686. var orientation = this.props.orientation;
  7687. return orientation === _constants.HORIZONTAL_ORIENTATION;
  7688. }
  7689. return isHorizontal;
  7690. }()
  7691. }, {
  7692. key: 'isVertical',
  7693. value: function () {
  7694. function isVertical() {
  7695. var orientation = this.props.orientation;
  7696. return orientation === _constants.VERTICAL_ORIENTATION || orientation === _constants.VERTICAL_SCROLLABLE;
  7697. }
  7698. return isVertical;
  7699. }()
  7700. }, {
  7701. key: 'updateStateAfterMonthTransition',
  7702. value: function () {
  7703. function updateStateAfterMonthTransition() {
  7704. var _this4 = this;
  7705. var _props7 = this.props,
  7706. onPrevMonthClick = _props7.onPrevMonthClick,
  7707. onNextMonthClick = _props7.onNextMonthClick,
  7708. numberOfMonths = _props7.numberOfMonths,
  7709. onMonthChange = _props7.onMonthChange,
  7710. onYearChange = _props7.onYearChange,
  7711. isRTL = _props7.isRTL;
  7712. var _state7 = this.state,
  7713. currentMonth = _state7.currentMonth,
  7714. monthTransition = _state7.monthTransition,
  7715. focusedDate = _state7.focusedDate,
  7716. nextFocusedDate = _state7.nextFocusedDate,
  7717. withMouseInteractions = _state7.withMouseInteractions,
  7718. calendarMonthWidth = _state7.calendarMonthWidth;
  7719. if (!monthTransition) return;
  7720. var newMonth = currentMonth.clone();
  7721. var firstDayOfWeek = this.getFirstDayOfWeek();
  7722. if (monthTransition === PREV_TRANSITION) {
  7723. newMonth.subtract(1, 'month');
  7724. if (onPrevMonthClick) onPrevMonthClick(newMonth);
  7725. var newInvisibleMonth = newMonth.clone().subtract(1, 'month');
  7726. var numberOfWeeks = (0, _getNumberOfCalendarMonthWeeks2['default'])(newInvisibleMonth, firstDayOfWeek);
  7727. this.calendarMonthWeeks = [numberOfWeeks].concat(_toConsumableArray(this.calendarMonthWeeks.slice(0, -1)));
  7728. } else if (monthTransition === NEXT_TRANSITION) {
  7729. newMonth.add(1, 'month');
  7730. if (onNextMonthClick) onNextMonthClick(newMonth);
  7731. var _newInvisibleMonth = newMonth.clone().add(numberOfMonths, 'month');
  7732. var _numberOfWeeks = (0, _getNumberOfCalendarMonthWeeks2['default'])(_newInvisibleMonth, firstDayOfWeek);
  7733. this.calendarMonthWeeks = [].concat(_toConsumableArray(this.calendarMonthWeeks.slice(1)), [_numberOfWeeks]);
  7734. } else if (monthTransition === MONTH_SELECTION_TRANSITION) {
  7735. if (onMonthChange) onMonthChange(newMonth);
  7736. } else if (monthTransition === YEAR_SELECTION_TRANSITION) {
  7737. if (onYearChange) onYearChange(newMonth);
  7738. }
  7739. var newFocusedDate = null;
  7740. if (nextFocusedDate) {
  7741. newFocusedDate = nextFocusedDate;
  7742. } else if (!focusedDate && !withMouseInteractions) {
  7743. newFocusedDate = this.getFocusedDay(newMonth);
  7744. }
  7745. this.setState({
  7746. currentMonth: newMonth,
  7747. monthTransition: null,
  7748. translationValue: isRTL && this.isHorizontal() ? -calendarMonthWidth : 0,
  7749. nextFocusedDate: null,
  7750. focusedDate: newFocusedDate
  7751. }, function () {
  7752. // we don't want to focus on the relevant calendar day after a month transition
  7753. // if the user is navigating around using a mouse
  7754. if (withMouseInteractions) {
  7755. var activeElement = (0, _getActiveElement2['default'])();
  7756. if (activeElement && activeElement !== document.body && _this4.container.contains(activeElement)) {
  7757. activeElement.blur();
  7758. }
  7759. }
  7760. });
  7761. }
  7762. return updateStateAfterMonthTransition;
  7763. }()
  7764. }, {
  7765. key: 'adjustDayPickerHeight',
  7766. value: function () {
  7767. function adjustDayPickerHeight(newMonthHeight) {
  7768. var _this5 = this;
  7769. var monthHeight = newMonthHeight + MONTH_PADDING;
  7770. if (monthHeight !== this.calendarMonthGridHeight) {
  7771. this.transitionContainer.style.height = String(monthHeight) + 'px';
  7772. if (!this.calendarMonthGridHeight) {
  7773. setTimeout(function () {
  7774. _this5.setState({ hasSetHeight: true });
  7775. }, 0);
  7776. }
  7777. this.calendarMonthGridHeight = monthHeight;
  7778. }
  7779. }
  7780. return adjustDayPickerHeight;
  7781. }()
  7782. }, {
  7783. key: 'calculateAndSetDayPickerHeight',
  7784. value: function () {
  7785. function calculateAndSetDayPickerHeight() {
  7786. var _props8 = this.props,
  7787. daySize = _props8.daySize,
  7788. numberOfMonths = _props8.numberOfMonths;
  7789. var monthTitleHeight = this.state.monthTitleHeight;
  7790. var visibleCalendarWeeks = this.calendarMonthWeeks.slice(1, numberOfMonths + 1);
  7791. var calendarMonthWeeksHeight = Math.max.apply(Math, [0].concat(_toConsumableArray(visibleCalendarWeeks))) * (daySize - 1);
  7792. var newMonthHeight = monthTitleHeight + calendarMonthWeeksHeight + 1;
  7793. if (this.isHorizontal()) {
  7794. this.adjustDayPickerHeight(newMonthHeight);
  7795. }
  7796. }
  7797. return calculateAndSetDayPickerHeight;
  7798. }()
  7799. }, {
  7800. key: 'openKeyboardShortcutsPanel',
  7801. value: function () {
  7802. function openKeyboardShortcutsPanel(onCloseCallBack) {
  7803. this.setState({
  7804. showKeyboardShortcuts: true,
  7805. onKeyboardShortcutsPanelClose: onCloseCallBack
  7806. });
  7807. }
  7808. return openKeyboardShortcutsPanel;
  7809. }()
  7810. }, {
  7811. key: 'closeKeyboardShortcutsPanel',
  7812. value: function () {
  7813. function closeKeyboardShortcutsPanel() {
  7814. var onKeyboardShortcutsPanelClose = this.state.onKeyboardShortcutsPanelClose;
  7815. if (onKeyboardShortcutsPanelClose) {
  7816. onKeyboardShortcutsPanelClose();
  7817. }
  7818. this.setState({
  7819. onKeyboardShortcutsPanelClose: null,
  7820. showKeyboardShortcuts: false
  7821. });
  7822. }
  7823. return closeKeyboardShortcutsPanel;
  7824. }()
  7825. }, {
  7826. key: 'renderNavigation',
  7827. value: function () {
  7828. function renderNavigation() {
  7829. var _this6 = this;
  7830. var _props9 = this.props,
  7831. navPrev = _props9.navPrev,
  7832. navNext = _props9.navNext,
  7833. noNavButtons = _props9.noNavButtons,
  7834. orientation = _props9.orientation,
  7835. phrases = _props9.phrases,
  7836. isRTL = _props9.isRTL;
  7837. if (noNavButtons) {
  7838. return null;
  7839. }
  7840. var onNextMonthClick = void 0;
  7841. if (orientation === _constants.VERTICAL_SCROLLABLE) {
  7842. onNextMonthClick = this.multiplyScrollableMonths;
  7843. } else {
  7844. onNextMonthClick = function () {
  7845. function onNextMonthClick(e) {
  7846. _this6.onNextMonthClick(null, e);
  7847. }
  7848. return onNextMonthClick;
  7849. }();
  7850. }
  7851. return _react2['default'].createElement(_DayPickerNavigation2['default'], {
  7852. onPrevMonthClick: function () {
  7853. function onPrevMonthClick(e) {
  7854. _this6.onPrevMonthClick(null, e);
  7855. }
  7856. return onPrevMonthClick;
  7857. }(),
  7858. onNextMonthClick: onNextMonthClick,
  7859. navPrev: navPrev,
  7860. navNext: navNext,
  7861. orientation: orientation,
  7862. phrases: phrases,
  7863. isRTL: isRTL
  7864. });
  7865. }
  7866. return renderNavigation;
  7867. }()
  7868. }, {
  7869. key: 'renderWeekHeader',
  7870. value: function () {
  7871. function renderWeekHeader(index) {
  7872. var _props10 = this.props,
  7873. daySize = _props10.daySize,
  7874. horizontalMonthPadding = _props10.horizontalMonthPadding,
  7875. orientation = _props10.orientation,
  7876. weekDayFormat = _props10.weekDayFormat,
  7877. styles = _props10.styles;
  7878. var calendarMonthWidth = this.state.calendarMonthWidth;
  7879. var verticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
  7880. var horizontalStyle = {
  7881. left: index * calendarMonthWidth
  7882. };
  7883. var verticalStyle = {
  7884. marginLeft: -calendarMonthWidth / 2
  7885. };
  7886. var weekHeaderStyle = {}; // no styles applied to the vertical-scrollable orientation
  7887. if (this.isHorizontal()) {
  7888. weekHeaderStyle = horizontalStyle;
  7889. } else if (this.isVertical() && !verticalScrollable) {
  7890. weekHeaderStyle = verticalStyle;
  7891. }
  7892. var firstDayOfWeek = this.getFirstDayOfWeek();
  7893. var header = [];
  7894. for (var i = 0; i < 7; i += 1) {
  7895. header.push(_react2['default'].createElement(
  7896. 'li',
  7897. _extends({ key: i }, (0, _reactWithStyles.css)(styles.DayPicker_weekHeader_li, { width: daySize })),
  7898. _react2['default'].createElement(
  7899. 'small',
  7900. null,
  7901. (0, _moment2['default'])().day((i + firstDayOfWeek) % 7).format(weekDayFormat)
  7902. )
  7903. ));
  7904. }
  7905. return _react2['default'].createElement(
  7906. 'div',
  7907. _extends({}, (0, _reactWithStyles.css)(styles.DayPicker_weekHeader, this.isVertical() && styles.DayPicker_weekHeader__vertical, verticalScrollable && styles.DayPicker_weekHeader__verticalScrollable, weekHeaderStyle, { padding: '0 ' + String(horizontalMonthPadding) + 'px' }), {
  7908. key: 'week-' + String(index)
  7909. }),
  7910. _react2['default'].createElement(
  7911. 'ul',
  7912. (0, _reactWithStyles.css)(styles.DayPicker_weekHeader_ul),
  7913. header
  7914. )
  7915. );
  7916. }
  7917. return renderWeekHeader;
  7918. }()
  7919. }, {
  7920. key: 'render',
  7921. value: function () {
  7922. function render() {
  7923. var _this7 = this;
  7924. var _state8 = this.state,
  7925. calendarMonthWidth = _state8.calendarMonthWidth,
  7926. currentMonth = _state8.currentMonth,
  7927. monthTransition = _state8.monthTransition,
  7928. translationValue = _state8.translationValue,
  7929. scrollableMonthMultiple = _state8.scrollableMonthMultiple,
  7930. focusedDate = _state8.focusedDate,
  7931. showKeyboardShortcuts = _state8.showKeyboardShortcuts,
  7932. isTouch = _state8.isTouchDevice,
  7933. hasSetHeight = _state8.hasSetHeight,
  7934. calendarInfoWidth = _state8.calendarInfoWidth,
  7935. monthTitleHeight = _state8.monthTitleHeight;
  7936. var _props11 = this.props,
  7937. enableOutsideDays = _props11.enableOutsideDays,
  7938. numberOfMonths = _props11.numberOfMonths,
  7939. orientation = _props11.orientation,
  7940. modifiers = _props11.modifiers,
  7941. withPortal = _props11.withPortal,
  7942. onDayClick = _props11.onDayClick,
  7943. onDayMouseEnter = _props11.onDayMouseEnter,
  7944. onDayMouseLeave = _props11.onDayMouseLeave,
  7945. firstDayOfWeek = _props11.firstDayOfWeek,
  7946. renderMonthText = _props11.renderMonthText,
  7947. renderCalendarDay = _props11.renderCalendarDay,
  7948. renderDayContents = _props11.renderDayContents,
  7949. renderCalendarInfo = _props11.renderCalendarInfo,
  7950. renderMonthElement = _props11.renderMonthElement,
  7951. calendarInfoPosition = _props11.calendarInfoPosition,
  7952. hideKeyboardShortcutsPanel = _props11.hideKeyboardShortcutsPanel,
  7953. onOutsideClick = _props11.onOutsideClick,
  7954. monthFormat = _props11.monthFormat,
  7955. daySize = _props11.daySize,
  7956. isFocused = _props11.isFocused,
  7957. isRTL = _props11.isRTL,
  7958. styles = _props11.styles,
  7959. theme = _props11.theme,
  7960. phrases = _props11.phrases,
  7961. verticalHeight = _props11.verticalHeight,
  7962. dayAriaLabelFormat = _props11.dayAriaLabelFormat,
  7963. noBorder = _props11.noBorder,
  7964. transitionDuration = _props11.transitionDuration,
  7965. verticalBorderSpacing = _props11.verticalBorderSpacing,
  7966. horizontalMonthPadding = _props11.horizontalMonthPadding;
  7967. var dayPickerHorizontalPadding = theme.reactDates.spacing.dayPickerHorizontalPadding;
  7968. var isHorizontal = this.isHorizontal();
  7969. var numOfWeekHeaders = this.isVertical() ? 1 : numberOfMonths;
  7970. var weekHeaders = [];
  7971. for (var i = 0; i < numOfWeekHeaders; i += 1) {
  7972. weekHeaders.push(this.renderWeekHeader(i));
  7973. }
  7974. var verticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
  7975. var height = void 0;
  7976. if (isHorizontal) {
  7977. height = this.calendarMonthGridHeight;
  7978. } else if (this.isVertical() && !verticalScrollable && !withPortal) {
  7979. // If the user doesn't set a desired height,
  7980. // we default back to this kind of made-up value that generally looks good
  7981. height = verticalHeight || 1.75 * calendarMonthWidth;
  7982. }
  7983. var isCalendarMonthGridAnimating = monthTransition !== null;
  7984. var shouldFocusDate = !isCalendarMonthGridAnimating && isFocused;
  7985. var keyboardShortcutButtonLocation = _DayPickerKeyboardShortcuts.BOTTOM_RIGHT;
  7986. if (this.isVertical()) {
  7987. keyboardShortcutButtonLocation = withPortal ? _DayPickerKeyboardShortcuts.TOP_LEFT : _DayPickerKeyboardShortcuts.TOP_RIGHT;
  7988. }
  7989. var shouldAnimateHeight = isHorizontal && hasSetHeight;
  7990. var calendarInfoPositionTop = calendarInfoPosition === _constants.INFO_POSITION_TOP;
  7991. var calendarInfoPositionBottom = calendarInfoPosition === _constants.INFO_POSITION_BOTTOM;
  7992. var calendarInfoPositionBefore = calendarInfoPosition === _constants.INFO_POSITION_BEFORE;
  7993. var calendarInfoPositionAfter = calendarInfoPosition === _constants.INFO_POSITION_AFTER;
  7994. var calendarInfoIsInline = calendarInfoPositionBefore || calendarInfoPositionAfter;
  7995. var calendarInfo = renderCalendarInfo && _react2['default'].createElement(
  7996. 'div',
  7997. _extends({
  7998. ref: this.setCalendarInfoRef
  7999. }, (0, _reactWithStyles.css)(calendarInfoIsInline && styles.DayPicker_calendarInfo__horizontal)),
  8000. renderCalendarInfo()
  8001. );
  8002. var calendarInfoPanelWidth = renderCalendarInfo && calendarInfoIsInline ? calendarInfoWidth : 0;
  8003. var firstVisibleMonthIndex = this.getFirstVisibleIndex();
  8004. var wrapperHorizontalWidth = calendarMonthWidth * numberOfMonths + 2 * dayPickerHorizontalPadding;
  8005. // Adding `1px` because of whitespace between 2 inline-block
  8006. var fullHorizontalWidth = wrapperHorizontalWidth + calendarInfoPanelWidth + 1;
  8007. var transitionContainerStyle = {
  8008. width: isHorizontal && wrapperHorizontalWidth,
  8009. height: height
  8010. };
  8011. var dayPickerWrapperStyle = {
  8012. width: isHorizontal && wrapperHorizontalWidth
  8013. };
  8014. var dayPickerStyle = {
  8015. width: isHorizontal && fullHorizontalWidth,
  8016. // These values are to center the datepicker (approximately) on the page
  8017. marginLeft: isHorizontal && withPortal ? -fullHorizontalWidth / 2 : null,
  8018. marginTop: isHorizontal && withPortal ? -calendarMonthWidth / 2 : null
  8019. };
  8020. return _react2['default'].createElement(
  8021. 'div',
  8022. _extends({
  8023. role: 'application',
  8024. 'aria-label': phrases.calendarLabel
  8025. }, (0, _reactWithStyles.css)(styles.DayPicker, isHorizontal && styles.DayPicker__horizontal, verticalScrollable && styles.DayPicker__verticalScrollable, isHorizontal && withPortal && styles.DayPicker_portal__horizontal, this.isVertical() && withPortal && styles.DayPicker_portal__vertical, dayPickerStyle, !monthTitleHeight && styles.DayPicker__hidden, !noBorder && styles.DayPicker__withBorder)),
  8026. _react2['default'].createElement(
  8027. _reactOutsideClickHandler2['default'],
  8028. { onOutsideClick: onOutsideClick },
  8029. (calendarInfoPositionTop || calendarInfoPositionBefore) && calendarInfo,
  8030. _react2['default'].createElement(
  8031. 'div',
  8032. (0, _reactWithStyles.css)(dayPickerWrapperStyle, calendarInfoIsInline && isHorizontal && styles.DayPicker_wrapper__horizontal),
  8033. _react2['default'].createElement(
  8034. 'div',
  8035. _extends({}, (0, _reactWithStyles.css)(styles.DayPicker_weekHeaders, isHorizontal && styles.DayPicker_weekHeaders__horizontal), {
  8036. 'aria-hidden': 'true',
  8037. role: 'presentation'
  8038. }),
  8039. weekHeaders
  8040. ),
  8041. _react2['default'].createElement(
  8042. 'div',
  8043. _extends({}, (0, _reactWithStyles.css)(styles.DayPicker_focusRegion), {
  8044. ref: this.setContainerRef,
  8045. onClick: function () {
  8046. function onClick(e) {
  8047. e.stopPropagation();
  8048. }
  8049. return onClick;
  8050. }(),
  8051. onKeyDown: this.onKeyDown,
  8052. onMouseUp: function () {
  8053. function onMouseUp() {
  8054. _this7.setState({ withMouseInteractions: true });
  8055. }
  8056. return onMouseUp;
  8057. }(),
  8058. role: 'region',
  8059. tabIndex: -1
  8060. }),
  8061. !verticalScrollable && this.renderNavigation(),
  8062. _react2['default'].createElement(
  8063. 'div',
  8064. _extends({}, (0, _reactWithStyles.css)(styles.DayPicker_transitionContainer, shouldAnimateHeight && styles.DayPicker_transitionContainer__horizontal, this.isVertical() && styles.DayPicker_transitionContainer__vertical, verticalScrollable && styles.DayPicker_transitionContainer__verticalScrollable, transitionContainerStyle), {
  8065. ref: this.setTransitionContainerRef
  8066. }),
  8067. _react2['default'].createElement(_CalendarMonthGrid2['default'], {
  8068. setMonthTitleHeight: !monthTitleHeight ? this.setMonthTitleHeight : undefined,
  8069. translationValue: translationValue,
  8070. enableOutsideDays: enableOutsideDays,
  8071. firstVisibleMonthIndex: firstVisibleMonthIndex,
  8072. initialMonth: currentMonth,
  8073. isAnimating: isCalendarMonthGridAnimating,
  8074. modifiers: modifiers,
  8075. orientation: orientation,
  8076. numberOfMonths: numberOfMonths * scrollableMonthMultiple,
  8077. onDayClick: onDayClick,
  8078. onDayMouseEnter: onDayMouseEnter,
  8079. onDayMouseLeave: onDayMouseLeave,
  8080. onMonthChange: this.onMonthChange,
  8081. onYearChange: this.onYearChange,
  8082. renderMonthText: renderMonthText,
  8083. renderCalendarDay: renderCalendarDay,
  8084. renderDayContents: renderDayContents,
  8085. renderMonthElement: renderMonthElement,
  8086. onMonthTransitionEnd: this.updateStateAfterMonthTransition,
  8087. monthFormat: monthFormat,
  8088. daySize: daySize,
  8089. firstDayOfWeek: firstDayOfWeek,
  8090. isFocused: shouldFocusDate,
  8091. focusedDate: focusedDate,
  8092. phrases: phrases,
  8093. isRTL: isRTL,
  8094. dayAriaLabelFormat: dayAriaLabelFormat,
  8095. transitionDuration: transitionDuration,
  8096. verticalBorderSpacing: verticalBorderSpacing,
  8097. horizontalMonthPadding: horizontalMonthPadding
  8098. }),
  8099. verticalScrollable && this.renderNavigation()
  8100. ),
  8101. !isTouch && !hideKeyboardShortcutsPanel && _react2['default'].createElement(_DayPickerKeyboardShortcuts2['default'], {
  8102. block: this.isVertical() && !withPortal,
  8103. buttonLocation: keyboardShortcutButtonLocation,
  8104. showKeyboardShortcutsPanel: showKeyboardShortcuts,
  8105. openKeyboardShortcutsPanel: this.openKeyboardShortcutsPanel,
  8106. closeKeyboardShortcutsPanel: this.closeKeyboardShortcutsPanel,
  8107. phrases: phrases
  8108. })
  8109. )
  8110. ),
  8111. (calendarInfoPositionBottom || calendarInfoPositionAfter) && calendarInfo
  8112. )
  8113. );
  8114. }
  8115. return render;
  8116. }()
  8117. }]);
  8118. return DayPicker;
  8119. }(_react2['default'].Component);
  8120. DayPicker.propTypes = propTypes;
  8121. DayPicker.defaultProps = defaultProps;
  8122. exports.PureDayPicker = DayPicker;
  8123. exports["default"] = (0, _reactWithStyles.withStyles)(function (_ref2) {
  8124. var _ref2$reactDates = _ref2.reactDates,
  8125. color = _ref2$reactDates.color,
  8126. font = _ref2$reactDates.font,
  8127. noScrollBarOnVerticalScrollable = _ref2$reactDates.noScrollBarOnVerticalScrollable,
  8128. spacing = _ref2$reactDates.spacing,
  8129. zIndex = _ref2$reactDates.zIndex;
  8130. return {
  8131. DayPicker: {
  8132. background: color.background,
  8133. position: 'relative',
  8134. textAlign: 'left'
  8135. },
  8136. DayPicker__horizontal: {
  8137. background: color.background
  8138. },
  8139. DayPicker__verticalScrollable: {
  8140. height: '100%'
  8141. },
  8142. DayPicker__hidden: {
  8143. visibility: 'hidden'
  8144. },
  8145. DayPicker__withBorder: {
  8146. boxShadow: '0 2px 6px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.07)',
  8147. borderRadius: 3
  8148. },
  8149. DayPicker_portal__horizontal: {
  8150. boxShadow: 'none',
  8151. position: 'absolute',
  8152. left: '50%',
  8153. top: '50%'
  8154. },
  8155. DayPicker_portal__vertical: {
  8156. position: 'initial'
  8157. },
  8158. DayPicker_focusRegion: {
  8159. outline: 'none'
  8160. },
  8161. DayPicker_calendarInfo__horizontal: {
  8162. display: 'inline-block',
  8163. verticalAlign: 'top'
  8164. },
  8165. DayPicker_wrapper__horizontal: {
  8166. display: 'inline-block',
  8167. verticalAlign: 'top'
  8168. },
  8169. DayPicker_weekHeaders: {
  8170. position: 'relative'
  8171. },
  8172. DayPicker_weekHeaders__horizontal: {
  8173. marginLeft: spacing.dayPickerHorizontalPadding
  8174. },
  8175. DayPicker_weekHeader: {
  8176. color: color.placeholderText,
  8177. position: 'absolute',
  8178. top: 62,
  8179. zIndex: zIndex + 2,
  8180. textAlign: 'left'
  8181. },
  8182. DayPicker_weekHeader__vertical: {
  8183. left: '50%'
  8184. },
  8185. DayPicker_weekHeader__verticalScrollable: {
  8186. top: 0,
  8187. display: 'table-row',
  8188. borderBottom: '1px solid ' + String(color.core.border),
  8189. background: color.background,
  8190. marginLeft: 0,
  8191. left: 0,
  8192. width: '100%',
  8193. textAlign: 'center'
  8194. },
  8195. DayPicker_weekHeader_ul: {
  8196. listStyle: 'none',
  8197. margin: '1px 0',
  8198. paddingLeft: 0,
  8199. paddingRight: 0,
  8200. fontSize: font.size
  8201. },
  8202. DayPicker_weekHeader_li: {
  8203. display: 'inline-block',
  8204. textAlign: 'center'
  8205. },
  8206. DayPicker_transitionContainer: {
  8207. position: 'relative',
  8208. overflow: 'hidden',
  8209. borderRadius: 3
  8210. },
  8211. DayPicker_transitionContainer__horizontal: {
  8212. transition: 'height 0.2s ease-in-out'
  8213. },
  8214. DayPicker_transitionContainer__vertical: {
  8215. width: '100%'
  8216. },
  8217. DayPicker_transitionContainer__verticalScrollable: (0, _object2['default'])({
  8218. paddingTop: 20,
  8219. height: '100%',
  8220. position: 'absolute',
  8221. top: 0,
  8222. bottom: 0,
  8223. right: 0,
  8224. left: 0,
  8225. overflowY: 'scroll'
  8226. }, noScrollBarOnVerticalScrollable && {
  8227. '-webkitOverflowScrolling': 'touch',
  8228. '::-webkit-scrollbar': {
  8229. '-webkit-appearance': 'none',
  8230. display: 'none'
  8231. }
  8232. })
  8233. };
  8234. })(DayPicker);
  8235. /***/ }),
  8236. /***/ 600:
  8237. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  8238. "use strict";
  8239. Object.defineProperty(exports, "__esModule", ({
  8240. value: true
  8241. }));
  8242. exports.BOTTOM_RIGHT = exports.TOP_RIGHT = exports.TOP_LEFT = undefined;
  8243. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  8244. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8245. var _object = __webpack_require__(4011);
  8246. var _object2 = _interopRequireDefault(_object);
  8247. var _react = __webpack_require__(9196);
  8248. var _react2 = _interopRequireDefault(_react);
  8249. var _propTypes = __webpack_require__(2652);
  8250. var _propTypes2 = _interopRequireDefault(_propTypes);
  8251. var _airbnbPropTypes = __webpack_require__(4882);
  8252. var _reactWithStyles = __webpack_require__(3576);
  8253. var _defaultPhrases = __webpack_require__(6030);
  8254. var _getPhrasePropTypes = __webpack_require__(2893);
  8255. var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
  8256. var _KeyboardShortcutRow = __webpack_require__(5820);
  8257. var _KeyboardShortcutRow2 = _interopRequireDefault(_KeyboardShortcutRow);
  8258. var _CloseButton = __webpack_require__(6973);
  8259. var _CloseButton2 = _interopRequireDefault(_CloseButton);
  8260. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  8261. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8262. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8263. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8264. var TOP_LEFT = exports.TOP_LEFT = 'top-left';
  8265. var TOP_RIGHT = exports.TOP_RIGHT = 'top-right';
  8266. var BOTTOM_RIGHT = exports.BOTTOM_RIGHT = 'bottom-right';
  8267. var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
  8268. block: _propTypes2['default'].bool,
  8269. buttonLocation: _propTypes2['default'].oneOf([TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT]),
  8270. showKeyboardShortcutsPanel: _propTypes2['default'].bool,
  8271. openKeyboardShortcutsPanel: _propTypes2['default'].func,
  8272. closeKeyboardShortcutsPanel: _propTypes2['default'].func,
  8273. phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.DayPickerKeyboardShortcutsPhrases))
  8274. }));
  8275. var defaultProps = {
  8276. block: false,
  8277. buttonLocation: BOTTOM_RIGHT,
  8278. showKeyboardShortcutsPanel: false,
  8279. openKeyboardShortcutsPanel: function () {
  8280. function openKeyboardShortcutsPanel() {}
  8281. return openKeyboardShortcutsPanel;
  8282. }(),
  8283. closeKeyboardShortcutsPanel: function () {
  8284. function closeKeyboardShortcutsPanel() {}
  8285. return closeKeyboardShortcutsPanel;
  8286. }(),
  8287. phrases: _defaultPhrases.DayPickerKeyboardShortcutsPhrases
  8288. };
  8289. function getKeyboardShortcuts(phrases) {
  8290. return [{
  8291. unicode: '↵',
  8292. label: phrases.enterKey,
  8293. action: phrases.selectFocusedDate
  8294. }, {
  8295. unicode: '←/→',
  8296. label: phrases.leftArrowRightArrow,
  8297. action: phrases.moveFocusByOneDay
  8298. }, {
  8299. unicode: '↑/↓',
  8300. label: phrases.upArrowDownArrow,
  8301. action: phrases.moveFocusByOneWeek
  8302. }, {
  8303. unicode: 'PgUp/PgDn',
  8304. label: phrases.pageUpPageDown,
  8305. action: phrases.moveFocusByOneMonth
  8306. }, {
  8307. unicode: 'Home/End',
  8308. label: phrases.homeEnd,
  8309. action: phrases.moveFocustoStartAndEndOfWeek
  8310. }, {
  8311. unicode: 'Esc',
  8312. label: phrases.escape,
  8313. action: phrases.returnFocusToInput
  8314. }, {
  8315. unicode: '?',
  8316. label: phrases.questionMark,
  8317. action: phrases.openThisPanel
  8318. }];
  8319. }
  8320. var DayPickerKeyboardShortcuts = function (_React$Component) {
  8321. _inherits(DayPickerKeyboardShortcuts, _React$Component);
  8322. function DayPickerKeyboardShortcuts() {
  8323. var _ref;
  8324. _classCallCheck(this, DayPickerKeyboardShortcuts);
  8325. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  8326. args[_key] = arguments[_key];
  8327. }
  8328. var _this = _possibleConstructorReturn(this, (_ref = DayPickerKeyboardShortcuts.__proto__ || Object.getPrototypeOf(DayPickerKeyboardShortcuts)).call.apply(_ref, [this].concat(args)));
  8329. var phrases = _this.props.phrases;
  8330. _this.keyboardShortcuts = getKeyboardShortcuts(phrases);
  8331. _this.onShowKeyboardShortcutsButtonClick = _this.onShowKeyboardShortcutsButtonClick.bind(_this);
  8332. _this.setShowKeyboardShortcutsButtonRef = _this.setShowKeyboardShortcutsButtonRef.bind(_this);
  8333. _this.setHideKeyboardShortcutsButtonRef = _this.setHideKeyboardShortcutsButtonRef.bind(_this);
  8334. _this.handleFocus = _this.handleFocus.bind(_this);
  8335. _this.onKeyDown = _this.onKeyDown.bind(_this);
  8336. return _this;
  8337. }
  8338. _createClass(DayPickerKeyboardShortcuts, [{
  8339. key: 'componentWillReceiveProps',
  8340. value: function () {
  8341. function componentWillReceiveProps(nextProps) {
  8342. var phrases = this.props.phrases;
  8343. if (nextProps.phrases !== phrases) {
  8344. this.keyboardShortcuts = getKeyboardShortcuts(nextProps.phrases);
  8345. }
  8346. }
  8347. return componentWillReceiveProps;
  8348. }()
  8349. }, {
  8350. key: 'componentDidUpdate',
  8351. value: function () {
  8352. function componentDidUpdate() {
  8353. this.handleFocus();
  8354. }
  8355. return componentDidUpdate;
  8356. }()
  8357. }, {
  8358. key: 'onKeyDown',
  8359. value: function () {
  8360. function onKeyDown(e) {
  8361. e.stopPropagation();
  8362. var closeKeyboardShortcutsPanel = this.props.closeKeyboardShortcutsPanel;
  8363. // Because the close button is the only focusable element inside of the panel, this
  8364. // amounts to a very basic focus trap. The user can exit the panel by "pressing" the
  8365. // close button or hitting escape
  8366. switch (e.key) {
  8367. case 'Enter':
  8368. case ' ':
  8369. case 'Spacebar': // for older browsers
  8370. case 'Escape':
  8371. closeKeyboardShortcutsPanel();
  8372. break;
  8373. // do nothing - this allows the up and down arrows continue their
  8374. // default behavior of scrolling the content of the Keyboard Shortcuts Panel
  8375. // which is needed when only a single month is shown for instance.
  8376. case 'ArrowUp':
  8377. case 'ArrowDown':
  8378. break;
  8379. // completely block the rest of the keys that have functionality outside of this panel
  8380. case 'Tab':
  8381. case 'Home':
  8382. case 'End':
  8383. case 'PageUp':
  8384. case 'PageDown':
  8385. case 'ArrowLeft':
  8386. case 'ArrowRight':
  8387. e.preventDefault();
  8388. break;
  8389. default:
  8390. break;
  8391. }
  8392. }
  8393. return onKeyDown;
  8394. }()
  8395. }, {
  8396. key: 'onShowKeyboardShortcutsButtonClick',
  8397. value: function () {
  8398. function onShowKeyboardShortcutsButtonClick() {
  8399. var _this2 = this;
  8400. var openKeyboardShortcutsPanel = this.props.openKeyboardShortcutsPanel;
  8401. // we want to return focus to this button after closing the keyboard shortcuts panel
  8402. openKeyboardShortcutsPanel(function () {
  8403. _this2.showKeyboardShortcutsButton.focus();
  8404. });
  8405. }
  8406. return onShowKeyboardShortcutsButtonClick;
  8407. }()
  8408. }, {
  8409. key: 'setShowKeyboardShortcutsButtonRef',
  8410. value: function () {
  8411. function setShowKeyboardShortcutsButtonRef(ref) {
  8412. this.showKeyboardShortcutsButton = ref;
  8413. }
  8414. return setShowKeyboardShortcutsButtonRef;
  8415. }()
  8416. }, {
  8417. key: 'setHideKeyboardShortcutsButtonRef',
  8418. value: function () {
  8419. function setHideKeyboardShortcutsButtonRef(ref) {
  8420. this.hideKeyboardShortcutsButton = ref;
  8421. }
  8422. return setHideKeyboardShortcutsButtonRef;
  8423. }()
  8424. }, {
  8425. key: 'handleFocus',
  8426. value: function () {
  8427. function handleFocus() {
  8428. if (this.hideKeyboardShortcutsButton) {
  8429. // automatically move focus into the dialog by moving
  8430. // to the only interactive element, the hide button
  8431. this.hideKeyboardShortcutsButton.focus();
  8432. }
  8433. }
  8434. return handleFocus;
  8435. }()
  8436. }, {
  8437. key: 'render',
  8438. value: function () {
  8439. function render() {
  8440. var _this3 = this;
  8441. var _props = this.props,
  8442. block = _props.block,
  8443. buttonLocation = _props.buttonLocation,
  8444. showKeyboardShortcutsPanel = _props.showKeyboardShortcutsPanel,
  8445. closeKeyboardShortcutsPanel = _props.closeKeyboardShortcutsPanel,
  8446. styles = _props.styles,
  8447. phrases = _props.phrases;
  8448. var toggleButtonText = showKeyboardShortcutsPanel ? phrases.hideKeyboardShortcutsPanel : phrases.showKeyboardShortcutsPanel;
  8449. var bottomRight = buttonLocation === BOTTOM_RIGHT;
  8450. var topRight = buttonLocation === TOP_RIGHT;
  8451. var topLeft = buttonLocation === TOP_LEFT;
  8452. return _react2['default'].createElement(
  8453. 'div',
  8454. null,
  8455. _react2['default'].createElement(
  8456. 'button',
  8457. _extends({
  8458. ref: this.setShowKeyboardShortcutsButtonRef
  8459. }, (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_buttonReset, styles.DayPickerKeyboardShortcuts_show, bottomRight && styles.DayPickerKeyboardShortcuts_show__bottomRight, topRight && styles.DayPickerKeyboardShortcuts_show__topRight, topLeft && styles.DayPickerKeyboardShortcuts_show__topLeft), {
  8460. type: 'button',
  8461. 'aria-label': toggleButtonText,
  8462. onClick: this.onShowKeyboardShortcutsButtonClick,
  8463. onKeyDown: function () {
  8464. function onKeyDown(e) {
  8465. if (e.key === 'Enter') {
  8466. e.preventDefault();
  8467. } else if (e.key === 'Space') {
  8468. _this3.onShowKeyboardShortcutsButtonClick(e);
  8469. }
  8470. }
  8471. return onKeyDown;
  8472. }(),
  8473. onMouseUp: function () {
  8474. function onMouseUp(e) {
  8475. e.currentTarget.blur();
  8476. }
  8477. return onMouseUp;
  8478. }()
  8479. }),
  8480. _react2['default'].createElement(
  8481. 'span',
  8482. (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_showSpan, bottomRight && styles.DayPickerKeyboardShortcuts_showSpan__bottomRight, topRight && styles.DayPickerKeyboardShortcuts_showSpan__topRight, topLeft && styles.DayPickerKeyboardShortcuts_showSpan__topLeft),
  8483. '?'
  8484. )
  8485. ),
  8486. showKeyboardShortcutsPanel && _react2['default'].createElement(
  8487. 'div',
  8488. _extends({}, (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_panel), {
  8489. role: 'dialog',
  8490. 'aria-labelledby': 'DayPickerKeyboardShortcuts_title',
  8491. 'aria-describedby': 'DayPickerKeyboardShortcuts_description'
  8492. }),
  8493. _react2['default'].createElement(
  8494. 'div',
  8495. _extends({}, (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_title), {
  8496. id: 'DayPickerKeyboardShortcuts_title'
  8497. }),
  8498. phrases.keyboardShortcuts
  8499. ),
  8500. _react2['default'].createElement(
  8501. 'button',
  8502. _extends({
  8503. ref: this.setHideKeyboardShortcutsButtonRef
  8504. }, (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_buttonReset, styles.DayPickerKeyboardShortcuts_close), {
  8505. type: 'button',
  8506. tabIndex: '0',
  8507. 'aria-label': phrases.hideKeyboardShortcutsPanel,
  8508. onClick: closeKeyboardShortcutsPanel,
  8509. onKeyDown: this.onKeyDown
  8510. }),
  8511. _react2['default'].createElement(_CloseButton2['default'], (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_closeSvg))
  8512. ),
  8513. _react2['default'].createElement(
  8514. 'ul',
  8515. _extends({}, (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_list), {
  8516. id: 'DayPickerKeyboardShortcuts_description'
  8517. }),
  8518. this.keyboardShortcuts.map(function (_ref2) {
  8519. var unicode = _ref2.unicode,
  8520. label = _ref2.label,
  8521. action = _ref2.action;
  8522. return _react2['default'].createElement(_KeyboardShortcutRow2['default'], {
  8523. key: label,
  8524. unicode: unicode,
  8525. label: label,
  8526. action: action,
  8527. block: block
  8528. });
  8529. })
  8530. )
  8531. )
  8532. );
  8533. }
  8534. return render;
  8535. }()
  8536. }]);
  8537. return DayPickerKeyboardShortcuts;
  8538. }(_react2['default'].Component);
  8539. DayPickerKeyboardShortcuts.propTypes = propTypes;
  8540. DayPickerKeyboardShortcuts.defaultProps = defaultProps;
  8541. exports["default"] = (0, _reactWithStyles.withStyles)(function (_ref3) {
  8542. var _ref3$reactDates = _ref3.reactDates,
  8543. color = _ref3$reactDates.color,
  8544. font = _ref3$reactDates.font,
  8545. zIndex = _ref3$reactDates.zIndex;
  8546. return {
  8547. DayPickerKeyboardShortcuts_buttonReset: {
  8548. background: 'none',
  8549. border: 0,
  8550. borderRadius: 0,
  8551. color: 'inherit',
  8552. font: 'inherit',
  8553. lineHeight: 'normal',
  8554. overflow: 'visible',
  8555. padding: 0,
  8556. cursor: 'pointer',
  8557. fontSize: font.size,
  8558. ':active': {
  8559. outline: 'none'
  8560. }
  8561. },
  8562. DayPickerKeyboardShortcuts_show: {
  8563. width: 22,
  8564. position: 'absolute',
  8565. zIndex: zIndex + 2
  8566. },
  8567. DayPickerKeyboardShortcuts_show__bottomRight: {
  8568. borderTop: '26px solid transparent',
  8569. borderRight: '33px solid ' + String(color.core.primary),
  8570. bottom: 0,
  8571. right: 0,
  8572. ':hover': {
  8573. borderRight: '33px solid ' + String(color.core.primary_dark)
  8574. }
  8575. },
  8576. DayPickerKeyboardShortcuts_show__topRight: {
  8577. borderBottom: '26px solid transparent',
  8578. borderRight: '33px solid ' + String(color.core.primary),
  8579. top: 0,
  8580. right: 0,
  8581. ':hover': {
  8582. borderRight: '33px solid ' + String(color.core.primary_dark)
  8583. }
  8584. },
  8585. DayPickerKeyboardShortcuts_show__topLeft: {
  8586. borderBottom: '26px solid transparent',
  8587. borderLeft: '33px solid ' + String(color.core.primary),
  8588. top: 0,
  8589. left: 0,
  8590. ':hover': {
  8591. borderLeft: '33px solid ' + String(color.core.primary_dark)
  8592. }
  8593. },
  8594. DayPickerKeyboardShortcuts_showSpan: {
  8595. color: color.core.white,
  8596. position: 'absolute'
  8597. },
  8598. DayPickerKeyboardShortcuts_showSpan__bottomRight: {
  8599. bottom: 0,
  8600. right: -28
  8601. },
  8602. DayPickerKeyboardShortcuts_showSpan__topRight: {
  8603. top: 1,
  8604. right: -28
  8605. },
  8606. DayPickerKeyboardShortcuts_showSpan__topLeft: {
  8607. top: 1,
  8608. left: -28
  8609. },
  8610. DayPickerKeyboardShortcuts_panel: {
  8611. overflow: 'auto',
  8612. background: color.background,
  8613. border: '1px solid ' + String(color.core.border),
  8614. borderRadius: 2,
  8615. position: 'absolute',
  8616. top: 0,
  8617. bottom: 0,
  8618. right: 0,
  8619. left: 0,
  8620. zIndex: zIndex + 2,
  8621. padding: 22,
  8622. margin: 33
  8623. },
  8624. DayPickerKeyboardShortcuts_title: {
  8625. fontSize: 16,
  8626. fontWeight: 'bold',
  8627. margin: 0
  8628. },
  8629. DayPickerKeyboardShortcuts_list: {
  8630. listStyle: 'none',
  8631. padding: 0,
  8632. fontSize: font.size
  8633. },
  8634. DayPickerKeyboardShortcuts_close: {
  8635. position: 'absolute',
  8636. right: 22,
  8637. top: 22,
  8638. zIndex: zIndex + 2,
  8639. ':active': {
  8640. outline: 'none'
  8641. }
  8642. },
  8643. DayPickerKeyboardShortcuts_closeSvg: {
  8644. height: 15,
  8645. width: 15,
  8646. fill: color.core.grayLighter,
  8647. ':hover': {
  8648. fill: color.core.grayLight
  8649. },
  8650. ':focus': {
  8651. fill: color.core.grayLight
  8652. }
  8653. }
  8654. };
  8655. })(DayPickerKeyboardShortcuts);
  8656. /***/ }),
  8657. /***/ 3895:
  8658. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  8659. "use strict";
  8660. Object.defineProperty(exports, "__esModule", ({
  8661. value: true
  8662. }));
  8663. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  8664. var _object = __webpack_require__(4011);
  8665. var _object2 = _interopRequireDefault(_object);
  8666. var _react = __webpack_require__(9196);
  8667. var _react2 = _interopRequireDefault(_react);
  8668. var _propTypes = __webpack_require__(2652);
  8669. var _propTypes2 = _interopRequireDefault(_propTypes);
  8670. var _airbnbPropTypes = __webpack_require__(4882);
  8671. var _reactWithStyles = __webpack_require__(3576);
  8672. var _defaultPhrases = __webpack_require__(6030);
  8673. var _getPhrasePropTypes = __webpack_require__(2893);
  8674. var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
  8675. var _LeftArrow = __webpack_require__(8);
  8676. var _LeftArrow2 = _interopRequireDefault(_LeftArrow);
  8677. var _RightArrow = __webpack_require__(4921);
  8678. var _RightArrow2 = _interopRequireDefault(_RightArrow);
  8679. var _ChevronUp = __webpack_require__(1809);
  8680. var _ChevronUp2 = _interopRequireDefault(_ChevronUp);
  8681. var _ChevronDown = __webpack_require__(9588);
  8682. var _ChevronDown2 = _interopRequireDefault(_ChevronDown);
  8683. var _ScrollableOrientationShape = __webpack_require__(6553);
  8684. var _ScrollableOrientationShape2 = _interopRequireDefault(_ScrollableOrientationShape);
  8685. var _constants = __webpack_require__(257);
  8686. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  8687. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  8688. var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
  8689. navPrev: _propTypes2['default'].node,
  8690. navNext: _propTypes2['default'].node,
  8691. orientation: _ScrollableOrientationShape2['default'],
  8692. onPrevMonthClick: _propTypes2['default'].func,
  8693. onNextMonthClick: _propTypes2['default'].func,
  8694. // internationalization
  8695. phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.DayPickerNavigationPhrases)),
  8696. isRTL: _propTypes2['default'].bool
  8697. }));
  8698. var defaultProps = {
  8699. navPrev: null,
  8700. navNext: null,
  8701. orientation: _constants.HORIZONTAL_ORIENTATION,
  8702. onPrevMonthClick: function () {
  8703. function onPrevMonthClick() {}
  8704. return onPrevMonthClick;
  8705. }(),
  8706. onNextMonthClick: function () {
  8707. function onNextMonthClick() {}
  8708. return onNextMonthClick;
  8709. }(),
  8710. // internationalization
  8711. phrases: _defaultPhrases.DayPickerNavigationPhrases,
  8712. isRTL: false
  8713. };
  8714. function DayPickerNavigation(_ref) {
  8715. var navPrev = _ref.navPrev,
  8716. navNext = _ref.navNext,
  8717. onPrevMonthClick = _ref.onPrevMonthClick,
  8718. onNextMonthClick = _ref.onNextMonthClick,
  8719. orientation = _ref.orientation,
  8720. phrases = _ref.phrases,
  8721. isRTL = _ref.isRTL,
  8722. styles = _ref.styles;
  8723. var isHorizontal = orientation === _constants.HORIZONTAL_ORIENTATION;
  8724. var isVertical = orientation !== _constants.HORIZONTAL_ORIENTATION;
  8725. var isVerticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
  8726. var navPrevIcon = navPrev;
  8727. var navNextIcon = navNext;
  8728. var isDefaultNavPrev = false;
  8729. var isDefaultNavNext = false;
  8730. if (!navPrevIcon) {
  8731. isDefaultNavPrev = true;
  8732. var Icon = isVertical ? _ChevronUp2['default'] : _LeftArrow2['default'];
  8733. if (isRTL && !isVertical) {
  8734. Icon = _RightArrow2['default'];
  8735. }
  8736. navPrevIcon = _react2['default'].createElement(Icon, (0, _reactWithStyles.css)(isHorizontal && styles.DayPickerNavigation_svg__horizontal, isVertical && styles.DayPickerNavigation_svg__vertical));
  8737. }
  8738. if (!navNextIcon) {
  8739. isDefaultNavNext = true;
  8740. var _Icon = isVertical ? _ChevronDown2['default'] : _RightArrow2['default'];
  8741. if (isRTL && !isVertical) {
  8742. _Icon = _LeftArrow2['default'];
  8743. }
  8744. navNextIcon = _react2['default'].createElement(_Icon, (0, _reactWithStyles.css)(isHorizontal && styles.DayPickerNavigation_svg__horizontal, isVertical && styles.DayPickerNavigation_svg__vertical));
  8745. }
  8746. var isDefaultNav = isVerticalScrollable ? isDefaultNavNext : isDefaultNavNext || isDefaultNavPrev;
  8747. return _react2['default'].createElement(
  8748. 'div',
  8749. _reactWithStyles.css.apply(undefined, [styles.DayPickerNavigation, isHorizontal && styles.DayPickerNavigation__horizontal].concat(_toConsumableArray(isVertical && [styles.DayPickerNavigation__vertical, isDefaultNav && styles.DayPickerNavigation__verticalDefault]), _toConsumableArray(isVerticalScrollable && [styles.DayPickerNavigation__verticalScrollable, isDefaultNav && styles.DayPickerNavigation__verticalScrollableDefault]))),
  8750. !isVerticalScrollable && _react2['default'].createElement(
  8751. 'div',
  8752. _extends({
  8753. role: 'button',
  8754. tabIndex: '0'
  8755. }, _reactWithStyles.css.apply(undefined, [styles.DayPickerNavigation_button, isDefaultNavPrev && styles.DayPickerNavigation_button__default].concat(_toConsumableArray(isHorizontal && [styles.DayPickerNavigation_button__horizontal].concat(_toConsumableArray(isDefaultNavPrev && [styles.DayPickerNavigation_button__horizontalDefault, !isRTL && styles.DayPickerNavigation_leftButton__horizontalDefault, isRTL && styles.DayPickerNavigation_rightButton__horizontalDefault]))), _toConsumableArray(isVertical && [styles.DayPickerNavigation_button__vertical].concat(_toConsumableArray(isDefaultNavPrev && [styles.DayPickerNavigation_button__verticalDefault, styles.DayPickerNavigation_prevButton__verticalDefault]))))), {
  8756. 'aria-label': phrases.jumpToPrevMonth,
  8757. onClick: onPrevMonthClick,
  8758. onKeyUp: function () {
  8759. function onKeyUp(e) {
  8760. var key = e.key;
  8761. if (key === 'Enter' || key === ' ') onPrevMonthClick(e);
  8762. }
  8763. return onKeyUp;
  8764. }(),
  8765. onMouseUp: function () {
  8766. function onMouseUp(e) {
  8767. e.currentTarget.blur();
  8768. }
  8769. return onMouseUp;
  8770. }()
  8771. }),
  8772. navPrevIcon
  8773. ),
  8774. _react2['default'].createElement(
  8775. 'div',
  8776. _extends({
  8777. role: 'button',
  8778. tabIndex: '0'
  8779. }, _reactWithStyles.css.apply(undefined, [styles.DayPickerNavigation_button, isDefaultNavNext && styles.DayPickerNavigation_button__default].concat(_toConsumableArray(isHorizontal && [styles.DayPickerNavigation_button__horizontal].concat(_toConsumableArray(isDefaultNavNext && [styles.DayPickerNavigation_button__horizontalDefault, isRTL && styles.DayPickerNavigation_leftButton__horizontalDefault, !isRTL && styles.DayPickerNavigation_rightButton__horizontalDefault]))), _toConsumableArray(isVertical && [styles.DayPickerNavigation_button__vertical, styles.DayPickerNavigation_nextButton__vertical].concat(_toConsumableArray(isDefaultNavNext && [styles.DayPickerNavigation_button__verticalDefault, styles.DayPickerNavigation_nextButton__verticalDefault, isVerticalScrollable && styles.DayPickerNavigation_nextButton__verticalScrollableDefault]))))), {
  8780. 'aria-label': phrases.jumpToNextMonth,
  8781. onClick: onNextMonthClick,
  8782. onKeyUp: function () {
  8783. function onKeyUp(e) {
  8784. var key = e.key;
  8785. if (key === 'Enter' || key === ' ') onNextMonthClick(e);
  8786. }
  8787. return onKeyUp;
  8788. }(),
  8789. onMouseUp: function () {
  8790. function onMouseUp(e) {
  8791. e.currentTarget.blur();
  8792. }
  8793. return onMouseUp;
  8794. }()
  8795. }),
  8796. navNextIcon
  8797. )
  8798. );
  8799. }
  8800. DayPickerNavigation.propTypes = propTypes;
  8801. DayPickerNavigation.defaultProps = defaultProps;
  8802. exports["default"] = (0, _reactWithStyles.withStyles)(function (_ref2) {
  8803. var _ref2$reactDates = _ref2.reactDates,
  8804. color = _ref2$reactDates.color,
  8805. zIndex = _ref2$reactDates.zIndex;
  8806. return {
  8807. DayPickerNavigation: {
  8808. position: 'relative',
  8809. zIndex: zIndex + 2
  8810. },
  8811. DayPickerNavigation__horizontal: {
  8812. height: 0
  8813. },
  8814. DayPickerNavigation__vertical: {},
  8815. DayPickerNavigation__verticalScrollable: {},
  8816. DayPickerNavigation__verticalDefault: {
  8817. position: 'absolute',
  8818. width: '100%',
  8819. height: 52,
  8820. bottom: 0,
  8821. left: 0
  8822. },
  8823. DayPickerNavigation__verticalScrollableDefault: {
  8824. position: 'relative'
  8825. },
  8826. DayPickerNavigation_button: {
  8827. cursor: 'pointer',
  8828. userSelect: 'none',
  8829. border: 0,
  8830. padding: 0,
  8831. margin: 0
  8832. },
  8833. DayPickerNavigation_button__default: {
  8834. border: '1px solid ' + String(color.core.borderLight),
  8835. backgroundColor: color.background,
  8836. color: color.placeholderText,
  8837. ':focus': {
  8838. border: '1px solid ' + String(color.core.borderMedium)
  8839. },
  8840. ':hover': {
  8841. border: '1px solid ' + String(color.core.borderMedium)
  8842. },
  8843. ':active': {
  8844. background: color.backgroundDark
  8845. }
  8846. },
  8847. DayPickerNavigation_button__horizontal: {},
  8848. DayPickerNavigation_button__horizontalDefault: {
  8849. position: 'absolute',
  8850. top: 18,
  8851. lineHeight: 0.78,
  8852. borderRadius: 3,
  8853. padding: '6px 9px'
  8854. },
  8855. DayPickerNavigation_leftButton__horizontalDefault: {
  8856. left: 22
  8857. },
  8858. DayPickerNavigation_rightButton__horizontalDefault: {
  8859. right: 22
  8860. },
  8861. DayPickerNavigation_button__vertical: {},
  8862. DayPickerNavigation_button__verticalDefault: {
  8863. padding: 5,
  8864. background: color.background,
  8865. boxShadow: '0 0 5px 2px rgba(0, 0, 0, 0.1)',
  8866. position: 'relative',
  8867. display: 'inline-block',
  8868. height: '100%',
  8869. width: '50%'
  8870. },
  8871. DayPickerNavigation_prevButton__verticalDefault: {},
  8872. DayPickerNavigation_nextButton__verticalDefault: {
  8873. borderLeft: 0
  8874. },
  8875. DayPickerNavigation_nextButton__verticalScrollableDefault: {
  8876. width: '100%'
  8877. },
  8878. DayPickerNavigation_svg__horizontal: {
  8879. height: 19,
  8880. width: 19,
  8881. fill: color.core.grayLight,
  8882. display: 'block'
  8883. },
  8884. DayPickerNavigation_svg__vertical: {
  8885. height: 42,
  8886. width: 42,
  8887. fill: color.text,
  8888. display: 'block'
  8889. }
  8890. };
  8891. })(DayPickerNavigation);
  8892. /***/ }),
  8893. /***/ 6302:
  8894. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  8895. "use strict";
  8896. var __webpack_unused_export__;
  8897. __webpack_unused_export__ = ({
  8898. value: true
  8899. });
  8900. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  8901. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8902. var _object = __webpack_require__(4011);
  8903. var _object2 = _interopRequireDefault(_object);
  8904. var _react = __webpack_require__(9196);
  8905. var _react2 = _interopRequireDefault(_react);
  8906. var _propTypes = __webpack_require__(2652);
  8907. var _propTypes2 = _interopRequireDefault(_propTypes);
  8908. var _reactMomentProptypes = __webpack_require__(6150);
  8909. var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
  8910. var _airbnbPropTypes = __webpack_require__(4882);
  8911. var _moment = __webpack_require__(6292);
  8912. var _moment2 = _interopRequireDefault(_moment);
  8913. var _object3 = __webpack_require__(5861);
  8914. var _object4 = _interopRequireDefault(_object3);
  8915. var _isTouchDevice = __webpack_require__(5834);
  8916. var _isTouchDevice2 = _interopRequireDefault(_isTouchDevice);
  8917. var _defaultPhrases = __webpack_require__(6030);
  8918. var _getPhrasePropTypes = __webpack_require__(2893);
  8919. var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
  8920. var _isSameDay = __webpack_require__(3923);
  8921. var _isSameDay2 = _interopRequireDefault(_isSameDay);
  8922. var _isAfterDay = __webpack_require__(7365);
  8923. var _isAfterDay2 = _interopRequireDefault(_isAfterDay);
  8924. var _getVisibleDays = __webpack_require__(3268);
  8925. var _getVisibleDays2 = _interopRequireDefault(_getVisibleDays);
  8926. var _isDayVisible = __webpack_require__(5713);
  8927. var _isDayVisible2 = _interopRequireDefault(_isDayVisible);
  8928. var _toISODateString = __webpack_require__(7310);
  8929. var _toISODateString2 = _interopRequireDefault(_toISODateString);
  8930. var _toISOMonthString = __webpack_require__(2705);
  8931. var _toISOMonthString2 = _interopRequireDefault(_toISOMonthString);
  8932. var _ScrollableOrientationShape = __webpack_require__(6553);
  8933. var _ScrollableOrientationShape2 = _interopRequireDefault(_ScrollableOrientationShape);
  8934. var _DayOfWeekShape = __webpack_require__(243);
  8935. var _DayOfWeekShape2 = _interopRequireDefault(_DayOfWeekShape);
  8936. var _CalendarInfoPositionShape = __webpack_require__(8182);
  8937. var _CalendarInfoPositionShape2 = _interopRequireDefault(_CalendarInfoPositionShape);
  8938. var _constants = __webpack_require__(257);
  8939. var _DayPicker = __webpack_require__(8665);
  8940. var _DayPicker2 = _interopRequireDefault(_DayPicker);
  8941. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  8942. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  8943. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8944. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8945. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8946. var propTypes = (0, _airbnbPropTypes.forbidExtraProps)({
  8947. date: _reactMomentProptypes2['default'].momentObj,
  8948. onDateChange: _propTypes2['default'].func,
  8949. focused: _propTypes2['default'].bool,
  8950. onFocusChange: _propTypes2['default'].func,
  8951. onClose: _propTypes2['default'].func,
  8952. keepOpenOnDateSelect: _propTypes2['default'].bool,
  8953. isOutsideRange: _propTypes2['default'].func,
  8954. isDayBlocked: _propTypes2['default'].func,
  8955. isDayHighlighted: _propTypes2['default'].func,
  8956. // DayPicker props
  8957. renderMonthText: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
  8958. renderMonthElement: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
  8959. enableOutsideDays: _propTypes2['default'].bool,
  8960. numberOfMonths: _propTypes2['default'].number,
  8961. orientation: _ScrollableOrientationShape2['default'],
  8962. withPortal: _propTypes2['default'].bool,
  8963. initialVisibleMonth: _propTypes2['default'].func,
  8964. firstDayOfWeek: _DayOfWeekShape2['default'],
  8965. hideKeyboardShortcutsPanel: _propTypes2['default'].bool,
  8966. daySize: _airbnbPropTypes.nonNegativeInteger,
  8967. verticalHeight: _airbnbPropTypes.nonNegativeInteger,
  8968. noBorder: _propTypes2['default'].bool,
  8969. verticalBorderSpacing: _airbnbPropTypes.nonNegativeInteger,
  8970. transitionDuration: _airbnbPropTypes.nonNegativeInteger,
  8971. horizontalMonthPadding: _airbnbPropTypes.nonNegativeInteger,
  8972. navPrev: _propTypes2['default'].node,
  8973. navNext: _propTypes2['default'].node,
  8974. onPrevMonthClick: _propTypes2['default'].func,
  8975. onNextMonthClick: _propTypes2['default'].func,
  8976. onOutsideClick: _propTypes2['default'].func,
  8977. renderCalendarDay: _propTypes2['default'].func,
  8978. renderDayContents: _propTypes2['default'].func,
  8979. renderCalendarInfo: _propTypes2['default'].func,
  8980. calendarInfoPosition: _CalendarInfoPositionShape2['default'],
  8981. // accessibility
  8982. onBlur: _propTypes2['default'].func,
  8983. isFocused: _propTypes2['default'].bool,
  8984. showKeyboardShortcuts: _propTypes2['default'].bool,
  8985. // i18n
  8986. monthFormat: _propTypes2['default'].string,
  8987. weekDayFormat: _propTypes2['default'].string,
  8988. phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.DayPickerPhrases)),
  8989. dayAriaLabelFormat: _propTypes2['default'].string,
  8990. isRTL: _propTypes2['default'].bool
  8991. });
  8992. var defaultProps = {
  8993. date: undefined, // TODO: use null
  8994. onDateChange: function () {
  8995. function onDateChange() {}
  8996. return onDateChange;
  8997. }(),
  8998. focused: false,
  8999. onFocusChange: function () {
  9000. function onFocusChange() {}
  9001. return onFocusChange;
  9002. }(),
  9003. onClose: function () {
  9004. function onClose() {}
  9005. return onClose;
  9006. }(),
  9007. keepOpenOnDateSelect: false,
  9008. isOutsideRange: function () {
  9009. function isOutsideRange() {}
  9010. return isOutsideRange;
  9011. }(),
  9012. isDayBlocked: function () {
  9013. function isDayBlocked() {}
  9014. return isDayBlocked;
  9015. }(),
  9016. isDayHighlighted: function () {
  9017. function isDayHighlighted() {}
  9018. return isDayHighlighted;
  9019. }(),
  9020. // DayPicker props
  9021. renderMonthText: null,
  9022. enableOutsideDays: false,
  9023. numberOfMonths: 1,
  9024. orientation: _constants.HORIZONTAL_ORIENTATION,
  9025. withPortal: false,
  9026. hideKeyboardShortcutsPanel: false,
  9027. initialVisibleMonth: null,
  9028. firstDayOfWeek: null,
  9029. daySize: _constants.DAY_SIZE,
  9030. verticalHeight: null,
  9031. noBorder: false,
  9032. verticalBorderSpacing: undefined,
  9033. transitionDuration: undefined,
  9034. horizontalMonthPadding: 13,
  9035. navPrev: null,
  9036. navNext: null,
  9037. onPrevMonthClick: function () {
  9038. function onPrevMonthClick() {}
  9039. return onPrevMonthClick;
  9040. }(),
  9041. onNextMonthClick: function () {
  9042. function onNextMonthClick() {}
  9043. return onNextMonthClick;
  9044. }(),
  9045. onOutsideClick: function () {
  9046. function onOutsideClick() {}
  9047. return onOutsideClick;
  9048. }(),
  9049. renderCalendarDay: undefined,
  9050. renderDayContents: null,
  9051. renderCalendarInfo: null,
  9052. renderMonthElement: null,
  9053. calendarInfoPosition: _constants.INFO_POSITION_BOTTOM,
  9054. // accessibility
  9055. onBlur: function () {
  9056. function onBlur() {}
  9057. return onBlur;
  9058. }(),
  9059. isFocused: false,
  9060. showKeyboardShortcuts: false,
  9061. // i18n
  9062. monthFormat: 'MMMM YYYY',
  9063. weekDayFormat: 'dd',
  9064. phrases: _defaultPhrases.DayPickerPhrases,
  9065. dayAriaLabelFormat: undefined,
  9066. isRTL: false
  9067. };
  9068. var DayPickerSingleDateController = function (_React$Component) {
  9069. _inherits(DayPickerSingleDateController, _React$Component);
  9070. function DayPickerSingleDateController(props) {
  9071. _classCallCheck(this, DayPickerSingleDateController);
  9072. var _this = _possibleConstructorReturn(this, (DayPickerSingleDateController.__proto__ || Object.getPrototypeOf(DayPickerSingleDateController)).call(this, props));
  9073. _this.isTouchDevice = false;
  9074. _this.today = (0, _moment2['default'])();
  9075. _this.modifiers = {
  9076. today: function () {
  9077. function today(day) {
  9078. return _this.isToday(day);
  9079. }
  9080. return today;
  9081. }(),
  9082. blocked: function () {
  9083. function blocked(day) {
  9084. return _this.isBlocked(day);
  9085. }
  9086. return blocked;
  9087. }(),
  9088. 'blocked-calendar': function () {
  9089. function blockedCalendar(day) {
  9090. return props.isDayBlocked(day);
  9091. }
  9092. return blockedCalendar;
  9093. }(),
  9094. 'blocked-out-of-range': function () {
  9095. function blockedOutOfRange(day) {
  9096. return props.isOutsideRange(day);
  9097. }
  9098. return blockedOutOfRange;
  9099. }(),
  9100. 'highlighted-calendar': function () {
  9101. function highlightedCalendar(day) {
  9102. return props.isDayHighlighted(day);
  9103. }
  9104. return highlightedCalendar;
  9105. }(),
  9106. valid: function () {
  9107. function valid(day) {
  9108. return !_this.isBlocked(day);
  9109. }
  9110. return valid;
  9111. }(),
  9112. hovered: function () {
  9113. function hovered(day) {
  9114. return _this.isHovered(day);
  9115. }
  9116. return hovered;
  9117. }(),
  9118. selected: function () {
  9119. function selected(day) {
  9120. return _this.isSelected(day);
  9121. }
  9122. return selected;
  9123. }(),
  9124. 'first-day-of-week': function () {
  9125. function firstDayOfWeek(day) {
  9126. return _this.isFirstDayOfWeek(day);
  9127. }
  9128. return firstDayOfWeek;
  9129. }(),
  9130. 'last-day-of-week': function () {
  9131. function lastDayOfWeek(day) {
  9132. return _this.isLastDayOfWeek(day);
  9133. }
  9134. return lastDayOfWeek;
  9135. }()
  9136. };
  9137. var _this$getStateForNewM = _this.getStateForNewMonth(props),
  9138. currentMonth = _this$getStateForNewM.currentMonth,
  9139. visibleDays = _this$getStateForNewM.visibleDays;
  9140. _this.state = {
  9141. hoverDate: null,
  9142. currentMonth: currentMonth,
  9143. visibleDays: visibleDays
  9144. };
  9145. _this.onDayMouseEnter = _this.onDayMouseEnter.bind(_this);
  9146. _this.onDayMouseLeave = _this.onDayMouseLeave.bind(_this);
  9147. _this.onDayClick = _this.onDayClick.bind(_this);
  9148. _this.onPrevMonthClick = _this.onPrevMonthClick.bind(_this);
  9149. _this.onNextMonthClick = _this.onNextMonthClick.bind(_this);
  9150. _this.onMonthChange = _this.onMonthChange.bind(_this);
  9151. _this.onYearChange = _this.onYearChange.bind(_this);
  9152. _this.getFirstFocusableDay = _this.getFirstFocusableDay.bind(_this);
  9153. return _this;
  9154. }
  9155. _createClass(DayPickerSingleDateController, [{
  9156. key: 'componentDidMount',
  9157. value: function () {
  9158. function componentDidMount() {
  9159. this.isTouchDevice = (0, _isTouchDevice2['default'])();
  9160. }
  9161. return componentDidMount;
  9162. }()
  9163. }, {
  9164. key: 'componentWillReceiveProps',
  9165. value: function () {
  9166. function componentWillReceiveProps(nextProps) {
  9167. var _this2 = this;
  9168. var date = nextProps.date,
  9169. focused = nextProps.focused,
  9170. isOutsideRange = nextProps.isOutsideRange,
  9171. isDayBlocked = nextProps.isDayBlocked,
  9172. isDayHighlighted = nextProps.isDayHighlighted,
  9173. initialVisibleMonth = nextProps.initialVisibleMonth,
  9174. numberOfMonths = nextProps.numberOfMonths,
  9175. enableOutsideDays = nextProps.enableOutsideDays;
  9176. var _props = this.props,
  9177. prevIsOutsideRange = _props.isOutsideRange,
  9178. prevIsDayBlocked = _props.isDayBlocked,
  9179. prevIsDayHighlighted = _props.isDayHighlighted,
  9180. prevNumberOfMonths = _props.numberOfMonths,
  9181. prevEnableOutsideDays = _props.enableOutsideDays,
  9182. prevInitialVisibleMonth = _props.initialVisibleMonth,
  9183. prevFocused = _props.focused,
  9184. prevDate = _props.date;
  9185. var visibleDays = this.state.visibleDays;
  9186. var recomputeOutsideRange = false;
  9187. var recomputeDayBlocked = false;
  9188. var recomputeDayHighlighted = false;
  9189. if (isOutsideRange !== prevIsOutsideRange) {
  9190. this.modifiers['blocked-out-of-range'] = function (day) {
  9191. return isOutsideRange(day);
  9192. };
  9193. recomputeOutsideRange = true;
  9194. }
  9195. if (isDayBlocked !== prevIsDayBlocked) {
  9196. this.modifiers['blocked-calendar'] = function (day) {
  9197. return isDayBlocked(day);
  9198. };
  9199. recomputeDayBlocked = true;
  9200. }
  9201. if (isDayHighlighted !== prevIsDayHighlighted) {
  9202. this.modifiers['highlighted-calendar'] = function (day) {
  9203. return isDayHighlighted(day);
  9204. };
  9205. recomputeDayHighlighted = true;
  9206. }
  9207. var recomputePropModifiers = recomputeOutsideRange || recomputeDayBlocked || recomputeDayHighlighted;
  9208. if (numberOfMonths !== prevNumberOfMonths || enableOutsideDays !== prevEnableOutsideDays || initialVisibleMonth !== prevInitialVisibleMonth && !prevFocused && focused) {
  9209. var newMonthState = this.getStateForNewMonth(nextProps);
  9210. var currentMonth = newMonthState.currentMonth;
  9211. visibleDays = newMonthState.visibleDays;
  9212. this.setState({
  9213. currentMonth: currentMonth,
  9214. visibleDays: visibleDays
  9215. });
  9216. }
  9217. var didDateChange = date !== prevDate;
  9218. var didFocusChange = focused !== prevFocused;
  9219. var modifiers = {};
  9220. if (didDateChange) {
  9221. modifiers = this.deleteModifier(modifiers, prevDate, 'selected');
  9222. modifiers = this.addModifier(modifiers, date, 'selected');
  9223. }
  9224. if (didFocusChange || recomputePropModifiers) {
  9225. (0, _object4['default'])(visibleDays).forEach(function (days) {
  9226. Object.keys(days).forEach(function (day) {
  9227. var momentObj = (0, _moment2['default'])(day);
  9228. if (_this2.isBlocked(momentObj)) {
  9229. modifiers = _this2.addModifier(modifiers, momentObj, 'blocked');
  9230. } else {
  9231. modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked');
  9232. }
  9233. if (didFocusChange || recomputeOutsideRange) {
  9234. if (isOutsideRange(momentObj)) {
  9235. modifiers = _this2.addModifier(modifiers, momentObj, 'blocked-out-of-range');
  9236. } else {
  9237. modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked-out-of-range');
  9238. }
  9239. }
  9240. if (didFocusChange || recomputeDayBlocked) {
  9241. if (isDayBlocked(momentObj)) {
  9242. modifiers = _this2.addModifier(modifiers, momentObj, 'blocked-calendar');
  9243. } else {
  9244. modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked-calendar');
  9245. }
  9246. }
  9247. if (didFocusChange || recomputeDayHighlighted) {
  9248. if (isDayHighlighted(momentObj)) {
  9249. modifiers = _this2.addModifier(modifiers, momentObj, 'highlighted-calendar');
  9250. } else {
  9251. modifiers = _this2.deleteModifier(modifiers, momentObj, 'highlighted-calendar');
  9252. }
  9253. }
  9254. });
  9255. });
  9256. }
  9257. var today = (0, _moment2['default'])();
  9258. if (!(0, _isSameDay2['default'])(this.today, today)) {
  9259. modifiers = this.deleteModifier(modifiers, this.today, 'today');
  9260. modifiers = this.addModifier(modifiers, today, 'today');
  9261. this.today = today;
  9262. }
  9263. if (Object.keys(modifiers).length > 0) {
  9264. this.setState({
  9265. visibleDays: (0, _object2['default'])({}, visibleDays, modifiers)
  9266. });
  9267. }
  9268. }
  9269. return componentWillReceiveProps;
  9270. }()
  9271. }, {
  9272. key: 'componentWillUpdate',
  9273. value: function () {
  9274. function componentWillUpdate() {
  9275. this.today = (0, _moment2['default'])();
  9276. }
  9277. return componentWillUpdate;
  9278. }()
  9279. }, {
  9280. key: 'onDayClick',
  9281. value: function () {
  9282. function onDayClick(day, e) {
  9283. if (e) e.preventDefault();
  9284. if (this.isBlocked(day)) return;
  9285. var _props2 = this.props,
  9286. onDateChange = _props2.onDateChange,
  9287. keepOpenOnDateSelect = _props2.keepOpenOnDateSelect,
  9288. onFocusChange = _props2.onFocusChange,
  9289. onClose = _props2.onClose;
  9290. onDateChange(day);
  9291. if (!keepOpenOnDateSelect) {
  9292. onFocusChange({ focused: false });
  9293. onClose({ date: day });
  9294. }
  9295. }
  9296. return onDayClick;
  9297. }()
  9298. }, {
  9299. key: 'onDayMouseEnter',
  9300. value: function () {
  9301. function onDayMouseEnter(day) {
  9302. if (this.isTouchDevice) return;
  9303. var _state = this.state,
  9304. hoverDate = _state.hoverDate,
  9305. visibleDays = _state.visibleDays;
  9306. var modifiers = this.deleteModifier({}, hoverDate, 'hovered');
  9307. modifiers = this.addModifier(modifiers, day, 'hovered');
  9308. this.setState({
  9309. hoverDate: day,
  9310. visibleDays: (0, _object2['default'])({}, visibleDays, modifiers)
  9311. });
  9312. }
  9313. return onDayMouseEnter;
  9314. }()
  9315. }, {
  9316. key: 'onDayMouseLeave',
  9317. value: function () {
  9318. function onDayMouseLeave() {
  9319. var _state2 = this.state,
  9320. hoverDate = _state2.hoverDate,
  9321. visibleDays = _state2.visibleDays;
  9322. if (this.isTouchDevice || !hoverDate) return;
  9323. var modifiers = this.deleteModifier({}, hoverDate, 'hovered');
  9324. this.setState({
  9325. hoverDate: null,
  9326. visibleDays: (0, _object2['default'])({}, visibleDays, modifiers)
  9327. });
  9328. }
  9329. return onDayMouseLeave;
  9330. }()
  9331. }, {
  9332. key: 'onPrevMonthClick',
  9333. value: function () {
  9334. function onPrevMonthClick() {
  9335. var _props3 = this.props,
  9336. onPrevMonthClick = _props3.onPrevMonthClick,
  9337. numberOfMonths = _props3.numberOfMonths,
  9338. enableOutsideDays = _props3.enableOutsideDays;
  9339. var _state3 = this.state,
  9340. currentMonth = _state3.currentMonth,
  9341. visibleDays = _state3.visibleDays;
  9342. var newVisibleDays = {};
  9343. Object.keys(visibleDays).sort().slice(0, numberOfMonths + 1).forEach(function (month) {
  9344. newVisibleDays[month] = visibleDays[month];
  9345. });
  9346. var prevMonth = currentMonth.clone().subtract(1, 'month');
  9347. var prevMonthVisibleDays = (0, _getVisibleDays2['default'])(prevMonth, 1, enableOutsideDays);
  9348. this.setState({
  9349. currentMonth: prevMonth,
  9350. visibleDays: (0, _object2['default'])({}, newVisibleDays, this.getModifiers(prevMonthVisibleDays))
  9351. }, function () {
  9352. onPrevMonthClick(prevMonth.clone());
  9353. });
  9354. }
  9355. return onPrevMonthClick;
  9356. }()
  9357. }, {
  9358. key: 'onNextMonthClick',
  9359. value: function () {
  9360. function onNextMonthClick() {
  9361. var _props4 = this.props,
  9362. onNextMonthClick = _props4.onNextMonthClick,
  9363. numberOfMonths = _props4.numberOfMonths,
  9364. enableOutsideDays = _props4.enableOutsideDays;
  9365. var _state4 = this.state,
  9366. currentMonth = _state4.currentMonth,
  9367. visibleDays = _state4.visibleDays;
  9368. var newVisibleDays = {};
  9369. Object.keys(visibleDays).sort().slice(1).forEach(function (month) {
  9370. newVisibleDays[month] = visibleDays[month];
  9371. });
  9372. var nextMonth = currentMonth.clone().add(numberOfMonths, 'month');
  9373. var nextMonthVisibleDays = (0, _getVisibleDays2['default'])(nextMonth, 1, enableOutsideDays);
  9374. var newCurrentMonth = currentMonth.clone().add(1, 'month');
  9375. this.setState({
  9376. currentMonth: newCurrentMonth,
  9377. visibleDays: (0, _object2['default'])({}, newVisibleDays, this.getModifiers(nextMonthVisibleDays))
  9378. }, function () {
  9379. onNextMonthClick(newCurrentMonth.clone());
  9380. });
  9381. }
  9382. return onNextMonthClick;
  9383. }()
  9384. }, {
  9385. key: 'onMonthChange',
  9386. value: function () {
  9387. function onMonthChange(newMonth) {
  9388. var _props5 = this.props,
  9389. numberOfMonths = _props5.numberOfMonths,
  9390. enableOutsideDays = _props5.enableOutsideDays,
  9391. orientation = _props5.orientation;
  9392. var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
  9393. var newVisibleDays = (0, _getVisibleDays2['default'])(newMonth, numberOfMonths, enableOutsideDays, withoutTransitionMonths);
  9394. this.setState({
  9395. currentMonth: newMonth.clone(),
  9396. visibleDays: this.getModifiers(newVisibleDays)
  9397. });
  9398. }
  9399. return onMonthChange;
  9400. }()
  9401. }, {
  9402. key: 'onYearChange',
  9403. value: function () {
  9404. function onYearChange(newMonth) {
  9405. var _props6 = this.props,
  9406. numberOfMonths = _props6.numberOfMonths,
  9407. enableOutsideDays = _props6.enableOutsideDays,
  9408. orientation = _props6.orientation;
  9409. var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
  9410. var newVisibleDays = (0, _getVisibleDays2['default'])(newMonth, numberOfMonths, enableOutsideDays, withoutTransitionMonths);
  9411. this.setState({
  9412. currentMonth: newMonth.clone(),
  9413. visibleDays: this.getModifiers(newVisibleDays)
  9414. });
  9415. }
  9416. return onYearChange;
  9417. }()
  9418. }, {
  9419. key: 'getFirstFocusableDay',
  9420. value: function () {
  9421. function getFirstFocusableDay(newMonth) {
  9422. var _this3 = this;
  9423. var _props7 = this.props,
  9424. date = _props7.date,
  9425. numberOfMonths = _props7.numberOfMonths;
  9426. var focusedDate = newMonth.clone().startOf('month');
  9427. if (date) {
  9428. focusedDate = date.clone();
  9429. }
  9430. if (this.isBlocked(focusedDate)) {
  9431. var days = [];
  9432. var lastVisibleDay = newMonth.clone().add(numberOfMonths - 1, 'months').endOf('month');
  9433. var currentDay = focusedDate.clone();
  9434. while (!(0, _isAfterDay2['default'])(currentDay, lastVisibleDay)) {
  9435. currentDay = currentDay.clone().add(1, 'day');
  9436. days.push(currentDay);
  9437. }
  9438. var viableDays = days.filter(function (day) {
  9439. return !_this3.isBlocked(day) && (0, _isAfterDay2['default'])(day, focusedDate);
  9440. });
  9441. if (viableDays.length > 0) {
  9442. var _viableDays = _slicedToArray(viableDays, 1);
  9443. focusedDate = _viableDays[0];
  9444. }
  9445. }
  9446. return focusedDate;
  9447. }
  9448. return getFirstFocusableDay;
  9449. }()
  9450. }, {
  9451. key: 'getModifiers',
  9452. value: function () {
  9453. function getModifiers(visibleDays) {
  9454. var _this4 = this;
  9455. var modifiers = {};
  9456. Object.keys(visibleDays).forEach(function (month) {
  9457. modifiers[month] = {};
  9458. visibleDays[month].forEach(function (day) {
  9459. modifiers[month][(0, _toISODateString2['default'])(day)] = _this4.getModifiersForDay(day);
  9460. });
  9461. });
  9462. return modifiers;
  9463. }
  9464. return getModifiers;
  9465. }()
  9466. }, {
  9467. key: 'getModifiersForDay',
  9468. value: function () {
  9469. function getModifiersForDay(day) {
  9470. var _this5 = this;
  9471. return new Set(Object.keys(this.modifiers).filter(function (modifier) {
  9472. return _this5.modifiers[modifier](day);
  9473. }));
  9474. }
  9475. return getModifiersForDay;
  9476. }()
  9477. }, {
  9478. key: 'getStateForNewMonth',
  9479. value: function () {
  9480. function getStateForNewMonth(nextProps) {
  9481. var _this6 = this;
  9482. var initialVisibleMonth = nextProps.initialVisibleMonth,
  9483. date = nextProps.date,
  9484. numberOfMonths = nextProps.numberOfMonths,
  9485. enableOutsideDays = nextProps.enableOutsideDays;
  9486. var initialVisibleMonthThunk = initialVisibleMonth || (date ? function () {
  9487. return date;
  9488. } : function () {
  9489. return _this6.today;
  9490. });
  9491. var currentMonth = initialVisibleMonthThunk();
  9492. var visibleDays = this.getModifiers((0, _getVisibleDays2['default'])(currentMonth, numberOfMonths, enableOutsideDays));
  9493. return { currentMonth: currentMonth, visibleDays: visibleDays };
  9494. }
  9495. return getStateForNewMonth;
  9496. }()
  9497. }, {
  9498. key: 'addModifier',
  9499. value: function () {
  9500. function addModifier(updatedDays, day, modifier) {
  9501. var _props8 = this.props,
  9502. numberOfVisibleMonths = _props8.numberOfMonths,
  9503. enableOutsideDays = _props8.enableOutsideDays,
  9504. orientation = _props8.orientation;
  9505. var _state5 = this.state,
  9506. firstVisibleMonth = _state5.currentMonth,
  9507. visibleDays = _state5.visibleDays;
  9508. var currentMonth = firstVisibleMonth;
  9509. var numberOfMonths = numberOfVisibleMonths;
  9510. if (orientation === _constants.VERTICAL_SCROLLABLE) {
  9511. numberOfMonths = Object.keys(visibleDays).length;
  9512. } else {
  9513. currentMonth = currentMonth.clone().subtract(1, 'month');
  9514. numberOfMonths += 2;
  9515. }
  9516. if (!day || !(0, _isDayVisible2['default'])(day, currentMonth, numberOfMonths, enableOutsideDays)) {
  9517. return updatedDays;
  9518. }
  9519. var iso = (0, _toISODateString2['default'])(day);
  9520. var updatedDaysAfterAddition = (0, _object2['default'])({}, updatedDays);
  9521. if (enableOutsideDays) {
  9522. var monthsToUpdate = Object.keys(visibleDays).filter(function (monthKey) {
  9523. return Object.keys(visibleDays[monthKey]).indexOf(iso) > -1;
  9524. });
  9525. updatedDaysAfterAddition = monthsToUpdate.reduce(function (days, monthIso) {
  9526. var month = updatedDays[monthIso] || visibleDays[monthIso];
  9527. var modifiers = new Set(month[iso]);
  9528. modifiers.add(modifier);
  9529. return (0, _object2['default'])({}, days, _defineProperty({}, monthIso, (0, _object2['default'])({}, month, _defineProperty({}, iso, modifiers))));
  9530. }, updatedDaysAfterAddition);
  9531. } else {
  9532. var monthIso = (0, _toISOMonthString2['default'])(day);
  9533. var month = updatedDays[monthIso] || visibleDays[monthIso];
  9534. var modifiers = new Set(month[iso]);
  9535. modifiers.add(modifier);
  9536. updatedDaysAfterAddition = (0, _object2['default'])({}, updatedDaysAfterAddition, _defineProperty({}, monthIso, (0, _object2['default'])({}, month, _defineProperty({}, iso, modifiers))));
  9537. }
  9538. return updatedDaysAfterAddition;
  9539. }
  9540. return addModifier;
  9541. }()
  9542. }, {
  9543. key: 'deleteModifier',
  9544. value: function () {
  9545. function deleteModifier(updatedDays, day, modifier) {
  9546. var _props9 = this.props,
  9547. numberOfVisibleMonths = _props9.numberOfMonths,
  9548. enableOutsideDays = _props9.enableOutsideDays,
  9549. orientation = _props9.orientation;
  9550. var _state6 = this.state,
  9551. firstVisibleMonth = _state6.currentMonth,
  9552. visibleDays = _state6.visibleDays;
  9553. var currentMonth = firstVisibleMonth;
  9554. var numberOfMonths = numberOfVisibleMonths;
  9555. if (orientation === _constants.VERTICAL_SCROLLABLE) {
  9556. numberOfMonths = Object.keys(visibleDays).length;
  9557. } else {
  9558. currentMonth = currentMonth.clone().subtract(1, 'month');
  9559. numberOfMonths += 2;
  9560. }
  9561. if (!day || !(0, _isDayVisible2['default'])(day, currentMonth, numberOfMonths, enableOutsideDays)) {
  9562. return updatedDays;
  9563. }
  9564. var iso = (0, _toISODateString2['default'])(day);
  9565. var updatedDaysAfterDeletion = (0, _object2['default'])({}, updatedDays);
  9566. if (enableOutsideDays) {
  9567. var monthsToUpdate = Object.keys(visibleDays).filter(function (monthKey) {
  9568. return Object.keys(visibleDays[monthKey]).indexOf(iso) > -1;
  9569. });
  9570. updatedDaysAfterDeletion = monthsToUpdate.reduce(function (days, monthIso) {
  9571. var month = updatedDays[monthIso] || visibleDays[monthIso];
  9572. var modifiers = new Set(month[iso]);
  9573. modifiers['delete'](modifier);
  9574. return (0, _object2['default'])({}, days, _defineProperty({}, monthIso, (0, _object2['default'])({}, month, _defineProperty({}, iso, modifiers))));
  9575. }, updatedDaysAfterDeletion);
  9576. } else {
  9577. var monthIso = (0, _toISOMonthString2['default'])(day);
  9578. var month = updatedDays[monthIso] || visibleDays[monthIso];
  9579. var modifiers = new Set(month[iso]);
  9580. modifiers['delete'](modifier);
  9581. updatedDaysAfterDeletion = (0, _object2['default'])({}, updatedDaysAfterDeletion, _defineProperty({}, monthIso, (0, _object2['default'])({}, month, _defineProperty({}, iso, modifiers))));
  9582. }
  9583. return updatedDaysAfterDeletion;
  9584. }
  9585. return deleteModifier;
  9586. }()
  9587. }, {
  9588. key: 'isBlocked',
  9589. value: function () {
  9590. function isBlocked(day) {
  9591. var _props10 = this.props,
  9592. isDayBlocked = _props10.isDayBlocked,
  9593. isOutsideRange = _props10.isOutsideRange;
  9594. return isDayBlocked(day) || isOutsideRange(day);
  9595. }
  9596. return isBlocked;
  9597. }()
  9598. }, {
  9599. key: 'isHovered',
  9600. value: function () {
  9601. function isHovered(day) {
  9602. var _ref = this.state || {},
  9603. hoverDate = _ref.hoverDate;
  9604. return (0, _isSameDay2['default'])(day, hoverDate);
  9605. }
  9606. return isHovered;
  9607. }()
  9608. }, {
  9609. key: 'isSelected',
  9610. value: function () {
  9611. function isSelected(day) {
  9612. var date = this.props.date;
  9613. return (0, _isSameDay2['default'])(day, date);
  9614. }
  9615. return isSelected;
  9616. }()
  9617. }, {
  9618. key: 'isToday',
  9619. value: function () {
  9620. function isToday(day) {
  9621. return (0, _isSameDay2['default'])(day, this.today);
  9622. }
  9623. return isToday;
  9624. }()
  9625. }, {
  9626. key: 'isFirstDayOfWeek',
  9627. value: function () {
  9628. function isFirstDayOfWeek(day) {
  9629. var firstDayOfWeek = this.props.firstDayOfWeek;
  9630. return day.day() === (firstDayOfWeek || _moment2['default'].localeData().firstDayOfWeek());
  9631. }
  9632. return isFirstDayOfWeek;
  9633. }()
  9634. }, {
  9635. key: 'isLastDayOfWeek',
  9636. value: function () {
  9637. function isLastDayOfWeek(day) {
  9638. var firstDayOfWeek = this.props.firstDayOfWeek;
  9639. return day.day() === ((firstDayOfWeek || _moment2['default'].localeData().firstDayOfWeek()) + 6) % 7;
  9640. }
  9641. return isLastDayOfWeek;
  9642. }()
  9643. }, {
  9644. key: 'render',
  9645. value: function () {
  9646. function render() {
  9647. var _props11 = this.props,
  9648. numberOfMonths = _props11.numberOfMonths,
  9649. orientation = _props11.orientation,
  9650. monthFormat = _props11.monthFormat,
  9651. renderMonthText = _props11.renderMonthText,
  9652. navPrev = _props11.navPrev,
  9653. navNext = _props11.navNext,
  9654. onOutsideClick = _props11.onOutsideClick,
  9655. withPortal = _props11.withPortal,
  9656. focused = _props11.focused,
  9657. enableOutsideDays = _props11.enableOutsideDays,
  9658. hideKeyboardShortcutsPanel = _props11.hideKeyboardShortcutsPanel,
  9659. daySize = _props11.daySize,
  9660. firstDayOfWeek = _props11.firstDayOfWeek,
  9661. renderCalendarDay = _props11.renderCalendarDay,
  9662. renderDayContents = _props11.renderDayContents,
  9663. renderCalendarInfo = _props11.renderCalendarInfo,
  9664. renderMonthElement = _props11.renderMonthElement,
  9665. calendarInfoPosition = _props11.calendarInfoPosition,
  9666. isFocused = _props11.isFocused,
  9667. isRTL = _props11.isRTL,
  9668. phrases = _props11.phrases,
  9669. dayAriaLabelFormat = _props11.dayAriaLabelFormat,
  9670. onBlur = _props11.onBlur,
  9671. showKeyboardShortcuts = _props11.showKeyboardShortcuts,
  9672. weekDayFormat = _props11.weekDayFormat,
  9673. verticalHeight = _props11.verticalHeight,
  9674. noBorder = _props11.noBorder,
  9675. transitionDuration = _props11.transitionDuration,
  9676. verticalBorderSpacing = _props11.verticalBorderSpacing,
  9677. horizontalMonthPadding = _props11.horizontalMonthPadding;
  9678. var _state7 = this.state,
  9679. currentMonth = _state7.currentMonth,
  9680. visibleDays = _state7.visibleDays;
  9681. return _react2['default'].createElement(_DayPicker2['default'], {
  9682. orientation: orientation,
  9683. enableOutsideDays: enableOutsideDays,
  9684. modifiers: visibleDays,
  9685. numberOfMonths: numberOfMonths,
  9686. onDayClick: this.onDayClick,
  9687. onDayMouseEnter: this.onDayMouseEnter,
  9688. onDayMouseLeave: this.onDayMouseLeave,
  9689. onPrevMonthClick: this.onPrevMonthClick,
  9690. onNextMonthClick: this.onNextMonthClick,
  9691. onMonthChange: this.onMonthChange,
  9692. onYearChange: this.onYearChange,
  9693. monthFormat: monthFormat,
  9694. withPortal: withPortal,
  9695. hidden: !focused,
  9696. hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
  9697. initialVisibleMonth: function () {
  9698. function initialVisibleMonth() {
  9699. return currentMonth;
  9700. }
  9701. return initialVisibleMonth;
  9702. }(),
  9703. firstDayOfWeek: firstDayOfWeek,
  9704. onOutsideClick: onOutsideClick,
  9705. navPrev: navPrev,
  9706. navNext: navNext,
  9707. renderMonthText: renderMonthText,
  9708. renderCalendarDay: renderCalendarDay,
  9709. renderDayContents: renderDayContents,
  9710. renderCalendarInfo: renderCalendarInfo,
  9711. renderMonthElement: renderMonthElement,
  9712. calendarInfoPosition: calendarInfoPosition,
  9713. isFocused: isFocused,
  9714. getFirstFocusableDay: this.getFirstFocusableDay,
  9715. onBlur: onBlur,
  9716. phrases: phrases,
  9717. daySize: daySize,
  9718. isRTL: isRTL,
  9719. showKeyboardShortcuts: showKeyboardShortcuts,
  9720. weekDayFormat: weekDayFormat,
  9721. dayAriaLabelFormat: dayAriaLabelFormat,
  9722. verticalHeight: verticalHeight,
  9723. noBorder: noBorder,
  9724. transitionDuration: transitionDuration,
  9725. verticalBorderSpacing: verticalBorderSpacing,
  9726. horizontalMonthPadding: horizontalMonthPadding
  9727. });
  9728. }
  9729. return render;
  9730. }()
  9731. }]);
  9732. return DayPickerSingleDateController;
  9733. }(_react2['default'].Component);
  9734. exports.Z = DayPickerSingleDateController;
  9735. DayPickerSingleDateController.propTypes = propTypes;
  9736. DayPickerSingleDateController.defaultProps = defaultProps;
  9737. /***/ }),
  9738. /***/ 5820:
  9739. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  9740. "use strict";
  9741. Object.defineProperty(exports, "__esModule", ({
  9742. value: true
  9743. }));
  9744. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  9745. var _object = __webpack_require__(4011);
  9746. var _object2 = _interopRequireDefault(_object);
  9747. var _react = __webpack_require__(9196);
  9748. var _react2 = _interopRequireDefault(_react);
  9749. var _propTypes = __webpack_require__(2652);
  9750. var _propTypes2 = _interopRequireDefault(_propTypes);
  9751. var _airbnbPropTypes = __webpack_require__(4882);
  9752. var _reactWithStyles = __webpack_require__(3576);
  9753. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9754. var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
  9755. unicode: _propTypes2['default'].string.isRequired,
  9756. label: _propTypes2['default'].string.isRequired,
  9757. action: _propTypes2['default'].string.isRequired,
  9758. block: _propTypes2['default'].bool
  9759. }));
  9760. var defaultProps = {
  9761. block: false
  9762. };
  9763. function KeyboardShortcutRow(_ref) {
  9764. var unicode = _ref.unicode,
  9765. label = _ref.label,
  9766. action = _ref.action,
  9767. block = _ref.block,
  9768. styles = _ref.styles;
  9769. return _react2['default'].createElement(
  9770. 'li',
  9771. (0, _reactWithStyles.css)(styles.KeyboardShortcutRow, block && styles.KeyboardShortcutRow__block),
  9772. _react2['default'].createElement(
  9773. 'div',
  9774. (0, _reactWithStyles.css)(styles.KeyboardShortcutRow_keyContainer, block && styles.KeyboardShortcutRow_keyContainer__block),
  9775. _react2['default'].createElement(
  9776. 'span',
  9777. _extends({}, (0, _reactWithStyles.css)(styles.KeyboardShortcutRow_key), {
  9778. role: 'img',
  9779. 'aria-label': String(label) + ',' // add comma so screen readers will pause before reading action
  9780. }),
  9781. unicode
  9782. )
  9783. ),
  9784. _react2['default'].createElement(
  9785. 'div',
  9786. (0, _reactWithStyles.css)(styles.KeyboardShortcutRow_action),
  9787. action
  9788. )
  9789. );
  9790. }
  9791. KeyboardShortcutRow.propTypes = propTypes;
  9792. KeyboardShortcutRow.defaultProps = defaultProps;
  9793. exports["default"] = (0, _reactWithStyles.withStyles)(function (_ref2) {
  9794. var color = _ref2.reactDates.color;
  9795. return {
  9796. KeyboardShortcutRow: {
  9797. listStyle: 'none',
  9798. margin: '6px 0'
  9799. },
  9800. KeyboardShortcutRow__block: {
  9801. marginBottom: 16
  9802. },
  9803. KeyboardShortcutRow_keyContainer: {
  9804. display: 'inline-block',
  9805. whiteSpace: 'nowrap',
  9806. textAlign: 'right',
  9807. marginRight: 6
  9808. },
  9809. KeyboardShortcutRow_keyContainer__block: {
  9810. textAlign: 'left',
  9811. display: 'inline'
  9812. },
  9813. KeyboardShortcutRow_key: {
  9814. fontFamily: 'monospace',
  9815. fontSize: 12,
  9816. textTransform: 'uppercase',
  9817. background: color.core.grayLightest,
  9818. padding: '2px 6px'
  9819. },
  9820. KeyboardShortcutRow_action: {
  9821. display: 'inline',
  9822. wordBreak: 'break-word',
  9823. marginLeft: 8
  9824. }
  9825. };
  9826. })(KeyboardShortcutRow);
  9827. /***/ }),
  9828. /***/ 8:
  9829. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  9830. "use strict";
  9831. Object.defineProperty(exports, "__esModule", ({
  9832. value: true
  9833. }));
  9834. var _react = __webpack_require__(9196);
  9835. var _react2 = _interopRequireDefault(_react);
  9836. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9837. var LeftArrow = function () {
  9838. function LeftArrow(props) {
  9839. return _react2['default'].createElement(
  9840. 'svg',
  9841. props,
  9842. _react2['default'].createElement('path', {
  9843. d: 'M336.2 274.5l-210.1 210h805.4c13 0 23 10 23 23s-10 23-23 23H126.1l210.1 210.1c11 11 11 21 0 32-5 5-10 7-16 7s-11-2-16-7l-249.1-249c-11-11-11-21 0-32l249.1-249.1c21-21.1 53 10.9 32 32z'
  9844. })
  9845. );
  9846. }
  9847. return LeftArrow;
  9848. }();
  9849. LeftArrow.defaultProps = {
  9850. viewBox: '0 0 1000 1000'
  9851. };
  9852. exports["default"] = LeftArrow;
  9853. /***/ }),
  9854. /***/ 4921:
  9855. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  9856. "use strict";
  9857. Object.defineProperty(exports, "__esModule", ({
  9858. value: true
  9859. }));
  9860. var _react = __webpack_require__(9196);
  9861. var _react2 = _interopRequireDefault(_react);
  9862. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9863. var RightArrow = function () {
  9864. function RightArrow(props) {
  9865. return _react2['default'].createElement(
  9866. 'svg',
  9867. props,
  9868. _react2['default'].createElement('path', {
  9869. d: 'M694.4 242.4l249.1 249.1c11 11 11 21 0 32L694.4 772.7c-5 5-10 7-16 7s-11-2-16-7c-11-11-11-21 0-32l210.1-210.1H67.1c-13 0-23-10-23-23s10-23 23-23h805.4L662.4 274.5c-21-21.1 11-53.1 32-32.1z'
  9870. })
  9871. );
  9872. }
  9873. return RightArrow;
  9874. }();
  9875. RightArrow.defaultProps = {
  9876. viewBox: '0 0 1000 1000'
  9877. };
  9878. exports["default"] = RightArrow;
  9879. /***/ }),
  9880. /***/ 257:
  9881. /***/ (function(__unused_webpack_module, exports) {
  9882. "use strict";
  9883. Object.defineProperty(exports, "__esModule", ({
  9884. value: true
  9885. }));
  9886. var DISPLAY_FORMAT = exports.DISPLAY_FORMAT = 'L';
  9887. var ISO_FORMAT = exports.ISO_FORMAT = 'YYYY-MM-DD';
  9888. var ISO_MONTH_FORMAT = exports.ISO_MONTH_FORMAT = 'YYYY-MM';
  9889. var START_DATE = exports.START_DATE = 'startDate';
  9890. var END_DATE = exports.END_DATE = 'endDate';
  9891. var HORIZONTAL_ORIENTATION = exports.HORIZONTAL_ORIENTATION = 'horizontal';
  9892. var VERTICAL_ORIENTATION = exports.VERTICAL_ORIENTATION = 'vertical';
  9893. var VERTICAL_SCROLLABLE = exports.VERTICAL_SCROLLABLE = 'verticalScrollable';
  9894. var ICON_BEFORE_POSITION = exports.ICON_BEFORE_POSITION = 'before';
  9895. var ICON_AFTER_POSITION = exports.ICON_AFTER_POSITION = 'after';
  9896. var INFO_POSITION_TOP = exports.INFO_POSITION_TOP = 'top';
  9897. var INFO_POSITION_BOTTOM = exports.INFO_POSITION_BOTTOM = 'bottom';
  9898. var INFO_POSITION_BEFORE = exports.INFO_POSITION_BEFORE = 'before';
  9899. var INFO_POSITION_AFTER = exports.INFO_POSITION_AFTER = 'after';
  9900. var ANCHOR_LEFT = exports.ANCHOR_LEFT = 'left';
  9901. var ANCHOR_RIGHT = exports.ANCHOR_RIGHT = 'right';
  9902. var OPEN_DOWN = exports.OPEN_DOWN = 'down';
  9903. var OPEN_UP = exports.OPEN_UP = 'up';
  9904. var DAY_SIZE = exports.DAY_SIZE = 39;
  9905. var BLOCKED_MODIFIER = exports.BLOCKED_MODIFIER = 'blocked';
  9906. var WEEKDAYS = exports.WEEKDAYS = [0, 1, 2, 3, 4, 5, 6];
  9907. var FANG_WIDTH_PX = exports.FANG_WIDTH_PX = 20;
  9908. var FANG_HEIGHT_PX = exports.FANG_HEIGHT_PX = 10;
  9909. var DEFAULT_VERTICAL_SPACING = exports.DEFAULT_VERTICAL_SPACING = 22;
  9910. var MODIFIER_KEY_NAMES = exports.MODIFIER_KEY_NAMES = new Set(['Shift', 'Control', 'Alt', 'Meta']);
  9911. /***/ }),
  9912. /***/ 6030:
  9913. /***/ (function(__unused_webpack_module, exports) {
  9914. "use strict";
  9915. Object.defineProperty(exports, "__esModule", ({
  9916. value: true
  9917. }));
  9918. var calendarLabel = 'Calendar';
  9919. var closeDatePicker = 'Close';
  9920. var focusStartDate = 'Interact with the calendar and add the check-in date for your trip.';
  9921. var clearDate = 'Clear Date';
  9922. var clearDates = 'Clear Dates';
  9923. var jumpToPrevMonth = 'Move backward to switch to the previous month.';
  9924. var jumpToNextMonth = 'Move forward to switch to the next month.';
  9925. var keyboardShortcuts = 'Keyboard Shortcuts';
  9926. var showKeyboardShortcutsPanel = 'Open the keyboard shortcuts panel.';
  9927. var hideKeyboardShortcutsPanel = 'Close the shortcuts panel.';
  9928. var openThisPanel = 'Open this panel.';
  9929. var enterKey = 'Enter key';
  9930. var leftArrowRightArrow = 'Right and left arrow keys';
  9931. var upArrowDownArrow = 'up and down arrow keys';
  9932. var pageUpPageDown = 'page up and page down keys';
  9933. var homeEnd = 'Home and end keys';
  9934. var escape = 'Escape key';
  9935. var questionMark = 'Question mark';
  9936. var selectFocusedDate = 'Select the date in focus.';
  9937. var moveFocusByOneDay = 'Move backward (left) and forward (right) by one day.';
  9938. var moveFocusByOneWeek = 'Move backward (up) and forward (down) by one week.';
  9939. var moveFocusByOneMonth = 'Switch months.';
  9940. var moveFocustoStartAndEndOfWeek = 'Go to the first or last day of a week.';
  9941. var returnFocusToInput = 'Return to the date input field.';
  9942. var keyboardNavigationInstructions = 'Press the down arrow key to interact with the calendar and\n select a date. Press the question mark key to get the keyboard shortcuts for changing dates.';
  9943. var chooseAvailableStartDate = function chooseAvailableStartDate(_ref) {
  9944. var date = _ref.date;
  9945. return 'Choose ' + String(date) + ' as your check-in date. It\u2019s available.';
  9946. };
  9947. var chooseAvailableEndDate = function chooseAvailableEndDate(_ref2) {
  9948. var date = _ref2.date;
  9949. return 'Choose ' + String(date) + ' as your check-out date. It\u2019s available.';
  9950. };
  9951. var chooseAvailableDate = function chooseAvailableDate(_ref3) {
  9952. var date = _ref3.date;
  9953. return date;
  9954. };
  9955. var dateIsUnavailable = function dateIsUnavailable(_ref4) {
  9956. var date = _ref4.date;
  9957. return 'Not available. ' + String(date);
  9958. };
  9959. var dateIsSelected = function dateIsSelected(_ref5) {
  9960. var date = _ref5.date;
  9961. return 'Selected. ' + String(date);
  9962. };
  9963. exports["default"] = {
  9964. calendarLabel: calendarLabel,
  9965. closeDatePicker: closeDatePicker,
  9966. focusStartDate: focusStartDate,
  9967. clearDate: clearDate,
  9968. clearDates: clearDates,
  9969. jumpToPrevMonth: jumpToPrevMonth,
  9970. jumpToNextMonth: jumpToNextMonth,
  9971. keyboardShortcuts: keyboardShortcuts,
  9972. showKeyboardShortcutsPanel: showKeyboardShortcutsPanel,
  9973. hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
  9974. openThisPanel: openThisPanel,
  9975. enterKey: enterKey,
  9976. leftArrowRightArrow: leftArrowRightArrow,
  9977. upArrowDownArrow: upArrowDownArrow,
  9978. pageUpPageDown: pageUpPageDown,
  9979. homeEnd: homeEnd,
  9980. escape: escape,
  9981. questionMark: questionMark,
  9982. selectFocusedDate: selectFocusedDate,
  9983. moveFocusByOneDay: moveFocusByOneDay,
  9984. moveFocusByOneWeek: moveFocusByOneWeek,
  9985. moveFocusByOneMonth: moveFocusByOneMonth,
  9986. moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek,
  9987. returnFocusToInput: returnFocusToInput,
  9988. keyboardNavigationInstructions: keyboardNavigationInstructions,
  9989. chooseAvailableStartDate: chooseAvailableStartDate,
  9990. chooseAvailableEndDate: chooseAvailableEndDate,
  9991. dateIsUnavailable: dateIsUnavailable,
  9992. dateIsSelected: dateIsSelected
  9993. };
  9994. var DateRangePickerPhrases = exports.DateRangePickerPhrases = {
  9995. calendarLabel: calendarLabel,
  9996. closeDatePicker: closeDatePicker,
  9997. clearDates: clearDates,
  9998. focusStartDate: focusStartDate,
  9999. jumpToPrevMonth: jumpToPrevMonth,
  10000. jumpToNextMonth: jumpToNextMonth,
  10001. keyboardShortcuts: keyboardShortcuts,
  10002. showKeyboardShortcutsPanel: showKeyboardShortcutsPanel,
  10003. hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
  10004. openThisPanel: openThisPanel,
  10005. enterKey: enterKey,
  10006. leftArrowRightArrow: leftArrowRightArrow,
  10007. upArrowDownArrow: upArrowDownArrow,
  10008. pageUpPageDown: pageUpPageDown,
  10009. homeEnd: homeEnd,
  10010. escape: escape,
  10011. questionMark: questionMark,
  10012. selectFocusedDate: selectFocusedDate,
  10013. moveFocusByOneDay: moveFocusByOneDay,
  10014. moveFocusByOneWeek: moveFocusByOneWeek,
  10015. moveFocusByOneMonth: moveFocusByOneMonth,
  10016. moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek,
  10017. returnFocusToInput: returnFocusToInput,
  10018. keyboardNavigationInstructions: keyboardNavigationInstructions,
  10019. chooseAvailableStartDate: chooseAvailableStartDate,
  10020. chooseAvailableEndDate: chooseAvailableEndDate,
  10021. dateIsUnavailable: dateIsUnavailable,
  10022. dateIsSelected: dateIsSelected
  10023. };
  10024. var DateRangePickerInputPhrases = exports.DateRangePickerInputPhrases = {
  10025. focusStartDate: focusStartDate,
  10026. clearDates: clearDates,
  10027. keyboardNavigationInstructions: keyboardNavigationInstructions
  10028. };
  10029. var SingleDatePickerPhrases = exports.SingleDatePickerPhrases = {
  10030. calendarLabel: calendarLabel,
  10031. closeDatePicker: closeDatePicker,
  10032. clearDate: clearDate,
  10033. jumpToPrevMonth: jumpToPrevMonth,
  10034. jumpToNextMonth: jumpToNextMonth,
  10035. keyboardShortcuts: keyboardShortcuts,
  10036. showKeyboardShortcutsPanel: showKeyboardShortcutsPanel,
  10037. hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
  10038. openThisPanel: openThisPanel,
  10039. enterKey: enterKey,
  10040. leftArrowRightArrow: leftArrowRightArrow,
  10041. upArrowDownArrow: upArrowDownArrow,
  10042. pageUpPageDown: pageUpPageDown,
  10043. homeEnd: homeEnd,
  10044. escape: escape,
  10045. questionMark: questionMark,
  10046. selectFocusedDate: selectFocusedDate,
  10047. moveFocusByOneDay: moveFocusByOneDay,
  10048. moveFocusByOneWeek: moveFocusByOneWeek,
  10049. moveFocusByOneMonth: moveFocusByOneMonth,
  10050. moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek,
  10051. returnFocusToInput: returnFocusToInput,
  10052. keyboardNavigationInstructions: keyboardNavigationInstructions,
  10053. chooseAvailableDate: chooseAvailableDate,
  10054. dateIsUnavailable: dateIsUnavailable,
  10055. dateIsSelected: dateIsSelected
  10056. };
  10057. var SingleDatePickerInputPhrases = exports.SingleDatePickerInputPhrases = {
  10058. clearDate: clearDate,
  10059. keyboardNavigationInstructions: keyboardNavigationInstructions
  10060. };
  10061. var DayPickerPhrases = exports.DayPickerPhrases = {
  10062. calendarLabel: calendarLabel,
  10063. jumpToPrevMonth: jumpToPrevMonth,
  10064. jumpToNextMonth: jumpToNextMonth,
  10065. keyboardShortcuts: keyboardShortcuts,
  10066. showKeyboardShortcutsPanel: showKeyboardShortcutsPanel,
  10067. hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
  10068. openThisPanel: openThisPanel,
  10069. enterKey: enterKey,
  10070. leftArrowRightArrow: leftArrowRightArrow,
  10071. upArrowDownArrow: upArrowDownArrow,
  10072. pageUpPageDown: pageUpPageDown,
  10073. homeEnd: homeEnd,
  10074. escape: escape,
  10075. questionMark: questionMark,
  10076. selectFocusedDate: selectFocusedDate,
  10077. moveFocusByOneDay: moveFocusByOneDay,
  10078. moveFocusByOneWeek: moveFocusByOneWeek,
  10079. moveFocusByOneMonth: moveFocusByOneMonth,
  10080. moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek,
  10081. returnFocusToInput: returnFocusToInput,
  10082. chooseAvailableStartDate: chooseAvailableStartDate,
  10083. chooseAvailableEndDate: chooseAvailableEndDate,
  10084. chooseAvailableDate: chooseAvailableDate,
  10085. dateIsUnavailable: dateIsUnavailable,
  10086. dateIsSelected: dateIsSelected
  10087. };
  10088. var DayPickerKeyboardShortcutsPhrases = exports.DayPickerKeyboardShortcutsPhrases = {
  10089. keyboardShortcuts: keyboardShortcuts,
  10090. showKeyboardShortcutsPanel: showKeyboardShortcutsPanel,
  10091. hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
  10092. openThisPanel: openThisPanel,
  10093. enterKey: enterKey,
  10094. leftArrowRightArrow: leftArrowRightArrow,
  10095. upArrowDownArrow: upArrowDownArrow,
  10096. pageUpPageDown: pageUpPageDown,
  10097. homeEnd: homeEnd,
  10098. escape: escape,
  10099. questionMark: questionMark,
  10100. selectFocusedDate: selectFocusedDate,
  10101. moveFocusByOneDay: moveFocusByOneDay,
  10102. moveFocusByOneWeek: moveFocusByOneWeek,
  10103. moveFocusByOneMonth: moveFocusByOneMonth,
  10104. moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek,
  10105. returnFocusToInput: returnFocusToInput
  10106. };
  10107. var DayPickerNavigationPhrases = exports.DayPickerNavigationPhrases = {
  10108. jumpToPrevMonth: jumpToPrevMonth,
  10109. jumpToNextMonth: jumpToNextMonth
  10110. };
  10111. var CalendarDayPhrases = exports.CalendarDayPhrases = {
  10112. chooseAvailableDate: chooseAvailableDate,
  10113. dateIsUnavailable: dateIsUnavailable,
  10114. dateIsSelected: dateIsSelected
  10115. };
  10116. /***/ }),
  10117. /***/ 17:
  10118. /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
  10119. "use strict";
  10120. var _registerCSSInterfaceWithDefaultTheme = __webpack_require__(9305);
  10121. var _registerCSSInterfaceWithDefaultTheme2 = _interopRequireDefault(_registerCSSInterfaceWithDefaultTheme);
  10122. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10123. (0, _registerCSSInterfaceWithDefaultTheme2['default'])();
  10124. /***/ }),
  10125. /***/ 8182:
  10126. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10127. "use strict";
  10128. Object.defineProperty(exports, "__esModule", ({
  10129. value: true
  10130. }));
  10131. var _propTypes = __webpack_require__(2652);
  10132. var _propTypes2 = _interopRequireDefault(_propTypes);
  10133. var _constants = __webpack_require__(257);
  10134. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10135. exports["default"] = _propTypes2['default'].oneOf([_constants.INFO_POSITION_TOP, _constants.INFO_POSITION_BOTTOM, _constants.INFO_POSITION_BEFORE, _constants.INFO_POSITION_AFTER]);
  10136. /***/ }),
  10137. /***/ 243:
  10138. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10139. "use strict";
  10140. Object.defineProperty(exports, "__esModule", ({
  10141. value: true
  10142. }));
  10143. var _propTypes = __webpack_require__(2652);
  10144. var _propTypes2 = _interopRequireDefault(_propTypes);
  10145. var _constants = __webpack_require__(257);
  10146. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10147. exports["default"] = _propTypes2['default'].oneOf(_constants.WEEKDAYS);
  10148. /***/ }),
  10149. /***/ 6747:
  10150. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10151. "use strict";
  10152. Object.defineProperty(exports, "__esModule", ({
  10153. value: true
  10154. }));
  10155. var _propTypes = __webpack_require__(2652);
  10156. var _propTypes2 = _interopRequireDefault(_propTypes);
  10157. var _airbnbPropTypes = __webpack_require__(4882);
  10158. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10159. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  10160. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  10161. exports["default"] = (0, _airbnbPropTypes.and)([_propTypes2['default'].instanceOf(Set), function () {
  10162. function modifiers(props, propName) {
  10163. for (var _len = arguments.length, rest = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  10164. rest[_key - 2] = arguments[_key];
  10165. }
  10166. var propValue = props[propName];
  10167. var firstError = void 0;
  10168. [].concat(_toConsumableArray(propValue)).some(function (v, i) {
  10169. var _PropTypes$string;
  10170. var fakePropName = String(propName) + ': index ' + String(i);
  10171. firstError = (_PropTypes$string = _propTypes2['default'].string).isRequired.apply(_PropTypes$string, [_defineProperty({}, fakePropName, v), fakePropName].concat(rest));
  10172. return firstError != null;
  10173. });
  10174. return firstError == null ? null : firstError;
  10175. }
  10176. return modifiers;
  10177. }()], 'Modifiers (Set of Strings)');
  10178. /***/ }),
  10179. /***/ 6553:
  10180. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10181. "use strict";
  10182. Object.defineProperty(exports, "__esModule", ({
  10183. value: true
  10184. }));
  10185. var _propTypes = __webpack_require__(2652);
  10186. var _propTypes2 = _interopRequireDefault(_propTypes);
  10187. var _constants = __webpack_require__(257);
  10188. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10189. exports["default"] = _propTypes2['default'].oneOf([_constants.HORIZONTAL_ORIENTATION, _constants.VERTICAL_ORIENTATION, _constants.VERTICAL_SCROLLABLE]);
  10190. /***/ }),
  10191. /***/ 8158:
  10192. /***/ (function(__unused_webpack_module, exports) {
  10193. "use strict";
  10194. Object.defineProperty(exports, "__esModule", ({
  10195. value: true
  10196. }));
  10197. var core = {
  10198. white: '#fff',
  10199. gray: '#484848',
  10200. grayLight: '#82888a',
  10201. grayLighter: '#cacccd',
  10202. grayLightest: '#f2f2f2',
  10203. borderMedium: '#c4c4c4',
  10204. border: '#dbdbdb',
  10205. borderLight: '#e4e7e7',
  10206. borderLighter: '#eceeee',
  10207. borderBright: '#f4f5f5',
  10208. primary: '#00a699',
  10209. primaryShade_1: '#33dacd',
  10210. primaryShade_2: '#66e2da',
  10211. primaryShade_3: '#80e8e0',
  10212. primaryShade_4: '#b2f1ec',
  10213. primary_dark: '#008489',
  10214. secondary: '#007a87',
  10215. yellow: '#ffe8bc',
  10216. yellow_dark: '#ffce71'
  10217. };
  10218. exports["default"] = {
  10219. reactDates: {
  10220. zIndex: 0,
  10221. border: {
  10222. input: {
  10223. border: 0,
  10224. borderTop: 0,
  10225. borderRight: 0,
  10226. borderBottom: '2px solid transparent',
  10227. borderLeft: 0,
  10228. outlineFocused: 0,
  10229. borderFocused: 0,
  10230. borderTopFocused: 0,
  10231. borderLeftFocused: 0,
  10232. borderBottomFocused: '2px solid ' + String(core.primary_dark),
  10233. borderRightFocused: 0,
  10234. borderRadius: 0
  10235. },
  10236. pickerInput: {
  10237. borderWidth: 1,
  10238. borderStyle: 'solid',
  10239. borderRadius: 2
  10240. }
  10241. },
  10242. color: {
  10243. core: core,
  10244. disabled: core.grayLightest,
  10245. background: core.white,
  10246. backgroundDark: '#f2f2f2',
  10247. backgroundFocused: core.white,
  10248. border: 'rgb(219, 219, 219)',
  10249. text: core.gray,
  10250. textDisabled: core.border,
  10251. textFocused: '#007a87',
  10252. placeholderText: '#757575',
  10253. outside: {
  10254. backgroundColor: core.white,
  10255. backgroundColor_active: core.white,
  10256. backgroundColor_hover: core.white,
  10257. color: core.gray,
  10258. color_active: core.gray,
  10259. color_hover: core.gray
  10260. },
  10261. highlighted: {
  10262. backgroundColor: core.yellow,
  10263. backgroundColor_active: core.yellow_dark,
  10264. backgroundColor_hover: core.yellow_dark,
  10265. color: core.gray,
  10266. color_active: core.gray,
  10267. color_hover: core.gray
  10268. },
  10269. minimumNights: {
  10270. backgroundColor: core.white,
  10271. backgroundColor_active: core.white,
  10272. backgroundColor_hover: core.white,
  10273. borderColor: core.borderLighter,
  10274. color: core.grayLighter,
  10275. color_active: core.grayLighter,
  10276. color_hover: core.grayLighter
  10277. },
  10278. hoveredSpan: {
  10279. backgroundColor: core.primaryShade_4,
  10280. backgroundColor_active: core.primaryShade_3,
  10281. backgroundColor_hover: core.primaryShade_4,
  10282. borderColor: core.primaryShade_3,
  10283. borderColor_active: core.primaryShade_3,
  10284. borderColor_hover: core.primaryShade_3,
  10285. color: core.secondary,
  10286. color_active: core.secondary,
  10287. color_hover: core.secondary
  10288. },
  10289. selectedSpan: {
  10290. backgroundColor: core.primaryShade_2,
  10291. backgroundColor_active: core.primaryShade_1,
  10292. backgroundColor_hover: core.primaryShade_1,
  10293. borderColor: core.primaryShade_1,
  10294. borderColor_active: core.primary,
  10295. borderColor_hover: core.primary,
  10296. color: core.white,
  10297. color_active: core.white,
  10298. color_hover: core.white
  10299. },
  10300. selected: {
  10301. backgroundColor: core.primary,
  10302. backgroundColor_active: core.primary,
  10303. backgroundColor_hover: core.primary,
  10304. borderColor: core.primary,
  10305. borderColor_active: core.primary,
  10306. borderColor_hover: core.primary,
  10307. color: core.white,
  10308. color_active: core.white,
  10309. color_hover: core.white
  10310. },
  10311. blocked_calendar: {
  10312. backgroundColor: core.grayLighter,
  10313. backgroundColor_active: core.grayLighter,
  10314. backgroundColor_hover: core.grayLighter,
  10315. borderColor: core.grayLighter,
  10316. borderColor_active: core.grayLighter,
  10317. borderColor_hover: core.grayLighter,
  10318. color: core.grayLight,
  10319. color_active: core.grayLight,
  10320. color_hover: core.grayLight
  10321. },
  10322. blocked_out_of_range: {
  10323. backgroundColor: core.white,
  10324. backgroundColor_active: core.white,
  10325. backgroundColor_hover: core.white,
  10326. borderColor: core.borderLight,
  10327. borderColor_active: core.borderLight,
  10328. borderColor_hover: core.borderLight,
  10329. color: core.grayLighter,
  10330. color_active: core.grayLighter,
  10331. color_hover: core.grayLighter
  10332. }
  10333. },
  10334. spacing: {
  10335. dayPickerHorizontalPadding: 9,
  10336. captionPaddingTop: 22,
  10337. captionPaddingBottom: 37,
  10338. inputPadding: 0,
  10339. displayTextPaddingVertical: undefined,
  10340. displayTextPaddingTop: 11,
  10341. displayTextPaddingBottom: 9,
  10342. displayTextPaddingHorizontal: undefined,
  10343. displayTextPaddingLeft: 11,
  10344. displayTextPaddingRight: 11,
  10345. displayTextPaddingVertical_small: undefined,
  10346. displayTextPaddingTop_small: 7,
  10347. displayTextPaddingBottom_small: 5,
  10348. displayTextPaddingHorizontal_small: undefined,
  10349. displayTextPaddingLeft_small: 7,
  10350. displayTextPaddingRight_small: 7
  10351. },
  10352. sizing: {
  10353. inputWidth: 130,
  10354. inputWidth_small: 97,
  10355. arrowWidth: 24
  10356. },
  10357. noScrollBarOnVerticalScrollable: false,
  10358. font: {
  10359. size: 14,
  10360. captionSize: 18,
  10361. input: {
  10362. size: 19,
  10363. lineHeight: '24px',
  10364. size_small: 15,
  10365. lineHeight_small: '18px',
  10366. letterSpacing_small: '0.2px',
  10367. styleDisabled: 'italic'
  10368. }
  10369. }
  10370. }
  10371. };
  10372. /***/ }),
  10373. /***/ 8607:
  10374. /***/ (function(__unused_webpack_module, exports) {
  10375. "use strict";
  10376. Object.defineProperty(exports, "__esModule", ({
  10377. value: true
  10378. }));
  10379. exports["default"] = calculateDimension;
  10380. function calculateDimension(el, axis) {
  10381. var borderBox = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  10382. var withMargin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  10383. if (!el) {
  10384. return 0;
  10385. }
  10386. var axisStart = axis === 'width' ? 'Left' : 'Top';
  10387. var axisEnd = axis === 'width' ? 'Right' : 'Bottom';
  10388. // Only read styles if we need to
  10389. var style = !borderBox || withMargin ? window.getComputedStyle(el) : null;
  10390. // Offset includes border and padding
  10391. var offsetWidth = el.offsetWidth,
  10392. offsetHeight = el.offsetHeight;
  10393. var size = axis === 'width' ? offsetWidth : offsetHeight;
  10394. // Get the inner size
  10395. if (!borderBox) {
  10396. size -= parseFloat(style['padding' + axisStart]) + parseFloat(style['padding' + axisEnd]) + parseFloat(style['border' + axisStart + 'Width']) + parseFloat(style['border' + axisEnd + 'Width']);
  10397. }
  10398. // Apply margin
  10399. if (withMargin) {
  10400. size += parseFloat(style['margin' + axisStart]) + parseFloat(style['margin' + axisEnd]);
  10401. }
  10402. return size;
  10403. }
  10404. /***/ }),
  10405. /***/ 5814:
  10406. /***/ (function(__unused_webpack_module, exports) {
  10407. "use strict";
  10408. Object.defineProperty(exports, "__esModule", ({
  10409. value: true
  10410. }));
  10411. exports["default"] = getActiveElement;
  10412. function getActiveElement() {
  10413. return typeof document !== 'undefined' && document.activeElement;
  10414. }
  10415. /***/ }),
  10416. /***/ 7475:
  10417. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10418. "use strict";
  10419. Object.defineProperty(exports, "__esModule", ({
  10420. value: true
  10421. }));
  10422. exports["default"] = getCalendarDaySettings;
  10423. var _getPhrase = __webpack_require__(7098);
  10424. var _getPhrase2 = _interopRequireDefault(_getPhrase);
  10425. var _constants = __webpack_require__(257);
  10426. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10427. function getCalendarDaySettings(day, ariaLabelFormat, daySize, modifiers, phrases) {
  10428. var chooseAvailableDate = phrases.chooseAvailableDate,
  10429. dateIsUnavailable = phrases.dateIsUnavailable,
  10430. dateIsSelected = phrases.dateIsSelected;
  10431. var daySizeStyles = {
  10432. width: daySize,
  10433. height: daySize - 1
  10434. };
  10435. var useDefaultCursor = modifiers.has('blocked-minimum-nights') || modifiers.has('blocked-calendar') || modifiers.has('blocked-out-of-range');
  10436. var selected = modifiers.has('selected') || modifiers.has('selected-start') || modifiers.has('selected-end');
  10437. var hoveredSpan = !selected && (modifiers.has('hovered-span') || modifiers.has('after-hovered-start'));
  10438. var isOutsideRange = modifiers.has('blocked-out-of-range');
  10439. var formattedDate = { date: day.format(ariaLabelFormat) };
  10440. var ariaLabel = (0, _getPhrase2['default'])(chooseAvailableDate, formattedDate);
  10441. if (modifiers.has(_constants.BLOCKED_MODIFIER)) {
  10442. ariaLabel = (0, _getPhrase2['default'])(dateIsUnavailable, formattedDate);
  10443. } else if (selected) {
  10444. ariaLabel = (0, _getPhrase2['default'])(dateIsSelected, formattedDate);
  10445. }
  10446. return {
  10447. daySizeStyles: daySizeStyles,
  10448. useDefaultCursor: useDefaultCursor,
  10449. selected: selected,
  10450. hoveredSpan: hoveredSpan,
  10451. isOutsideRange: isOutsideRange,
  10452. ariaLabel: ariaLabel
  10453. };
  10454. }
  10455. /***/ }),
  10456. /***/ 5644:
  10457. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10458. "use strict";
  10459. Object.defineProperty(exports, "__esModule", ({
  10460. value: true
  10461. }));
  10462. exports["default"] = getCalendarMonthWeeks;
  10463. var _moment = __webpack_require__(6292);
  10464. var _moment2 = _interopRequireDefault(_moment);
  10465. var _constants = __webpack_require__(257);
  10466. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10467. function getCalendarMonthWeeks(month, enableOutsideDays) {
  10468. var firstDayOfWeek = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _moment2['default'].localeData().firstDayOfWeek();
  10469. if (!_moment2['default'].isMoment(month) || !month.isValid()) {
  10470. throw new TypeError('`month` must be a valid moment object');
  10471. }
  10472. if (_constants.WEEKDAYS.indexOf(firstDayOfWeek) === -1) {
  10473. throw new TypeError('`firstDayOfWeek` must be an integer between 0 and 6');
  10474. }
  10475. // set utc offset to get correct dates in future (when timezone changes)
  10476. var firstOfMonth = month.clone().startOf('month').hour(12);
  10477. var lastOfMonth = month.clone().endOf('month').hour(12);
  10478. // calculate the exact first and last days to fill the entire matrix
  10479. // (considering days outside month)
  10480. var prevDays = (firstOfMonth.day() + 7 - firstDayOfWeek) % 7;
  10481. var nextDays = (firstDayOfWeek + 6 - lastOfMonth.day()) % 7;
  10482. var firstDay = firstOfMonth.clone().subtract(prevDays, 'day');
  10483. var lastDay = lastOfMonth.clone().add(nextDays, 'day');
  10484. var totalDays = lastDay.diff(firstDay, 'days') + 1;
  10485. var currentDay = firstDay.clone();
  10486. var weeksInMonth = [];
  10487. for (var i = 0; i < totalDays; i += 1) {
  10488. if (i % 7 === 0) {
  10489. weeksInMonth.push([]);
  10490. }
  10491. var day = null;
  10492. if (i >= prevDays && i < totalDays - nextDays || enableOutsideDays) {
  10493. day = currentDay.clone();
  10494. }
  10495. weeksInMonth[weeksInMonth.length - 1].push(day);
  10496. currentDay.add(1, 'day');
  10497. }
  10498. return weeksInMonth;
  10499. }
  10500. /***/ }),
  10501. /***/ 8964:
  10502. /***/ (function(__unused_webpack_module, exports) {
  10503. "use strict";
  10504. Object.defineProperty(exports, "__esModule", ({
  10505. value: true
  10506. }));
  10507. exports["default"] = getCalendarMonthWidth;
  10508. function getCalendarMonthWidth(daySize, calendarMonthPadding) {
  10509. return 7 * daySize + 2 * calendarMonthPadding + 1;
  10510. }
  10511. /***/ }),
  10512. /***/ 4112:
  10513. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10514. "use strict";
  10515. Object.defineProperty(exports, "__esModule", ({
  10516. value: true
  10517. }));
  10518. exports["default"] = getNumberOfCalendarMonthWeeks;
  10519. var _moment = __webpack_require__(6292);
  10520. var _moment2 = _interopRequireDefault(_moment);
  10521. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10522. function getBlankDaysBeforeFirstDay(firstDayOfMonth, firstDayOfWeek) {
  10523. var weekDayDiff = firstDayOfMonth.day() - firstDayOfWeek;
  10524. return (weekDayDiff + 7) % 7;
  10525. }
  10526. function getNumberOfCalendarMonthWeeks(month) {
  10527. var firstDayOfWeek = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _moment2['default'].localeData().firstDayOfWeek();
  10528. var firstDayOfMonth = month.clone().startOf('month');
  10529. var numBlankDays = getBlankDaysBeforeFirstDay(firstDayOfMonth, firstDayOfWeek);
  10530. return Math.ceil((numBlankDays + month.daysInMonth()) / 7);
  10531. }
  10532. /***/ }),
  10533. /***/ 7098:
  10534. /***/ (function(__unused_webpack_module, exports) {
  10535. "use strict";
  10536. Object.defineProperty(exports, "__esModule", ({
  10537. value: true
  10538. }));
  10539. exports["default"] = getPhrase;
  10540. function getPhrase(phrase, args) {
  10541. if (typeof phrase === 'string') return phrase;
  10542. if (typeof phrase === 'function') {
  10543. return phrase(args);
  10544. }
  10545. return '';
  10546. }
  10547. /***/ }),
  10548. /***/ 2893:
  10549. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10550. "use strict";
  10551. Object.defineProperty(exports, "__esModule", ({
  10552. value: true
  10553. }));
  10554. exports["default"] = getPhrasePropTypes;
  10555. var _object = __webpack_require__(4011);
  10556. var _object2 = _interopRequireDefault(_object);
  10557. var _propTypes = __webpack_require__(2652);
  10558. var _propTypes2 = _interopRequireDefault(_propTypes);
  10559. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10560. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  10561. function getPhrasePropTypes(defaultPhrases) {
  10562. return Object.keys(defaultPhrases).reduce(function (phrases, key) {
  10563. return (0, _object2['default'])({}, phrases, _defineProperty({}, key, _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].func, _propTypes2['default'].node])));
  10564. }, {});
  10565. }
  10566. /***/ }),
  10567. /***/ 8304:
  10568. /***/ (function(__unused_webpack_module, exports) {
  10569. "use strict";
  10570. Object.defineProperty(exports, "__esModule", ({
  10571. value: true
  10572. }));
  10573. exports["default"] = getTransformStyles;
  10574. function getTransformStyles(transformValue) {
  10575. return {
  10576. transform: transformValue,
  10577. msTransform: transformValue,
  10578. MozTransform: transformValue,
  10579. WebkitTransform: transformValue
  10580. };
  10581. }
  10582. /***/ }),
  10583. /***/ 3268:
  10584. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10585. "use strict";
  10586. Object.defineProperty(exports, "__esModule", ({
  10587. value: true
  10588. }));
  10589. exports["default"] = getVisibleDays;
  10590. var _moment = __webpack_require__(6292);
  10591. var _moment2 = _interopRequireDefault(_moment);
  10592. var _toISOMonthString = __webpack_require__(2705);
  10593. var _toISOMonthString2 = _interopRequireDefault(_toISOMonthString);
  10594. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10595. function getVisibleDays(month, numberOfMonths, enableOutsideDays, withoutTransitionMonths) {
  10596. if (!_moment2['default'].isMoment(month)) return {};
  10597. var visibleDaysByMonth = {};
  10598. var currentMonth = withoutTransitionMonths ? month.clone() : month.clone().subtract(1, 'month');
  10599. for (var i = 0; i < (withoutTransitionMonths ? numberOfMonths : numberOfMonths + 2); i += 1) {
  10600. var visibleDays = [];
  10601. // set utc offset to get correct dates in future (when timezone changes)
  10602. var baseDate = currentMonth.clone();
  10603. var firstOfMonth = baseDate.clone().startOf('month').hour(12);
  10604. var lastOfMonth = baseDate.clone().endOf('month').hour(12);
  10605. var currentDay = firstOfMonth.clone();
  10606. // days belonging to the previous month
  10607. if (enableOutsideDays) {
  10608. for (var j = 0; j < currentDay.weekday(); j += 1) {
  10609. var prevDay = currentDay.clone().subtract(j + 1, 'day');
  10610. visibleDays.unshift(prevDay);
  10611. }
  10612. }
  10613. while (currentDay < lastOfMonth) {
  10614. visibleDays.push(currentDay.clone());
  10615. currentDay.add(1, 'day');
  10616. }
  10617. if (enableOutsideDays) {
  10618. // weekday() returns the index of the day of the week according to the locale
  10619. // this means if the week starts on Monday, weekday() will return 0 for a Monday date, not 1
  10620. if (currentDay.weekday() !== 0) {
  10621. // days belonging to the next month
  10622. for (var k = currentDay.weekday(), count = 0; k < 7; k += 1, count += 1) {
  10623. var nextDay = currentDay.clone().add(count, 'day');
  10624. visibleDays.push(nextDay);
  10625. }
  10626. }
  10627. }
  10628. visibleDaysByMonth[(0, _toISOMonthString2['default'])(currentMonth)] = visibleDays;
  10629. currentMonth = currentMonth.clone().add(1, 'month');
  10630. }
  10631. return visibleDaysByMonth;
  10632. }
  10633. /***/ }),
  10634. /***/ 7365:
  10635. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10636. "use strict";
  10637. Object.defineProperty(exports, "__esModule", ({
  10638. value: true
  10639. }));
  10640. exports["default"] = isAfterDay;
  10641. var _moment = __webpack_require__(6292);
  10642. var _moment2 = _interopRequireDefault(_moment);
  10643. var _isBeforeDay = __webpack_require__(862);
  10644. var _isBeforeDay2 = _interopRequireDefault(_isBeforeDay);
  10645. var _isSameDay = __webpack_require__(3923);
  10646. var _isSameDay2 = _interopRequireDefault(_isSameDay);
  10647. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10648. function isAfterDay(a, b) {
  10649. if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
  10650. return !(0, _isBeforeDay2['default'])(a, b) && !(0, _isSameDay2['default'])(a, b);
  10651. }
  10652. /***/ }),
  10653. /***/ 862:
  10654. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10655. "use strict";
  10656. Object.defineProperty(exports, "__esModule", ({
  10657. value: true
  10658. }));
  10659. exports["default"] = isBeforeDay;
  10660. var _moment = __webpack_require__(6292);
  10661. var _moment2 = _interopRequireDefault(_moment);
  10662. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10663. function isBeforeDay(a, b) {
  10664. if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
  10665. var aYear = a.year();
  10666. var aMonth = a.month();
  10667. var bYear = b.year();
  10668. var bMonth = b.month();
  10669. var isSameYear = aYear === bYear;
  10670. var isSameMonth = aMonth === bMonth;
  10671. if (isSameYear && isSameMonth) return a.date() < b.date();
  10672. if (isSameYear) return aMonth < bMonth;
  10673. return aYear < bYear;
  10674. }
  10675. /***/ }),
  10676. /***/ 5713:
  10677. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10678. "use strict";
  10679. Object.defineProperty(exports, "__esModule", ({
  10680. value: true
  10681. }));
  10682. exports["default"] = isDayVisible;
  10683. var _isBeforeDay = __webpack_require__(862);
  10684. var _isBeforeDay2 = _interopRequireDefault(_isBeforeDay);
  10685. var _isAfterDay = __webpack_require__(7365);
  10686. var _isAfterDay2 = _interopRequireDefault(_isAfterDay);
  10687. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10688. function isDayVisible(day, month, numberOfMonths, enableOutsideDays) {
  10689. var firstDayOfFirstMonth = month.clone().startOf('month');
  10690. if (enableOutsideDays) firstDayOfFirstMonth = firstDayOfFirstMonth.startOf('week');
  10691. if ((0, _isBeforeDay2['default'])(day, firstDayOfFirstMonth)) return false;
  10692. var lastDayOfLastMonth = month.clone().add(numberOfMonths - 1, 'months').endOf('month');
  10693. if (enableOutsideDays) lastDayOfLastMonth = lastDayOfLastMonth.endOf('week');
  10694. return !(0, _isAfterDay2['default'])(day, lastDayOfLastMonth);
  10695. }
  10696. /***/ }),
  10697. /***/ 1310:
  10698. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10699. "use strict";
  10700. Object.defineProperty(exports, "__esModule", ({
  10701. value: true
  10702. }));
  10703. exports["default"] = isNextMonth;
  10704. var _moment = __webpack_require__(6292);
  10705. var _moment2 = _interopRequireDefault(_moment);
  10706. var _isSameMonth = __webpack_require__(4669);
  10707. var _isSameMonth2 = _interopRequireDefault(_isSameMonth);
  10708. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10709. function isNextMonth(a, b) {
  10710. if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
  10711. return (0, _isSameMonth2['default'])(a.clone().add(1, 'month'), b);
  10712. }
  10713. /***/ }),
  10714. /***/ 3858:
  10715. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10716. "use strict";
  10717. Object.defineProperty(exports, "__esModule", ({
  10718. value: true
  10719. }));
  10720. exports["default"] = isPrevMonth;
  10721. var _moment = __webpack_require__(6292);
  10722. var _moment2 = _interopRequireDefault(_moment);
  10723. var _isSameMonth = __webpack_require__(4669);
  10724. var _isSameMonth2 = _interopRequireDefault(_isSameMonth);
  10725. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10726. function isPrevMonth(a, b) {
  10727. if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
  10728. return (0, _isSameMonth2['default'])(a.clone().subtract(1, 'month'), b);
  10729. }
  10730. /***/ }),
  10731. /***/ 3923:
  10732. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10733. "use strict";
  10734. Object.defineProperty(exports, "__esModule", ({
  10735. value: true
  10736. }));
  10737. exports["default"] = isSameDay;
  10738. var _moment = __webpack_require__(6292);
  10739. var _moment2 = _interopRequireDefault(_moment);
  10740. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10741. function isSameDay(a, b) {
  10742. if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
  10743. // Compare least significant, most likely to change units first
  10744. // Moment's isSame clones moment inputs and is a tad slow
  10745. return a.date() === b.date() && a.month() === b.month() && a.year() === b.year();
  10746. }
  10747. /***/ }),
  10748. /***/ 4669:
  10749. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10750. "use strict";
  10751. Object.defineProperty(exports, "__esModule", ({
  10752. value: true
  10753. }));
  10754. exports["default"] = isSameMonth;
  10755. var _moment = __webpack_require__(6292);
  10756. var _moment2 = _interopRequireDefault(_moment);
  10757. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10758. function isSameMonth(a, b) {
  10759. if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
  10760. // Compare least significant, most likely to change units first
  10761. // Moment's isSame clones moment inputs and is a tad slow
  10762. return a.month() === b.month() && a.year() === b.year();
  10763. }
  10764. /***/ }),
  10765. /***/ 7978:
  10766. /***/ (function(__unused_webpack_module, exports) {
  10767. "use strict";
  10768. Object.defineProperty(exports, "__esModule", ({
  10769. value: true
  10770. }));
  10771. exports["default"] = isTransitionEndSupported;
  10772. function isTransitionEndSupported() {
  10773. return !!(typeof window !== 'undefined' && 'TransitionEvent' in window);
  10774. }
  10775. /***/ }),
  10776. /***/ 9305:
  10777. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10778. "use strict";
  10779. Object.defineProperty(exports, "__esModule", ({
  10780. value: true
  10781. }));
  10782. exports["default"] = registerCSSInterfaceWithDefaultTheme;
  10783. var _reactWithStylesInterfaceCss = __webpack_require__(5553);
  10784. var _reactWithStylesInterfaceCss2 = _interopRequireDefault(_reactWithStylesInterfaceCss);
  10785. var _registerInterfaceWithDefaultTheme = __webpack_require__(1980);
  10786. var _registerInterfaceWithDefaultTheme2 = _interopRequireDefault(_registerInterfaceWithDefaultTheme);
  10787. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10788. function registerCSSInterfaceWithDefaultTheme() {
  10789. (0, _registerInterfaceWithDefaultTheme2['default'])(_reactWithStylesInterfaceCss2['default']);
  10790. }
  10791. /***/ }),
  10792. /***/ 1980:
  10793. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10794. "use strict";
  10795. Object.defineProperty(exports, "__esModule", ({
  10796. value: true
  10797. }));
  10798. exports["default"] = registerInterfaceWithDefaultTheme;
  10799. var _ThemedStyleSheet = __webpack_require__(9349);
  10800. var _ThemedStyleSheet2 = _interopRequireDefault(_ThemedStyleSheet);
  10801. var _DefaultTheme = __webpack_require__(8158);
  10802. var _DefaultTheme2 = _interopRequireDefault(_DefaultTheme);
  10803. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10804. function registerInterfaceWithDefaultTheme(reactWithStylesInterface) {
  10805. _ThemedStyleSheet2['default'].registerInterface(reactWithStylesInterface);
  10806. _ThemedStyleSheet2['default'].registerTheme(_DefaultTheme2['default']);
  10807. }
  10808. /***/ }),
  10809. /***/ 7310:
  10810. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10811. "use strict";
  10812. Object.defineProperty(exports, "__esModule", ({
  10813. value: true
  10814. }));
  10815. exports["default"] = toISODateString;
  10816. var _moment = __webpack_require__(6292);
  10817. var _moment2 = _interopRequireDefault(_moment);
  10818. var _toMomentObject = __webpack_require__(2008);
  10819. var _toMomentObject2 = _interopRequireDefault(_toMomentObject);
  10820. var _constants = __webpack_require__(257);
  10821. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10822. function toISODateString(date, currentFormat) {
  10823. var dateObj = _moment2['default'].isMoment(date) ? date : (0, _toMomentObject2['default'])(date, currentFormat);
  10824. if (!dateObj) return null;
  10825. return dateObj.format(_constants.ISO_FORMAT);
  10826. }
  10827. /***/ }),
  10828. /***/ 2705:
  10829. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10830. "use strict";
  10831. Object.defineProperty(exports, "__esModule", ({
  10832. value: true
  10833. }));
  10834. exports["default"] = toISOMonthString;
  10835. var _moment = __webpack_require__(6292);
  10836. var _moment2 = _interopRequireDefault(_moment);
  10837. var _toMomentObject = __webpack_require__(2008);
  10838. var _toMomentObject2 = _interopRequireDefault(_toMomentObject);
  10839. var _constants = __webpack_require__(257);
  10840. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10841. function toISOMonthString(date, currentFormat) {
  10842. var dateObj = _moment2['default'].isMoment(date) ? date : (0, _toMomentObject2['default'])(date, currentFormat);
  10843. if (!dateObj) return null;
  10844. return dateObj.format(_constants.ISO_MONTH_FORMAT);
  10845. }
  10846. /***/ }),
  10847. /***/ 2008:
  10848. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  10849. "use strict";
  10850. Object.defineProperty(exports, "__esModule", ({
  10851. value: true
  10852. }));
  10853. exports["default"] = toMomentObject;
  10854. var _moment = __webpack_require__(6292);
  10855. var _moment2 = _interopRequireDefault(_moment);
  10856. var _constants = __webpack_require__(257);
  10857. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10858. function toMomentObject(dateString, customFormat) {
  10859. var dateFormats = customFormat ? [customFormat, _constants.DISPLAY_FORMAT, _constants.ISO_FORMAT] : [_constants.DISPLAY_FORMAT, _constants.ISO_FORMAT];
  10860. var date = (0, _moment2['default'])(dateString, dateFormats, true);
  10861. return date.isValid() ? date.hour(12) : null;
  10862. }
  10863. /***/ }),
  10864. /***/ 4821:
  10865. /***/ (function(__unused_webpack_module, exports) {
  10866. "use strict";
  10867. /** @license React v16.13.1
  10868. * react-is.production.min.js
  10869. *
  10870. * Copyright (c) Facebook, Inc. and its affiliates.
  10871. *
  10872. * This source code is licensed under the MIT license found in the
  10873. * LICENSE file in the root directory of this source tree.
  10874. */
  10875. var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
  10876. Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
  10877. function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;
  10878. exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};
  10879. exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};
  10880. exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;
  10881. /***/ }),
  10882. /***/ 338:
  10883. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  10884. "use strict";
  10885. if (true) {
  10886. module.exports = __webpack_require__(4821);
  10887. } else {}
  10888. /***/ }),
  10889. /***/ 9217:
  10890. /***/ (function(module) {
  10891. var messages = {
  10892. invalidPredicate: '`predicate` must be a function',
  10893. invalidPropValidator: '`propValidator` must be a function',
  10894. requiredCore: 'is marked as required',
  10895. invalidTypeCore: 'Invalid input type',
  10896. predicateFailureCore: 'Failed to succeed with predicate',
  10897. anonymousMessage: '<<anonymous>>',
  10898. baseInvalidMessage: 'Invalid ',
  10899. };
  10900. function constructPropValidatorVariations(propValidator) {
  10901. if (typeof propValidator !== 'function') {
  10902. throw new Error(messages.invalidPropValidator);
  10903. }
  10904. var requiredPropValidator = propValidator.bind(null, false, null);
  10905. requiredPropValidator.isRequired = propValidator.bind(null, true, null);
  10906. requiredPropValidator.withPredicate = function predicateApplication(predicate) {
  10907. if (typeof predicate !== 'function') {
  10908. throw new Error(messages.invalidPredicate);
  10909. }
  10910. var basePropValidator = propValidator.bind(null, false, predicate);
  10911. basePropValidator.isRequired = propValidator.bind(null, true, predicate);
  10912. return basePropValidator;
  10913. };
  10914. return requiredPropValidator;
  10915. }
  10916. function createInvalidRequiredErrorMessage(propName, componentName, value) {
  10917. return new Error(
  10918. 'The prop `' + propName + '` ' + messages.requiredCore +
  10919. ' in `' + componentName + '`, but its value is `' + value + '`.'
  10920. );
  10921. }
  10922. var independentGuardianValue = -1;
  10923. function preValidationRequireCheck(isRequired, componentName, propFullName, propValue) {
  10924. var isPropValueUndefined = typeof propValue === 'undefined';
  10925. var isPropValueNull = propValue === null;
  10926. if (isRequired) {
  10927. if (isPropValueUndefined) {
  10928. return createInvalidRequiredErrorMessage(propFullName, componentName, 'undefined');
  10929. } else if (isPropValueNull) {
  10930. return createInvalidRequiredErrorMessage(propFullName, componentName, 'null');
  10931. }
  10932. }
  10933. if (isPropValueUndefined || isPropValueNull) {
  10934. return null;
  10935. }
  10936. return independentGuardianValue;
  10937. }
  10938. function createMomentChecker(type, typeValidator, validator, momentType) {
  10939. function propValidator(
  10940. isRequired, // Bound parameter to indicate with the propType is required
  10941. predicate, // Bound parameter to allow user to add dynamic validation
  10942. props,
  10943. propName,
  10944. componentName,
  10945. location,
  10946. propFullName
  10947. ) {
  10948. var propValue = props[ propName ];
  10949. var propType = typeof propValue;
  10950. componentName = componentName || messages.anonymousMessage;
  10951. propFullName = propFullName || propName;
  10952. var preValidationRequireCheckValue = preValidationRequireCheck(
  10953. isRequired, componentName, propFullName, propValue
  10954. );
  10955. if (preValidationRequireCheckValue !== independentGuardianValue) {
  10956. return preValidationRequireCheckValue;
  10957. }
  10958. if (typeValidator && !typeValidator(propValue)) {
  10959. return new Error(
  10960. messages.invalidTypeCore + ': `' + propName + '` of type `' + propType + '` ' +
  10961. 'supplied to `' + componentName + '`, expected `' + type + '`.'
  10962. );
  10963. }
  10964. if (!validator(propValue)) {
  10965. return new Error(
  10966. messages.baseInvalidMessage + location + ' `' + propName + '` of type `' + propType + '` ' +
  10967. 'supplied to `' + componentName + '`, expected `' + momentType + '`.'
  10968. );
  10969. }
  10970. if (predicate && !predicate(propValue)) {
  10971. var predicateName = predicate.name || messages.anonymousMessage;
  10972. return new Error(
  10973. messages.baseInvalidMessage + location + ' `' + propName + '` of type `' + propType + '` ' +
  10974. 'supplied to `' + componentName + '`. ' + messages.predicateFailureCore + ' `' +
  10975. predicateName + '`.'
  10976. );
  10977. }
  10978. return null;
  10979. }
  10980. return constructPropValidatorVariations(propValidator);
  10981. }
  10982. module.exports = {
  10983. constructPropValidatorVariations: constructPropValidatorVariations,
  10984. createMomentChecker: createMomentChecker,
  10985. messages: messages,
  10986. };
  10987. /***/ }),
  10988. /***/ 6150:
  10989. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  10990. var moment = __webpack_require__(6292);
  10991. var momentValidationWrapper = __webpack_require__(3416);
  10992. var core = __webpack_require__(9217);
  10993. module.exports = {
  10994. momentObj : core.createMomentChecker(
  10995. 'object',
  10996. function(obj) {
  10997. return typeof obj === 'object';
  10998. },
  10999. function isValid(value) {
  11000. return momentValidationWrapper.isValidMoment(value);
  11001. },
  11002. 'Moment'
  11003. ),
  11004. momentString : core.createMomentChecker(
  11005. 'string',
  11006. function(str) {
  11007. return typeof str === 'string';
  11008. },
  11009. function isValid(value) {
  11010. return momentValidationWrapper.isValidMoment(moment(value));
  11011. },
  11012. 'Moment'
  11013. ),
  11014. momentDurationObj : core.createMomentChecker(
  11015. 'object',
  11016. function(obj) {
  11017. return typeof obj === 'object';
  11018. },
  11019. function isValid(value) {
  11020. return moment.isDuration(value);
  11021. },
  11022. 'Duration'
  11023. ),
  11024. };
  11025. /***/ }),
  11026. /***/ 3416:
  11027. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11028. var moment = __webpack_require__(6292);
  11029. function isValidMoment(testMoment) {
  11030. if (typeof moment.isMoment === 'function' && !moment.isMoment(testMoment)) {
  11031. return false;
  11032. }
  11033. /* istanbul ignore else */
  11034. if (typeof testMoment.isValid === 'function') {
  11035. // moment 1.7.0+
  11036. return testMoment.isValid();
  11037. }
  11038. /* istanbul ignore next */
  11039. return !isNaN(testMoment);
  11040. }
  11041. module.exports = {
  11042. isValidMoment : isValidMoment,
  11043. };
  11044. /***/ }),
  11045. /***/ 2239:
  11046. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  11047. "use strict";
  11048. Object.defineProperty(exports, "__esModule", ({
  11049. value: true
  11050. }));
  11051. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  11052. var _react = __webpack_require__(9196);
  11053. var _react2 = _interopRequireDefault(_react);
  11054. var _propTypes = __webpack_require__(2652);
  11055. var _propTypes2 = _interopRequireDefault(_propTypes);
  11056. var _airbnbPropTypes = __webpack_require__(4882);
  11057. var _consolidatedEvents = __webpack_require__(8495);
  11058. var _object = __webpack_require__(5861);
  11059. var _object2 = _interopRequireDefault(_object);
  11060. var _document = __webpack_require__(6789);
  11061. var _document2 = _interopRequireDefault(_document);
  11062. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  11063. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  11064. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  11065. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  11066. var DISPLAY = {
  11067. BLOCK: 'block',
  11068. FLEX: 'flex',
  11069. INLINE: 'inline',
  11070. INLINE_BLOCK: 'inline-block',
  11071. CONTENTS: 'contents'
  11072. };
  11073. var propTypes = (0, _airbnbPropTypes.forbidExtraProps)({
  11074. children: _propTypes2['default'].node.isRequired,
  11075. onOutsideClick: _propTypes2['default'].func.isRequired,
  11076. disabled: _propTypes2['default'].bool,
  11077. useCapture: _propTypes2['default'].bool,
  11078. display: _propTypes2['default'].oneOf((0, _object2['default'])(DISPLAY))
  11079. });
  11080. var defaultProps = {
  11081. disabled: false,
  11082. // `useCapture` is set to true by default so that a `stopPropagation` in the
  11083. // children will not prevent all outside click handlers from firing - maja
  11084. useCapture: true,
  11085. display: DISPLAY.BLOCK
  11086. };
  11087. var OutsideClickHandler = function (_React$Component) {
  11088. _inherits(OutsideClickHandler, _React$Component);
  11089. function OutsideClickHandler() {
  11090. var _ref;
  11091. _classCallCheck(this, OutsideClickHandler);
  11092. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  11093. args[_key] = arguments[_key];
  11094. }
  11095. var _this = _possibleConstructorReturn(this, (_ref = OutsideClickHandler.__proto__ || Object.getPrototypeOf(OutsideClickHandler)).call.apply(_ref, [this].concat(args)));
  11096. _this.onMouseDown = _this.onMouseDown.bind(_this);
  11097. _this.onMouseUp = _this.onMouseUp.bind(_this);
  11098. _this.setChildNodeRef = _this.setChildNodeRef.bind(_this);
  11099. return _this;
  11100. }
  11101. _createClass(OutsideClickHandler, [{
  11102. key: 'componentDidMount',
  11103. value: function () {
  11104. function componentDidMount() {
  11105. var _props = this.props,
  11106. disabled = _props.disabled,
  11107. useCapture = _props.useCapture;
  11108. if (!disabled) this.addMouseDownEventListener(useCapture);
  11109. }
  11110. return componentDidMount;
  11111. }()
  11112. }, {
  11113. key: 'componentDidUpdate',
  11114. value: function () {
  11115. function componentDidUpdate(_ref2) {
  11116. var prevDisabled = _ref2.disabled;
  11117. var _props2 = this.props,
  11118. disabled = _props2.disabled,
  11119. useCapture = _props2.useCapture;
  11120. if (prevDisabled !== disabled) {
  11121. if (disabled) {
  11122. this.removeEventListeners();
  11123. } else {
  11124. this.addMouseDownEventListener(useCapture);
  11125. }
  11126. }
  11127. }
  11128. return componentDidUpdate;
  11129. }()
  11130. }, {
  11131. key: 'componentWillUnmount',
  11132. value: function () {
  11133. function componentWillUnmount() {
  11134. this.removeEventListeners();
  11135. }
  11136. return componentWillUnmount;
  11137. }()
  11138. // Use mousedown/mouseup to enforce that clicks remain outside the root's
  11139. // descendant tree, even when dragged. This should also get triggered on
  11140. // touch devices.
  11141. }, {
  11142. key: 'onMouseDown',
  11143. value: function () {
  11144. function onMouseDown(e) {
  11145. var useCapture = this.props.useCapture;
  11146. var isDescendantOfRoot = this.childNode && (0, _document2['default'])(this.childNode, e.target);
  11147. if (!isDescendantOfRoot) {
  11148. if (this.removeMouseUp) {
  11149. this.removeMouseUp();
  11150. this.removeMouseUp = null;
  11151. }
  11152. this.removeMouseUp = (0, _consolidatedEvents.addEventListener)(document, 'mouseup', this.onMouseUp, { capture: useCapture });
  11153. }
  11154. }
  11155. return onMouseDown;
  11156. }()
  11157. // Use mousedown/mouseup to enforce that clicks remain outside the root's
  11158. // descendant tree, even when dragged. This should also get triggered on
  11159. // touch devices.
  11160. }, {
  11161. key: 'onMouseUp',
  11162. value: function () {
  11163. function onMouseUp(e) {
  11164. var onOutsideClick = this.props.onOutsideClick;
  11165. var isDescendantOfRoot = this.childNode && (0, _document2['default'])(this.childNode, e.target);
  11166. if (this.removeMouseUp) {
  11167. this.removeMouseUp();
  11168. this.removeMouseUp = null;
  11169. }
  11170. if (!isDescendantOfRoot) {
  11171. onOutsideClick(e);
  11172. }
  11173. }
  11174. return onMouseUp;
  11175. }()
  11176. }, {
  11177. key: 'setChildNodeRef',
  11178. value: function () {
  11179. function setChildNodeRef(ref) {
  11180. this.childNode = ref;
  11181. }
  11182. return setChildNodeRef;
  11183. }()
  11184. }, {
  11185. key: 'addMouseDownEventListener',
  11186. value: function () {
  11187. function addMouseDownEventListener(useCapture) {
  11188. this.removeMouseDown = (0, _consolidatedEvents.addEventListener)(document, 'mousedown', this.onMouseDown, { capture: useCapture });
  11189. }
  11190. return addMouseDownEventListener;
  11191. }()
  11192. }, {
  11193. key: 'removeEventListeners',
  11194. value: function () {
  11195. function removeEventListeners() {
  11196. if (this.removeMouseDown) this.removeMouseDown();
  11197. if (this.removeMouseUp) this.removeMouseUp();
  11198. }
  11199. return removeEventListeners;
  11200. }()
  11201. }, {
  11202. key: 'render',
  11203. value: function () {
  11204. function render() {
  11205. var _props3 = this.props,
  11206. children = _props3.children,
  11207. display = _props3.display;
  11208. return _react2['default'].createElement(
  11209. 'div',
  11210. {
  11211. ref: this.setChildNodeRef,
  11212. style: display !== DISPLAY.BLOCK && (0, _object2['default'])(DISPLAY).includes(display) ? { display: display } : undefined
  11213. },
  11214. children
  11215. );
  11216. }
  11217. return render;
  11218. }()
  11219. }]);
  11220. return OutsideClickHandler;
  11221. }(_react2['default'].Component);
  11222. exports["default"] = OutsideClickHandler;
  11223. OutsideClickHandler.propTypes = propTypes;
  11224. OutsideClickHandler.defaultProps = defaultProps;
  11225. /***/ }),
  11226. /***/ 6606:
  11227. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11228. // eslint-disable-next-line import/no-unresolved
  11229. module.exports = __webpack_require__(2239);
  11230. /***/ }),
  11231. /***/ 235:
  11232. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11233. var e=__webpack_require__(9196),n={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},t=function(t){var r=t.onResize,u=e.useRef();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function u(){t();var e=r();e&&e.addEventListener("resize",t)}e.useEffect((function(){return r()?u():n.current&&n.current.addEventListener&&n.current.addEventListener("load",u),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(u,(function(){return r(u)})),e.createElement("iframe",{style:n,src:"about:blank",ref:u,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},r=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};module.exports=function(n){void 0===n&&(n=r);var u=e.useState(n(null)),o=u[0],i=u[1],c=e.useCallback((function(e){return i(n(e.current))}),[n]);return[e.useMemo((function(){return e.createElement(t,{onResize:c})}),[c]),o]};
  11234. /***/ }),
  11235. /***/ 5080:
  11236. /***/ (function(__unused_webpack_module, exports) {
  11237. "use strict";
  11238. Object.defineProperty(exports, "__esModule", ({
  11239. value: true
  11240. }));
  11241. var CHANNEL = exports.CHANNEL = '__direction__';
  11242. var DIRECTIONS = exports.DIRECTIONS = {
  11243. LTR: 'ltr',
  11244. RTL: 'rtl'
  11245. };
  11246. /***/ }),
  11247. /***/ 6640:
  11248. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  11249. "use strict";
  11250. Object.defineProperty(exports, "__esModule", ({
  11251. value: true
  11252. }));
  11253. var _propTypes = __webpack_require__(2652);
  11254. var _propTypes2 = _interopRequireDefault(_propTypes);
  11255. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  11256. exports["default"] = _propTypes2['default'].shape({
  11257. getState: _propTypes2['default'].func,
  11258. setState: _propTypes2['default'].func,
  11259. subscribe: _propTypes2['default'].func
  11260. });
  11261. /***/ }),
  11262. /***/ 3688:
  11263. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  11264. var __webpack_unused_export__;
  11265. __webpack_unused_export__ = ({
  11266. value: true
  11267. });
  11268. var _arrayPrototype = __webpack_require__(116);
  11269. var _arrayPrototype2 = _interopRequireDefault(_arrayPrototype);
  11270. var _globalCache = __webpack_require__(5371);
  11271. var _globalCache2 = _interopRequireDefault(_globalCache);
  11272. var _constants = __webpack_require__(6930);
  11273. var _getClassName = __webpack_require__(1689);
  11274. var _getClassName2 = _interopRequireDefault(_getClassName);
  11275. var _separateStyles2 = __webpack_require__(1881);
  11276. var _separateStyles3 = _interopRequireDefault(_separateStyles2);
  11277. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  11278. /**
  11279. * Function required as part of the react-with-styles interface. Parses the styles provided by
  11280. * react-with-styles to produce class names based on the style name and optionally the namespace if
  11281. * available.
  11282. *
  11283. * stylesObject {Object} The styles object passed to withStyles.
  11284. *
  11285. * Return an object mapping style names to class names.
  11286. */
  11287. function create(stylesObject) {
  11288. var stylesToClasses = {};
  11289. var styleNames = Object.keys(stylesObject);
  11290. var sharedState = _globalCache2['default'].get(_constants.GLOBAL_CACHE_KEY) || {};
  11291. var _sharedState$namespac = sharedState.namespace,
  11292. namespace = _sharedState$namespac === undefined ? '' : _sharedState$namespac;
  11293. styleNames.forEach(function (styleName) {
  11294. var className = (0, _getClassName2['default'])(namespace, styleName);
  11295. stylesToClasses[styleName] = className;
  11296. });
  11297. return stylesToClasses;
  11298. }
  11299. /**
  11300. * Process styles to be consumed by a component.
  11301. *
  11302. * stylesArray {Array} Array of the following: values returned by create, plain JavaScript objects
  11303. * representing inline styles, or arrays thereof.
  11304. *
  11305. * Return an object with optional className and style properties to be spread on a component.
  11306. */
  11307. function resolve(stylesArray) {
  11308. var flattenedStyles = (0, _arrayPrototype2['default'])(stylesArray, Infinity);
  11309. var _separateStyles = (0, _separateStyles3['default'])(flattenedStyles),
  11310. classNames = _separateStyles.classNames,
  11311. hasInlineStyles = _separateStyles.hasInlineStyles,
  11312. inlineStyles = _separateStyles.inlineStyles;
  11313. var specificClassNames = classNames.map(function (name, index) {
  11314. return String(name) + ' ' + String(name) + '_' + String(index + 1);
  11315. });
  11316. var className = specificClassNames.join(' ');
  11317. var result = { className: className };
  11318. if (hasInlineStyles) result.style = inlineStyles;
  11319. return result;
  11320. }
  11321. exports["default"] = { create: create, resolve: resolve };
  11322. /***/ }),
  11323. /***/ 6930:
  11324. /***/ (function(__unused_webpack_module, exports) {
  11325. Object.defineProperty(exports, "__esModule", ({
  11326. value: true
  11327. }));
  11328. var GLOBAL_CACHE_KEY = 'reactWithStylesInterfaceCSS';
  11329. var MAX_SPECIFICITY = 20;
  11330. exports.GLOBAL_CACHE_KEY = GLOBAL_CACHE_KEY;
  11331. exports.MAX_SPECIFICITY = MAX_SPECIFICITY;
  11332. /***/ }),
  11333. /***/ 1689:
  11334. /***/ (function(__unused_webpack_module, exports) {
  11335. Object.defineProperty(exports, "__esModule", ({
  11336. value: true
  11337. }));
  11338. exports["default"] = getClassName;
  11339. /**
  11340. * Construct a class name.
  11341. *
  11342. * namespace {String} Used to construct unique class names.
  11343. * styleName {String} Name identifying the specific style.
  11344. *
  11345. * Return the class name.
  11346. */
  11347. function getClassName(namespace, styleName) {
  11348. var namespaceSegment = namespace.length > 0 ? String(namespace) + '__' : '';
  11349. return '' + namespaceSegment + String(styleName);
  11350. }
  11351. /***/ }),
  11352. /***/ 1881:
  11353. /***/ (function(__unused_webpack_module, exports) {
  11354. Object.defineProperty(exports, "__esModule", ({
  11355. value: true
  11356. }));
  11357. // This function takes an array of styles and separates them into styles that
  11358. // are handled by Aphrodite and inline styles.
  11359. function separateStyles(stylesArray) {
  11360. var classNames = [];
  11361. // Since determining if an Object is empty requires collecting all of its
  11362. // keys, and we want the best performance in this code because we are in the
  11363. // render path, we are going to do a little bookkeeping ourselves.
  11364. var hasInlineStyles = false;
  11365. var inlineStyles = {};
  11366. // This is run on potentially every node in the tree when rendering, where
  11367. // performance is critical. Normally we would prefer using `forEach`, but
  11368. // old-fashioned for loops are faster so that's what we have chosen here.
  11369. for (var i = 0; i < stylesArray.length; i++) {
  11370. // eslint-disable-line no-plusplus
  11371. var style = stylesArray[i];
  11372. // If this style is falsy, we just want to disregard it. This allows for
  11373. // syntax like:
  11374. //
  11375. // css(isFoo && styles.foo)
  11376. if (style) {
  11377. if (typeof style === 'string') {
  11378. classNames.push(style);
  11379. } else {
  11380. Object.assign(inlineStyles, style);
  11381. hasInlineStyles = true;
  11382. }
  11383. }
  11384. }
  11385. return {
  11386. classNames: classNames,
  11387. hasInlineStyles: hasInlineStyles,
  11388. inlineStyles: inlineStyles
  11389. };
  11390. }
  11391. exports["default"] = separateStyles;
  11392. /***/ }),
  11393. /***/ 5553:
  11394. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11395. // eslint-disable-next-line import/no-unresolved
  11396. module.exports = __webpack_require__(3688)["default"];
  11397. /***/ }),
  11398. /***/ 9349:
  11399. /***/ (function(__unused_webpack_module, exports) {
  11400. "use strict";
  11401. Object.defineProperty(exports, "__esModule", ({
  11402. value: true
  11403. }));
  11404. var styleInterface = void 0;
  11405. var styleTheme = void 0;
  11406. var START_MARK = 'react-with-styles.resolve.start';
  11407. var END_MARK = 'react-with-styles.resolve.end';
  11408. var MEASURE_MARK = '\uD83D\uDC69\u200D\uD83C\uDFA8 [resolve]';
  11409. function registerTheme(theme) {
  11410. styleTheme = theme;
  11411. }
  11412. function registerInterface(interfaceToRegister) {
  11413. styleInterface = interfaceToRegister;
  11414. }
  11415. function create(makeFromTheme, createWithDirection) {
  11416. var styles = createWithDirection(makeFromTheme(styleTheme));
  11417. return function () {
  11418. return styles;
  11419. };
  11420. }
  11421. function createLTR(makeFromTheme) {
  11422. return create(makeFromTheme, styleInterface.createLTR || styleInterface.create);
  11423. }
  11424. function createRTL(makeFromTheme) {
  11425. return create(makeFromTheme, styleInterface.createRTL || styleInterface.create);
  11426. }
  11427. function get() {
  11428. return styleTheme;
  11429. }
  11430. function resolve() {
  11431. if (false) {}
  11432. for (var _len = arguments.length, styles = Array(_len), _key = 0; _key < _len; _key++) {
  11433. styles[_key] = arguments[_key];
  11434. }
  11435. var result = styleInterface.resolve(styles);
  11436. if (false) {}
  11437. return result;
  11438. }
  11439. function resolveLTR() {
  11440. for (var _len2 = arguments.length, styles = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  11441. styles[_key2] = arguments[_key2];
  11442. }
  11443. if (styleInterface.resolveLTR) {
  11444. return styleInterface.resolveLTR(styles);
  11445. }
  11446. return resolve(styles);
  11447. }
  11448. function resolveRTL() {
  11449. for (var _len3 = arguments.length, styles = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  11450. styles[_key3] = arguments[_key3];
  11451. }
  11452. if (styleInterface.resolveRTL) {
  11453. return styleInterface.resolveRTL(styles);
  11454. }
  11455. return resolve(styles);
  11456. }
  11457. function flush() {
  11458. if (styleInterface.flush) {
  11459. styleInterface.flush();
  11460. }
  11461. }
  11462. exports["default"] = {
  11463. registerTheme: registerTheme,
  11464. registerInterface: registerInterface,
  11465. create: createLTR,
  11466. createLTR: createLTR,
  11467. createRTL: createRTL,
  11468. get: get,
  11469. resolve: resolveLTR,
  11470. resolveLTR: resolveLTR,
  11471. resolveRTL: resolveRTL,
  11472. flush: flush
  11473. };
  11474. /***/ }),
  11475. /***/ 3576:
  11476. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  11477. "use strict";
  11478. Object.defineProperty(exports, "__esModule", ({
  11479. value: true
  11480. }));
  11481. exports.withStylesPropTypes = exports.css = undefined;
  11482. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  11483. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  11484. exports.withStyles = withStyles;
  11485. var _object = __webpack_require__(4011);
  11486. var _object2 = _interopRequireDefault(_object);
  11487. var _react = __webpack_require__(9196);
  11488. var _react2 = _interopRequireDefault(_react);
  11489. var _propTypes = __webpack_require__(2652);
  11490. var _propTypes2 = _interopRequireDefault(_propTypes);
  11491. var _hoistNonReactStatics = __webpack_require__(1281);
  11492. var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
  11493. var _constants = __webpack_require__(5080);
  11494. var _brcast = __webpack_require__(6640);
  11495. var _brcast2 = _interopRequireDefault(_brcast);
  11496. var _ThemedStyleSheet = __webpack_require__(9349);
  11497. var _ThemedStyleSheet2 = _interopRequireDefault(_ThemedStyleSheet);
  11498. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  11499. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  11500. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  11501. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  11502. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* eslint react/forbid-foreign-prop-types: off */
  11503. // Add some named exports to assist in upgrading and for convenience
  11504. var css = exports.css = _ThemedStyleSheet2['default'].resolveLTR;
  11505. var withStylesPropTypes = exports.withStylesPropTypes = {
  11506. styles: _propTypes2['default'].object.isRequired, // eslint-disable-line react/forbid-prop-types
  11507. theme: _propTypes2['default'].object.isRequired, // eslint-disable-line react/forbid-prop-types
  11508. css: _propTypes2['default'].func.isRequired
  11509. };
  11510. var EMPTY_STYLES = {};
  11511. var EMPTY_STYLES_FN = function EMPTY_STYLES_FN() {
  11512. return EMPTY_STYLES;
  11513. };
  11514. var START_MARK = 'react-with-styles.createStyles.start';
  11515. var END_MARK = 'react-with-styles.createStyles.end';
  11516. function baseClass(pureComponent) {
  11517. if (pureComponent) {
  11518. if (!_react2['default'].PureComponent) {
  11519. throw new ReferenceError('withStyles() pureComponent option requires React 15.3.0 or later');
  11520. }
  11521. return _react2['default'].PureComponent;
  11522. }
  11523. return _react2['default'].Component;
  11524. }
  11525. var contextTypes = _defineProperty({}, _constants.CHANNEL, _brcast2['default']);
  11526. var defaultDirection = _constants.DIRECTIONS.LTR;
  11527. function withStyles(styleFn) {
  11528. var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  11529. _ref$stylesPropName = _ref.stylesPropName,
  11530. stylesPropName = _ref$stylesPropName === undefined ? 'styles' : _ref$stylesPropName,
  11531. _ref$themePropName = _ref.themePropName,
  11532. themePropName = _ref$themePropName === undefined ? 'theme' : _ref$themePropName,
  11533. _ref$cssPropName = _ref.cssPropName,
  11534. cssPropName = _ref$cssPropName === undefined ? 'css' : _ref$cssPropName,
  11535. _ref$flushBefore = _ref.flushBefore,
  11536. flushBefore = _ref$flushBefore === undefined ? false : _ref$flushBefore,
  11537. _ref$pureComponent = _ref.pureComponent,
  11538. pureComponent = _ref$pureComponent === undefined ? false : _ref$pureComponent;
  11539. var styleDefLTR = void 0;
  11540. var styleDefRTL = void 0;
  11541. var currentThemeLTR = void 0;
  11542. var currentThemeRTL = void 0;
  11543. var BaseClass = baseClass(pureComponent);
  11544. function getResolveMethod(direction) {
  11545. return direction === _constants.DIRECTIONS.LTR ? _ThemedStyleSheet2['default'].resolveLTR : _ThemedStyleSheet2['default'].resolveRTL;
  11546. }
  11547. function getCurrentTheme(direction) {
  11548. return direction === _constants.DIRECTIONS.LTR ? currentThemeLTR : currentThemeRTL;
  11549. }
  11550. function getStyleDef(direction, wrappedComponentName) {
  11551. var currentTheme = getCurrentTheme(direction);
  11552. var styleDef = direction === _constants.DIRECTIONS.LTR ? styleDefLTR : styleDefRTL;
  11553. var registeredTheme = _ThemedStyleSheet2['default'].get();
  11554. // Return the existing styles if they've already been defined
  11555. // and if the theme used to create them corresponds to the theme
  11556. // registered with ThemedStyleSheet
  11557. if (styleDef && currentTheme === registeredTheme) {
  11558. return styleDef;
  11559. }
  11560. if (false) {}
  11561. var isRTL = direction === _constants.DIRECTIONS.RTL;
  11562. if (isRTL) {
  11563. styleDefRTL = styleFn ? _ThemedStyleSheet2['default'].createRTL(styleFn) : EMPTY_STYLES_FN;
  11564. currentThemeRTL = registeredTheme;
  11565. styleDef = styleDefRTL;
  11566. } else {
  11567. styleDefLTR = styleFn ? _ThemedStyleSheet2['default'].createLTR(styleFn) : EMPTY_STYLES_FN;
  11568. currentThemeLTR = registeredTheme;
  11569. styleDef = styleDefLTR;
  11570. }
  11571. if (false) { var measureName; }
  11572. return styleDef;
  11573. }
  11574. function getState(direction, wrappedComponentName) {
  11575. return {
  11576. resolveMethod: getResolveMethod(direction),
  11577. styleDef: getStyleDef(direction, wrappedComponentName)
  11578. };
  11579. }
  11580. return function () {
  11581. function withStylesHOC(WrappedComponent) {
  11582. var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
  11583. // NOTE: Use a class here so components are ref-able if need be:
  11584. // eslint-disable-next-line react/prefer-stateless-function
  11585. var WithStyles = function (_BaseClass) {
  11586. _inherits(WithStyles, _BaseClass);
  11587. function WithStyles(props, context) {
  11588. _classCallCheck(this, WithStyles);
  11589. var _this = _possibleConstructorReturn(this, (WithStyles.__proto__ || Object.getPrototypeOf(WithStyles)).call(this, props, context));
  11590. var direction = _this.context[_constants.CHANNEL] ? _this.context[_constants.CHANNEL].getState() : defaultDirection;
  11591. _this.state = getState(direction, wrappedComponentName);
  11592. return _this;
  11593. }
  11594. _createClass(WithStyles, [{
  11595. key: 'componentDidMount',
  11596. value: function () {
  11597. function componentDidMount() {
  11598. var _this2 = this;
  11599. if (this.context[_constants.CHANNEL]) {
  11600. // subscribe to future direction changes
  11601. this.channelUnsubscribe = this.context[_constants.CHANNEL].subscribe(function (direction) {
  11602. _this2.setState(getState(direction, wrappedComponentName));
  11603. });
  11604. }
  11605. }
  11606. return componentDidMount;
  11607. }()
  11608. }, {
  11609. key: 'componentWillUnmount',
  11610. value: function () {
  11611. function componentWillUnmount() {
  11612. if (this.channelUnsubscribe) {
  11613. this.channelUnsubscribe();
  11614. }
  11615. }
  11616. return componentWillUnmount;
  11617. }()
  11618. }, {
  11619. key: 'render',
  11620. value: function () {
  11621. function render() {
  11622. var _ref2;
  11623. // As some components will depend on previous styles in
  11624. // the component tree, we provide the option of flushing the
  11625. // buffered styles (i.e. to a style tag) **before** the rendering
  11626. // cycle begins.
  11627. //
  11628. // The interfaces provide the optional "flush" method which
  11629. // is run in turn by ThemedStyleSheet.flush.
  11630. if (flushBefore) {
  11631. _ThemedStyleSheet2['default'].flush();
  11632. }
  11633. var _state = this.state,
  11634. resolveMethod = _state.resolveMethod,
  11635. styleDef = _state.styleDef;
  11636. return _react2['default'].createElement(WrappedComponent, _extends({}, this.props, (_ref2 = {}, _defineProperty(_ref2, themePropName, _ThemedStyleSheet2['default'].get()), _defineProperty(_ref2, stylesPropName, styleDef()), _defineProperty(_ref2, cssPropName, resolveMethod), _ref2)));
  11637. }
  11638. return render;
  11639. }()
  11640. }]);
  11641. return WithStyles;
  11642. }(BaseClass);
  11643. WithStyles.WrappedComponent = WrappedComponent;
  11644. WithStyles.displayName = 'withStyles(' + String(wrappedComponentName) + ')';
  11645. WithStyles.contextTypes = contextTypes;
  11646. if (WrappedComponent.propTypes) {
  11647. WithStyles.propTypes = (0, _object2['default'])({}, WrappedComponent.propTypes);
  11648. delete WithStyles.propTypes[stylesPropName];
  11649. delete WithStyles.propTypes[themePropName];
  11650. delete WithStyles.propTypes[cssPropName];
  11651. }
  11652. if (WrappedComponent.defaultProps) {
  11653. WithStyles.defaultProps = (0, _object2['default'])({}, WrappedComponent.defaultProps);
  11654. }
  11655. return (0, _hoistNonReactStatics2['default'])(WithStyles, WrappedComponent);
  11656. }
  11657. return withStylesHOC;
  11658. }();
  11659. }
  11660. /***/ }),
  11661. /***/ 9196:
  11662. /***/ (function(module) {
  11663. "use strict";
  11664. module.exports = window["React"];
  11665. /***/ }),
  11666. /***/ 6292:
  11667. /***/ (function(module) {
  11668. "use strict";
  11669. module.exports = window["moment"];
  11670. /***/ }),
  11671. /***/ 4080:
  11672. /***/ (function() {
  11673. /* (ignored) */
  11674. /***/ }),
  11675. /***/ 3665:
  11676. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11677. "use strict";
  11678. var GetIntrinsic = __webpack_require__(4219);
  11679. var $ArrayPrototype = GetIntrinsic('%Array.prototype%');
  11680. var $RangeError = GetIntrinsic('%RangeError%');
  11681. var $SyntaxError = GetIntrinsic('%SyntaxError%');
  11682. var $TypeError = GetIntrinsic('%TypeError%');
  11683. var IsIntegralNumber = __webpack_require__(485);
  11684. var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1;
  11685. var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || (
  11686. // eslint-disable-next-line no-proto, no-negated-condition
  11687. [].__proto__ !== $ArrayPrototype
  11688. ? null
  11689. : function (O, proto) {
  11690. O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign
  11691. return O;
  11692. }
  11693. );
  11694. // https://www.ecma-international.org/ecma-262/12.0/#sec-arraycreate
  11695. module.exports = function ArrayCreate(length) {
  11696. if (!IsIntegralNumber(length) || length < 0) {
  11697. throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0');
  11698. }
  11699. if (length > MAX_ARRAY_LENGTH) {
  11700. throw new $RangeError('length is greater than (2**32 - 1)');
  11701. }
  11702. var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype;
  11703. var A = []; // steps 3, 5
  11704. if (proto !== $ArrayPrototype) { // step 4
  11705. if (!$setProto) {
  11706. throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]');
  11707. }
  11708. $setProto(A, proto);
  11709. }
  11710. if (length !== 0) { // bypasses the need for step 6
  11711. A.length = length;
  11712. }
  11713. /* step 6, the above as a shortcut for the below
  11714. OrdinaryDefineOwnProperty(A, 'length', {
  11715. '[[Configurable]]': false,
  11716. '[[Enumerable]]': false,
  11717. '[[Value]]': length,
  11718. '[[Writable]]': true
  11719. });
  11720. */
  11721. return A;
  11722. };
  11723. /***/ }),
  11724. /***/ 1539:
  11725. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11726. "use strict";
  11727. var GetIntrinsic = __webpack_require__(4219);
  11728. var $species = GetIntrinsic('%Symbol.species%', true);
  11729. var $TypeError = GetIntrinsic('%TypeError%');
  11730. var ArrayCreate = __webpack_require__(3665);
  11731. var Get = __webpack_require__(6448);
  11732. var IsArray = __webpack_require__(5971);
  11733. var IsConstructor = __webpack_require__(4065);
  11734. var IsIntegralNumber = __webpack_require__(485);
  11735. var Type = __webpack_require__(9747);
  11736. // https://ecma-international.org/ecma-262/12.0/#sec-arrayspeciescreate
  11737. module.exports = function ArraySpeciesCreate(originalArray, length) {
  11738. if (!IsIntegralNumber(length) || length < 0) {
  11739. throw new $TypeError('Assertion failed: length must be an integer >= 0');
  11740. }
  11741. var isArray = IsArray(originalArray);
  11742. if (!isArray) {
  11743. return ArrayCreate(length);
  11744. }
  11745. var C = Get(originalArray, 'constructor');
  11746. // TODO: figure out how to make a cross-realm normal Array, a same-realm Array
  11747. // if (IsConstructor(C)) {
  11748. // if C is another realm's Array, C = undefined
  11749. // Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ?
  11750. // }
  11751. if ($species && Type(C) === 'Object') {
  11752. C = Get(C, $species);
  11753. if (C === null) {
  11754. C = void 0;
  11755. }
  11756. }
  11757. if (typeof C === 'undefined') {
  11758. return ArrayCreate(length);
  11759. }
  11760. if (!IsConstructor(C)) {
  11761. throw new $TypeError('C must be a constructor');
  11762. }
  11763. return new C(length); // Construct(C, length);
  11764. };
  11765. /***/ }),
  11766. /***/ 8323:
  11767. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11768. "use strict";
  11769. var GetIntrinsic = __webpack_require__(4219);
  11770. var callBound = __webpack_require__(9630);
  11771. var $TypeError = GetIntrinsic('%TypeError%');
  11772. var IsArray = __webpack_require__(5971);
  11773. var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%');
  11774. // https://ecma-international.org/ecma-262/6.0/#sec-call
  11775. module.exports = function Call(F, V) {
  11776. var argumentsList = arguments.length > 2 ? arguments[2] : [];
  11777. if (!IsArray(argumentsList)) {
  11778. throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List');
  11779. }
  11780. return $apply(F, V, argumentsList);
  11781. };
  11782. /***/ }),
  11783. /***/ 5597:
  11784. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11785. "use strict";
  11786. var GetIntrinsic = __webpack_require__(4219);
  11787. var $TypeError = GetIntrinsic('%TypeError%');
  11788. var DefineOwnProperty = __webpack_require__(1327);
  11789. var FromPropertyDescriptor = __webpack_require__(8487);
  11790. var OrdinaryGetOwnProperty = __webpack_require__(6403);
  11791. var IsDataDescriptor = __webpack_require__(1392);
  11792. var IsExtensible = __webpack_require__(3428);
  11793. var IsPropertyKey = __webpack_require__(3290);
  11794. var SameValue = __webpack_require__(9836);
  11795. var Type = __webpack_require__(9747);
  11796. // https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty
  11797. module.exports = function CreateDataProperty(O, P, V) {
  11798. if (Type(O) !== 'Object') {
  11799. throw new $TypeError('Assertion failed: Type(O) is not Object');
  11800. }
  11801. if (!IsPropertyKey(P)) {
  11802. throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
  11803. }
  11804. var oldDesc = OrdinaryGetOwnProperty(O, P);
  11805. var extensible = !oldDesc || IsExtensible(O);
  11806. var nonConfigurable = oldDesc && !oldDesc['[[Configurable]]'];
  11807. if (nonConfigurable || !extensible) {
  11808. return false;
  11809. }
  11810. return DefineOwnProperty(
  11811. IsDataDescriptor,
  11812. SameValue,
  11813. FromPropertyDescriptor,
  11814. O,
  11815. P,
  11816. {
  11817. '[[Configurable]]': true,
  11818. '[[Enumerable]]': true,
  11819. '[[Value]]': V,
  11820. '[[Writable]]': true
  11821. }
  11822. );
  11823. };
  11824. /***/ }),
  11825. /***/ 3323:
  11826. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11827. "use strict";
  11828. var GetIntrinsic = __webpack_require__(4219);
  11829. var $TypeError = GetIntrinsic('%TypeError%');
  11830. var CreateDataProperty = __webpack_require__(5597);
  11831. var IsPropertyKey = __webpack_require__(3290);
  11832. var Type = __webpack_require__(9747);
  11833. // // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow
  11834. module.exports = function CreateDataPropertyOrThrow(O, P, V) {
  11835. if (Type(O) !== 'Object') {
  11836. throw new $TypeError('Assertion failed: Type(O) is not Object');
  11837. }
  11838. if (!IsPropertyKey(P)) {
  11839. throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
  11840. }
  11841. var success = CreateDataProperty(O, P, V);
  11842. if (!success) {
  11843. throw new $TypeError('unable to create data property');
  11844. }
  11845. return success;
  11846. };
  11847. /***/ }),
  11848. /***/ 6356:
  11849. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11850. "use strict";
  11851. var GetIntrinsic = __webpack_require__(4219);
  11852. var $TypeError = GetIntrinsic('%TypeError%');
  11853. var isPropertyDescriptor = __webpack_require__(8682);
  11854. var DefineOwnProperty = __webpack_require__(1327);
  11855. var FromPropertyDescriptor = __webpack_require__(8487);
  11856. var IsAccessorDescriptor = __webpack_require__(7857);
  11857. var IsDataDescriptor = __webpack_require__(1392);
  11858. var IsPropertyKey = __webpack_require__(3290);
  11859. var SameValue = __webpack_require__(9836);
  11860. var ToPropertyDescriptor = __webpack_require__(2402);
  11861. var Type = __webpack_require__(9747);
  11862. // https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow
  11863. module.exports = function DefinePropertyOrThrow(O, P, desc) {
  11864. if (Type(O) !== 'Object') {
  11865. throw new $TypeError('Assertion failed: Type(O) is not Object');
  11866. }
  11867. if (!IsPropertyKey(P)) {
  11868. throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
  11869. }
  11870. var Desc = isPropertyDescriptor({
  11871. Type: Type,
  11872. IsDataDescriptor: IsDataDescriptor,
  11873. IsAccessorDescriptor: IsAccessorDescriptor
  11874. }, desc) ? desc : ToPropertyDescriptor(desc);
  11875. if (!isPropertyDescriptor({
  11876. Type: Type,
  11877. IsDataDescriptor: IsDataDescriptor,
  11878. IsAccessorDescriptor: IsAccessorDescriptor
  11879. }, Desc)) {
  11880. throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor');
  11881. }
  11882. return DefineOwnProperty(
  11883. IsDataDescriptor,
  11884. SameValue,
  11885. FromPropertyDescriptor,
  11886. O,
  11887. P,
  11888. Desc
  11889. );
  11890. };
  11891. /***/ }),
  11892. /***/ 6739:
  11893. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11894. "use strict";
  11895. var GetIntrinsic = __webpack_require__(4219);
  11896. var $TypeError = GetIntrinsic('%TypeError%');
  11897. var MAX_SAFE_INTEGER = __webpack_require__(8540);
  11898. var Call = __webpack_require__(8323);
  11899. var CreateDataPropertyOrThrow = __webpack_require__(3323);
  11900. var Get = __webpack_require__(6448);
  11901. var HasProperty = __webpack_require__(3059);
  11902. var IsArray = __webpack_require__(5971);
  11903. var LengthOfArrayLike = __webpack_require__(2151);
  11904. var ToString = __webpack_require__(6888);
  11905. // https://262.ecma-international.org/11.0/#sec-flattenintoarray
  11906. // eslint-disable-next-line max-params
  11907. module.exports = function FlattenIntoArray(target, source, sourceLen, start, depth) {
  11908. var mapperFunction;
  11909. if (arguments.length > 5) {
  11910. mapperFunction = arguments[5];
  11911. }
  11912. var targetIndex = start;
  11913. var sourceIndex = 0;
  11914. while (sourceIndex < sourceLen) {
  11915. var P = ToString(sourceIndex);
  11916. var exists = HasProperty(source, P);
  11917. if (exists === true) {
  11918. var element = Get(source, P);
  11919. if (typeof mapperFunction !== 'undefined') {
  11920. if (arguments.length <= 6) {
  11921. throw new $TypeError('Assertion failed: thisArg is required when mapperFunction is provided');
  11922. }
  11923. element = Call(mapperFunction, arguments[6], [element, sourceIndex, source]);
  11924. }
  11925. var shouldFlatten = false;
  11926. if (depth > 0) {
  11927. shouldFlatten = IsArray(element);
  11928. }
  11929. if (shouldFlatten) {
  11930. var elementLen = LengthOfArrayLike(element);
  11931. targetIndex = FlattenIntoArray(target, element, elementLen, targetIndex, depth - 1);
  11932. } else {
  11933. if (targetIndex >= MAX_SAFE_INTEGER) {
  11934. throw new $TypeError('index too large');
  11935. }
  11936. CreateDataPropertyOrThrow(target, ToString(targetIndex), element);
  11937. targetIndex += 1;
  11938. }
  11939. }
  11940. sourceIndex += 1;
  11941. }
  11942. return targetIndex;
  11943. };
  11944. /***/ }),
  11945. /***/ 8487:
  11946. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11947. "use strict";
  11948. var assertRecord = __webpack_require__(5114);
  11949. var fromPropertyDescriptor = __webpack_require__(3359);
  11950. var Type = __webpack_require__(9747);
  11951. // https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor
  11952. module.exports = function FromPropertyDescriptor(Desc) {
  11953. if (typeof Desc !== 'undefined') {
  11954. assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
  11955. }
  11956. return fromPropertyDescriptor(Desc);
  11957. };
  11958. /***/ }),
  11959. /***/ 6448:
  11960. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11961. "use strict";
  11962. var GetIntrinsic = __webpack_require__(4219);
  11963. var $TypeError = GetIntrinsic('%TypeError%');
  11964. var inspect = __webpack_require__(3205);
  11965. var IsPropertyKey = __webpack_require__(3290);
  11966. var Type = __webpack_require__(9747);
  11967. // https://ecma-international.org/ecma-262/6.0/#sec-get-o-p
  11968. module.exports = function Get(O, P) {
  11969. // 7.3.1.1
  11970. if (Type(O) !== 'Object') {
  11971. throw new $TypeError('Assertion failed: Type(O) is not Object');
  11972. }
  11973. // 7.3.1.2
  11974. if (!IsPropertyKey(P)) {
  11975. throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P));
  11976. }
  11977. // 7.3.1.3
  11978. return O[P];
  11979. };
  11980. /***/ }),
  11981. /***/ 3059:
  11982. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  11983. "use strict";
  11984. var GetIntrinsic = __webpack_require__(4219);
  11985. var $TypeError = GetIntrinsic('%TypeError%');
  11986. var IsPropertyKey = __webpack_require__(3290);
  11987. var Type = __webpack_require__(9747);
  11988. // https://ecma-international.org/ecma-262/6.0/#sec-hasproperty
  11989. module.exports = function HasProperty(O, P) {
  11990. if (Type(O) !== 'Object') {
  11991. throw new $TypeError('Assertion failed: `O` must be an Object');
  11992. }
  11993. if (!IsPropertyKey(P)) {
  11994. throw new $TypeError('Assertion failed: `P` must be a Property Key');
  11995. }
  11996. return P in O;
  11997. };
  11998. /***/ }),
  11999. /***/ 7857:
  12000. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12001. "use strict";
  12002. var has = __webpack_require__(9284);
  12003. var assertRecord = __webpack_require__(5114);
  12004. var Type = __webpack_require__(9747);
  12005. // https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor
  12006. module.exports = function IsAccessorDescriptor(Desc) {
  12007. if (typeof Desc === 'undefined') {
  12008. return false;
  12009. }
  12010. assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
  12011. if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) {
  12012. return false;
  12013. }
  12014. return true;
  12015. };
  12016. /***/ }),
  12017. /***/ 5971:
  12018. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12019. "use strict";
  12020. // https://ecma-international.org/ecma-262/6.0/#sec-isarray
  12021. module.exports = __webpack_require__(4351);
  12022. /***/ }),
  12023. /***/ 1089:
  12024. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12025. "use strict";
  12026. // http://262.ecma-international.org/5.1/#sec-9.11
  12027. module.exports = __webpack_require__(4363);
  12028. /***/ }),
  12029. /***/ 4065:
  12030. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12031. "use strict";
  12032. var GetIntrinsic = __webpack_require__(137);
  12033. var $construct = GetIntrinsic('%Reflect.construct%', true);
  12034. var DefinePropertyOrThrow = __webpack_require__(6356);
  12035. try {
  12036. DefinePropertyOrThrow({}, '', { '[[Get]]': function () {} });
  12037. } catch (e) {
  12038. // Accessor properties aren't supported
  12039. DefinePropertyOrThrow = null;
  12040. }
  12041. // https://ecma-international.org/ecma-262/6.0/#sec-isconstructor
  12042. if (DefinePropertyOrThrow && $construct) {
  12043. var isConstructorMarker = {};
  12044. var badArrayLike = {};
  12045. DefinePropertyOrThrow(badArrayLike, 'length', {
  12046. '[[Get]]': function () {
  12047. throw isConstructorMarker;
  12048. },
  12049. '[[Enumerable]]': true
  12050. });
  12051. module.exports = function IsConstructor(argument) {
  12052. try {
  12053. // `Reflect.construct` invokes `IsConstructor(target)` before `Get(args, 'length')`:
  12054. $construct(argument, badArrayLike);
  12055. } catch (err) {
  12056. return err === isConstructorMarker;
  12057. }
  12058. };
  12059. } else {
  12060. module.exports = function IsConstructor(argument) {
  12061. // unfortunately there's no way to truly check this without try/catch `new argument` in old environments
  12062. return typeof argument === 'function' && !!argument.prototype;
  12063. };
  12064. }
  12065. /***/ }),
  12066. /***/ 1392:
  12067. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12068. "use strict";
  12069. var has = __webpack_require__(9284);
  12070. var assertRecord = __webpack_require__(5114);
  12071. var Type = __webpack_require__(9747);
  12072. // https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor
  12073. module.exports = function IsDataDescriptor(Desc) {
  12074. if (typeof Desc === 'undefined') {
  12075. return false;
  12076. }
  12077. assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
  12078. if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) {
  12079. return false;
  12080. }
  12081. return true;
  12082. };
  12083. /***/ }),
  12084. /***/ 3428:
  12085. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12086. "use strict";
  12087. var GetIntrinsic = __webpack_require__(4219);
  12088. var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true);
  12089. var $isExtensible = GetIntrinsic('%Object.isExtensible%', true);
  12090. var isPrimitive = __webpack_require__(5019);
  12091. // https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o
  12092. module.exports = $preventExtensions
  12093. ? function IsExtensible(obj) {
  12094. return !isPrimitive(obj) && $isExtensible(obj);
  12095. }
  12096. : function IsExtensible(obj) {
  12097. return !isPrimitive(obj);
  12098. };
  12099. /***/ }),
  12100. /***/ 485:
  12101. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12102. "use strict";
  12103. var abs = __webpack_require__(13);
  12104. var floor = __webpack_require__(5127);
  12105. var Type = __webpack_require__(9747);
  12106. var $isNaN = __webpack_require__(3234);
  12107. var $isFinite = __webpack_require__(7061);
  12108. // https://tc39.es/ecma262/#sec-isintegralnumber
  12109. module.exports = function IsIntegralNumber(argument) {
  12110. if (Type(argument) !== 'Number' || $isNaN(argument) || !$isFinite(argument)) {
  12111. return false;
  12112. }
  12113. var absValue = abs(argument);
  12114. return floor(absValue) === absValue;
  12115. };
  12116. /***/ }),
  12117. /***/ 3290:
  12118. /***/ (function(module) {
  12119. "use strict";
  12120. // https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey
  12121. module.exports = function IsPropertyKey(argument) {
  12122. return typeof argument === 'string' || typeof argument === 'symbol';
  12123. };
  12124. /***/ }),
  12125. /***/ 1275:
  12126. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12127. "use strict";
  12128. var GetIntrinsic = __webpack_require__(4219);
  12129. var $match = GetIntrinsic('%Symbol.match%', true);
  12130. var hasRegExpMatcher = __webpack_require__(4221);
  12131. var ToBoolean = __webpack_require__(3704);
  12132. // https://ecma-international.org/ecma-262/6.0/#sec-isregexp
  12133. module.exports = function IsRegExp(argument) {
  12134. if (!argument || typeof argument !== 'object') {
  12135. return false;
  12136. }
  12137. if ($match) {
  12138. var isRegExp = argument[$match];
  12139. if (typeof isRegExp !== 'undefined') {
  12140. return ToBoolean(isRegExp);
  12141. }
  12142. }
  12143. return hasRegExpMatcher(argument);
  12144. };
  12145. /***/ }),
  12146. /***/ 2151:
  12147. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12148. "use strict";
  12149. var GetIntrinsic = __webpack_require__(4219);
  12150. var $TypeError = GetIntrinsic('%TypeError%');
  12151. var Get = __webpack_require__(6448);
  12152. var ToLength = __webpack_require__(6840);
  12153. var Type = __webpack_require__(9747);
  12154. // https://262.ecma-international.org/11.0/#sec-lengthofarraylike
  12155. module.exports = function LengthOfArrayLike(obj) {
  12156. if (Type(obj) !== 'Object') {
  12157. throw new $TypeError('Assertion failed: `obj` must be an Object');
  12158. }
  12159. return ToLength(Get(obj, 'length'));
  12160. };
  12161. // TODO: use this all over
  12162. /***/ }),
  12163. /***/ 6403:
  12164. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12165. "use strict";
  12166. var GetIntrinsic = __webpack_require__(4219);
  12167. var $gOPD = __webpack_require__(5180);
  12168. var $TypeError = GetIntrinsic('%TypeError%');
  12169. var callBound = __webpack_require__(9630);
  12170. var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
  12171. var has = __webpack_require__(9284);
  12172. var IsArray = __webpack_require__(5971);
  12173. var IsPropertyKey = __webpack_require__(3290);
  12174. var IsRegExp = __webpack_require__(1275);
  12175. var ToPropertyDescriptor = __webpack_require__(2402);
  12176. var Type = __webpack_require__(9747);
  12177. // https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty
  12178. module.exports = function OrdinaryGetOwnProperty(O, P) {
  12179. if (Type(O) !== 'Object') {
  12180. throw new $TypeError('Assertion failed: O must be an Object');
  12181. }
  12182. if (!IsPropertyKey(P)) {
  12183. throw new $TypeError('Assertion failed: P must be a Property Key');
  12184. }
  12185. if (!has(O, P)) {
  12186. return void 0;
  12187. }
  12188. if (!$gOPD) {
  12189. // ES3 / IE 8 fallback
  12190. var arrayLength = IsArray(O) && P === 'length';
  12191. var regexLastIndex = IsRegExp(O) && P === 'lastIndex';
  12192. return {
  12193. '[[Configurable]]': !(arrayLength || regexLastIndex),
  12194. '[[Enumerable]]': $isEnumerable(O, P),
  12195. '[[Value]]': O[P],
  12196. '[[Writable]]': true
  12197. };
  12198. }
  12199. return ToPropertyDescriptor($gOPD(O, P));
  12200. };
  12201. /***/ }),
  12202. /***/ 6953:
  12203. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12204. "use strict";
  12205. module.exports = __webpack_require__(3031);
  12206. /***/ }),
  12207. /***/ 9836:
  12208. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12209. "use strict";
  12210. var $isNaN = __webpack_require__(3234);
  12211. // http://262.ecma-international.org/5.1/#sec-9.12
  12212. module.exports = function SameValue(x, y) {
  12213. if (x === y) { // 0 === -0, but they are not identical.
  12214. if (x === 0) { return 1 / x === 1 / y; }
  12215. return true;
  12216. }
  12217. return $isNaN(x) && $isNaN(y);
  12218. };
  12219. /***/ }),
  12220. /***/ 3704:
  12221. /***/ (function(module) {
  12222. "use strict";
  12223. // http://262.ecma-international.org/5.1/#sec-9.2
  12224. module.exports = function ToBoolean(value) { return !!value; };
  12225. /***/ }),
  12226. /***/ 1723:
  12227. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12228. "use strict";
  12229. var abs = __webpack_require__(13);
  12230. var floor = __webpack_require__(5127);
  12231. var ToNumber = __webpack_require__(5541);
  12232. var $isNaN = __webpack_require__(3234);
  12233. var $isFinite = __webpack_require__(7061);
  12234. var $sign = __webpack_require__(2163);
  12235. // https://262.ecma-international.org/12.0/#sec-tointegerorinfinity
  12236. module.exports = function ToIntegerOrInfinity(value) {
  12237. var number = ToNumber(value);
  12238. if ($isNaN(number) || number === 0) { return 0; }
  12239. if (!$isFinite(number)) { return number; }
  12240. return $sign(number) * floor(abs(number));
  12241. };
  12242. /***/ }),
  12243. /***/ 6840:
  12244. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12245. "use strict";
  12246. var MAX_SAFE_INTEGER = __webpack_require__(8540);
  12247. var ToIntegerOrInfinity = __webpack_require__(1723);
  12248. module.exports = function ToLength(argument) {
  12249. var len = ToIntegerOrInfinity(argument);
  12250. if (len <= 0) { return 0; } // includes converting -0 to +0
  12251. if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; }
  12252. return len;
  12253. };
  12254. /***/ }),
  12255. /***/ 5541:
  12256. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12257. "use strict";
  12258. var GetIntrinsic = __webpack_require__(4219);
  12259. var $TypeError = GetIntrinsic('%TypeError%');
  12260. var $Number = GetIntrinsic('%Number%');
  12261. var $RegExp = GetIntrinsic('%RegExp%');
  12262. var $parseInteger = GetIntrinsic('%parseInt%');
  12263. var callBound = __webpack_require__(9630);
  12264. var regexTester = __webpack_require__(8441);
  12265. var isPrimitive = __webpack_require__(5019);
  12266. var $strSlice = callBound('String.prototype.slice');
  12267. var isBinary = regexTester(/^0b[01]+$/i);
  12268. var isOctal = regexTester(/^0o[0-7]+$/i);
  12269. var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i);
  12270. var nonWS = ['\u0085', '\u200b', '\ufffe'].join('');
  12271. var nonWSregex = new $RegExp('[' + nonWS + ']', 'g');
  12272. var hasNonWS = regexTester(nonWSregex);
  12273. // whitespace from: https://es5.github.io/#x15.5.4.20
  12274. // implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324
  12275. var ws = [
  12276. '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003',
  12277. '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028',
  12278. '\u2029\uFEFF'
  12279. ].join('');
  12280. var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g');
  12281. var $replace = callBound('String.prototype.replace');
  12282. var $trim = function (value) {
  12283. return $replace(value, trimRegex, '');
  12284. };
  12285. var ToPrimitive = __webpack_require__(6745);
  12286. // https://ecma-international.org/ecma-262/6.0/#sec-tonumber
  12287. module.exports = function ToNumber(argument) {
  12288. var value = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number);
  12289. if (typeof value === 'symbol') {
  12290. throw new $TypeError('Cannot convert a Symbol value to a number');
  12291. }
  12292. if (typeof value === 'bigint') {
  12293. throw new $TypeError('Conversion from \'BigInt\' to \'number\' is not allowed.');
  12294. }
  12295. if (typeof value === 'string') {
  12296. if (isBinary(value)) {
  12297. return ToNumber($parseInteger($strSlice(value, 2), 2));
  12298. } else if (isOctal(value)) {
  12299. return ToNumber($parseInteger($strSlice(value, 2), 8));
  12300. } else if (hasNonWS(value) || isInvalidHexLiteral(value)) {
  12301. return NaN;
  12302. }
  12303. var trimmed = $trim(value);
  12304. if (trimmed !== value) {
  12305. return ToNumber(trimmed);
  12306. }
  12307. }
  12308. return $Number(value);
  12309. };
  12310. /***/ }),
  12311. /***/ 1283:
  12312. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12313. "use strict";
  12314. var GetIntrinsic = __webpack_require__(4219);
  12315. var $Object = GetIntrinsic('%Object%');
  12316. var RequireObjectCoercible = __webpack_require__(6953);
  12317. // https://ecma-international.org/ecma-262/6.0/#sec-toobject
  12318. module.exports = function ToObject(value) {
  12319. RequireObjectCoercible(value);
  12320. return $Object(value);
  12321. };
  12322. /***/ }),
  12323. /***/ 6745:
  12324. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12325. "use strict";
  12326. var toPrimitive = __webpack_require__(5249);
  12327. // https://ecma-international.org/ecma-262/6.0/#sec-toprimitive
  12328. module.exports = function ToPrimitive(input) {
  12329. if (arguments.length > 1) {
  12330. return toPrimitive(input, arguments[1]);
  12331. }
  12332. return toPrimitive(input);
  12333. };
  12334. /***/ }),
  12335. /***/ 2402:
  12336. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12337. "use strict";
  12338. var has = __webpack_require__(9284);
  12339. var GetIntrinsic = __webpack_require__(4219);
  12340. var $TypeError = GetIntrinsic('%TypeError%');
  12341. var Type = __webpack_require__(9747);
  12342. var ToBoolean = __webpack_require__(3704);
  12343. var IsCallable = __webpack_require__(1089);
  12344. // https://262.ecma-international.org/5.1/#sec-8.10.5
  12345. module.exports = function ToPropertyDescriptor(Obj) {
  12346. if (Type(Obj) !== 'Object') {
  12347. throw new $TypeError('ToPropertyDescriptor requires an object');
  12348. }
  12349. var desc = {};
  12350. if (has(Obj, 'enumerable')) {
  12351. desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable);
  12352. }
  12353. if (has(Obj, 'configurable')) {
  12354. desc['[[Configurable]]'] = ToBoolean(Obj.configurable);
  12355. }
  12356. if (has(Obj, 'value')) {
  12357. desc['[[Value]]'] = Obj.value;
  12358. }
  12359. if (has(Obj, 'writable')) {
  12360. desc['[[Writable]]'] = ToBoolean(Obj.writable);
  12361. }
  12362. if (has(Obj, 'get')) {
  12363. var getter = Obj.get;
  12364. if (typeof getter !== 'undefined' && !IsCallable(getter)) {
  12365. throw new $TypeError('getter must be a function');
  12366. }
  12367. desc['[[Get]]'] = getter;
  12368. }
  12369. if (has(Obj, 'set')) {
  12370. var setter = Obj.set;
  12371. if (typeof setter !== 'undefined' && !IsCallable(setter)) {
  12372. throw new $TypeError('setter must be a function');
  12373. }
  12374. desc['[[Set]]'] = setter;
  12375. }
  12376. if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) {
  12377. throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute');
  12378. }
  12379. return desc;
  12380. };
  12381. /***/ }),
  12382. /***/ 6888:
  12383. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12384. "use strict";
  12385. var GetIntrinsic = __webpack_require__(4219);
  12386. var $String = GetIntrinsic('%String%');
  12387. var $TypeError = GetIntrinsic('%TypeError%');
  12388. // https://ecma-international.org/ecma-262/6.0/#sec-tostring
  12389. module.exports = function ToString(argument) {
  12390. if (typeof argument === 'symbol') {
  12391. throw new $TypeError('Cannot convert a Symbol value to a string');
  12392. }
  12393. return $String(argument);
  12394. };
  12395. /***/ }),
  12396. /***/ 9747:
  12397. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12398. "use strict";
  12399. var ES5Type = __webpack_require__(290);
  12400. // https://262.ecma-international.org/11.0/#sec-ecmascript-data-types-and-values
  12401. module.exports = function Type(x) {
  12402. if (typeof x === 'symbol') {
  12403. return 'Symbol';
  12404. }
  12405. if (typeof x === 'bigint') {
  12406. return 'BigInt';
  12407. }
  12408. return ES5Type(x);
  12409. };
  12410. /***/ }),
  12411. /***/ 13:
  12412. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12413. "use strict";
  12414. var GetIntrinsic = __webpack_require__(4219);
  12415. var $abs = GetIntrinsic('%Math.abs%');
  12416. // http://262.ecma-international.org/5.1/#sec-5.2
  12417. module.exports = function abs(x) {
  12418. return $abs(x);
  12419. };
  12420. /***/ }),
  12421. /***/ 5127:
  12422. /***/ (function(module) {
  12423. "use strict";
  12424. // var modulo = require('./modulo');
  12425. var $floor = Math.floor;
  12426. // http://262.ecma-international.org/5.1/#sec-5.2
  12427. module.exports = function floor(x) {
  12428. // return x - modulo(x, 1);
  12429. return $floor(x);
  12430. };
  12431. /***/ }),
  12432. /***/ 3031:
  12433. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12434. "use strict";
  12435. var GetIntrinsic = __webpack_require__(4219);
  12436. var $TypeError = GetIntrinsic('%TypeError%');
  12437. // http://262.ecma-international.org/5.1/#sec-9.10
  12438. module.exports = function CheckObjectCoercible(value, optMessage) {
  12439. if (value == null) {
  12440. throw new $TypeError(optMessage || ('Cannot call method on ' + value));
  12441. }
  12442. return value;
  12443. };
  12444. /***/ }),
  12445. /***/ 290:
  12446. /***/ (function(module) {
  12447. "use strict";
  12448. // https://262.ecma-international.org/5.1/#sec-8
  12449. module.exports = function Type(x) {
  12450. if (x === null) {
  12451. return 'Null';
  12452. }
  12453. if (typeof x === 'undefined') {
  12454. return 'Undefined';
  12455. }
  12456. if (typeof x === 'function' || typeof x === 'object') {
  12457. return 'Object';
  12458. }
  12459. if (typeof x === 'number') {
  12460. return 'Number';
  12461. }
  12462. if (typeof x === 'boolean') {
  12463. return 'Boolean';
  12464. }
  12465. if (typeof x === 'string') {
  12466. return 'String';
  12467. }
  12468. };
  12469. /***/ }),
  12470. /***/ 137:
  12471. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12472. "use strict";
  12473. // TODO: remove, semver-major
  12474. module.exports = __webpack_require__(4219);
  12475. /***/ }),
  12476. /***/ 1327:
  12477. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12478. "use strict";
  12479. var hasPropertyDescriptors = __webpack_require__(8198);
  12480. var GetIntrinsic = __webpack_require__(4219);
  12481. var $defineProperty = hasPropertyDescriptors() && GetIntrinsic('%Object.defineProperty%', true);
  12482. var hasArrayLengthDefineBug = hasPropertyDescriptors.hasArrayLengthDefineBug();
  12483. // eslint-disable-next-line global-require
  12484. var isArray = hasArrayLengthDefineBug && __webpack_require__(4351);
  12485. var callBound = __webpack_require__(9630);
  12486. var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
  12487. // eslint-disable-next-line max-params
  12488. module.exports = function DefineOwnProperty(IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, desc) {
  12489. if (!$defineProperty) {
  12490. if (!IsDataDescriptor(desc)) {
  12491. // ES3 does not support getters/setters
  12492. return false;
  12493. }
  12494. if (!desc['[[Configurable]]'] || !desc['[[Writable]]']) {
  12495. return false;
  12496. }
  12497. // fallback for ES3
  12498. if (P in O && $isEnumerable(O, P) !== !!desc['[[Enumerable]]']) {
  12499. // a non-enumerable existing property
  12500. return false;
  12501. }
  12502. // property does not exist at all, or exists but is enumerable
  12503. var V = desc['[[Value]]'];
  12504. // eslint-disable-next-line no-param-reassign
  12505. O[P] = V; // will use [[Define]]
  12506. return SameValue(O[P], V);
  12507. }
  12508. if (
  12509. hasArrayLengthDefineBug
  12510. && P === 'length'
  12511. && '[[Value]]' in desc
  12512. && isArray(O)
  12513. && O.length !== desc['[[Value]]']
  12514. ) {
  12515. // eslint-disable-next-line no-param-reassign
  12516. O.length = desc['[[Value]]'];
  12517. return O.length === desc['[[Value]]'];
  12518. }
  12519. $defineProperty(O, P, FromPropertyDescriptor(desc));
  12520. return true;
  12521. };
  12522. /***/ }),
  12523. /***/ 4351:
  12524. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12525. "use strict";
  12526. var GetIntrinsic = __webpack_require__(4219);
  12527. var $Array = GetIntrinsic('%Array%');
  12528. // eslint-disable-next-line global-require
  12529. var toStr = !$Array.isArray && __webpack_require__(9630)('Object.prototype.toString');
  12530. module.exports = $Array.isArray || function IsArray(argument) {
  12531. return toStr(argument) === '[object Array]';
  12532. };
  12533. /***/ }),
  12534. /***/ 5114:
  12535. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12536. "use strict";
  12537. var GetIntrinsic = __webpack_require__(4219);
  12538. var $TypeError = GetIntrinsic('%TypeError%');
  12539. var $SyntaxError = GetIntrinsic('%SyntaxError%');
  12540. var has = __webpack_require__(9284);
  12541. var isMatchRecord = __webpack_require__(7040);
  12542. var predicates = {
  12543. // https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type
  12544. 'Property Descriptor': function isPropertyDescriptor(Desc) {
  12545. var allowed = {
  12546. '[[Configurable]]': true,
  12547. '[[Enumerable]]': true,
  12548. '[[Get]]': true,
  12549. '[[Set]]': true,
  12550. '[[Value]]': true,
  12551. '[[Writable]]': true
  12552. };
  12553. for (var key in Desc) { // eslint-disable-line
  12554. if (has(Desc, key) && !allowed[key]) {
  12555. return false;
  12556. }
  12557. }
  12558. var isData = has(Desc, '[[Value]]');
  12559. var IsAccessor = has(Desc, '[[Get]]') || has(Desc, '[[Set]]');
  12560. if (isData && IsAccessor) {
  12561. throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
  12562. }
  12563. return true;
  12564. },
  12565. // https://262.ecma-international.org/13.0/#sec-match-records
  12566. 'Match Record': isMatchRecord
  12567. };
  12568. module.exports = function assertRecord(Type, recordType, argumentName, value) {
  12569. var predicate = predicates[recordType];
  12570. if (typeof predicate !== 'function') {
  12571. throw new $SyntaxError('unknown record type: ' + recordType);
  12572. }
  12573. if (Type(value) !== 'Object' || !predicate(value)) {
  12574. throw new $TypeError(argumentName + ' must be a ' + recordType);
  12575. }
  12576. };
  12577. /***/ }),
  12578. /***/ 3359:
  12579. /***/ (function(module) {
  12580. "use strict";
  12581. module.exports = function fromPropertyDescriptor(Desc) {
  12582. if (typeof Desc === 'undefined') {
  12583. return Desc;
  12584. }
  12585. var obj = {};
  12586. if ('[[Value]]' in Desc) {
  12587. obj.value = Desc['[[Value]]'];
  12588. }
  12589. if ('[[Writable]]' in Desc) {
  12590. obj.writable = !!Desc['[[Writable]]'];
  12591. }
  12592. if ('[[Get]]' in Desc) {
  12593. obj.get = Desc['[[Get]]'];
  12594. }
  12595. if ('[[Set]]' in Desc) {
  12596. obj.set = Desc['[[Set]]'];
  12597. }
  12598. if ('[[Enumerable]]' in Desc) {
  12599. obj.enumerable = !!Desc['[[Enumerable]]'];
  12600. }
  12601. if ('[[Configurable]]' in Desc) {
  12602. obj.configurable = !!Desc['[[Configurable]]'];
  12603. }
  12604. return obj;
  12605. };
  12606. /***/ }),
  12607. /***/ 5180:
  12608. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12609. "use strict";
  12610. var GetIntrinsic = __webpack_require__(4219);
  12611. var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
  12612. if ($gOPD) {
  12613. try {
  12614. $gOPD([], 'length');
  12615. } catch (e) {
  12616. // IE 8 has a broken gOPD
  12617. $gOPD = null;
  12618. }
  12619. }
  12620. module.exports = $gOPD;
  12621. /***/ }),
  12622. /***/ 7061:
  12623. /***/ (function(module) {
  12624. "use strict";
  12625. var $isNaN = Number.isNaN || function (a) { return a !== a; };
  12626. module.exports = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; };
  12627. /***/ }),
  12628. /***/ 7040:
  12629. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12630. "use strict";
  12631. var has = __webpack_require__(9284);
  12632. // https://262.ecma-international.org/13.0/#sec-match-records
  12633. module.exports = function isMatchRecord(record) {
  12634. return (
  12635. has(record, '[[StartIndex]]')
  12636. && has(record, '[[EndIndex]]')
  12637. && record['[[StartIndex]]'] >= 0
  12638. && record['[[EndIndex]]'] >= record['[[StartIndex]]']
  12639. && String(parseInt(record['[[StartIndex]]'], 10)) === String(record['[[StartIndex]]'])
  12640. && String(parseInt(record['[[EndIndex]]'], 10)) === String(record['[[EndIndex]]'])
  12641. );
  12642. };
  12643. /***/ }),
  12644. /***/ 3234:
  12645. /***/ (function(module) {
  12646. "use strict";
  12647. module.exports = Number.isNaN || function isNaN(a) {
  12648. return a !== a;
  12649. };
  12650. /***/ }),
  12651. /***/ 5019:
  12652. /***/ (function(module) {
  12653. "use strict";
  12654. module.exports = function isPrimitive(value) {
  12655. return value === null || (typeof value !== 'function' && typeof value !== 'object');
  12656. };
  12657. /***/ }),
  12658. /***/ 8682:
  12659. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12660. "use strict";
  12661. var GetIntrinsic = __webpack_require__(4219);
  12662. var has = __webpack_require__(9284);
  12663. var $TypeError = GetIntrinsic('%TypeError%');
  12664. module.exports = function IsPropertyDescriptor(ES, Desc) {
  12665. if (ES.Type(Desc) !== 'Object') {
  12666. return false;
  12667. }
  12668. var allowed = {
  12669. '[[Configurable]]': true,
  12670. '[[Enumerable]]': true,
  12671. '[[Get]]': true,
  12672. '[[Set]]': true,
  12673. '[[Value]]': true,
  12674. '[[Writable]]': true
  12675. };
  12676. for (var key in Desc) { // eslint-disable-line no-restricted-syntax
  12677. if (has(Desc, key) && !allowed[key]) {
  12678. return false;
  12679. }
  12680. }
  12681. if (ES.IsDataDescriptor(Desc) && ES.IsAccessorDescriptor(Desc)) {
  12682. throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
  12683. }
  12684. return true;
  12685. };
  12686. /***/ }),
  12687. /***/ 8540:
  12688. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12689. "use strict";
  12690. var GetIntrinsic = __webpack_require__(4219);
  12691. var $Math = GetIntrinsic('%Math%');
  12692. var $Number = GetIntrinsic('%Number%');
  12693. module.exports = $Number.MAX_SAFE_INTEGER || $Math.pow(2, 53) - 1;
  12694. /***/ }),
  12695. /***/ 8441:
  12696. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  12697. "use strict";
  12698. var callBound = __webpack_require__(9630);
  12699. var $exec = callBound('RegExp.prototype.exec');
  12700. module.exports = function regexTester(regex) {
  12701. return function test(s) { return $exec(regex, s) !== null; };
  12702. };
  12703. /***/ }),
  12704. /***/ 2163:
  12705. /***/ (function(module) {
  12706. "use strict";
  12707. module.exports = function sign(number) {
  12708. return number >= 0 ? 1 : -1;
  12709. };
  12710. /***/ })
  12711. /******/ });
  12712. /************************************************************************/
  12713. /******/ // The module cache
  12714. /******/ var __webpack_module_cache__ = {};
  12715. /******/
  12716. /******/ // The require function
  12717. /******/ function __webpack_require__(moduleId) {
  12718. /******/ // Check if module is in cache
  12719. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  12720. /******/ if (cachedModule !== undefined) {
  12721. /******/ return cachedModule.exports;
  12722. /******/ }
  12723. /******/ // Create a new module (and put it into the cache)
  12724. /******/ var module = __webpack_module_cache__[moduleId] = {
  12725. /******/ // no module.id needed
  12726. /******/ // no module.loaded needed
  12727. /******/ exports: {}
  12728. /******/ };
  12729. /******/
  12730. /******/ // Execute the module function
  12731. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  12732. /******/
  12733. /******/ // Return the exports of the module
  12734. /******/ return module.exports;
  12735. /******/ }
  12736. /******/
  12737. /************************************************************************/
  12738. /******/ /* webpack/runtime/compat get default export */
  12739. /******/ !function() {
  12740. /******/ // getDefaultExport function for compatibility with non-harmony modules
  12741. /******/ __webpack_require__.n = function(module) {
  12742. /******/ var getter = module && module.__esModule ?
  12743. /******/ function() { return module['default']; } :
  12744. /******/ function() { return module; };
  12745. /******/ __webpack_require__.d(getter, { a: getter });
  12746. /******/ return getter;
  12747. /******/ };
  12748. /******/ }();
  12749. /******/
  12750. /******/ /* webpack/runtime/define property getters */
  12751. /******/ !function() {
  12752. /******/ // define getter functions for harmony exports
  12753. /******/ __webpack_require__.d = function(exports, definition) {
  12754. /******/ for(var key in definition) {
  12755. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  12756. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  12757. /******/ }
  12758. /******/ }
  12759. /******/ };
  12760. /******/ }();
  12761. /******/
  12762. /******/ /* webpack/runtime/global */
  12763. /******/ !function() {
  12764. /******/ __webpack_require__.g = (function() {
  12765. /******/ if (typeof globalThis === 'object') return globalThis;
  12766. /******/ try {
  12767. /******/ return this || new Function('return this')();
  12768. /******/ } catch (e) {
  12769. /******/ if (typeof window === 'object') return window;
  12770. /******/ }
  12771. /******/ })();
  12772. /******/ }();
  12773. /******/
  12774. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  12775. /******/ !function() {
  12776. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  12777. /******/ }();
  12778. /******/
  12779. /******/ /* webpack/runtime/make namespace object */
  12780. /******/ !function() {
  12781. /******/ // define __esModule on exports
  12782. /******/ __webpack_require__.r = function(exports) {
  12783. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  12784. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  12785. /******/ }
  12786. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  12787. /******/ };
  12788. /******/ }();
  12789. /******/
  12790. /************************************************************************/
  12791. var __webpack_exports__ = {};
  12792. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  12793. !function() {
  12794. "use strict";
  12795. // ESM COMPAT FLAG
  12796. __webpack_require__.r(__webpack_exports__);
  12797. // EXPORTS
  12798. __webpack_require__.d(__webpack_exports__, {
  12799. "AnglePickerControl": function() { return /* reexport */ AnglePickerControl; },
  12800. "Animate": function() { return /* reexport */ Animate; },
  12801. "Autocomplete": function() { return /* reexport */ Autocomplete; },
  12802. "BaseControl": function() { return /* reexport */ base_control; },
  12803. "BlockQuotation": function() { return /* reexport */ external_wp_primitives_namespaceObject.BlockQuotation; },
  12804. "Button": function() { return /* reexport */ build_module_button; },
  12805. "ButtonGroup": function() { return /* reexport */ button_group; },
  12806. "Card": function() { return /* reexport */ card_component; },
  12807. "CardBody": function() { return /* reexport */ card_body_component; },
  12808. "CardDivider": function() { return /* reexport */ card_divider_component; },
  12809. "CardFooter": function() { return /* reexport */ card_footer_component; },
  12810. "CardHeader": function() { return /* reexport */ card_header_component; },
  12811. "CardMedia": function() { return /* reexport */ card_media_component; },
  12812. "CheckboxControl": function() { return /* reexport */ CheckboxControl; },
  12813. "Circle": function() { return /* reexport */ external_wp_primitives_namespaceObject.Circle; },
  12814. "ClipboardButton": function() { return /* reexport */ ClipboardButton; },
  12815. "ColorIndicator": function() { return /* reexport */ color_indicator; },
  12816. "ColorPalette": function() { return /* reexport */ ColorPalette; },
  12817. "ColorPicker": function() { return /* reexport */ LegacyAdapter; },
  12818. "ComboboxControl": function() { return /* reexport */ combobox_control; },
  12819. "CustomGradientPicker": function() { return /* reexport */ CustomGradientPicker; },
  12820. "CustomSelectControl": function() { return /* reexport */ CustomSelectControl; },
  12821. "Dashicon": function() { return /* reexport */ dashicon; },
  12822. "DatePicker": function() { return /* reexport */ date; },
  12823. "DateTimePicker": function() { return /* reexport */ date_time; },
  12824. "Disabled": function() { return /* reexport */ disabled; },
  12825. "Draggable": function() { return /* reexport */ Draggable; },
  12826. "DropZone": function() { return /* reexport */ DropZoneComponent; },
  12827. "DropZoneProvider": function() { return /* reexport */ DropZoneProvider; },
  12828. "Dropdown": function() { return /* reexport */ Dropdown; },
  12829. "DropdownMenu": function() { return /* reexport */ dropdown_menu; },
  12830. "DuotonePicker": function() { return /* reexport */ duotone_picker; },
  12831. "DuotoneSwatch": function() { return /* reexport */ duotone_swatch; },
  12832. "ExternalLink": function() { return /* reexport */ external_link; },
  12833. "Fill": function() { return /* reexport */ slot_fill_Fill; },
  12834. "Flex": function() { return /* reexport */ flex_component; },
  12835. "FlexBlock": function() { return /* reexport */ flex_block_component; },
  12836. "FlexItem": function() { return /* reexport */ flex_item_component; },
  12837. "FocalPointPicker": function() { return /* reexport */ focal_point_picker; },
  12838. "FocusReturnProvider": function() { return /* reexport */ with_focus_return_Provider; },
  12839. "FocusableIframe": function() { return /* reexport */ FocusableIframe; },
  12840. "FontSizePicker": function() { return /* reexport */ font_size_picker; },
  12841. "FormFileUpload": function() { return /* reexport */ form_file_upload; },
  12842. "FormToggle": function() { return /* reexport */ form_toggle; },
  12843. "FormTokenField": function() { return /* reexport */ form_token_field; },
  12844. "G": function() { return /* reexport */ external_wp_primitives_namespaceObject.G; },
  12845. "GradientPicker": function() { return /* reexport */ GradientPicker; },
  12846. "Guide": function() { return /* reexport */ Guide; },
  12847. "GuidePage": function() { return /* reexport */ GuidePage; },
  12848. "HorizontalRule": function() { return /* reexport */ external_wp_primitives_namespaceObject.HorizontalRule; },
  12849. "Icon": function() { return /* reexport */ build_module_icon; },
  12850. "IconButton": function() { return /* reexport */ deprecated; },
  12851. "IsolatedEventContainer": function() { return /* reexport */ isolated_event_container; },
  12852. "KeyboardShortcuts": function() { return /* reexport */ keyboard_shortcuts; },
  12853. "MenuGroup": function() { return /* reexport */ menu_group; },
  12854. "MenuItem": function() { return /* reexport */ menu_item; },
  12855. "MenuItemsChoice": function() { return /* reexport */ MenuItemsChoice; },
  12856. "Modal": function() { return /* reexport */ modal; },
  12857. "NavigableMenu": function() { return /* reexport */ navigable_container_menu; },
  12858. "Notice": function() { return /* reexport */ build_module_notice; },
  12859. "NoticeList": function() { return /* reexport */ list; },
  12860. "Panel": function() { return /* reexport */ panel; },
  12861. "PanelBody": function() { return /* reexport */ body; },
  12862. "PanelHeader": function() { return /* reexport */ panel_header; },
  12863. "PanelRow": function() { return /* reexport */ row; },
  12864. "Path": function() { return /* reexport */ external_wp_primitives_namespaceObject.Path; },
  12865. "Placeholder": function() { return /* reexport */ placeholder; },
  12866. "Polygon": function() { return /* reexport */ external_wp_primitives_namespaceObject.Polygon; },
  12867. "Popover": function() { return /* reexport */ popover; },
  12868. "QueryControls": function() { return /* reexport */ QueryControls; },
  12869. "RadioControl": function() { return /* reexport */ RadioControl; },
  12870. "RangeControl": function() { return /* reexport */ range_control; },
  12871. "Rect": function() { return /* reexport */ external_wp_primitives_namespaceObject.Rect; },
  12872. "ResizableBox": function() { return /* reexport */ resizable_box; },
  12873. "ResponsiveWrapper": function() { return /* reexport */ responsive_wrapper; },
  12874. "SVG": function() { return /* reexport */ external_wp_primitives_namespaceObject.SVG; },
  12875. "SandBox": function() { return /* reexport */ Sandbox; },
  12876. "ScrollLock": function() { return /* reexport */ ScrollLock; },
  12877. "SearchControl": function() { return /* reexport */ search_control; },
  12878. "SelectControl": function() { return /* reexport */ select_control; },
  12879. "Slot": function() { return /* reexport */ slot_fill_Slot; },
  12880. "SlotFillProvider": function() { return /* reexport */ Provider; },
  12881. "Snackbar": function() { return /* reexport */ snackbar; },
  12882. "SnackbarList": function() { return /* reexport */ snackbar_list; },
  12883. "Spinner": function() { return /* reexport */ Spinner; },
  12884. "TabPanel": function() { return /* reexport */ TabPanel; },
  12885. "TabbableContainer": function() { return /* reexport */ tabbable; },
  12886. "TextControl": function() { return /* reexport */ text_control; },
  12887. "TextHighlight": function() { return /* reexport */ text_highlight; },
  12888. "TextareaControl": function() { return /* reexport */ TextareaControl; },
  12889. "TimePicker": function() { return /* reexport */ time; },
  12890. "Tip": function() { return /* reexport */ build_module_tip; },
  12891. "ToggleControl": function() { return /* reexport */ ToggleControl; },
  12892. "Toolbar": function() { return /* reexport */ toolbar; },
  12893. "ToolbarButton": function() { return /* reexport */ toolbar_button; },
  12894. "ToolbarDropdownMenu": function() { return /* reexport */ toolbar_dropdown_menu; },
  12895. "ToolbarGroup": function() { return /* reexport */ toolbar_group; },
  12896. "ToolbarItem": function() { return /* reexport */ toolbar_item; },
  12897. "Tooltip": function() { return /* reexport */ tooltip; },
  12898. "TreeSelect": function() { return /* reexport */ TreeSelect; },
  12899. "VisuallyHidden": function() { return /* reexport */ visually_hidden_component; },
  12900. "__experimentalAlignmentMatrixControl": function() { return /* reexport */ AlignmentMatrixControl; },
  12901. "__experimentalBorderBoxControl": function() { return /* reexport */ border_box_control_component; },
  12902. "__experimentalBorderControl": function() { return /* reexport */ border_control_component; },
  12903. "__experimentalBoxControl": function() { return /* reexport */ BoxControl; },
  12904. "__experimentalConfirmDialog": function() { return /* reexport */ confirm_dialog_component; },
  12905. "__experimentalDimensionControl": function() { return /* reexport */ dimension_control; },
  12906. "__experimentalDivider": function() { return /* reexport */ divider_component; },
  12907. "__experimentalElevation": function() { return /* reexport */ elevation_component; },
  12908. "__experimentalFlyout": function() { return /* reexport */ flyout_component; },
  12909. "__experimentalGrid": function() { return /* reexport */ grid_component; },
  12910. "__experimentalHStack": function() { return /* reexport */ h_stack_component; },
  12911. "__experimentalHasSplitBorders": function() { return /* reexport */ hasSplitBorders; },
  12912. "__experimentalHeading": function() { return /* reexport */ heading_component; },
  12913. "__experimentalInputControl": function() { return /* reexport */ input_control; },
  12914. "__experimentalIsDefinedBorder": function() { return /* reexport */ isDefinedBorder; },
  12915. "__experimentalIsEmptyBorder": function() { return /* reexport */ isEmptyBorder; },
  12916. "__experimentalItem": function() { return /* reexport */ item_component; },
  12917. "__experimentalItemGroup": function() { return /* reexport */ item_group_component; },
  12918. "__experimentalNavigation": function() { return /* reexport */ Navigation; },
  12919. "__experimentalNavigationBackButton": function() { return /* reexport */ back_button; },
  12920. "__experimentalNavigationGroup": function() { return /* reexport */ NavigationGroup; },
  12921. "__experimentalNavigationItem": function() { return /* reexport */ NavigationItem; },
  12922. "__experimentalNavigationMenu": function() { return /* reexport */ NavigationMenu; },
  12923. "__experimentalNavigatorBackButton": function() { return /* reexport */ navigator_back_button_component; },
  12924. "__experimentalNavigatorButton": function() { return /* reexport */ navigator_button_component; },
  12925. "__experimentalNavigatorProvider": function() { return /* reexport */ navigator_provider_component; },
  12926. "__experimentalNavigatorScreen": function() { return /* reexport */ navigator_screen_component; },
  12927. "__experimentalNumberControl": function() { return /* reexport */ number_control; },
  12928. "__experimentalPaletteEdit": function() { return /* reexport */ PaletteEdit; },
  12929. "__experimentalParseQuantityAndUnitFromRawValue": function() { return /* reexport */ parseQuantityAndUnitFromRawValue; },
  12930. "__experimentalRadio": function() { return /* reexport */ build_module_radio; },
  12931. "__experimentalRadioGroup": function() { return /* reexport */ radio_group; },
  12932. "__experimentalScrollable": function() { return /* reexport */ scrollable_component; },
  12933. "__experimentalSpacer": function() { return /* reexport */ spacer_component; },
  12934. "__experimentalStyleProvider": function() { return /* reexport */ StyleProvider; },
  12935. "__experimentalSurface": function() { return /* reexport */ surface_component; },
  12936. "__experimentalText": function() { return /* reexport */ text_component; },
  12937. "__experimentalToggleGroupControl": function() { return /* reexport */ toggle_group_control_component; },
  12938. "__experimentalToggleGroupControlOption": function() { return /* reexport */ ToggleGroupControlOption; },
  12939. "__experimentalToggleGroupControlOptionIcon": function() { return /* reexport */ ToggleGroupControlOptionIcon; },
  12940. "__experimentalToolbarContext": function() { return /* reexport */ toolbar_context; },
  12941. "__experimentalToolsPanel": function() { return /* reexport */ tools_panel_component; },
  12942. "__experimentalToolsPanelContext": function() { return /* reexport */ ToolsPanelContext; },
  12943. "__experimentalToolsPanelItem": function() { return /* reexport */ tools_panel_item_component; },
  12944. "__experimentalTreeGrid": function() { return /* reexport */ tree_grid; },
  12945. "__experimentalTreeGridCell": function() { return /* reexport */ cell; },
  12946. "__experimentalTreeGridItem": function() { return /* reexport */ tree_grid_item; },
  12947. "__experimentalTreeGridRow": function() { return /* reexport */ tree_grid_row; },
  12948. "__experimentalTruncate": function() { return /* reexport */ truncate_component; },
  12949. "__experimentalUnitControl": function() { return /* reexport */ unit_control; },
  12950. "__experimentalUseCustomUnits": function() { return /* reexport */ useCustomUnits; },
  12951. "__experimentalUseNavigator": function() { return /* reexport */ use_navigator; },
  12952. "__experimentalUseSlot": function() { return /* reexport */ use_slot_useSlot; },
  12953. "__experimentalVStack": function() { return /* reexport */ v_stack_component; },
  12954. "__experimentalView": function() { return /* reexport */ component; },
  12955. "__experimentalZStack": function() { return /* reexport */ z_stack_component; },
  12956. "__unstableComposite": function() { return /* reexport */ Composite; },
  12957. "__unstableCompositeGroup": function() { return /* reexport */ CompositeGroup; },
  12958. "__unstableCompositeItem": function() { return /* reexport */ CompositeItem; },
  12959. "__unstableDisclosureContent": function() { return /* reexport */ DisclosureContent; },
  12960. "__unstableGetAnimateClassName": function() { return /* reexport */ getAnimateClassName; },
  12961. "__unstableMotion": function() { return /* reexport */ motion; },
  12962. "__unstableUseAutocompleteProps": function() { return /* reexport */ useAutocompleteProps; },
  12963. "__unstableUseCompositeState": function() { return /* reexport */ useCompositeState; },
  12964. "__unstableUseNavigateRegions": function() { return /* reexport */ useNavigateRegions; },
  12965. "createSlotFill": function() { return /* reexport */ createSlotFill; },
  12966. "navigateRegions": function() { return /* reexport */ navigate_regions; },
  12967. "withConstrainedTabbing": function() { return /* reexport */ with_constrained_tabbing; },
  12968. "withFallbackStyles": function() { return /* reexport */ with_fallback_styles; },
  12969. "withFilters": function() { return /* reexport */ withFilters; },
  12970. "withFocusOutside": function() { return /* reexport */ with_focus_outside; },
  12971. "withFocusReturn": function() { return /* reexport */ with_focus_return; },
  12972. "withNotices": function() { return /* reexport */ with_notices; },
  12973. "withSpokenMessages": function() { return /* reexport */ with_spoken_messages; }
  12974. });
  12975. // NAMESPACE OBJECT: ./node_modules/@wordpress/components/build-module/text/styles.js
  12976. var text_styles_namespaceObject = {};
  12977. __webpack_require__.r(text_styles_namespaceObject);
  12978. __webpack_require__.d(text_styles_namespaceObject, {
  12979. "Text": function() { return Text; },
  12980. "block": function() { return styles_block; },
  12981. "destructive": function() { return destructive; },
  12982. "highlighterText": function() { return highlighterText; },
  12983. "muted": function() { return muted; },
  12984. "positive": function() { return positive; },
  12985. "upperCase": function() { return upperCase; }
  12986. });
  12987. // NAMESPACE OBJECT: ./node_modules/@wordpress/components/build-module/ui/tooltip/styles.js
  12988. var tooltip_styles_namespaceObject = {};
  12989. __webpack_require__.r(tooltip_styles_namespaceObject);
  12990. __webpack_require__.d(tooltip_styles_namespaceObject, {
  12991. "TooltipContent": function() { return TooltipContent; },
  12992. "TooltipPopoverView": function() { return TooltipPopoverView; },
  12993. "TooltipShortcut": function() { return TooltipShortcut; },
  12994. "noOutline": function() { return noOutline; }
  12995. });
  12996. // NAMESPACE OBJECT: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/styles.js
  12997. var toggle_group_control_option_base_styles_namespaceObject = {};
  12998. __webpack_require__.r(toggle_group_control_option_base_styles_namespaceObject);
  12999. __webpack_require__.d(toggle_group_control_option_base_styles_namespaceObject, {
  13000. "ButtonContentView": function() { return ButtonContentView; },
  13001. "LabelView": function() { return LabelView; },
  13002. "buttonActive": function() { return buttonActive; },
  13003. "buttonView": function() { return buttonView; },
  13004. "labelBlock": function() { return labelBlock; },
  13005. "medium": function() { return medium; },
  13006. "separatorActive": function() { return separatorActive; }
  13007. });
  13008. ;// CONCATENATED MODULE: external ["wp","primitives"]
  13009. var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  13010. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  13011. function extends_extends() {
  13012. extends_extends = Object.assign || function (target) {
  13013. for (var i = 1; i < arguments.length; i++) {
  13014. var source = arguments[i];
  13015. for (var key in source) {
  13016. if (Object.prototype.hasOwnProperty.call(source, key)) {
  13017. target[key] = source[key];
  13018. }
  13019. }
  13020. }
  13021. return target;
  13022. };
  13023. return extends_extends.apply(this, arguments);
  13024. }
  13025. ;// CONCATENATED MODULE: external ["wp","element"]
  13026. var external_wp_element_namespaceObject = window["wp"]["element"];
  13027. ;// CONCATENATED MODULE: external "lodash"
  13028. var external_lodash_namespaceObject = window["lodash"];
  13029. // EXTERNAL MODULE: ./node_modules/classnames/index.js
  13030. var classnames = __webpack_require__(4403);
  13031. var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
  13032. ;// CONCATENATED MODULE: external ["wp","i18n"]
  13033. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  13034. ;// CONCATENATED MODULE: external ["wp","compose"]
  13035. var external_wp_compose_namespaceObject = window["wp"]["compose"];
  13036. ;// CONCATENATED MODULE: ./node_modules/reakit/es/_rollupPluginBabelHelpers-1f0bf8c2.js
  13037. function _defineProperty(obj, key, value) {
  13038. if (key in obj) {
  13039. Object.defineProperty(obj, key, {
  13040. value: value,
  13041. enumerable: true,
  13042. configurable: true,
  13043. writable: true
  13044. });
  13045. } else {
  13046. obj[key] = value;
  13047. }
  13048. return obj;
  13049. }
  13050. function ownKeys(object, enumerableOnly) {
  13051. var keys = Object.keys(object);
  13052. if (Object.getOwnPropertySymbols) {
  13053. var symbols = Object.getOwnPropertySymbols(object);
  13054. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  13055. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  13056. });
  13057. keys.push.apply(keys, symbols);
  13058. }
  13059. return keys;
  13060. }
  13061. function _objectSpread2(target) {
  13062. for (var i = 1; i < arguments.length; i++) {
  13063. var source = arguments[i] != null ? arguments[i] : {};
  13064. if (i % 2) {
  13065. ownKeys(Object(source), true).forEach(function (key) {
  13066. _defineProperty(target, key, source[key]);
  13067. });
  13068. } else if (Object.getOwnPropertyDescriptors) {
  13069. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  13070. } else {
  13071. ownKeys(Object(source)).forEach(function (key) {
  13072. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  13073. });
  13074. }
  13075. }
  13076. return target;
  13077. }
  13078. function _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(source, excluded) {
  13079. if (source == null) return {};
  13080. var target = {};
  13081. var sourceKeys = Object.keys(source);
  13082. var key, i;
  13083. for (i = 0; i < sourceKeys.length; i++) {
  13084. key = sourceKeys[i];
  13085. if (excluded.indexOf(key) >= 0) continue;
  13086. target[key] = source[key];
  13087. }
  13088. return target;
  13089. }
  13090. function _unsupportedIterableToArray(o, minLen) {
  13091. if (!o) return;
  13092. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  13093. var n = Object.prototype.toString.call(o).slice(8, -1);
  13094. if (n === "Object" && o.constructor) n = o.constructor.name;
  13095. if (n === "Map" || n === "Set") return Array.from(o);
  13096. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  13097. }
  13098. function _arrayLikeToArray(arr, len) {
  13099. if (len == null || len > arr.length) len = arr.length;
  13100. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  13101. return arr2;
  13102. }
  13103. function _createForOfIteratorHelperLoose(o, allowArrayLike) {
  13104. var it;
  13105. if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
  13106. if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  13107. if (it) o = it;
  13108. var i = 0;
  13109. return function () {
  13110. if (i >= o.length) return {
  13111. done: true
  13112. };
  13113. return {
  13114. done: false,
  13115. value: o[i++]
  13116. };
  13117. };
  13118. }
  13119. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  13120. }
  13121. it = o[Symbol.iterator]();
  13122. return it.next.bind(it);
  13123. }
  13124. // EXTERNAL MODULE: external "React"
  13125. var external_React_ = __webpack_require__(9196);
  13126. var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_);
  13127. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/_rollupPluginBabelHelpers-0c84a174.js
  13128. function _rollupPluginBabelHelpers_0c84a174_defineProperty(obj, key, value) {
  13129. if (key in obj) {
  13130. Object.defineProperty(obj, key, {
  13131. value: value,
  13132. enumerable: true,
  13133. configurable: true,
  13134. writable: true
  13135. });
  13136. } else {
  13137. obj[key] = value;
  13138. }
  13139. return obj;
  13140. }
  13141. function _rollupPluginBabelHelpers_0c84a174_ownKeys(object, enumerableOnly) {
  13142. var keys = Object.keys(object);
  13143. if (Object.getOwnPropertySymbols) {
  13144. var symbols = Object.getOwnPropertySymbols(object);
  13145. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  13146. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  13147. });
  13148. keys.push.apply(keys, symbols);
  13149. }
  13150. return keys;
  13151. }
  13152. function _rollupPluginBabelHelpers_0c84a174_objectSpread2(target) {
  13153. for (var i = 1; i < arguments.length; i++) {
  13154. var source = arguments[i] != null ? arguments[i] : {};
  13155. if (i % 2) {
  13156. _rollupPluginBabelHelpers_0c84a174_ownKeys(Object(source), true).forEach(function (key) {
  13157. _rollupPluginBabelHelpers_0c84a174_defineProperty(target, key, source[key]);
  13158. });
  13159. } else if (Object.getOwnPropertyDescriptors) {
  13160. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  13161. } else {
  13162. _rollupPluginBabelHelpers_0c84a174_ownKeys(Object(source)).forEach(function (key) {
  13163. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  13164. });
  13165. }
  13166. }
  13167. return target;
  13168. }
  13169. function _rollupPluginBabelHelpers_0c84a174_objectWithoutPropertiesLoose(source, excluded) {
  13170. if (source == null) return {};
  13171. var target = {};
  13172. var sourceKeys = Object.keys(source);
  13173. var key, i;
  13174. for (i = 0; i < sourceKeys.length; i++) {
  13175. key = sourceKeys[i];
  13176. if (excluded.indexOf(key) >= 0) continue;
  13177. target[key] = source[key];
  13178. }
  13179. return target;
  13180. }
  13181. function _rollupPluginBabelHelpers_0c84a174_unsupportedIterableToArray(o, minLen) {
  13182. if (!o) return;
  13183. if (typeof o === "string") return _rollupPluginBabelHelpers_0c84a174_arrayLikeToArray(o, minLen);
  13184. var n = Object.prototype.toString.call(o).slice(8, -1);
  13185. if (n === "Object" && o.constructor) n = o.constructor.name;
  13186. if (n === "Map" || n === "Set") return Array.from(o);
  13187. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _rollupPluginBabelHelpers_0c84a174_arrayLikeToArray(o, minLen);
  13188. }
  13189. function _rollupPluginBabelHelpers_0c84a174_arrayLikeToArray(arr, len) {
  13190. if (len == null || len > arr.length) len = arr.length;
  13191. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  13192. return arr2;
  13193. }
  13194. function _rollupPluginBabelHelpers_0c84a174_createForOfIteratorHelperLoose(o, allowArrayLike) {
  13195. var it;
  13196. if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
  13197. if (Array.isArray(o) || (it = _rollupPluginBabelHelpers_0c84a174_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  13198. if (it) o = it;
  13199. var i = 0;
  13200. return function () {
  13201. if (i >= o.length) return {
  13202. done: true
  13203. };
  13204. return {
  13205. done: false,
  13206. value: o[i++]
  13207. };
  13208. };
  13209. }
  13210. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  13211. }
  13212. it = o[Symbol.iterator]();
  13213. return it.next.bind(it);
  13214. }
  13215. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/SystemContext.js
  13216. var SystemContext = /*#__PURE__*/(0,external_React_.createContext)({});
  13217. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/useCreateElement.js
  13218. function isRenderProp(children) {
  13219. return typeof children === "function";
  13220. }
  13221. /**
  13222. * Custom hook that will call `children` if it's a function. If
  13223. * `useCreateElement` has been passed to the context, it'll be used instead.
  13224. *
  13225. * @example
  13226. * import React from "react";
  13227. * import { SystemProvider, useCreateElement } from "reakit-system";
  13228. *
  13229. * const system = {
  13230. * useCreateElement(type, props, children = props.children) {
  13231. * // very similar to what `useCreateElement` does already
  13232. * if (typeof children === "function") {
  13233. * const { children: _, ...rest } = props;
  13234. * return children(rest);
  13235. * }
  13236. * return React.createElement(type, props, children);
  13237. * },
  13238. * };
  13239. *
  13240. * function Component(props) {
  13241. * return useCreateElement("div", props);
  13242. * }
  13243. *
  13244. * function App() {
  13245. * return (
  13246. * <SystemProvider unstable_system={system}>
  13247. * <Component url="url">{({ url }) => <a href={url}>link</a>}</Component>
  13248. * </SystemProvider>
  13249. * );
  13250. * }
  13251. */
  13252. var useCreateElement = function useCreateElement(type, props, children) {
  13253. if (children === void 0) {
  13254. children = props.children;
  13255. }
  13256. var context = (0,external_React_.useContext)(SystemContext);
  13257. if (context.useCreateElement) {
  13258. return context.useCreateElement(type, props, children);
  13259. }
  13260. if (typeof type === "string" && isRenderProp(children)) {
  13261. var _ = props.children,
  13262. rest = _rollupPluginBabelHelpers_0c84a174_objectWithoutPropertiesLoose(props, ["children"]);
  13263. return children(rest);
  13264. }
  13265. return /*#__PURE__*/(0,external_React_.createElement)(type, props, children);
  13266. };
  13267. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/_rollupPluginBabelHelpers-1f0bf8c2.js
  13268. function _rollupPluginBabelHelpers_1f0bf8c2_defineProperty(obj, key, value) {
  13269. if (key in obj) {
  13270. Object.defineProperty(obj, key, {
  13271. value: value,
  13272. enumerable: true,
  13273. configurable: true,
  13274. writable: true
  13275. });
  13276. } else {
  13277. obj[key] = value;
  13278. }
  13279. return obj;
  13280. }
  13281. function _rollupPluginBabelHelpers_1f0bf8c2_ownKeys(object, enumerableOnly) {
  13282. var keys = Object.keys(object);
  13283. if (Object.getOwnPropertySymbols) {
  13284. var symbols = Object.getOwnPropertySymbols(object);
  13285. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  13286. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  13287. });
  13288. keys.push.apply(keys, symbols);
  13289. }
  13290. return keys;
  13291. }
  13292. function _rollupPluginBabelHelpers_1f0bf8c2_objectSpread2(target) {
  13293. for (var i = 1; i < arguments.length; i++) {
  13294. var source = arguments[i] != null ? arguments[i] : {};
  13295. if (i % 2) {
  13296. _rollupPluginBabelHelpers_1f0bf8c2_ownKeys(Object(source), true).forEach(function (key) {
  13297. _rollupPluginBabelHelpers_1f0bf8c2_defineProperty(target, key, source[key]);
  13298. });
  13299. } else if (Object.getOwnPropertyDescriptors) {
  13300. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  13301. } else {
  13302. _rollupPluginBabelHelpers_1f0bf8c2_ownKeys(Object(source)).forEach(function (key) {
  13303. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  13304. });
  13305. }
  13306. }
  13307. return target;
  13308. }
  13309. function es_rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(source, excluded) {
  13310. if (source == null) return {};
  13311. var target = {};
  13312. var sourceKeys = Object.keys(source);
  13313. var key, i;
  13314. for (i = 0; i < sourceKeys.length; i++) {
  13315. key = sourceKeys[i];
  13316. if (excluded.indexOf(key) >= 0) continue;
  13317. target[key] = source[key];
  13318. }
  13319. return target;
  13320. }
  13321. function _rollupPluginBabelHelpers_1f0bf8c2_unsupportedIterableToArray(o, minLen) {
  13322. if (!o) return;
  13323. if (typeof o === "string") return _rollupPluginBabelHelpers_1f0bf8c2_arrayLikeToArray(o, minLen);
  13324. var n = Object.prototype.toString.call(o).slice(8, -1);
  13325. if (n === "Object" && o.constructor) n = o.constructor.name;
  13326. if (n === "Map" || n === "Set") return Array.from(o);
  13327. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _rollupPluginBabelHelpers_1f0bf8c2_arrayLikeToArray(o, minLen);
  13328. }
  13329. function _rollupPluginBabelHelpers_1f0bf8c2_arrayLikeToArray(arr, len) {
  13330. if (len == null || len > arr.length) len = arr.length;
  13331. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  13332. return arr2;
  13333. }
  13334. function _rollupPluginBabelHelpers_1f0bf8c2_createForOfIteratorHelperLoose(o, allowArrayLike) {
  13335. var it;
  13336. if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
  13337. if (Array.isArray(o) || (it = _rollupPluginBabelHelpers_1f0bf8c2_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  13338. if (it) o = it;
  13339. var i = 0;
  13340. return function () {
  13341. if (i >= o.length) return {
  13342. done: true
  13343. };
  13344. return {
  13345. done: false,
  13346. value: o[i++]
  13347. };
  13348. };
  13349. }
  13350. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  13351. }
  13352. it = o[Symbol.iterator]();
  13353. return it.next.bind(it);
  13354. }
  13355. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isObject.js
  13356. /**
  13357. * Checks whether `arg` is an object or not.
  13358. *
  13359. * @returns {boolean}
  13360. */
  13361. function isObject_isObject(arg) {
  13362. return typeof arg === "object" && arg != null;
  13363. }
  13364. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isPlainObject.js
  13365. /**
  13366. * Checks whether `arg` is a plain object or not.
  13367. *
  13368. * @returns {boolean}
  13369. */
  13370. function isPlainObject(arg) {
  13371. var _proto$constructor;
  13372. if (!isObject_isObject(arg)) return false;
  13373. var proto = Object.getPrototypeOf(arg);
  13374. if (proto == null) return true;
  13375. return ((_proto$constructor = proto.constructor) === null || _proto$constructor === void 0 ? void 0 : _proto$constructor.toString()) === Object.toString();
  13376. }
  13377. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/splitProps.js
  13378. /**
  13379. * Splits an object (`props`) into a tuple where the first item is an object
  13380. * with the passed `keys`, and the second item is an object with these keys
  13381. * omitted.
  13382. *
  13383. * @deprecated will be removed in version 2
  13384. *
  13385. * @example
  13386. * import { splitProps } from "reakit-utils";
  13387. *
  13388. * splitProps({ a: "a", b: "b" }, ["a"]); // [{ a: "a" }, { b: "b" }]
  13389. */
  13390. function __deprecatedSplitProps(props, keys) {
  13391. var propsKeys = Object.keys(props);
  13392. var picked = {};
  13393. var omitted = {};
  13394. for (var _i = 0, _propsKeys = propsKeys; _i < _propsKeys.length; _i++) {
  13395. var key = _propsKeys[_i];
  13396. if (keys.indexOf(key) >= 0) {
  13397. picked[key] = props[key];
  13398. } else {
  13399. omitted[key] = props[key];
  13400. }
  13401. }
  13402. return [picked, omitted];
  13403. }
  13404. /**
  13405. * Splits an object (`props`) into a tuple where the first item
  13406. * is the `state` property, and the second item is the rest of the properties.
  13407. *
  13408. * It is also backward compatible with version 1. If `keys` are passed then
  13409. * splits an object (`props`) into a tuple where the first item is an object
  13410. * with the passed `keys`, and the second item is an object with these keys
  13411. * omitted.
  13412. *
  13413. * @example
  13414. * import { splitProps } from "reakit-utils";
  13415. *
  13416. * splitProps({ a: "a", b: "b" }, ["a"]); // [{ a: "a" }, { b: "b" }]
  13417. *
  13418. * @example
  13419. * import { splitProps } from "reakit-utils";
  13420. *
  13421. * splitProps({ state: { a: "a" }, b: "b" }); // [{ a: "a" }, { b: "b" }]
  13422. */
  13423. function splitProps(props, keys) {
  13424. if (keys === void 0) {
  13425. keys = [];
  13426. }
  13427. if (!isPlainObject(props.state)) {
  13428. return __deprecatedSplitProps(props, keys);
  13429. }
  13430. var _deprecatedSplitProp = __deprecatedSplitProps(props, [].concat(keys, ["state"])),
  13431. picked = _deprecatedSplitProp[0],
  13432. omitted = _deprecatedSplitProp[1];
  13433. var state = picked.state,
  13434. restPicked = es_rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(picked, ["state"]);
  13435. return [_rollupPluginBabelHelpers_1f0bf8c2_objectSpread2(_rollupPluginBabelHelpers_1f0bf8c2_objectSpread2({}, state), restPicked), omitted];
  13436. }
  13437. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/shallowEqual.js
  13438. /**
  13439. * Compares two objects.
  13440. *
  13441. * @example
  13442. * import { shallowEqual } from "reakit-utils";
  13443. *
  13444. * shallowEqual({ a: "a" }, {}); // false
  13445. * shallowEqual({ a: "a" }, { b: "b" }); // false
  13446. * shallowEqual({ a: "a" }, { a: "a" }); // true
  13447. * shallowEqual({ a: "a" }, { a: "a", b: "b" }); // false
  13448. */
  13449. function shallowEqual(objA, objB) {
  13450. if (objA === objB) return true;
  13451. if (!objA) return false;
  13452. if (!objB) return false;
  13453. if (typeof objA !== "object") return false;
  13454. if (typeof objB !== "object") return false;
  13455. var aKeys = Object.keys(objA);
  13456. var bKeys = Object.keys(objB);
  13457. var length = aKeys.length;
  13458. if (bKeys.length !== length) return false;
  13459. for (var _i = 0, _aKeys = aKeys; _i < _aKeys.length; _i++) {
  13460. var key = _aKeys[_i];
  13461. if (objA[key] !== objB[key]) {
  13462. return false;
  13463. }
  13464. }
  13465. return true;
  13466. }
  13467. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/normalizePropsAreEqual.js
  13468. /**
  13469. * This higher order functions take `propsAreEqual` function and
  13470. * returns a new function which normalizes the props.
  13471. *
  13472. * Normalizing in our case is making sure the `propsAreEqual` works with
  13473. * both version 1 (object spreading) and version 2 (state object) state passing.
  13474. *
  13475. * To achieve this, the returned function in case of a state object
  13476. * will spread the state object in both `prev` and `next props.
  13477. *
  13478. * Other case it just returns the function as is which makes sure
  13479. * that we are still backward compatible
  13480. */
  13481. function normalizePropsAreEqual(propsAreEqual) {
  13482. if (propsAreEqual.name === "normalizePropsAreEqualInner") {
  13483. return propsAreEqual;
  13484. }
  13485. return function normalizePropsAreEqualInner(prev, next) {
  13486. if (!isPlainObject(prev.state) || !isPlainObject(next.state)) {
  13487. return propsAreEqual(prev, next);
  13488. }
  13489. return propsAreEqual(_rollupPluginBabelHelpers_1f0bf8c2_objectSpread2(_rollupPluginBabelHelpers_1f0bf8c2_objectSpread2({}, prev.state), prev), _rollupPluginBabelHelpers_1f0bf8c2_objectSpread2(_rollupPluginBabelHelpers_1f0bf8c2_objectSpread2({}, next.state), next));
  13490. };
  13491. }
  13492. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/createComponent.js
  13493. function createComponent_forwardRef(component) {
  13494. return /*#__PURE__*/(0,external_React_.forwardRef)(component);
  13495. }
  13496. function memo(component, propsAreEqual) {
  13497. return /*#__PURE__*/(0,external_React_.memo)(component, propsAreEqual);
  13498. }
  13499. /**
  13500. * Creates a React component.
  13501. *
  13502. * @example
  13503. * import { createComponent } from "reakit-system";
  13504. *
  13505. * const A = createComponent({ as: "a" });
  13506. *
  13507. * @param options
  13508. */
  13509. function createComponent(_ref) {
  13510. var type = _ref.as,
  13511. useHook = _ref.useHook,
  13512. shouldMemo = _ref.memo,
  13513. _ref$propsAreEqual = _ref.propsAreEqual,
  13514. propsAreEqual = _ref$propsAreEqual === void 0 ? useHook === null || useHook === void 0 ? void 0 : useHook.unstable_propsAreEqual : _ref$propsAreEqual,
  13515. _ref$keys = _ref.keys,
  13516. keys = _ref$keys === void 0 ? (useHook === null || useHook === void 0 ? void 0 : useHook.__keys) || [] : _ref$keys,
  13517. _ref$useCreateElement = _ref.useCreateElement,
  13518. useCreateElement$1 = _ref$useCreateElement === void 0 ? useCreateElement : _ref$useCreateElement;
  13519. var Comp = function Comp(_ref2, ref) {
  13520. var _ref2$as = _ref2.as,
  13521. as = _ref2$as === void 0 ? type : _ref2$as,
  13522. props = _rollupPluginBabelHelpers_0c84a174_objectWithoutPropertiesLoose(_ref2, ["as"]);
  13523. if (useHook) {
  13524. var _as$render;
  13525. var _splitProps = splitProps(props, keys),
  13526. _options = _splitProps[0],
  13527. htmlProps = _splitProps[1];
  13528. var _useHook = useHook(_options, _rollupPluginBabelHelpers_0c84a174_objectSpread2({
  13529. ref: ref
  13530. }, htmlProps)),
  13531. wrapElement = _useHook.wrapElement,
  13532. elementProps = _rollupPluginBabelHelpers_0c84a174_objectWithoutPropertiesLoose(_useHook, ["wrapElement"]); // @ts-ignore
  13533. var asKeys = ((_as$render = as.render) === null || _as$render === void 0 ? void 0 : _as$render.__keys) || as.__keys;
  13534. var asOptions = asKeys && splitProps(props, asKeys)[0];
  13535. var allProps = asOptions ? _rollupPluginBabelHelpers_0c84a174_objectSpread2(_rollupPluginBabelHelpers_0c84a174_objectSpread2({}, elementProps), asOptions) : elementProps;
  13536. var _element = useCreateElement$1(as, allProps);
  13537. if (wrapElement) {
  13538. return wrapElement(_element);
  13539. }
  13540. return _element;
  13541. }
  13542. return useCreateElement$1(as, _rollupPluginBabelHelpers_0c84a174_objectSpread2({
  13543. ref: ref
  13544. }, props));
  13545. };
  13546. if (false) {}
  13547. Comp = createComponent_forwardRef(Comp);
  13548. if (shouldMemo) {
  13549. Comp = memo(Comp, propsAreEqual && normalizePropsAreEqual(propsAreEqual));
  13550. }
  13551. Comp.__keys = keys;
  13552. Comp.unstable_propsAreEqual = normalizePropsAreEqual(propsAreEqual || shallowEqual);
  13553. return Comp;
  13554. }
  13555. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/useToken.js
  13556. /**
  13557. * React custom hook that returns the value of any token defined in the
  13558. * SystemContext. It's mainly used internally in [`useOptions`](#useoptions)
  13559. * and [`useProps`](#useprops).
  13560. *
  13561. * @example
  13562. * import { SystemProvider, useToken } from "reakit-system";
  13563. *
  13564. * const system = {
  13565. * token: "value",
  13566. * };
  13567. *
  13568. * function Component(props) {
  13569. * const token = useToken("token", "default value");
  13570. * return <div {...props}>{token}</div>;
  13571. * }
  13572. *
  13573. * function App() {
  13574. * return (
  13575. * <SystemProvider unstable_system={system}>
  13576. * <Component />
  13577. * </SystemProvider>
  13578. * );
  13579. * }
  13580. */
  13581. function useToken(token, defaultValue) {
  13582. (0,external_React_.useDebugValue)(token);
  13583. var context = (0,external_React_.useContext)(SystemContext);
  13584. return context[token] != null ? context[token] : defaultValue;
  13585. }
  13586. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/useProps.js
  13587. /**
  13588. * React custom hook that returns the props returned by a given
  13589. * `use${name}Props` in the SystemContext.
  13590. *
  13591. * @example
  13592. * import { SystemProvider, useProps } from "reakit-system";
  13593. *
  13594. * const system = {
  13595. * useAProps(options, htmlProps) {
  13596. * return {
  13597. * ...htmlProps,
  13598. * href: options.url,
  13599. * };
  13600. * },
  13601. * };
  13602. *
  13603. * function A({ url, ...htmlProps }) {
  13604. * const props = useProps("A", { url }, htmlProps);
  13605. * return <a {...props} />;
  13606. * }
  13607. *
  13608. * function App() {
  13609. * return (
  13610. * <SystemProvider unstable_system={system}>
  13611. * <A url="url">It will convert url into href in useAProps</A>
  13612. * </SystemProvider>
  13613. * );
  13614. * }
  13615. */
  13616. function useProps(name, options, htmlProps) {
  13617. if (options === void 0) {
  13618. options = {};
  13619. }
  13620. if (htmlProps === void 0) {
  13621. htmlProps = {};
  13622. }
  13623. var hookName = "use" + name + "Props";
  13624. (0,external_React_.useDebugValue)(hookName);
  13625. var useHook = useToken(hookName);
  13626. if (useHook) {
  13627. return useHook(options, htmlProps);
  13628. }
  13629. return htmlProps;
  13630. }
  13631. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/useOptions.js
  13632. /**
  13633. * React custom hook that returns the options returned by a given
  13634. * `use${name}Options` in the SystemContext.
  13635. *
  13636. * @example
  13637. * import React from "react";
  13638. * import { SystemProvider, useOptions } from "reakit-system";
  13639. *
  13640. * const system = {
  13641. * useAOptions(options, htmlProps) {
  13642. * return {
  13643. * ...options,
  13644. * url: htmlProps.href,
  13645. * };
  13646. * },
  13647. * };
  13648. *
  13649. * function A({ url, ...htmlProps }) {
  13650. * const options = useOptions("A", { url }, htmlProps);
  13651. * return <a href={options.url} {...htmlProps} />;
  13652. * }
  13653. *
  13654. * function App() {
  13655. * return (
  13656. * <SystemProvider unstable_system={system}>
  13657. * <A href="url">
  13658. * It will convert href into url in useAOptions and then url into href in A
  13659. * </A>
  13660. * </SystemProvider>
  13661. * );
  13662. * }
  13663. */
  13664. function useOptions(name, options, htmlProps) {
  13665. if (options === void 0) {
  13666. options = {};
  13667. }
  13668. if (htmlProps === void 0) {
  13669. htmlProps = {};
  13670. }
  13671. var hookName = "use" + name + "Options";
  13672. (0,external_React_.useDebugValue)(hookName);
  13673. var useHook = useToken(hookName);
  13674. if (useHook) {
  13675. return _rollupPluginBabelHelpers_0c84a174_objectSpread2(_rollupPluginBabelHelpers_0c84a174_objectSpread2({}, options), useHook(options, htmlProps));
  13676. }
  13677. return options;
  13678. }
  13679. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/toArray.js
  13680. /**
  13681. * Transforms `arg` into an array if it's not already.
  13682. *
  13683. * @example
  13684. * import { toArray } from "reakit-utils";
  13685. *
  13686. * toArray("a"); // ["a"]
  13687. * toArray(["a"]); // ["a"]
  13688. */
  13689. function toArray(arg) {
  13690. if (Array.isArray(arg)) {
  13691. return arg;
  13692. }
  13693. return typeof arg !== "undefined" ? [arg] : [];
  13694. }
  13695. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/createHook.js
  13696. /**
  13697. * Creates a React custom hook that will return component props.
  13698. *
  13699. * @example
  13700. * import { createHook } from "reakit-system";
  13701. *
  13702. * const useA = createHook({
  13703. * name: "A",
  13704. * keys: ["url"], // custom props/options keys
  13705. * useProps(options, htmlProps) {
  13706. * return {
  13707. * ...htmlProps,
  13708. * href: options.url,
  13709. * };
  13710. * },
  13711. * });
  13712. *
  13713. * function A({ url, ...htmlProps }) {
  13714. * const props = useA({ url }, htmlProps);
  13715. * return <a {...props} />;
  13716. * }
  13717. *
  13718. * @param options
  13719. */
  13720. function createHook(options) {
  13721. var _options$useState, _composedHooks$;
  13722. var composedHooks = toArray(options.compose);
  13723. var __useOptions = function __useOptions(hookOptions, htmlProps) {
  13724. // Call the current hook's useOptions first
  13725. if (options.useOptions) {
  13726. hookOptions = options.useOptions(hookOptions, htmlProps);
  13727. } // If there's name, call useOptions from the system context
  13728. if (options.name) {
  13729. hookOptions = useOptions(options.name, hookOptions, htmlProps);
  13730. } // Run composed hooks useOptions
  13731. if (options.compose) {
  13732. for (var _iterator = _rollupPluginBabelHelpers_0c84a174_createForOfIteratorHelperLoose(composedHooks), _step; !(_step = _iterator()).done;) {
  13733. var hook = _step.value;
  13734. hookOptions = hook.__useOptions(hookOptions, htmlProps);
  13735. }
  13736. }
  13737. return hookOptions;
  13738. };
  13739. var useHook = function useHook(hookOptions, htmlProps, unstable_ignoreUseOptions) {
  13740. if (hookOptions === void 0) {
  13741. hookOptions = {};
  13742. }
  13743. if (htmlProps === void 0) {
  13744. htmlProps = {};
  13745. }
  13746. if (unstable_ignoreUseOptions === void 0) {
  13747. unstable_ignoreUseOptions = false;
  13748. }
  13749. // This won't execute when useHook was called from within another useHook
  13750. if (!unstable_ignoreUseOptions) {
  13751. hookOptions = __useOptions(hookOptions, htmlProps);
  13752. } // Call the current hook's useProps
  13753. if (options.useProps) {
  13754. htmlProps = options.useProps(hookOptions, htmlProps);
  13755. } // If there's name, call useProps from the system context
  13756. if (options.name) {
  13757. htmlProps = useProps(options.name, hookOptions, htmlProps);
  13758. }
  13759. if (options.compose) {
  13760. if (options.useComposeOptions) {
  13761. hookOptions = options.useComposeOptions(hookOptions, htmlProps);
  13762. }
  13763. if (options.useComposeProps) {
  13764. htmlProps = options.useComposeProps(hookOptions, htmlProps);
  13765. } else {
  13766. for (var _iterator2 = _rollupPluginBabelHelpers_0c84a174_createForOfIteratorHelperLoose(composedHooks), _step2; !(_step2 = _iterator2()).done;) {
  13767. var hook = _step2.value;
  13768. htmlProps = hook(hookOptions, htmlProps, true);
  13769. }
  13770. }
  13771. } // Remove undefined values from htmlProps
  13772. var finalHTMLProps = {};
  13773. var definedHTMLProps = htmlProps || {};
  13774. for (var prop in definedHTMLProps) {
  13775. if (definedHTMLProps[prop] !== undefined) {
  13776. finalHTMLProps[prop] = definedHTMLProps[prop];
  13777. }
  13778. }
  13779. return finalHTMLProps;
  13780. };
  13781. useHook.__useOptions = __useOptions;
  13782. var composedKeys = composedHooks.reduce(function (keys, hook) {
  13783. keys.push.apply(keys, hook.__keys || []);
  13784. return keys;
  13785. }, []); // It's used by createComponent to split option props (keys) and html props
  13786. useHook.__keys = [].concat(composedKeys, ((_options$useState = options.useState) === null || _options$useState === void 0 ? void 0 : _options$useState.__keys) || [], options.keys || []);
  13787. useHook.unstable_propsAreEqual = options.propsAreEqual || ((_composedHooks$ = composedHooks[0]) === null || _composedHooks$ === void 0 ? void 0 : _composedHooks$.unstable_propsAreEqual) || shallowEqual;
  13788. if (false) {}
  13789. return useHook;
  13790. }
  13791. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/useForkRef.js
  13792. // https://github.com/mui-org/material-ui/blob/2bcc874cf07b81202968f769cb9c2398c7c11311/packages/material-ui/src/utils/useForkRef.js
  13793. function setRef(ref, value) {
  13794. if (value === void 0) {
  13795. value = null;
  13796. }
  13797. if (!ref) return;
  13798. if (typeof ref === "function") {
  13799. ref(value);
  13800. } else {
  13801. ref.current = value;
  13802. }
  13803. }
  13804. /**
  13805. * Merges up to two React Refs into a single memoized function React Ref so you
  13806. * can pass it to an element.
  13807. *
  13808. * @example
  13809. * import React from "react";
  13810. * import { useForkRef } from "reakit-utils";
  13811. *
  13812. * const Component = React.forwardRef((props, ref) => {
  13813. * const internalRef = React.useRef();
  13814. * return <div {...props} ref={useForkRef(internalRef, ref)} />;
  13815. * });
  13816. */
  13817. function useForkRef(refA, refB) {
  13818. return (0,external_React_.useMemo)(function () {
  13819. if (refA == null && refB == null) {
  13820. return null;
  13821. }
  13822. return function (value) {
  13823. setRef(refA, value);
  13824. setRef(refB, value);
  13825. };
  13826. }, [refA, refB]);
  13827. }
  13828. ;// CONCATENATED MODULE: ./node_modules/reakit-warning/es/useWarning.js
  13829. function isRefObject(ref) {
  13830. return isObject(ref) && "current" in ref;
  13831. }
  13832. /**
  13833. * Logs `messages` to the console using `console.warn` based on a `condition`.
  13834. * This should be used inside components.
  13835. */
  13836. function useWarning(condition) {
  13837. for (var _len = arguments.length, messages = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  13838. messages[_key - 1] = arguments[_key];
  13839. }
  13840. if (false) {}
  13841. }
  13842. ;// CONCATENATED MODULE: ./node_modules/reakit-warning/es/index.js
  13843. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/getDocument.js
  13844. /**
  13845. * Returns `element.ownerDocument || document`.
  13846. */
  13847. function getDocument(element) {
  13848. return element ? element.ownerDocument || element : document;
  13849. }
  13850. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/getWindow.js
  13851. // Thanks to Fluent UI for doing the [research on IE11 memory leak](https://github.com/microsoft/fluentui/pull/9010#issuecomment-490768427)
  13852. var _window; // Note: Accessing "window" in IE11 is somewhat expensive, and calling "typeof window"
  13853. // hits a memory leak, whereas aliasing it and calling "typeof _window" does not.
  13854. // Caching the window value at the file scope lets us minimize the impact.
  13855. try {
  13856. _window = window;
  13857. } catch (e) {
  13858. /* no-op */
  13859. }
  13860. /**
  13861. * Returns `element.ownerDocument.defaultView || window`.
  13862. */
  13863. function getWindow(element) {
  13864. if (!element) {
  13865. return _window;
  13866. }
  13867. return getDocument(element).defaultView || _window;
  13868. }
  13869. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/canUseDOM.js
  13870. function checkIsBrowser() {
  13871. var _window = getWindow();
  13872. return Boolean(typeof _window !== "undefined" && _window.document && _window.document.createElement);
  13873. }
  13874. /**
  13875. * It's `true` if it is running in a browser environment or `false` if it is not (SSR).
  13876. *
  13877. * @example
  13878. * import { canUseDOM } from "reakit-utils";
  13879. *
  13880. * const title = canUseDOM ? document.title : "";
  13881. */
  13882. var canUseDOM = checkIsBrowser();
  13883. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/useIsomorphicEffect.js
  13884. /**
  13885. * `React.useLayoutEffect` that fallbacks to `React.useEffect` on server side
  13886. * rendering.
  13887. */
  13888. var useIsomorphicEffect = !canUseDOM ? external_React_.useEffect : external_React_.useLayoutEffect;
  13889. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/useLiveRef.js
  13890. /**
  13891. * A `React.Ref` that keeps track of the passed `value`.
  13892. */
  13893. function useLiveRef(value) {
  13894. var ref = (0,external_React_.useRef)(value);
  13895. useIsomorphicEffect(function () {
  13896. ref.current = value;
  13897. });
  13898. return ref;
  13899. }
  13900. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isSelfTarget.js
  13901. /**
  13902. * Returns `true` if `event.target` and `event.currentTarget` are the same.
  13903. */
  13904. function isSelfTarget(event) {
  13905. return event.target === event.currentTarget;
  13906. }
  13907. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/getActiveElement.js
  13908. /**
  13909. * Returns `element.ownerDocument.activeElement`.
  13910. */
  13911. function getActiveElement_getActiveElement(element) {
  13912. var _getDocument = getDocument(element),
  13913. activeElement = _getDocument.activeElement;
  13914. if (!(activeElement !== null && activeElement !== void 0 && activeElement.nodeName)) {
  13915. // In IE11, activeElement might be an empty object if we're interacting
  13916. // with elements inside of an iframe.
  13917. return null;
  13918. }
  13919. return activeElement;
  13920. }
  13921. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/contains.js
  13922. /**
  13923. * Similar to `Element.prototype.contains`, but a little bit faster when
  13924. * `element` is the same as `child`.
  13925. *
  13926. * @example
  13927. * import { contains } from "reakit-utils";
  13928. *
  13929. * contains(document.getElementById("parent"), document.getElementById("child"));
  13930. */
  13931. function contains(parent, child) {
  13932. return parent === child || parent.contains(child);
  13933. }
  13934. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/hasFocusWithin.js
  13935. /**
  13936. * Checks if `element` has focus within. Elements that are referenced by
  13937. * `aria-activedescendant` are also considered.
  13938. *
  13939. * @example
  13940. * import { hasFocusWithin } from "reakit-utils";
  13941. *
  13942. * hasFocusWithin(document.getElementById("id"));
  13943. */
  13944. function hasFocusWithin(element) {
  13945. var activeElement = getActiveElement_getActiveElement(element);
  13946. if (!activeElement) return false;
  13947. if (contains(element, activeElement)) return true;
  13948. var activeDescendant = activeElement.getAttribute("aria-activedescendant");
  13949. if (!activeDescendant) return false;
  13950. if (activeDescendant === element.id) return true;
  13951. return !!element.querySelector("#" + activeDescendant);
  13952. }
  13953. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isPortalEvent.js
  13954. /**
  13955. * Returns `true` if `event` has been fired within a React Portal element.
  13956. */
  13957. function isPortalEvent(event) {
  13958. return !contains(event.currentTarget, event.target);
  13959. }
  13960. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isButton.js
  13961. var buttonInputTypes = ["button", "color", "file", "image", "reset", "submit"];
  13962. /**
  13963. * Checks whether `element` is a native HTML button element.
  13964. *
  13965. * @example
  13966. * import { isButton } from "reakit-utils";
  13967. *
  13968. * isButton(document.querySelector("button")); // true
  13969. * isButton(document.querySelector("input[type='button']")); // true
  13970. * isButton(document.querySelector("div")); // false
  13971. * isButton(document.querySelector("input[type='text']")); // false
  13972. * isButton(document.querySelector("div[role='button']")); // false
  13973. *
  13974. * @returns {boolean}
  13975. */
  13976. function isButton(element) {
  13977. if (element.tagName === "BUTTON") return true;
  13978. if (element.tagName === "INPUT") {
  13979. var input = element;
  13980. return buttonInputTypes.indexOf(input.type) !== -1;
  13981. }
  13982. return false;
  13983. }
  13984. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/dom.js
  13985. /**
  13986. * Checks if a given string exists in the user agent string.
  13987. */
  13988. function isUA(string) {
  13989. if (!canUseDOM) return false;
  13990. return window.navigator.userAgent.indexOf(string) !== -1;
  13991. }
  13992. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/matches.js
  13993. /**
  13994. * Ponyfill for `Element.prototype.matches`
  13995. *
  13996. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
  13997. */
  13998. function matches(element, selectors) {
  13999. if ("matches" in element) {
  14000. return element.matches(selectors);
  14001. }
  14002. if ("msMatchesSelector" in element) {
  14003. return element.msMatchesSelector(selectors);
  14004. }
  14005. return element.webkitMatchesSelector(selectors);
  14006. }
  14007. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/tabbable.js
  14008. /** @module tabbable */
  14009. var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), " + "textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], " + "iframe, object, embed, area[href], audio[controls], video[controls], " + "[contenteditable]:not([contenteditable='false'])";
  14010. function isVisible(element) {
  14011. var htmlElement = element;
  14012. return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
  14013. }
  14014. function hasNegativeTabIndex(element) {
  14015. var tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
  14016. return tabIndex < 0;
  14017. }
  14018. /**
  14019. * Checks whether `element` is focusable or not.
  14020. *
  14021. * @memberof tabbable
  14022. *
  14023. * @example
  14024. * import { isFocusable } from "reakit-utils";
  14025. *
  14026. * isFocusable(document.querySelector("input")); // true
  14027. * isFocusable(document.querySelector("input[tabindex='-1']")); // true
  14028. * isFocusable(document.querySelector("input[hidden]")); // false
  14029. * isFocusable(document.querySelector("input:disabled")); // false
  14030. */
  14031. function isFocusable(element) {
  14032. return matches(element, selector) && isVisible(element);
  14033. }
  14034. /**
  14035. * Checks whether `element` is tabbable or not.
  14036. *
  14037. * @memberof tabbable
  14038. *
  14039. * @example
  14040. * import { isTabbable } from "reakit-utils";
  14041. *
  14042. * isTabbable(document.querySelector("input")); // true
  14043. * isTabbable(document.querySelector("input[tabindex='-1']")); // false
  14044. * isTabbable(document.querySelector("input[hidden]")); // false
  14045. * isTabbable(document.querySelector("input:disabled")); // false
  14046. */
  14047. function isTabbable(element) {
  14048. return isFocusable(element) && !hasNegativeTabIndex(element);
  14049. }
  14050. /**
  14051. * Returns all the focusable elements in `container`.
  14052. *
  14053. * @memberof tabbable
  14054. *
  14055. * @param {Element} container
  14056. *
  14057. * @returns {Element[]}
  14058. */
  14059. function getAllFocusableIn(container) {
  14060. var allFocusable = Array.from(container.querySelectorAll(selector));
  14061. allFocusable.unshift(container);
  14062. return allFocusable.filter(isFocusable);
  14063. }
  14064. /**
  14065. * Returns the first focusable element in `container`.
  14066. *
  14067. * @memberof tabbable
  14068. *
  14069. * @param {Element} container
  14070. *
  14071. * @returns {Element|null}
  14072. */
  14073. function getFirstFocusableIn(container) {
  14074. var _getAllFocusableIn = getAllFocusableIn(container),
  14075. first = _getAllFocusableIn[0];
  14076. return first || null;
  14077. }
  14078. /**
  14079. * Returns all the tabbable elements in `container`, including the container
  14080. * itself.
  14081. *
  14082. * @memberof tabbable
  14083. *
  14084. * @param {Element} container
  14085. * @param fallbackToFocusable If `true`, it'll return focusable elements if there are no tabbable ones.
  14086. *
  14087. * @returns {Element[]}
  14088. */
  14089. function getAllTabbableIn(container, fallbackToFocusable) {
  14090. var allFocusable = Array.from(container.querySelectorAll(selector));
  14091. var allTabbable = allFocusable.filter(isTabbable);
  14092. if (isTabbable(container)) {
  14093. allTabbable.unshift(container);
  14094. }
  14095. if (!allTabbable.length && fallbackToFocusable) {
  14096. return allFocusable;
  14097. }
  14098. return allTabbable;
  14099. }
  14100. /**
  14101. * Returns the first tabbable element in `container`, including the container
  14102. * itself if it's tabbable.
  14103. *
  14104. * @memberof tabbable
  14105. *
  14106. * @param {Element} container
  14107. * @param fallbackToFocusable If `true`, it'll return the first focusable element if there are no tabbable ones.
  14108. *
  14109. * @returns {Element|null}
  14110. */
  14111. function getFirstTabbableIn(container, fallbackToFocusable) {
  14112. var _getAllTabbableIn = getAllTabbableIn(container, fallbackToFocusable),
  14113. first = _getAllTabbableIn[0];
  14114. return first || null;
  14115. }
  14116. /**
  14117. * Returns the last tabbable element in `container`, including the container
  14118. * itself if it's tabbable.
  14119. *
  14120. * @memberof tabbable
  14121. *
  14122. * @param {Element} container
  14123. * @param fallbackToFocusable If `true`, it'll return the last focusable element if there are no tabbable ones.
  14124. *
  14125. * @returns {Element|null}
  14126. */
  14127. function getLastTabbableIn(container, fallbackToFocusable) {
  14128. var allTabbable = getAllTabbableIn(container, fallbackToFocusable);
  14129. return allTabbable[allTabbable.length - 1] || null;
  14130. }
  14131. /**
  14132. * Returns the next tabbable element in `container`.
  14133. *
  14134. * @memberof tabbable
  14135. *
  14136. * @param {Element} container
  14137. * @param fallbackToFocusable If `true`, it'll return the next focusable element if there are no tabbable ones.
  14138. *
  14139. * @returns {Element|null}
  14140. */
  14141. function getNextTabbableIn(container, fallbackToFocusable) {
  14142. var activeElement = getActiveElement(container);
  14143. var allFocusable = getAllFocusableIn(container);
  14144. var index = allFocusable.indexOf(activeElement);
  14145. var slice = allFocusable.slice(index + 1);
  14146. return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);
  14147. }
  14148. /**
  14149. * Returns the previous tabbable element in `container`.
  14150. *
  14151. * @memberof tabbable
  14152. *
  14153. * @param {Element} container
  14154. * @param fallbackToFocusable If `true`, it'll return the previous focusable element if there are no tabbable ones.
  14155. *
  14156. * @returns {Element|null}
  14157. */
  14158. function getPreviousTabbableIn(container, fallbackToFocusable) {
  14159. var activeElement = getActiveElement(container);
  14160. var allFocusable = getAllFocusableIn(container).reverse();
  14161. var index = allFocusable.indexOf(activeElement);
  14162. var slice = allFocusable.slice(index + 1);
  14163. return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);
  14164. }
  14165. /**
  14166. * Returns the closest focusable element.
  14167. *
  14168. * @memberof tabbable
  14169. *
  14170. * @param {Element} container
  14171. *
  14172. * @returns {Element|null}
  14173. */
  14174. function getClosestFocusable(element) {
  14175. while (element && !isFocusable(element)) {
  14176. element = closest(element, selector);
  14177. }
  14178. return element;
  14179. }
  14180. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Role/Role.js
  14181. // Automatically generated
  14182. var ROLE_KEYS = ["unstable_system"];
  14183. var useRole = createHook({
  14184. name: "Role",
  14185. keys: ROLE_KEYS,
  14186. propsAreEqual: function propsAreEqual(prev, next) {
  14187. var prevSystem = prev.unstable_system,
  14188. prevProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(prev, ["unstable_system"]);
  14189. var nextSystem = next.unstable_system,
  14190. nextProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(next, ["unstable_system"]);
  14191. if (prevSystem !== nextSystem && !shallowEqual(prevSystem, nextSystem)) {
  14192. return false;
  14193. }
  14194. return shallowEqual(prevProps, nextProps);
  14195. }
  14196. });
  14197. var Role = createComponent({
  14198. as: "div",
  14199. useHook: useRole
  14200. });
  14201. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Tabbable/Tabbable.js
  14202. // Automatically generated
  14203. var TABBABLE_KEYS = ["disabled", "focusable"];
  14204. var isSafariOrFirefoxOnMac = isUA("Mac") && !isUA("Chrome") && (isUA("Safari") || isUA("Firefox"));
  14205. function focusIfNeeded(element) {
  14206. if (!hasFocusWithin(element) && isFocusable(element)) {
  14207. element.focus();
  14208. }
  14209. }
  14210. function isNativeTabbable(element) {
  14211. return ["BUTTON", "INPUT", "SELECT", "TEXTAREA", "A"].includes(element.tagName);
  14212. }
  14213. function supportsDisabledAttribute(element) {
  14214. return ["BUTTON", "INPUT", "SELECT", "TEXTAREA"].includes(element.tagName);
  14215. }
  14216. function getTabIndex(trulyDisabled, nativeTabbable, supportsDisabled, htmlTabIndex) {
  14217. if (trulyDisabled) {
  14218. if (nativeTabbable && !supportsDisabled) {
  14219. // Anchor, audio and video tags don't support the `disabled` attribute.
  14220. // We must pass tabIndex={-1} so they don't receive focus on tab.
  14221. return -1;
  14222. } // Elements that support the `disabled` attribute don't need tabIndex.
  14223. return undefined;
  14224. }
  14225. if (nativeTabbable) {
  14226. // If the element is enabled and it's natively tabbable, we don't need to
  14227. // specify a tabIndex attribute unless it's explicitly set by the user.
  14228. return htmlTabIndex;
  14229. } // If the element is enabled and is not natively tabbable, we have to
  14230. // fallback tabIndex={0}.
  14231. return htmlTabIndex || 0;
  14232. }
  14233. function useDisableEvent(htmlEventRef, disabled) {
  14234. return (0,external_React_.useCallback)(function (event) {
  14235. var _htmlEventRef$current;
  14236. (_htmlEventRef$current = htmlEventRef.current) === null || _htmlEventRef$current === void 0 ? void 0 : _htmlEventRef$current.call(htmlEventRef, event);
  14237. if (event.defaultPrevented) return;
  14238. if (disabled) {
  14239. event.stopPropagation();
  14240. event.preventDefault();
  14241. }
  14242. }, [htmlEventRef, disabled]);
  14243. }
  14244. var useTabbable = createHook({
  14245. name: "Tabbable",
  14246. compose: useRole,
  14247. keys: TABBABLE_KEYS,
  14248. useOptions: function useOptions(options, _ref) {
  14249. var disabled = _ref.disabled;
  14250. return _objectSpread2({
  14251. disabled: disabled
  14252. }, options);
  14253. },
  14254. useProps: function useProps(options, _ref2) {
  14255. var htmlRef = _ref2.ref,
  14256. htmlTabIndex = _ref2.tabIndex,
  14257. htmlOnClickCapture = _ref2.onClickCapture,
  14258. htmlOnMouseDownCapture = _ref2.onMouseDownCapture,
  14259. htmlOnMouseDown = _ref2.onMouseDown,
  14260. htmlOnKeyPressCapture = _ref2.onKeyPressCapture,
  14261. htmlStyle = _ref2.style,
  14262. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref2, ["ref", "tabIndex", "onClickCapture", "onMouseDownCapture", "onMouseDown", "onKeyPressCapture", "style"]);
  14263. var ref = (0,external_React_.useRef)(null);
  14264. var onClickCaptureRef = useLiveRef(htmlOnClickCapture);
  14265. var onMouseDownCaptureRef = useLiveRef(htmlOnMouseDownCapture);
  14266. var onMouseDownRef = useLiveRef(htmlOnMouseDown);
  14267. var onKeyPressCaptureRef = useLiveRef(htmlOnKeyPressCapture);
  14268. var trulyDisabled = !!options.disabled && !options.focusable;
  14269. var _React$useState = (0,external_React_.useState)(true),
  14270. nativeTabbable = _React$useState[0],
  14271. setNativeTabbable = _React$useState[1];
  14272. var _React$useState2 = (0,external_React_.useState)(true),
  14273. supportsDisabled = _React$useState2[0],
  14274. setSupportsDisabled = _React$useState2[1];
  14275. var style = options.disabled ? _objectSpread2({
  14276. pointerEvents: "none"
  14277. }, htmlStyle) : htmlStyle;
  14278. useIsomorphicEffect(function () {
  14279. var tabbable = ref.current;
  14280. if (!tabbable) {
  14281. false ? 0 : void 0;
  14282. return;
  14283. }
  14284. if (!isNativeTabbable(tabbable)) {
  14285. setNativeTabbable(false);
  14286. }
  14287. if (!supportsDisabledAttribute(tabbable)) {
  14288. setSupportsDisabled(false);
  14289. }
  14290. }, []);
  14291. var onClickCapture = useDisableEvent(onClickCaptureRef, options.disabled);
  14292. var onMouseDownCapture = useDisableEvent(onMouseDownCaptureRef, options.disabled);
  14293. var onKeyPressCapture = useDisableEvent(onKeyPressCaptureRef, options.disabled);
  14294. var onMouseDown = (0,external_React_.useCallback)(function (event) {
  14295. var _onMouseDownRef$curre;
  14296. (_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event);
  14297. var element = event.currentTarget;
  14298. if (event.defaultPrevented) return; // Safari and Firefox on MacOS don't focus on buttons on mouse down
  14299. // like other browsers/platforms. Instead, they focus on the closest
  14300. // focusable ancestor element, which is ultimately the body element. So
  14301. // we make sure to give focus to the tabbable element on mouse down so
  14302. // it works consistently across browsers.
  14303. if (!isSafariOrFirefoxOnMac) return;
  14304. if (isPortalEvent(event)) return;
  14305. if (!isButton(element)) return; // We can't focus right away after on mouse down, otherwise it would
  14306. // prevent drag events from happening. So we schedule the focus to the
  14307. // next animation frame.
  14308. var raf = requestAnimationFrame(function () {
  14309. element.removeEventListener("mouseup", focusImmediately, true);
  14310. focusIfNeeded(element);
  14311. }); // If mouseUp happens before the next animation frame (which is common
  14312. // on touch screens or by just tapping the trackpad on MacBook's), we
  14313. // cancel the animation frame and immediately focus on the element.
  14314. var focusImmediately = function focusImmediately() {
  14315. cancelAnimationFrame(raf);
  14316. focusIfNeeded(element);
  14317. }; // By listening to the event in the capture phase, we make sure the
  14318. // focus event is fired before the onMouseUp and onMouseUpCapture React
  14319. // events, which is aligned with the default browser behavior.
  14320. element.addEventListener("mouseup", focusImmediately, {
  14321. once: true,
  14322. capture: true
  14323. });
  14324. }, []);
  14325. return _objectSpread2({
  14326. ref: useForkRef(ref, htmlRef),
  14327. style: style,
  14328. tabIndex: getTabIndex(trulyDisabled, nativeTabbable, supportsDisabled, htmlTabIndex),
  14329. disabled: trulyDisabled && supportsDisabled ? true : undefined,
  14330. "aria-disabled": options.disabled ? true : undefined,
  14331. onClickCapture: onClickCapture,
  14332. onMouseDownCapture: onMouseDownCapture,
  14333. onMouseDown: onMouseDown,
  14334. onKeyPressCapture: onKeyPressCapture
  14335. }, htmlProps);
  14336. }
  14337. });
  14338. var Tabbable = createComponent({
  14339. as: "div",
  14340. useHook: useTabbable
  14341. });
  14342. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Clickable/Clickable.js
  14343. // Automatically generated
  14344. var CLICKABLE_KEYS = ["unstable_clickOnEnter", "unstable_clickOnSpace"];
  14345. function isNativeClick(event) {
  14346. var element = event.currentTarget;
  14347. if (!event.isTrusted) return false; // istanbul ignore next: can't test trusted events yet
  14348. return isButton(element) || element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "A" || element.tagName === "SELECT";
  14349. }
  14350. var useClickable = createHook({
  14351. name: "Clickable",
  14352. compose: useTabbable,
  14353. keys: CLICKABLE_KEYS,
  14354. useOptions: function useOptions(_ref) {
  14355. var _ref$unstable_clickOn = _ref.unstable_clickOnEnter,
  14356. unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? true : _ref$unstable_clickOn,
  14357. _ref$unstable_clickOn2 = _ref.unstable_clickOnSpace,
  14358. unstable_clickOnSpace = _ref$unstable_clickOn2 === void 0 ? true : _ref$unstable_clickOn2,
  14359. options = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["unstable_clickOnEnter", "unstable_clickOnSpace"]);
  14360. return _objectSpread2({
  14361. unstable_clickOnEnter: unstable_clickOnEnter,
  14362. unstable_clickOnSpace: unstable_clickOnSpace
  14363. }, options);
  14364. },
  14365. useProps: function useProps(options, _ref2) {
  14366. var htmlOnKeyDown = _ref2.onKeyDown,
  14367. htmlOnKeyUp = _ref2.onKeyUp,
  14368. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref2, ["onKeyDown", "onKeyUp"]);
  14369. var _React$useState = (0,external_React_.useState)(false),
  14370. active = _React$useState[0],
  14371. setActive = _React$useState[1];
  14372. var onKeyDownRef = useLiveRef(htmlOnKeyDown);
  14373. var onKeyUpRef = useLiveRef(htmlOnKeyUp);
  14374. var onKeyDown = (0,external_React_.useCallback)(function (event) {
  14375. var _onKeyDownRef$current;
  14376. (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
  14377. if (event.defaultPrevented) return;
  14378. if (options.disabled) return;
  14379. if (event.metaKey) return;
  14380. if (!isSelfTarget(event)) return;
  14381. var isEnter = options.unstable_clickOnEnter && event.key === "Enter";
  14382. var isSpace = options.unstable_clickOnSpace && event.key === " ";
  14383. if (isEnter || isSpace) {
  14384. if (isNativeClick(event)) return;
  14385. event.preventDefault();
  14386. if (isEnter) {
  14387. event.currentTarget.click();
  14388. } else if (isSpace) {
  14389. setActive(true);
  14390. }
  14391. }
  14392. }, [options.disabled, options.unstable_clickOnEnter, options.unstable_clickOnSpace]);
  14393. var onKeyUp = (0,external_React_.useCallback)(function (event) {
  14394. var _onKeyUpRef$current;
  14395. (_onKeyUpRef$current = onKeyUpRef.current) === null || _onKeyUpRef$current === void 0 ? void 0 : _onKeyUpRef$current.call(onKeyUpRef, event);
  14396. if (event.defaultPrevented) return;
  14397. if (options.disabled) return;
  14398. if (event.metaKey) return;
  14399. var isSpace = options.unstable_clickOnSpace && event.key === " ";
  14400. if (active && isSpace) {
  14401. setActive(false);
  14402. event.currentTarget.click();
  14403. }
  14404. }, [options.disabled, options.unstable_clickOnSpace, active]);
  14405. return _objectSpread2({
  14406. "data-active": active || undefined,
  14407. onKeyDown: onKeyDown,
  14408. onKeyUp: onKeyUp
  14409. }, htmlProps);
  14410. }
  14411. });
  14412. var Clickable = createComponent({
  14413. as: "button",
  14414. memo: true,
  14415. useHook: useClickable
  14416. });
  14417. ;// CONCATENATED MODULE: ./node_modules/reakit/es/getCurrentId-5aa9849e.js
  14418. function findFirstEnabledItem(items, excludeId) {
  14419. if (excludeId) {
  14420. return items.find(function (item) {
  14421. return !item.disabled && item.id !== excludeId;
  14422. });
  14423. }
  14424. return items.find(function (item) {
  14425. return !item.disabled;
  14426. });
  14427. }
  14428. function getCurrentId(options, passedId) {
  14429. var _findFirstEnabledItem;
  14430. if (passedId || passedId === null) {
  14431. return passedId;
  14432. }
  14433. if (options.currentId || options.currentId === null) {
  14434. return options.currentId;
  14435. }
  14436. return (_findFirstEnabledItem = findFirstEnabledItem(options.items || [])) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id;
  14437. }
  14438. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-6742f591.js
  14439. // Automatically generated
  14440. var COMPOSITE_STATE_KEYS = ["baseId", "unstable_idCountRef", "setBaseId", "unstable_virtual", "rtl", "orientation", "items", "groups", "currentId", "loop", "wrap", "shift", "unstable_moves", "unstable_hasActiveWidget", "unstable_includesBaseElement", "registerItem", "unregisterItem", "registerGroup", "unregisterGroup", "move", "next", "previous", "up", "down", "first", "last", "sort", "unstable_setVirtual", "setRTL", "setOrientation", "setCurrentId", "setLoop", "setWrap", "setShift", "reset", "unstable_setIncludesBaseElement", "unstable_setHasActiveWidget"];
  14441. var COMPOSITE_KEYS = COMPOSITE_STATE_KEYS;
  14442. var COMPOSITE_GROUP_KEYS = COMPOSITE_KEYS;
  14443. var COMPOSITE_ITEM_KEYS = COMPOSITE_GROUP_KEYS;
  14444. var COMPOSITE_ITEM_WIDGET_KEYS = (/* unused pure expression or super */ null && (COMPOSITE_ITEM_KEYS));
  14445. ;// CONCATENATED MODULE: ./node_modules/reakit/es/userFocus-e16425e3.js
  14446. function userFocus(element) {
  14447. element.userFocus = true;
  14448. element.focus();
  14449. element.userFocus = false;
  14450. }
  14451. function hasUserFocus(element) {
  14452. return !!element.userFocus;
  14453. }
  14454. function setUserFocus(element, value) {
  14455. element.userFocus = value;
  14456. }
  14457. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isTextField.js
  14458. /**
  14459. * Check whether the given element is a text field, where text field is defined
  14460. * by the ability to select within the input, or that it is contenteditable.
  14461. *
  14462. * @example
  14463. * import { isTextField } from "reakit-utils";
  14464. *
  14465. * isTextField(document.querySelector("div")); // false
  14466. * isTextField(document.querySelector("input")); // true
  14467. * isTextField(document.querySelector("input[type='button']")); // false
  14468. * isTextField(document.querySelector("textarea")); // true
  14469. * isTextField(document.querySelector("div[contenteditable='true']")); // true
  14470. */
  14471. function isTextField(element) {
  14472. try {
  14473. var isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
  14474. var isTextArea = element.tagName === "TEXTAREA";
  14475. var isContentEditable = element.contentEditable === "true";
  14476. return isTextInput || isTextArea || isContentEditable || false;
  14477. } catch (error) {
  14478. // Safari throws an exception when trying to get `selectionStart`
  14479. // on non-text <input> elements (which, understandably, don't
  14480. // have the text selection API). We catch this via a try/catch
  14481. // block, as opposed to a more explicit check of the element's
  14482. // input types, because of Safari's non-standard behavior. This
  14483. // also means we don't have to worry about the list of input
  14484. // types that support `selectionStart` changing as the HTML spec
  14485. // evolves over time.
  14486. return false;
  14487. }
  14488. }
  14489. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/hasFocus.js
  14490. /**
  14491. * Checks if `element` has focus. Elements that are referenced by
  14492. * `aria-activedescendant` are also considered.
  14493. *
  14494. * @example
  14495. * import { hasFocus } from "reakit-utils";
  14496. *
  14497. * hasFocus(document.getElementById("id"));
  14498. */
  14499. function hasFocus(element) {
  14500. var activeElement = getActiveElement_getActiveElement(element);
  14501. if (!activeElement) return false;
  14502. if (activeElement === element) return true;
  14503. var activeDescendant = activeElement.getAttribute("aria-activedescendant");
  14504. if (!activeDescendant) return false;
  14505. return activeDescendant === element.id;
  14506. }
  14507. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/ensureFocus.js
  14508. /**
  14509. * Ensures `element` will receive focus if it's not already.
  14510. *
  14511. * @example
  14512. * import { ensureFocus } from "reakit-utils";
  14513. *
  14514. * ensureFocus(document.activeElement); // does nothing
  14515. *
  14516. * const element = document.querySelector("input");
  14517. *
  14518. * ensureFocus(element); // focuses element
  14519. * ensureFocus(element, { preventScroll: true }); // focuses element preventing scroll jump
  14520. *
  14521. * function isActive(el) {
  14522. * return el.dataset.active === "true";
  14523. * }
  14524. *
  14525. * ensureFocus(document.querySelector("[data-active='true']"), { isActive }); // does nothing
  14526. *
  14527. * @returns {number} `requestAnimationFrame` call ID so it can be passed to `cancelAnimationFrame` if needed.
  14528. */
  14529. function ensureFocus(element, _temp) {
  14530. var _ref = _temp === void 0 ? {} : _temp,
  14531. preventScroll = _ref.preventScroll,
  14532. _ref$isActive = _ref.isActive,
  14533. isActive = _ref$isActive === void 0 ? hasFocus : _ref$isActive;
  14534. if (isActive(element)) return -1;
  14535. element.focus({
  14536. preventScroll: preventScroll
  14537. });
  14538. if (isActive(element)) return -1;
  14539. return requestAnimationFrame(function () {
  14540. element.focus({
  14541. preventScroll: preventScroll
  14542. });
  14543. });
  14544. }
  14545. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Id/IdProvider.js
  14546. var defaultPrefix = "id";
  14547. function generateRandomString(prefix) {
  14548. if (prefix === void 0) {
  14549. prefix = defaultPrefix;
  14550. }
  14551. return "" + (prefix ? prefix + "-" : "") + Math.random().toString(32).substr(2, 6);
  14552. }
  14553. var unstable_IdContext = /*#__PURE__*/(0,external_React_.createContext)(generateRandomString);
  14554. function unstable_IdProvider(_ref) {
  14555. var children = _ref.children,
  14556. _ref$prefix = _ref.prefix,
  14557. prefix = _ref$prefix === void 0 ? defaultPrefix : _ref$prefix;
  14558. var count = useRef(0);
  14559. var generateId = useCallback(function (localPrefix) {
  14560. if (localPrefix === void 0) {
  14561. localPrefix = prefix;
  14562. }
  14563. return "" + (localPrefix ? localPrefix + "-" : "") + ++count.current;
  14564. }, [prefix]);
  14565. return /*#__PURE__*/createElement(unstable_IdContext.Provider, {
  14566. value: generateId
  14567. }, children);
  14568. }
  14569. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Id/Id.js
  14570. // Automatically generated
  14571. var ID_STATE_KEYS = ["baseId", "unstable_idCountRef", "setBaseId"];
  14572. var ID_KEYS = [].concat(ID_STATE_KEYS, ["id"]);
  14573. var unstable_useId = createHook({
  14574. keys: ID_KEYS,
  14575. useOptions: function useOptions(options, htmlProps) {
  14576. var generateId = (0,external_React_.useContext)(unstable_IdContext);
  14577. var _React$useState = (0,external_React_.useState)(function () {
  14578. // This comes from useIdState
  14579. if (options.unstable_idCountRef) {
  14580. options.unstable_idCountRef.current += 1;
  14581. return "-" + options.unstable_idCountRef.current;
  14582. } // If there's no useIdState, we check if `baseId` was passed (as a prop,
  14583. // not from useIdState).
  14584. if (options.baseId) {
  14585. return "-" + generateId("");
  14586. }
  14587. return "";
  14588. }),
  14589. suffix = _React$useState[0]; // `baseId` will be the prop passed directly as a prop or via useIdState.
  14590. // If there's neither, then it'll fallback to Context's generateId.
  14591. // This generateId can result in a sequential ID (if there's a Provider)
  14592. // or a random string (without Provider).
  14593. var baseId = (0,external_React_.useMemo)(function () {
  14594. return options.baseId || generateId();
  14595. }, [options.baseId, generateId]);
  14596. var id = htmlProps.id || options.id || "" + baseId + suffix;
  14597. return _objectSpread2(_objectSpread2({}, options), {}, {
  14598. id: id
  14599. });
  14600. },
  14601. useProps: function useProps(options, htmlProps) {
  14602. return _objectSpread2({
  14603. id: options.id
  14604. }, htmlProps);
  14605. }
  14606. });
  14607. var unstable_Id = createComponent({
  14608. as: "div",
  14609. useHook: unstable_useId
  14610. });
  14611. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/createEvent.js
  14612. /**
  14613. * Creates an `Event` in a way that also works on IE 11.
  14614. *
  14615. * @example
  14616. * import { createEvent } from "reakit-utils";
  14617. *
  14618. * const el = document.getElementById("id");
  14619. * el.dispatchEvent(createEvent(el, "blur", { bubbles: false }));
  14620. */
  14621. function createEvent(element, type, eventInit) {
  14622. if (typeof Event === "function") {
  14623. return new Event(type, eventInit);
  14624. } // IE 11 doesn't support Event constructors
  14625. var event = getDocument(element).createEvent("Event");
  14626. event.initEvent(type, eventInit === null || eventInit === void 0 ? void 0 : eventInit.bubbles, eventInit === null || eventInit === void 0 ? void 0 : eventInit.cancelable);
  14627. return event;
  14628. }
  14629. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/fireEvent.js
  14630. /**
  14631. * Creates and dispatches `Event` in a way that also works on IE 11.
  14632. *
  14633. * @example
  14634. * import { fireEvent } from "reakit-utils";
  14635. *
  14636. * fireEvent(document.getElementById("id"), "blur", {
  14637. * bubbles: true,
  14638. * cancelable: true,
  14639. * });
  14640. */
  14641. function fireEvent(element, type, eventInit) {
  14642. return element.dispatchEvent(createEvent(element, type, eventInit));
  14643. }
  14644. ;// CONCATENATED MODULE: ./node_modules/reakit/es/setTextFieldValue-0a221f4e.js
  14645. function setTextFieldValue(element, value) {
  14646. if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {
  14647. var _Object$getOwnPropert;
  14648. var proto = Object.getPrototypeOf(element);
  14649. var setValue = (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(proto, "value")) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.set;
  14650. if (setValue) {
  14651. setValue.call(element, value);
  14652. fireEvent(element, "input", {
  14653. bubbles: true
  14654. });
  14655. }
  14656. }
  14657. }
  14658. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/CompositeItem.js
  14659. function getWidget(itemElement) {
  14660. return itemElement.querySelector("[data-composite-item-widget]");
  14661. }
  14662. function useItem(options) {
  14663. return (0,external_React_.useMemo)(function () {
  14664. var _options$items;
  14665. return (_options$items = options.items) === null || _options$items === void 0 ? void 0 : _options$items.find(function (item) {
  14666. return options.id && item.id === options.id;
  14667. });
  14668. }, [options.items, options.id]);
  14669. }
  14670. function targetIsAnotherItem(event, items) {
  14671. if (isSelfTarget(event)) return false;
  14672. for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
  14673. var item = _step.value;
  14674. if (item.ref.current === event.target) {
  14675. return true;
  14676. }
  14677. }
  14678. return false;
  14679. }
  14680. var useCompositeItem = createHook({
  14681. name: "CompositeItem",
  14682. compose: [useClickable, unstable_useId],
  14683. keys: COMPOSITE_ITEM_KEYS,
  14684. propsAreEqual: function propsAreEqual(prev, next) {
  14685. if (!next.id || prev.id !== next.id) {
  14686. return useClickable.unstable_propsAreEqual(prev, next);
  14687. }
  14688. var prevCurrentId = prev.currentId,
  14689. prevMoves = prev.unstable_moves,
  14690. prevProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(prev, ["currentId", "unstable_moves"]);
  14691. var nextCurrentId = next.currentId,
  14692. nextMoves = next.unstable_moves,
  14693. nextProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(next, ["currentId", "unstable_moves"]);
  14694. if (nextCurrentId !== prevCurrentId) {
  14695. if (next.id === nextCurrentId || next.id === prevCurrentId) {
  14696. return false;
  14697. }
  14698. } else if (prevMoves !== nextMoves) {
  14699. return false;
  14700. }
  14701. return useClickable.unstable_propsAreEqual(prevProps, nextProps);
  14702. },
  14703. useOptions: function useOptions(options) {
  14704. return _objectSpread2(_objectSpread2({}, options), {}, {
  14705. id: options.id,
  14706. currentId: getCurrentId(options),
  14707. unstable_clickOnSpace: options.unstable_hasActiveWidget ? false : options.unstable_clickOnSpace
  14708. });
  14709. },
  14710. useProps: function useProps(options, _ref) {
  14711. var _options$items2;
  14712. var htmlRef = _ref.ref,
  14713. _ref$tabIndex = _ref.tabIndex,
  14714. htmlTabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
  14715. htmlOnMouseDown = _ref.onMouseDown,
  14716. htmlOnFocus = _ref.onFocus,
  14717. htmlOnBlurCapture = _ref.onBlurCapture,
  14718. htmlOnKeyDown = _ref.onKeyDown,
  14719. htmlOnClick = _ref.onClick,
  14720. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["ref", "tabIndex", "onMouseDown", "onFocus", "onBlurCapture", "onKeyDown", "onClick"]);
  14721. var ref = (0,external_React_.useRef)(null);
  14722. var id = options.id;
  14723. var trulyDisabled = options.disabled && !options.focusable;
  14724. var isCurrentItem = options.currentId === id;
  14725. var isCurrentItemRef = useLiveRef(isCurrentItem);
  14726. var hasFocusedComposite = (0,external_React_.useRef)(false);
  14727. var item = useItem(options);
  14728. var onMouseDownRef = useLiveRef(htmlOnMouseDown);
  14729. var onFocusRef = useLiveRef(htmlOnFocus);
  14730. var onBlurCaptureRef = useLiveRef(htmlOnBlurCapture);
  14731. var onKeyDownRef = useLiveRef(htmlOnKeyDown);
  14732. var onClickRef = useLiveRef(htmlOnClick);
  14733. var shouldTabIndex = !options.unstable_virtual && !options.unstable_hasActiveWidget && isCurrentItem || // We don't want to set tabIndex="-1" when using CompositeItem as a
  14734. // standalone component, without state props.
  14735. !((_options$items2 = options.items) !== null && _options$items2 !== void 0 && _options$items2.length);
  14736. (0,external_React_.useEffect)(function () {
  14737. var _options$registerItem;
  14738. if (!id) return undefined;
  14739. (_options$registerItem = options.registerItem) === null || _options$registerItem === void 0 ? void 0 : _options$registerItem.call(options, {
  14740. id: id,
  14741. ref: ref,
  14742. disabled: !!trulyDisabled
  14743. });
  14744. return function () {
  14745. var _options$unregisterIt;
  14746. (_options$unregisterIt = options.unregisterItem) === null || _options$unregisterIt === void 0 ? void 0 : _options$unregisterIt.call(options, id);
  14747. };
  14748. }, [id, trulyDisabled, options.registerItem, options.unregisterItem]);
  14749. (0,external_React_.useEffect)(function () {
  14750. var element = ref.current;
  14751. if (!element) {
  14752. false ? 0 : void 0;
  14753. return;
  14754. } // `moves` will be incremented whenever next, previous, up, down, first,
  14755. // last or move have been called. This means that the composite item will
  14756. // be focused whenever some of these functions are called. We're using
  14757. // isCurrentItemRef instead of isCurrentItem because we don't want to
  14758. // focus the item if isCurrentItem changes (and options.moves doesn't).
  14759. if (options.unstable_moves && isCurrentItemRef.current) {
  14760. userFocus(element);
  14761. }
  14762. }, [options.unstable_moves]);
  14763. var onMouseDown = (0,external_React_.useCallback)(function (event) {
  14764. var _onMouseDownRef$curre;
  14765. (_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event);
  14766. setUserFocus(event.currentTarget, true);
  14767. }, []);
  14768. var onFocus = (0,external_React_.useCallback)(function (event) {
  14769. var _onFocusRef$current, _options$setCurrentId;
  14770. var shouldFocusComposite = hasUserFocus(event.currentTarget);
  14771. setUserFocus(event.currentTarget, false);
  14772. (_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
  14773. if (event.defaultPrevented) return;
  14774. if (isPortalEvent(event)) return;
  14775. if (!id) return;
  14776. if (targetIsAnotherItem(event, options.items)) return;
  14777. (_options$setCurrentId = options.setCurrentId) === null || _options$setCurrentId === void 0 ? void 0 : _options$setCurrentId.call(options, id); // When using aria-activedescendant, we want to make sure that the
  14778. // composite container receives focus, not the composite item.
  14779. // But we don't want to do this if the target is another focusable
  14780. // element inside the composite item, such as CompositeItemWidget.
  14781. if (shouldFocusComposite && options.unstable_virtual && options.baseId && isSelfTarget(event)) {
  14782. var target = event.target;
  14783. var composite = getDocument(target).getElementById(options.baseId);
  14784. if (composite) {
  14785. hasFocusedComposite.current = true;
  14786. ensureFocus(composite);
  14787. }
  14788. }
  14789. }, [id, options.items, options.setCurrentId, options.unstable_virtual, options.baseId]);
  14790. var onBlurCapture = (0,external_React_.useCallback)(function (event) {
  14791. var _onBlurCaptureRef$cur;
  14792. (_onBlurCaptureRef$cur = onBlurCaptureRef.current) === null || _onBlurCaptureRef$cur === void 0 ? void 0 : _onBlurCaptureRef$cur.call(onBlurCaptureRef, event);
  14793. if (event.defaultPrevented) return;
  14794. if (options.unstable_virtual && hasFocusedComposite.current) {
  14795. // When hasFocusedComposite is true, composite has been focused right
  14796. // after focusing this item. This is an intermediate blur event, so
  14797. // we ignore it.
  14798. hasFocusedComposite.current = false;
  14799. event.preventDefault();
  14800. event.stopPropagation();
  14801. }
  14802. }, [options.unstable_virtual]);
  14803. var onKeyDown = (0,external_React_.useCallback)(function (event) {
  14804. var _onKeyDownRef$current;
  14805. if (!isSelfTarget(event)) return;
  14806. var isVertical = options.orientation !== "horizontal";
  14807. var isHorizontal = options.orientation !== "vertical";
  14808. var isGrid = !!(item !== null && item !== void 0 && item.groupId);
  14809. var keyMap = {
  14810. ArrowUp: (isGrid || isVertical) && options.up,
  14811. ArrowRight: (isGrid || isHorizontal) && options.next,
  14812. ArrowDown: (isGrid || isVertical) && options.down,
  14813. ArrowLeft: (isGrid || isHorizontal) && options.previous,
  14814. Home: function Home() {
  14815. if (!isGrid || event.ctrlKey) {
  14816. var _options$first;
  14817. (_options$first = options.first) === null || _options$first === void 0 ? void 0 : _options$first.call(options);
  14818. } else {
  14819. var _options$previous;
  14820. (_options$previous = options.previous) === null || _options$previous === void 0 ? void 0 : _options$previous.call(options, true);
  14821. }
  14822. },
  14823. End: function End() {
  14824. if (!isGrid || event.ctrlKey) {
  14825. var _options$last;
  14826. (_options$last = options.last) === null || _options$last === void 0 ? void 0 : _options$last.call(options);
  14827. } else {
  14828. var _options$next;
  14829. (_options$next = options.next) === null || _options$next === void 0 ? void 0 : _options$next.call(options, true);
  14830. }
  14831. },
  14832. PageUp: function PageUp() {
  14833. if (isGrid) {
  14834. var _options$up;
  14835. (_options$up = options.up) === null || _options$up === void 0 ? void 0 : _options$up.call(options, true);
  14836. } else {
  14837. var _options$first2;
  14838. (_options$first2 = options.first) === null || _options$first2 === void 0 ? void 0 : _options$first2.call(options);
  14839. }
  14840. },
  14841. PageDown: function PageDown() {
  14842. if (isGrid) {
  14843. var _options$down;
  14844. (_options$down = options.down) === null || _options$down === void 0 ? void 0 : _options$down.call(options, true);
  14845. } else {
  14846. var _options$last2;
  14847. (_options$last2 = options.last) === null || _options$last2 === void 0 ? void 0 : _options$last2.call(options);
  14848. }
  14849. }
  14850. };
  14851. var action = keyMap[event.key];
  14852. if (action) {
  14853. event.preventDefault();
  14854. action();
  14855. return;
  14856. }
  14857. (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
  14858. if (event.defaultPrevented) return;
  14859. if (event.key.length === 1 && event.key !== " ") {
  14860. var widget = getWidget(event.currentTarget);
  14861. if (widget && isTextField(widget)) {
  14862. widget.focus();
  14863. setTextFieldValue(widget, "");
  14864. }
  14865. } else if (event.key === "Delete" || event.key === "Backspace") {
  14866. var _widget = getWidget(event.currentTarget);
  14867. if (_widget && isTextField(_widget)) {
  14868. event.preventDefault();
  14869. setTextFieldValue(_widget, "");
  14870. }
  14871. }
  14872. }, [options.orientation, item, options.up, options.next, options.down, options.previous, options.first, options.last]);
  14873. var onClick = (0,external_React_.useCallback)(function (event) {
  14874. var _onClickRef$current;
  14875. (_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
  14876. if (event.defaultPrevented) return;
  14877. var element = event.currentTarget;
  14878. var widget = getWidget(element);
  14879. if (widget && !hasFocusWithin(widget)) {
  14880. // If there's a widget inside the composite item, we make sure it's
  14881. // focused when pressing enter, space or clicking on the composite item.
  14882. widget.focus();
  14883. }
  14884. }, []);
  14885. return _objectSpread2({
  14886. ref: useForkRef(ref, htmlRef),
  14887. id: id,
  14888. tabIndex: shouldTabIndex ? htmlTabIndex : -1,
  14889. "aria-selected": options.unstable_virtual && isCurrentItem ? true : undefined,
  14890. onMouseDown: onMouseDown,
  14891. onFocus: onFocus,
  14892. onBlurCapture: onBlurCapture,
  14893. onKeyDown: onKeyDown,
  14894. onClick: onClick
  14895. }, htmlProps);
  14896. }
  14897. });
  14898. var CompositeItem = createComponent({
  14899. as: "button",
  14900. memo: true,
  14901. useHook: useCompositeItem
  14902. });
  14903. ;// CONCATENATED MODULE: external ["wp","dom"]
  14904. var external_wp_dom_namespaceObject = window["wp"]["dom"];
  14905. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
  14906. /**
  14907. * WordPress dependencies
  14908. */
  14909. const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  14910. xmlns: "http://www.w3.org/2000/svg",
  14911. viewBox: "0 0 24 24"
  14912. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  14913. d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"
  14914. }));
  14915. /* harmony default export */ var library_close = (close_close);
  14916. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/utils.js
  14917. // @ts-nocheck
  14918. /**
  14919. * WordPress dependencies
  14920. */
  14921. /**
  14922. * Module constants
  14923. */
  14924. const HEIGHT_OFFSET = 10; // Used by the arrow and a bit of empty space.
  14925. /**
  14926. * Utility used to compute the popover position over the xAxis
  14927. *
  14928. * @param {Object} anchorRect Anchor Rect.
  14929. * @param {Object} contentSize Content Size.
  14930. * @param {string} xAxis Desired xAxis.
  14931. * @param {string} corner Desired corner.
  14932. * @param {boolean} stickyBoundaryElement The boundary element to use when
  14933. * switching between sticky and normal
  14934. * position.
  14935. * @param {string} chosenYAxis yAxis to be used.
  14936. * @param {Element} boundaryElement Boundary element.
  14937. * @param {boolean} forcePosition Don't adjust position based on anchor.
  14938. * @param {boolean} forceXAlignment Don't adjust alignment based on YAxis
  14939. *
  14940. * @return {Object} Popover xAxis position and constraints.
  14941. */
  14942. function computePopoverXAxisPosition(anchorRect, contentSize, xAxis, corner, stickyBoundaryElement, chosenYAxis, boundaryElement, forcePosition, forceXAlignment) {
  14943. const {
  14944. width
  14945. } = contentSize; // Correct xAxis for RTL support.
  14946. if (xAxis === 'left' && (0,external_wp_i18n_namespaceObject.isRTL)()) {
  14947. xAxis = 'right';
  14948. } else if (xAxis === 'right' && (0,external_wp_i18n_namespaceObject.isRTL)()) {
  14949. xAxis = 'left';
  14950. }
  14951. if (corner === 'left' && (0,external_wp_i18n_namespaceObject.isRTL)()) {
  14952. corner = 'right';
  14953. } else if (corner === 'right' && (0,external_wp_i18n_namespaceObject.isRTL)()) {
  14954. corner = 'left';
  14955. } // X axis alignment choices.
  14956. const anchorMidPoint = Math.round(anchorRect.left + anchorRect.width / 2);
  14957. const centerAlignment = {
  14958. popoverLeft: anchorMidPoint,
  14959. contentWidth: (anchorMidPoint - width / 2 > 0 ? width / 2 : anchorMidPoint) + (anchorMidPoint + width / 2 > window.innerWidth ? window.innerWidth - anchorMidPoint : width / 2)
  14960. };
  14961. let leftAlignmentX = anchorRect.left;
  14962. if (corner === 'right') {
  14963. leftAlignmentX = anchorRect.right;
  14964. } else if (chosenYAxis !== 'middle' && !forceXAlignment) {
  14965. leftAlignmentX = anchorMidPoint;
  14966. }
  14967. let rightAlignmentX = anchorRect.right;
  14968. if (corner === 'left') {
  14969. rightAlignmentX = anchorRect.left;
  14970. } else if (chosenYAxis !== 'middle' && !forceXAlignment) {
  14971. rightAlignmentX = anchorMidPoint;
  14972. }
  14973. const leftAlignment = {
  14974. popoverLeft: leftAlignmentX,
  14975. contentWidth: leftAlignmentX - width > 0 ? width : leftAlignmentX
  14976. };
  14977. const rightAlignment = {
  14978. popoverLeft: rightAlignmentX,
  14979. contentWidth: rightAlignmentX + width > window.innerWidth ? window.innerWidth - rightAlignmentX : width
  14980. }; // Choosing the x axis.
  14981. let chosenXAxis = xAxis;
  14982. let contentWidth = null;
  14983. if (!stickyBoundaryElement && !forcePosition) {
  14984. if (xAxis === 'center' && centerAlignment.contentWidth === width) {
  14985. chosenXAxis = 'center';
  14986. } else if (xAxis === 'left' && leftAlignment.contentWidth === width) {
  14987. chosenXAxis = 'left';
  14988. } else if (xAxis === 'right' && rightAlignment.contentWidth === width) {
  14989. chosenXAxis = 'right';
  14990. } else {
  14991. chosenXAxis = leftAlignment.contentWidth > rightAlignment.contentWidth ? 'left' : 'right';
  14992. const chosenWidth = chosenXAxis === 'left' ? leftAlignment.contentWidth : rightAlignment.contentWidth; // Limit width of the content to the viewport width
  14993. if (width > window.innerWidth) {
  14994. contentWidth = window.innerWidth;
  14995. } // If we can't find any alignment options that could fit
  14996. // our content, then let's fallback to the center of the viewport.
  14997. if (chosenWidth !== width) {
  14998. chosenXAxis = 'center';
  14999. centerAlignment.popoverLeft = window.innerWidth / 2;
  15000. }
  15001. }
  15002. }
  15003. let popoverLeft;
  15004. if (chosenXAxis === 'center') {
  15005. popoverLeft = centerAlignment.popoverLeft;
  15006. } else if (chosenXAxis === 'left') {
  15007. popoverLeft = leftAlignment.popoverLeft;
  15008. } else {
  15009. popoverLeft = rightAlignment.popoverLeft;
  15010. }
  15011. if (boundaryElement) {
  15012. popoverLeft = Math.min(popoverLeft, boundaryElement.offsetLeft + boundaryElement.offsetWidth - width); // Avoid the popover being position beyond the left boundary if the
  15013. // direction is left to right.
  15014. if (!(0,external_wp_i18n_namespaceObject.isRTL)()) {
  15015. popoverLeft = Math.max(popoverLeft, 0);
  15016. }
  15017. }
  15018. return {
  15019. xAxis: chosenXAxis,
  15020. popoverLeft,
  15021. contentWidth
  15022. };
  15023. }
  15024. /**
  15025. * Utility used to compute the popover position over the yAxis
  15026. *
  15027. * @param {Object} anchorRect Anchor Rect.
  15028. * @param {Object} contentSize Content Size.
  15029. * @param {string} yAxis Desired yAxis.
  15030. * @param {string} corner Desired corner.
  15031. * @param {boolean} stickyBoundaryElement The boundary element to use when switching between sticky
  15032. * and normal position.
  15033. * @param {Element} anchorRef The anchor element.
  15034. * @param {Element} relativeOffsetTop If applicable, top offset of the relative positioned
  15035. * parent container.
  15036. * @param {boolean} forcePosition Don't adjust position based on anchor.
  15037. * @param {Element|null} editorWrapper Element that wraps the editor content. Used to access
  15038. * scroll position to determine sticky behavior.
  15039. * @return {Object} Popover xAxis position and constraints.
  15040. */
  15041. function computePopoverYAxisPosition(anchorRect, contentSize, yAxis, corner, stickyBoundaryElement, anchorRef, relativeOffsetTop, forcePosition, editorWrapper) {
  15042. const {
  15043. height
  15044. } = contentSize;
  15045. if (stickyBoundaryElement) {
  15046. const stickyRect = stickyBoundaryElement.getBoundingClientRect();
  15047. const stickyPositionTop = stickyRect.top + height - relativeOffsetTop;
  15048. const stickyPositionBottom = stickyRect.bottom - height - relativeOffsetTop;
  15049. if (anchorRect.top <= stickyPositionTop) {
  15050. if (editorWrapper) {
  15051. // If a popover cannot be positioned above the anchor, even after scrolling, we must
  15052. // ensure we use the bottom position instead of the popover slot. This prevents the
  15053. // popover from always restricting block content and interaction while selected if the
  15054. // block is near the top of the site editor.
  15055. const isRoomAboveInCanvas = height + HEIGHT_OFFSET < editorWrapper.scrollTop + anchorRect.top;
  15056. if (!isRoomAboveInCanvas) {
  15057. return {
  15058. yAxis: 'bottom',
  15059. // If the bottom of the block is also below the bottom sticky position (ex -
  15060. // block is also taller than the editor window), return the bottom sticky
  15061. // position instead. We do this instead of the top sticky position both to
  15062. // allow a smooth transition and more importantly to ensure every section of
  15063. // the block can be free from popover obscuration at some point in the
  15064. // scroll position.
  15065. popoverTop: Math.min(anchorRect.bottom, stickyPositionBottom)
  15066. };
  15067. }
  15068. } // Default sticky behavior.
  15069. return {
  15070. yAxis,
  15071. popoverTop: Math.min(anchorRect.bottom, stickyPositionTop)
  15072. };
  15073. }
  15074. } // Y axis alignment choices.
  15075. let anchorMidPoint = anchorRect.top + anchorRect.height / 2;
  15076. if (corner === 'bottom') {
  15077. anchorMidPoint = anchorRect.bottom;
  15078. } else if (corner === 'top') {
  15079. anchorMidPoint = anchorRect.top;
  15080. }
  15081. const middleAlignment = {
  15082. popoverTop: anchorMidPoint,
  15083. contentHeight: (anchorMidPoint - height / 2 > 0 ? height / 2 : anchorMidPoint) + (anchorMidPoint + height / 2 > window.innerHeight ? window.innerHeight - anchorMidPoint : height / 2)
  15084. };
  15085. const topAlignment = {
  15086. popoverTop: anchorRect.top,
  15087. contentHeight: anchorRect.top - HEIGHT_OFFSET - height > 0 ? height : anchorRect.top - HEIGHT_OFFSET
  15088. };
  15089. const bottomAlignment = {
  15090. popoverTop: anchorRect.bottom,
  15091. contentHeight: anchorRect.bottom + HEIGHT_OFFSET + height > window.innerHeight ? window.innerHeight - HEIGHT_OFFSET - anchorRect.bottom : height
  15092. }; // Choosing the y axis.
  15093. let chosenYAxis = yAxis;
  15094. let contentHeight = null;
  15095. if (!stickyBoundaryElement && !forcePosition) {
  15096. if (yAxis === 'middle' && middleAlignment.contentHeight === height) {
  15097. chosenYAxis = 'middle';
  15098. } else if (yAxis === 'top' && topAlignment.contentHeight === height) {
  15099. chosenYAxis = 'top';
  15100. } else if (yAxis === 'bottom' && bottomAlignment.contentHeight === height) {
  15101. chosenYAxis = 'bottom';
  15102. } else {
  15103. chosenYAxis = topAlignment.contentHeight > bottomAlignment.contentHeight ? 'top' : 'bottom';
  15104. const chosenHeight = chosenYAxis === 'top' ? topAlignment.contentHeight : bottomAlignment.contentHeight;
  15105. contentHeight = chosenHeight !== height ? chosenHeight : null;
  15106. }
  15107. }
  15108. let popoverTop;
  15109. if (chosenYAxis === 'middle') {
  15110. popoverTop = middleAlignment.popoverTop;
  15111. } else if (chosenYAxis === 'top') {
  15112. popoverTop = topAlignment.popoverTop;
  15113. } else {
  15114. popoverTop = bottomAlignment.popoverTop;
  15115. }
  15116. return {
  15117. yAxis: chosenYAxis,
  15118. popoverTop,
  15119. contentHeight
  15120. };
  15121. }
  15122. /**
  15123. * Utility used to compute the popover position and the content max width/height for a popover given
  15124. * its anchor rect and its content size.
  15125. *
  15126. * @param {Object} anchorRect Anchor Rect.
  15127. * @param {Object} contentSize Content Size.
  15128. * @param {string} position Position.
  15129. * @param {boolean} stickyBoundaryElement The boundary element to use when switching between
  15130. * sticky and normal position.
  15131. * @param {Element} anchorRef The anchor element.
  15132. * @param {number} relativeOffsetTop If applicable, top offset of the relative positioned
  15133. * parent container.
  15134. * @param {Element} boundaryElement Boundary element.
  15135. * @param {boolean} forcePosition Don't adjust position based on anchor.
  15136. * @param {boolean} forceXAlignment Don't adjust alignment based on YAxis
  15137. * @param {Element|null} editorWrapper Element that wraps the editor content. Used to access
  15138. * scroll position to determine sticky behavior.
  15139. * @return {Object} Popover position and constraints.
  15140. */
  15141. function computePopoverPosition(anchorRect, contentSize) {
  15142. let position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'top';
  15143. let stickyBoundaryElement = arguments.length > 3 ? arguments[3] : undefined;
  15144. let anchorRef = arguments.length > 4 ? arguments[4] : undefined;
  15145. let relativeOffsetTop = arguments.length > 5 ? arguments[5] : undefined;
  15146. let boundaryElement = arguments.length > 6 ? arguments[6] : undefined;
  15147. let forcePosition = arguments.length > 7 ? arguments[7] : undefined;
  15148. let forceXAlignment = arguments.length > 8 ? arguments[8] : undefined;
  15149. let editorWrapper = arguments.length > 9 ? arguments[9] : undefined;
  15150. const [yAxis, xAxis = 'center', corner] = position.split(' ');
  15151. const yAxisPosition = computePopoverYAxisPosition(anchorRect, contentSize, yAxis, corner, stickyBoundaryElement, anchorRef, relativeOffsetTop, forcePosition, editorWrapper);
  15152. const xAxisPosition = computePopoverXAxisPosition(anchorRect, contentSize, xAxis, corner, stickyBoundaryElement, yAxisPosition.yAxis, boundaryElement, forcePosition, forceXAlignment);
  15153. return { ...xAxisPosition,
  15154. ...yAxisPosition
  15155. };
  15156. }
  15157. /**
  15158. * Offsets the given rect by the position of the iframe that contains the
  15159. * element. If the owner document is not in an iframe then it returns with the
  15160. * original rect. If the popover container document and the anchor document are
  15161. * the same, the original rect will also be returned.
  15162. *
  15163. * @param {DOMRect} rect bounds of the element
  15164. * @param {Document} ownerDocument document of the element
  15165. * @param {Element} container The popover container to position.
  15166. *
  15167. * @return {DOMRect} offsetted bounds
  15168. */
  15169. function offsetIframe(rect, ownerDocument, container) {
  15170. const {
  15171. defaultView
  15172. } = ownerDocument;
  15173. const {
  15174. frameElement
  15175. } = defaultView;
  15176. if (!frameElement || ownerDocument === container.ownerDocument) {
  15177. return rect;
  15178. }
  15179. const iframeRect = frameElement.getBoundingClientRect();
  15180. return new defaultView.DOMRect(rect.left + iframeRect.left, rect.top + iframeRect.top, rect.width, rect.height);
  15181. }
  15182. ;// CONCATENATED MODULE: external ["wp","deprecated"]
  15183. var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
  15184. var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
  15185. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dashicon/index.js
  15186. /**
  15187. * @typedef OwnProps
  15188. *
  15189. * @property {import('./types').IconKey} icon Icon name
  15190. * @property {string} [className] Class name
  15191. */
  15192. /** @typedef {import('react').ComponentPropsWithoutRef<'span'> & OwnProps} Props */
  15193. /**
  15194. * @param {Props} props
  15195. * @return {JSX.Element} Element
  15196. */
  15197. function Dashicon(_ref) {
  15198. let {
  15199. icon,
  15200. className,
  15201. ...extraProps
  15202. } = _ref;
  15203. const iconClass = ['dashicon', 'dashicons', 'dashicons-' + icon, className].filter(Boolean).join(' ');
  15204. return (0,external_wp_element_namespaceObject.createElement)("span", extends_extends({
  15205. className: iconClass
  15206. }, extraProps));
  15207. }
  15208. /* harmony default export */ var dashicon = (Dashicon);
  15209. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/icon/index.js
  15210. /**
  15211. * External dependencies
  15212. */
  15213. /**
  15214. * WordPress dependencies
  15215. */
  15216. /**
  15217. * Internal dependencies
  15218. */
  15219. function Icon(_ref) {
  15220. let {
  15221. icon = null,
  15222. size = 24,
  15223. ...additionalProps
  15224. } = _ref;
  15225. if ('string' === typeof icon) {
  15226. return (0,external_wp_element_namespaceObject.createElement)(dashicon, extends_extends({
  15227. icon: icon
  15228. }, additionalProps));
  15229. }
  15230. if ((0,external_wp_element_namespaceObject.isValidElement)(icon) && dashicon === icon.type) {
  15231. return (0,external_wp_element_namespaceObject.cloneElement)(icon, { ...additionalProps
  15232. });
  15233. }
  15234. if ('function' === typeof icon) {
  15235. if (icon.prototype instanceof external_wp_element_namespaceObject.Component) {
  15236. return (0,external_wp_element_namespaceObject.createElement)(icon, {
  15237. size,
  15238. ...additionalProps
  15239. });
  15240. }
  15241. return icon({
  15242. size,
  15243. ...additionalProps
  15244. });
  15245. }
  15246. if (icon && (icon.type === 'svg' || icon.type === external_wp_primitives_namespaceObject.SVG)) {
  15247. const appliedProps = {
  15248. width: size,
  15249. height: size,
  15250. ...icon.props,
  15251. ...additionalProps
  15252. };
  15253. return (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, appliedProps);
  15254. }
  15255. if ((0,external_wp_element_namespaceObject.isValidElement)(icon)) {
  15256. return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
  15257. // @ts-ignore Just forwarding the size prop along
  15258. size,
  15259. ...additionalProps
  15260. });
  15261. }
  15262. return icon;
  15263. }
  15264. /* harmony default export */ var build_module_icon = (Icon);
  15265. ;// CONCATENATED MODULE: external ["wp","warning"]
  15266. var external_wp_warning_namespaceObject = window["wp"]["warning"];
  15267. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/context-system-provider.js
  15268. /**
  15269. * External dependencies
  15270. */
  15271. /**
  15272. * WordPress dependencies
  15273. */
  15274. const ComponentsContext = (0,external_wp_element_namespaceObject.createContext)(
  15275. /** @type {Record<string, any>} */
  15276. {});
  15277. const useComponentsContext = () => (0,external_wp_element_namespaceObject.useContext)(ComponentsContext);
  15278. /**
  15279. * Runs an effect only on update (i.e., ignores the first render)
  15280. *
  15281. * @param {import('react').EffectCallback} effect
  15282. * @param {import('react').DependencyList} deps
  15283. */
  15284. function useUpdateEffect(effect, deps) {
  15285. const mounted = (0,external_wp_element_namespaceObject.useRef)(false);
  15286. (0,external_wp_element_namespaceObject.useEffect)(() => {
  15287. if (mounted.current) {
  15288. return effect();
  15289. }
  15290. mounted.current = true;
  15291. return undefined;
  15292. }, deps);
  15293. }
  15294. /**
  15295. * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.
  15296. *
  15297. * Note: This function will warn if it detects an un-memoized `value`
  15298. *
  15299. * @param {Object} props
  15300. * @param {Record<string, any>} props.value
  15301. * @return {Record<string, any>} The consolidated value.
  15302. */
  15303. function useContextSystemBridge(_ref) {
  15304. let {
  15305. value
  15306. } = _ref;
  15307. const parentContext = useComponentsContext();
  15308. const valueRef = (0,external_wp_element_namespaceObject.useRef)(value);
  15309. useUpdateEffect(() => {
  15310. if ( // Objects are equivalent.
  15311. (0,external_lodash_namespaceObject.isEqual)(valueRef.current, value) && // But not the same reference.
  15312. valueRef.current !== value) {
  15313. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
  15314. }
  15315. }, [value]); // `parentContext` will always be memoized (i.e., the result of this hook itself)
  15316. // or the default value from when the `ComponentsContext` was originally
  15317. // initialized (which will never change, it's a static variable)
  15318. // so this memoization will prevent `merge` and `cloneDeep` from rerunning unless
  15319. // the references to `value` change OR the `parentContext` has an actual material change
  15320. // (because again, it's guaranteed to be memoized or a static reference to the empty object
  15321. // so we know that the only changes for `parentContext` are material ones... i.e., why we
  15322. // don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only
  15323. // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are
  15324. // correctly warning when the `value` isn't being properly memoized. All of that to say
  15325. // that this should be super safe to assume that `useMemo` will only run on actual
  15326. // changes to the two dependencies, therefore saving us calls to `merge` and `cloneDeep`!
  15327. const config = (0,external_wp_element_namespaceObject.useMemo)(() => {
  15328. return (0,external_lodash_namespaceObject.merge)((0,external_lodash_namespaceObject.cloneDeep)(parentContext), value);
  15329. }, [parentContext, value]);
  15330. return config;
  15331. }
  15332. /**
  15333. * A Provider component that can modify props for connected components within
  15334. * the Context system.
  15335. *
  15336. * @example
  15337. * ```jsx
  15338. * <ContextSystemProvider value={{ Button: { size: 'small' }}}>
  15339. * <Button>...</Button>
  15340. * </ContextSystemProvider>
  15341. * ```
  15342. *
  15343. * @template {Record<string, any>} T
  15344. * @param {Object} options
  15345. * @param {import('react').ReactNode} options.children Children to render.
  15346. * @param {T} options.value Props to render into connected components.
  15347. * @return {JSX.Element} A Provider wrapped component.
  15348. */
  15349. const BaseContextSystemProvider = _ref2 => {
  15350. let {
  15351. children,
  15352. value
  15353. } = _ref2;
  15354. const contextValue = useContextSystemBridge({
  15355. value
  15356. });
  15357. return (0,external_wp_element_namespaceObject.createElement)(ComponentsContext.Provider, {
  15358. value: contextValue
  15359. }, children);
  15360. };
  15361. const ContextSystemProvider = (0,external_wp_element_namespaceObject.memo)(BaseContextSystemProvider);
  15362. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/constants.js
  15363. const REACT_TYPEOF_KEY = '$$typeof';
  15364. const COMPONENT_NAMESPACE = 'data-wp-component';
  15365. const CONNECTED_NAMESPACE = 'data-wp-c16t';
  15366. const CONTEXT_COMPONENT_NAMESPACE = 'data-wp-c5tc8t';
  15367. /**
  15368. * Special key where the connected namespaces are stored.
  15369. * This is attached to Context connected components as a static property.
  15370. */
  15371. const CONNECT_STATIC_NAMESPACE = '__contextSystemKey__';
  15372. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/utils.js
  15373. /**
  15374. * Internal dependencies
  15375. */
  15376. /**
  15377. * Creates a dedicated context namespace HTML attribute for components.
  15378. * ns is short for "namespace"
  15379. *
  15380. * @example
  15381. * ```jsx
  15382. * <div {...ns('Container')} />
  15383. * ```
  15384. *
  15385. * @param {string} componentName The name for the component.
  15386. * @return {Record<string, any>} A props object with the namespaced HTML attribute.
  15387. */
  15388. function getNamespace(componentName) {
  15389. return {
  15390. [COMPONENT_NAMESPACE]: componentName
  15391. };
  15392. }
  15393. /**
  15394. * Creates a dedicated connected context namespace HTML attribute for components.
  15395. * ns is short for "namespace"
  15396. *
  15397. * @example
  15398. * ```jsx
  15399. * <div {...cns()} />
  15400. * ```
  15401. *
  15402. * @return {Record<string, any>} A props object with the namespaced HTML attribute.
  15403. */
  15404. function getConnectedNamespace() {
  15405. return {
  15406. [CONNECTED_NAMESPACE]: true
  15407. };
  15408. }
  15409. // EXTERNAL MODULE: ./node_modules/memize/index.js
  15410. var memize = __webpack_require__(9756);
  15411. var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
  15412. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/get-styled-class-name-from-key.js
  15413. /**
  15414. * External dependencies
  15415. */
  15416. /**
  15417. * Generates the connected component CSS className based on the namespace.
  15418. *
  15419. * @param namespace The name of the connected component.
  15420. * @return The generated CSS className.
  15421. */
  15422. function getStyledClassName(namespace) {
  15423. const kebab = (0,external_lodash_namespaceObject.kebabCase)(namespace);
  15424. return `components-${kebab}`;
  15425. }
  15426. const getStyledClassNameFromKey = memize_default()(getStyledClassName);
  15427. ;// CONCATENATED MODULE: ./node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js
  15428. /*
  15429. Based off glamor's StyleSheet, thanks Sunil ❤️
  15430. high performance StyleSheet for css-in-js systems
  15431. - uses multiple style tags behind the scenes for millions of rules
  15432. - uses `insertRule` for appending in production for *much* faster performance
  15433. // usage
  15434. import { StyleSheet } from '@emotion/sheet'
  15435. let styleSheet = new StyleSheet({ key: '', container: document.head })
  15436. styleSheet.insert('#box { border: 1px solid red; }')
  15437. - appends a css rule into the stylesheet
  15438. styleSheet.flush()
  15439. - empties the stylesheet of all its contents
  15440. */
  15441. // $FlowFixMe
  15442. function sheetForTag(tag) {
  15443. if (tag.sheet) {
  15444. // $FlowFixMe
  15445. return tag.sheet;
  15446. } // this weirdness brought to you by firefox
  15447. /* istanbul ignore next */
  15448. for (var i = 0; i < document.styleSheets.length; i++) {
  15449. if (document.styleSheets[i].ownerNode === tag) {
  15450. // $FlowFixMe
  15451. return document.styleSheets[i];
  15452. }
  15453. }
  15454. }
  15455. function createStyleElement(options) {
  15456. var tag = document.createElement('style');
  15457. tag.setAttribute('data-emotion', options.key);
  15458. if (options.nonce !== undefined) {
  15459. tag.setAttribute('nonce', options.nonce);
  15460. }
  15461. tag.appendChild(document.createTextNode(''));
  15462. tag.setAttribute('data-s', '');
  15463. return tag;
  15464. }
  15465. var StyleSheet = /*#__PURE__*/function () {
  15466. function StyleSheet(options) {
  15467. var _this = this;
  15468. this._insertTag = function (tag) {
  15469. var before;
  15470. if (_this.tags.length === 0) {
  15471. if (_this.insertionPoint) {
  15472. before = _this.insertionPoint.nextSibling;
  15473. } else if (_this.prepend) {
  15474. before = _this.container.firstChild;
  15475. } else {
  15476. before = _this.before;
  15477. }
  15478. } else {
  15479. before = _this.tags[_this.tags.length - 1].nextSibling;
  15480. }
  15481. _this.container.insertBefore(tag, before);
  15482. _this.tags.push(tag);
  15483. };
  15484. this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy;
  15485. this.tags = [];
  15486. this.ctr = 0;
  15487. this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
  15488. this.key = options.key;
  15489. this.container = options.container;
  15490. this.prepend = options.prepend;
  15491. this.insertionPoint = options.insertionPoint;
  15492. this.before = null;
  15493. }
  15494. var _proto = StyleSheet.prototype;
  15495. _proto.hydrate = function hydrate(nodes) {
  15496. nodes.forEach(this._insertTag);
  15497. };
  15498. _proto.insert = function insert(rule) {
  15499. // the max length is how many rules we have per style tag, it's 65000 in speedy mode
  15500. // it's 1 in dev because we insert source maps that map a single rule to a location
  15501. // and you can only have one source map per style tag
  15502. if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
  15503. this._insertTag(createStyleElement(this));
  15504. }
  15505. var tag = this.tags[this.tags.length - 1];
  15506. if (false) { var isImportRule; }
  15507. if (this.isSpeedy) {
  15508. var sheet = sheetForTag(tag);
  15509. try {
  15510. // this is the ultrafast version, works across browsers
  15511. // the big drawback is that the css won't be editable in devtools
  15512. sheet.insertRule(rule, sheet.cssRules.length);
  15513. } catch (e) {
  15514. if (false) {}
  15515. }
  15516. } else {
  15517. tag.appendChild(document.createTextNode(rule));
  15518. }
  15519. this.ctr++;
  15520. };
  15521. _proto.flush = function flush() {
  15522. // $FlowFixMe
  15523. this.tags.forEach(function (tag) {
  15524. return tag.parentNode && tag.parentNode.removeChild(tag);
  15525. });
  15526. this.tags = [];
  15527. this.ctr = 0;
  15528. if (false) {}
  15529. };
  15530. return StyleSheet;
  15531. }();
  15532. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Utility.js
  15533. /**
  15534. * @param {number}
  15535. * @return {number}
  15536. */
  15537. var abs = Math.abs
  15538. /**
  15539. * @param {number}
  15540. * @return {string}
  15541. */
  15542. var Utility_from = String.fromCharCode
  15543. /**
  15544. * @param {object}
  15545. * @return {object}
  15546. */
  15547. var Utility_assign = Object.assign
  15548. /**
  15549. * @param {string} value
  15550. * @param {number} length
  15551. * @return {number}
  15552. */
  15553. function hash (value, length) {
  15554. return (((((((length << 2) ^ Utility_charat(value, 0)) << 2) ^ Utility_charat(value, 1)) << 2) ^ Utility_charat(value, 2)) << 2) ^ Utility_charat(value, 3)
  15555. }
  15556. /**
  15557. * @param {string} value
  15558. * @return {string}
  15559. */
  15560. function trim (value) {
  15561. return value.trim()
  15562. }
  15563. /**
  15564. * @param {string} value
  15565. * @param {RegExp} pattern
  15566. * @return {string?}
  15567. */
  15568. function match (value, pattern) {
  15569. return (value = pattern.exec(value)) ? value[0] : value
  15570. }
  15571. /**
  15572. * @param {string} value
  15573. * @param {(string|RegExp)} pattern
  15574. * @param {string} replacement
  15575. * @return {string}
  15576. */
  15577. function replace (value, pattern, replacement) {
  15578. return value.replace(pattern, replacement)
  15579. }
  15580. /**
  15581. * @param {string} value
  15582. * @param {string} search
  15583. * @return {number}
  15584. */
  15585. function indexof (value, search) {
  15586. return value.indexOf(search)
  15587. }
  15588. /**
  15589. * @param {string} value
  15590. * @param {number} index
  15591. * @return {number}
  15592. */
  15593. function Utility_charat (value, index) {
  15594. return value.charCodeAt(index) | 0
  15595. }
  15596. /**
  15597. * @param {string} value
  15598. * @param {number} begin
  15599. * @param {number} end
  15600. * @return {string}
  15601. */
  15602. function Utility_substr (value, begin, end) {
  15603. return value.slice(begin, end)
  15604. }
  15605. /**
  15606. * @param {string} value
  15607. * @return {number}
  15608. */
  15609. function Utility_strlen (value) {
  15610. return value.length
  15611. }
  15612. /**
  15613. * @param {any[]} value
  15614. * @return {number}
  15615. */
  15616. function Utility_sizeof (value) {
  15617. return value.length
  15618. }
  15619. /**
  15620. * @param {any} value
  15621. * @param {any[]} array
  15622. * @return {any}
  15623. */
  15624. function Utility_append (value, array) {
  15625. return array.push(value), value
  15626. }
  15627. /**
  15628. * @param {string[]} array
  15629. * @param {function} callback
  15630. * @return {string}
  15631. */
  15632. function Utility_combine (array, callback) {
  15633. return array.map(callback).join('')
  15634. }
  15635. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Tokenizer.js
  15636. var line = 1
  15637. var column = 1
  15638. var Tokenizer_length = 0
  15639. var position = 0
  15640. var character = 0
  15641. var characters = ''
  15642. /**
  15643. * @param {string} value
  15644. * @param {object | null} root
  15645. * @param {object | null} parent
  15646. * @param {string} type
  15647. * @param {string[] | string} props
  15648. * @param {object[] | string} children
  15649. * @param {number} length
  15650. */
  15651. function node (value, root, parent, type, props, children, length) {
  15652. return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}
  15653. }
  15654. /**
  15655. * @param {object} root
  15656. * @param {object} props
  15657. * @return {object}
  15658. */
  15659. function copy (root, props) {
  15660. return Utility_assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)
  15661. }
  15662. /**
  15663. * @return {number}
  15664. */
  15665. function Tokenizer_char () {
  15666. return character
  15667. }
  15668. /**
  15669. * @return {number}
  15670. */
  15671. function prev () {
  15672. character = position > 0 ? Utility_charat(characters, --position) : 0
  15673. if (column--, character === 10)
  15674. column = 1, line--
  15675. return character
  15676. }
  15677. /**
  15678. * @return {number}
  15679. */
  15680. function next () {
  15681. character = position < Tokenizer_length ? Utility_charat(characters, position++) : 0
  15682. if (column++, character === 10)
  15683. column = 1, line++
  15684. return character
  15685. }
  15686. /**
  15687. * @return {number}
  15688. */
  15689. function peek () {
  15690. return Utility_charat(characters, position)
  15691. }
  15692. /**
  15693. * @return {number}
  15694. */
  15695. function caret () {
  15696. return position
  15697. }
  15698. /**
  15699. * @param {number} begin
  15700. * @param {number} end
  15701. * @return {string}
  15702. */
  15703. function slice (begin, end) {
  15704. return Utility_substr(characters, begin, end)
  15705. }
  15706. /**
  15707. * @param {number} type
  15708. * @return {number}
  15709. */
  15710. function token (type) {
  15711. switch (type) {
  15712. // \0 \t \n \r \s whitespace token
  15713. case 0: case 9: case 10: case 13: case 32:
  15714. return 5
  15715. // ! + , / > @ ~ isolate token
  15716. case 33: case 43: case 44: case 47: case 62: case 64: case 126:
  15717. // ; { } breakpoint token
  15718. case 59: case 123: case 125:
  15719. return 4
  15720. // : accompanied token
  15721. case 58:
  15722. return 3
  15723. // " ' ( [ opening delimit token
  15724. case 34: case 39: case 40: case 91:
  15725. return 2
  15726. // ) ] closing delimit token
  15727. case 41: case 93:
  15728. return 1
  15729. }
  15730. return 0
  15731. }
  15732. /**
  15733. * @param {string} value
  15734. * @return {any[]}
  15735. */
  15736. function alloc (value) {
  15737. return line = column = 1, Tokenizer_length = Utility_strlen(characters = value), position = 0, []
  15738. }
  15739. /**
  15740. * @param {any} value
  15741. * @return {any}
  15742. */
  15743. function dealloc (value) {
  15744. return characters = '', value
  15745. }
  15746. /**
  15747. * @param {number} type
  15748. * @return {string}
  15749. */
  15750. function delimit (type) {
  15751. return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
  15752. }
  15753. /**
  15754. * @param {string} value
  15755. * @return {string[]}
  15756. */
  15757. function Tokenizer_tokenize (value) {
  15758. return dealloc(tokenizer(alloc(value)))
  15759. }
  15760. /**
  15761. * @param {number} type
  15762. * @return {string}
  15763. */
  15764. function whitespace (type) {
  15765. while (character = peek())
  15766. if (character < 33)
  15767. next()
  15768. else
  15769. break
  15770. return token(type) > 2 || token(character) > 3 ? '' : ' '
  15771. }
  15772. /**
  15773. * @param {string[]} children
  15774. * @return {string[]}
  15775. */
  15776. function tokenizer (children) {
  15777. while (next())
  15778. switch (token(character)) {
  15779. case 0: append(identifier(position - 1), children)
  15780. break
  15781. case 2: append(delimit(character), children)
  15782. break
  15783. default: append(from(character), children)
  15784. }
  15785. return children
  15786. }
  15787. /**
  15788. * @param {number} index
  15789. * @param {number} count
  15790. * @return {string}
  15791. */
  15792. function escaping (index, count) {
  15793. while (--count && next())
  15794. // not 0-9 A-F a-f
  15795. if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))
  15796. break
  15797. return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))
  15798. }
  15799. /**
  15800. * @param {number} type
  15801. * @return {number}
  15802. */
  15803. function delimiter (type) {
  15804. while (next())
  15805. switch (character) {
  15806. // ] ) " '
  15807. case type:
  15808. return position
  15809. // " '
  15810. case 34: case 39:
  15811. if (type !== 34 && type !== 39)
  15812. delimiter(character)
  15813. break
  15814. // (
  15815. case 40:
  15816. if (type === 41)
  15817. delimiter(type)
  15818. break
  15819. // \
  15820. case 92:
  15821. next()
  15822. break
  15823. }
  15824. return position
  15825. }
  15826. /**
  15827. * @param {number} type
  15828. * @param {number} index
  15829. * @return {number}
  15830. */
  15831. function commenter (type, index) {
  15832. while (next())
  15833. // //
  15834. if (type + character === 47 + 10)
  15835. break
  15836. // /*
  15837. else if (type + character === 42 + 42 && peek() === 47)
  15838. break
  15839. return '/*' + slice(index, position - 1) + '*' + Utility_from(type === 47 ? type : next())
  15840. }
  15841. /**
  15842. * @param {number} index
  15843. * @return {string}
  15844. */
  15845. function identifier (index) {
  15846. while (!token(peek()))
  15847. next()
  15848. return slice(index, position)
  15849. }
  15850. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Enum.js
  15851. var MS = '-ms-'
  15852. var MOZ = '-moz-'
  15853. var WEBKIT = '-webkit-'
  15854. var COMMENT = 'comm'
  15855. var Enum_RULESET = 'rule'
  15856. var DECLARATION = 'decl'
  15857. var PAGE = '@page'
  15858. var MEDIA = '@media'
  15859. var IMPORT = '@import'
  15860. var CHARSET = '@charset'
  15861. var VIEWPORT = '@viewport'
  15862. var SUPPORTS = '@supports'
  15863. var DOCUMENT = '@document'
  15864. var NAMESPACE = '@namespace'
  15865. var KEYFRAMES = '@keyframes'
  15866. var FONT_FACE = '@font-face'
  15867. var COUNTER_STYLE = '@counter-style'
  15868. var FONT_FEATURE_VALUES = '@font-feature-values'
  15869. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Serializer.js
  15870. /**
  15871. * @param {object[]} children
  15872. * @param {function} callback
  15873. * @return {string}
  15874. */
  15875. function serialize (children, callback) {
  15876. var output = ''
  15877. var length = Utility_sizeof(children)
  15878. for (var i = 0; i < length; i++)
  15879. output += callback(children[i], i, children, callback) || ''
  15880. return output
  15881. }
  15882. /**
  15883. * @param {object} element
  15884. * @param {number} index
  15885. * @param {object[]} children
  15886. * @param {function} callback
  15887. * @return {string}
  15888. */
  15889. function stringify (element, index, children, callback) {
  15890. switch (element.type) {
  15891. case IMPORT: case DECLARATION: return element.return = element.return || element.value
  15892. case COMMENT: return ''
  15893. case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'
  15894. case Enum_RULESET: element.value = element.props.join(',')
  15895. }
  15896. return Utility_strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
  15897. }
  15898. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Prefixer.js
  15899. /**
  15900. * @param {string} value
  15901. * @param {number} length
  15902. * @return {string}
  15903. */
  15904. function prefix (value, length) {
  15905. switch (hash(value, length)) {
  15906. // color-adjust
  15907. case 5103:
  15908. return WEBKIT + 'print-' + value + value
  15909. // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
  15910. case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921:
  15911. // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
  15912. case 5572: case 6356: case 5844: case 3191: case 6645: case 3005:
  15913. // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
  15914. case 6391: case 5879: case 5623: case 6135: case 4599: case 4855:
  15915. // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
  15916. case 4215: case 6389: case 5109: case 5365: case 5621: case 3829:
  15917. return WEBKIT + value + value
  15918. // appearance, user-select, transform, hyphens, text-size-adjust
  15919. case 5349: case 4246: case 4810: case 6968: case 2756:
  15920. return WEBKIT + value + MOZ + value + MS + value + value
  15921. // flex, flex-direction
  15922. case 6828: case 4268:
  15923. return WEBKIT + value + MS + value + value
  15924. // order
  15925. case 6165:
  15926. return WEBKIT + value + MS + 'flex-' + value + value
  15927. // align-items
  15928. case 5187:
  15929. return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value
  15930. // align-self
  15931. case 5443:
  15932. return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value
  15933. // align-content
  15934. case 4675:
  15935. return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value
  15936. // flex-shrink
  15937. case 5548:
  15938. return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value
  15939. // flex-basis
  15940. case 5292:
  15941. return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value
  15942. // flex-grow
  15943. case 6060:
  15944. return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value
  15945. // transition
  15946. case 4554:
  15947. return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value
  15948. // cursor
  15949. case 6187:
  15950. return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value
  15951. // background, background-image
  15952. case 5495: case 3959:
  15953. return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1')
  15954. // justify-content
  15955. case 4968:
  15956. return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value
  15957. // (margin|padding)-inline-(start|end)
  15958. case 4095: case 3583: case 4068: case 2532:
  15959. return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value
  15960. // (min|max)?(width|height|inline-size|block-size)
  15961. case 8116: case 7059: case 5753: case 5535:
  15962. case 5445: case 5701: case 4933: case 4677:
  15963. case 5533: case 5789: case 5021: case 4765:
  15964. // stretch, max-content, min-content, fill-available
  15965. if (Utility_strlen(value) - 1 - length > 6)
  15966. switch (Utility_charat(value, length + 1)) {
  15967. // (m)ax-content, (m)in-content
  15968. case 109:
  15969. // -
  15970. if (Utility_charat(value, length + 4) !== 45)
  15971. break
  15972. // (f)ill-available, (f)it-content
  15973. case 102:
  15974. return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (Utility_charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value
  15975. // (s)tretch
  15976. case 115:
  15977. return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value
  15978. }
  15979. break
  15980. // position: sticky
  15981. case 4949:
  15982. // (s)ticky?
  15983. if (Utility_charat(value, length + 1) !== 115)
  15984. break
  15985. // display: (flex|inline-flex)
  15986. case 6444:
  15987. switch (Utility_charat(value, Utility_strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
  15988. // stic(k)y
  15989. case 107:
  15990. return replace(value, ':', ':' + WEBKIT) + value
  15991. // (inline-)?fl(e)x
  15992. case 101:
  15993. return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (Utility_charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value
  15994. }
  15995. break
  15996. // writing-mode
  15997. case 5936:
  15998. switch (Utility_charat(value, length + 11)) {
  15999. // vertical-l(r)
  16000. case 114:
  16001. return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value
  16002. // vertical-r(l)
  16003. case 108:
  16004. return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value
  16005. // horizontal(-)tb
  16006. case 45:
  16007. return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value
  16008. }
  16009. return WEBKIT + value + MS + value + value
  16010. }
  16011. return value
  16012. }
  16013. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Middleware.js
  16014. /**
  16015. * @param {function[]} collection
  16016. * @return {function}
  16017. */
  16018. function middleware (collection) {
  16019. var length = Utility_sizeof(collection)
  16020. return function (element, index, children, callback) {
  16021. var output = ''
  16022. for (var i = 0; i < length; i++)
  16023. output += collection[i](element, index, children, callback) || ''
  16024. return output
  16025. }
  16026. }
  16027. /**
  16028. * @param {function} callback
  16029. * @return {function}
  16030. */
  16031. function rulesheet (callback) {
  16032. return function (element) {
  16033. if (!element.root)
  16034. if (element = element.return)
  16035. callback(element)
  16036. }
  16037. }
  16038. /**
  16039. * @param {object} element
  16040. * @param {number} index
  16041. * @param {object[]} children
  16042. * @param {function} callback
  16043. */
  16044. function prefixer (element, index, children, callback) {
  16045. if (element.length > -1)
  16046. if (!element.return)
  16047. switch (element.type) {
  16048. case DECLARATION: element.return = prefix(element.value, element.length)
  16049. break
  16050. case KEYFRAMES:
  16051. return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)
  16052. case Enum_RULESET:
  16053. if (element.length)
  16054. return Utility_combine(element.props, function (value) {
  16055. switch (match(value, /(::plac\w+|:read-\w+)/)) {
  16056. // :read-(only|write)
  16057. case ':read-only': case ':read-write':
  16058. return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback)
  16059. // :placeholder
  16060. case '::placeholder':
  16061. return serialize([
  16062. copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}),
  16063. copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}),
  16064. copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]})
  16065. ], callback)
  16066. }
  16067. return ''
  16068. })
  16069. }
  16070. }
  16071. /**
  16072. * @param {object} element
  16073. * @param {number} index
  16074. * @param {object[]} children
  16075. */
  16076. function namespace (element) {
  16077. switch (element.type) {
  16078. case RULESET:
  16079. element.props = element.props.map(function (value) {
  16080. return combine(tokenize(value), function (value, index, children) {
  16081. switch (charat(value, 0)) {
  16082. // \f
  16083. case 12:
  16084. return substr(value, 1, strlen(value))
  16085. // \0 ( + > ~
  16086. case 0: case 40: case 43: case 62: case 126:
  16087. return value
  16088. // :
  16089. case 58:
  16090. if (children[++index] === 'global')
  16091. children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1)
  16092. // \s
  16093. case 32:
  16094. return index === 1 ? '' : value
  16095. default:
  16096. switch (index) {
  16097. case 0: element = value
  16098. return sizeof(children) > 1 ? '' : value
  16099. case index = sizeof(children) - 1: case 2:
  16100. return index === 2 ? value + element + element : value + element
  16101. default:
  16102. return value
  16103. }
  16104. }
  16105. })
  16106. })
  16107. }
  16108. }
  16109. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Parser.js
  16110. /**
  16111. * @param {string} value
  16112. * @return {object[]}
  16113. */
  16114. function compile (value) {
  16115. return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))
  16116. }
  16117. /**
  16118. * @param {string} value
  16119. * @param {object} root
  16120. * @param {object?} parent
  16121. * @param {string[]} rule
  16122. * @param {string[]} rules
  16123. * @param {string[]} rulesets
  16124. * @param {number[]} pseudo
  16125. * @param {number[]} points
  16126. * @param {string[]} declarations
  16127. * @return {object}
  16128. */
  16129. function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
  16130. var index = 0
  16131. var offset = 0
  16132. var length = pseudo
  16133. var atrule = 0
  16134. var property = 0
  16135. var previous = 0
  16136. var variable = 1
  16137. var scanning = 1
  16138. var ampersand = 1
  16139. var character = 0
  16140. var type = ''
  16141. var props = rules
  16142. var children = rulesets
  16143. var reference = rule
  16144. var characters = type
  16145. while (scanning)
  16146. switch (previous = character, character = next()) {
  16147. // (
  16148. case 40:
  16149. if (previous != 108 && characters.charCodeAt(length - 1) == 58) {
  16150. if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1)
  16151. ampersand = -1
  16152. break
  16153. }
  16154. // " ' [
  16155. case 34: case 39: case 91:
  16156. characters += delimit(character)
  16157. break
  16158. // \t \n \r \s
  16159. case 9: case 10: case 13: case 32:
  16160. characters += whitespace(previous)
  16161. break
  16162. // \
  16163. case 92:
  16164. characters += escaping(caret() - 1, 7)
  16165. continue
  16166. // /
  16167. case 47:
  16168. switch (peek()) {
  16169. case 42: case 47:
  16170. Utility_append(comment(commenter(next(), caret()), root, parent), declarations)
  16171. break
  16172. default:
  16173. characters += '/'
  16174. }
  16175. break
  16176. // {
  16177. case 123 * variable:
  16178. points[index++] = Utility_strlen(characters) * ampersand
  16179. // } ; \0
  16180. case 125 * variable: case 59: case 0:
  16181. switch (character) {
  16182. // \0 }
  16183. case 0: case 125: scanning = 0
  16184. // ;
  16185. case 59 + offset:
  16186. if (property > 0 && (Utility_strlen(characters) - length))
  16187. Utility_append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)
  16188. break
  16189. // @ ;
  16190. case 59: characters += ';'
  16191. // { rule/at-rule
  16192. default:
  16193. Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)
  16194. if (character === 123)
  16195. if (offset === 0)
  16196. parse(characters, root, reference, reference, props, rulesets, length, points, children)
  16197. else
  16198. switch (atrule) {
  16199. // d m s
  16200. case 100: case 109: case 115:
  16201. parse(value, reference, reference, rule && Utility_append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children)
  16202. break
  16203. default:
  16204. parse(characters, reference, reference, reference, [''], children, 0, points, children)
  16205. }
  16206. }
  16207. index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo
  16208. break
  16209. // :
  16210. case 58:
  16211. length = 1 + Utility_strlen(characters), property = previous
  16212. default:
  16213. if (variable < 1)
  16214. if (character == 123)
  16215. --variable
  16216. else if (character == 125 && variable++ == 0 && prev() == 125)
  16217. continue
  16218. switch (characters += Utility_from(character), character * variable) {
  16219. // &
  16220. case 38:
  16221. ampersand = offset > 0 ? 1 : (characters += '\f', -1)
  16222. break
  16223. // ,
  16224. case 44:
  16225. points[index++] = (Utility_strlen(characters) - 1) * ampersand, ampersand = 1
  16226. break
  16227. // @
  16228. case 64:
  16229. // -
  16230. if (peek() === 45)
  16231. characters += delimit(next())
  16232. atrule = peek(), offset = length = Utility_strlen(type = characters += identifier(caret())), character++
  16233. break
  16234. // -
  16235. case 45:
  16236. if (previous === 45 && Utility_strlen(characters) == 2)
  16237. variable = 0
  16238. }
  16239. }
  16240. return rulesets
  16241. }
  16242. /**
  16243. * @param {string} value
  16244. * @param {object} root
  16245. * @param {object?} parent
  16246. * @param {number} index
  16247. * @param {number} offset
  16248. * @param {string[]} rules
  16249. * @param {number[]} points
  16250. * @param {string} type
  16251. * @param {string[]} props
  16252. * @param {string[]} children
  16253. * @param {number} length
  16254. * @return {object}
  16255. */
  16256. function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {
  16257. var post = offset - 1
  16258. var rule = offset === 0 ? rules : ['']
  16259. var size = Utility_sizeof(rule)
  16260. for (var i = 0, j = 0, k = 0; i < index; ++i)
  16261. for (var x = 0, y = Utility_substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
  16262. if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x])))
  16263. props[k++] = z
  16264. return node(value, root, parent, offset === 0 ? Enum_RULESET : type, props, children, length)
  16265. }
  16266. /**
  16267. * @param {number} value
  16268. * @param {object} root
  16269. * @param {object?} parent
  16270. * @return {object}
  16271. */
  16272. function comment (value, root, parent) {
  16273. return node(value, root, parent, COMMENT, Utility_from(Tokenizer_char()), Utility_substr(value, 2, -2), 0)
  16274. }
  16275. /**
  16276. * @param {string} value
  16277. * @param {object} root
  16278. * @param {object?} parent
  16279. * @param {number} length
  16280. * @return {object}
  16281. */
  16282. function declaration (value, root, parent, length) {
  16283. return node(value, root, parent, DECLARATION, Utility_substr(value, 0, length), Utility_substr(value, length + 1, -1), length)
  16284. }
  16285. ;// CONCATENATED MODULE: ./node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js
  16286. var last = function last(arr) {
  16287. return arr.length ? arr[arr.length - 1] : null;
  16288. }; // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244
  16289. var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
  16290. var previous = 0;
  16291. var character = 0;
  16292. while (true) {
  16293. previous = character;
  16294. character = peek(); // &\f
  16295. if (previous === 38 && character === 12) {
  16296. points[index] = 1;
  16297. }
  16298. if (token(character)) {
  16299. break;
  16300. }
  16301. next();
  16302. }
  16303. return slice(begin, position);
  16304. };
  16305. var toRules = function toRules(parsed, points) {
  16306. // pretend we've started with a comma
  16307. var index = -1;
  16308. var character = 44;
  16309. do {
  16310. switch (token(character)) {
  16311. case 0:
  16312. // &\f
  16313. if (character === 38 && peek() === 12) {
  16314. // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
  16315. // stylis inserts \f after & to know when & where it should replace this sequence with the context selector
  16316. // and when it should just concatenate the outer and inner selectors
  16317. // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
  16318. points[index] = 1;
  16319. }
  16320. parsed[index] += identifierWithPointTracking(position - 1, points, index);
  16321. break;
  16322. case 2:
  16323. parsed[index] += delimit(character);
  16324. break;
  16325. case 4:
  16326. // comma
  16327. if (character === 44) {
  16328. // colon
  16329. parsed[++index] = peek() === 58 ? '&\f' : '';
  16330. points[index] = parsed[index].length;
  16331. break;
  16332. }
  16333. // fallthrough
  16334. default:
  16335. parsed[index] += Utility_from(character);
  16336. }
  16337. } while (character = next());
  16338. return parsed;
  16339. };
  16340. var getRules = function getRules(value, points) {
  16341. return dealloc(toRules(alloc(value), points));
  16342. }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
  16343. var fixedElements = /* #__PURE__ */new WeakMap();
  16344. var compat = function compat(element) {
  16345. if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
  16346. // negative .length indicates that this rule has been already prefixed
  16347. element.length < 1) {
  16348. return;
  16349. }
  16350. var value = element.value,
  16351. parent = element.parent;
  16352. var isImplicitRule = element.column === parent.column && element.line === parent.line;
  16353. while (parent.type !== 'rule') {
  16354. parent = parent.parent;
  16355. if (!parent) return;
  16356. } // short-circuit for the simplest case
  16357. if (element.props.length === 1 && value.charCodeAt(0) !== 58
  16358. /* colon */
  16359. && !fixedElements.get(parent)) {
  16360. return;
  16361. } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
  16362. // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
  16363. if (isImplicitRule) {
  16364. return;
  16365. }
  16366. fixedElements.set(element, true);
  16367. var points = [];
  16368. var rules = getRules(value, points);
  16369. var parentRules = parent.props;
  16370. for (var i = 0, k = 0; i < rules.length; i++) {
  16371. for (var j = 0; j < parentRules.length; j++, k++) {
  16372. element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
  16373. }
  16374. }
  16375. };
  16376. var removeLabel = function removeLabel(element) {
  16377. if (element.type === 'decl') {
  16378. var value = element.value;
  16379. if ( // charcode for l
  16380. value.charCodeAt(0) === 108 && // charcode for b
  16381. value.charCodeAt(2) === 98) {
  16382. // this ignores label
  16383. element["return"] = '';
  16384. element.value = '';
  16385. }
  16386. }
  16387. };
  16388. var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
  16389. var isIgnoringComment = function isIgnoringComment(element) {
  16390. return !!element && element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
  16391. };
  16392. var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
  16393. return function (element, index, children) {
  16394. if (element.type !== 'rule') return;
  16395. var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
  16396. if (unsafePseudoClasses && cache.compat !== true) {
  16397. var prevElement = index > 0 ? children[index - 1] : null;
  16398. if (prevElement && isIgnoringComment(last(prevElement.children))) {
  16399. return;
  16400. }
  16401. unsafePseudoClasses.forEach(function (unsafePseudoClass) {
  16402. console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
  16403. });
  16404. }
  16405. };
  16406. };
  16407. var isImportRule = function isImportRule(element) {
  16408. return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
  16409. };
  16410. var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
  16411. for (var i = index - 1; i >= 0; i--) {
  16412. if (!isImportRule(children[i])) {
  16413. return true;
  16414. }
  16415. }
  16416. return false;
  16417. }; // use this to remove incorrect elements from further processing
  16418. // so they don't get handed to the `sheet` (or anything else)
  16419. // as that could potentially lead to additional logs which in turn could be overhelming to the user
  16420. var nullifyElement = function nullifyElement(element) {
  16421. element.type = '';
  16422. element.value = '';
  16423. element["return"] = '';
  16424. element.children = '';
  16425. element.props = '';
  16426. };
  16427. var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
  16428. if (!isImportRule(element)) {
  16429. return;
  16430. }
  16431. if (element.parent) {
  16432. console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
  16433. nullifyElement(element);
  16434. } else if (isPrependedWithRegularRules(index, children)) {
  16435. console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
  16436. nullifyElement(element);
  16437. }
  16438. };
  16439. var defaultStylisPlugins = [prefixer];
  16440. var createCache = function createCache(options) {
  16441. var key = options.key;
  16442. if (false) {}
  16443. if ( key === 'css') {
  16444. var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
  16445. // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
  16446. // note this very very intentionally targets all style elements regardless of the key to ensure
  16447. // that creating a cache works inside of render of a React component
  16448. Array.prototype.forEach.call(ssrStyles, function (node) {
  16449. // we want to only move elements which have a space in the data-emotion attribute value
  16450. // because that indicates that it is an Emotion 11 server-side rendered style elements
  16451. // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
  16452. // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
  16453. // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
  16454. // will not result in the Emotion 10 styles being destroyed
  16455. var dataEmotionAttribute = node.getAttribute('data-emotion');
  16456. if (dataEmotionAttribute.indexOf(' ') === -1) {
  16457. return;
  16458. }
  16459. document.head.appendChild(node);
  16460. node.setAttribute('data-s', '');
  16461. });
  16462. }
  16463. var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
  16464. if (false) {}
  16465. var inserted = {}; // $FlowFixMe
  16466. var container;
  16467. var nodesToHydrate = [];
  16468. {
  16469. container = options.container || document.head;
  16470. Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
  16471. // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
  16472. document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
  16473. var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe
  16474. for (var i = 1; i < attrib.length; i++) {
  16475. inserted[attrib[i]] = true;
  16476. }
  16477. nodesToHydrate.push(node);
  16478. });
  16479. }
  16480. var _insert;
  16481. var omnipresentPlugins = [compat, removeLabel];
  16482. if (false) {}
  16483. {
  16484. var currentSheet;
  16485. var finalizingPlugins = [stringify, false ? 0 : rulesheet(function (rule) {
  16486. currentSheet.insert(rule);
  16487. })];
  16488. var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
  16489. var stylis = function stylis(styles) {
  16490. return serialize(compile(styles), serializer);
  16491. };
  16492. _insert = function insert(selector, serialized, sheet, shouldCache) {
  16493. currentSheet = sheet;
  16494. if (false) {}
  16495. stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
  16496. if (shouldCache) {
  16497. cache.inserted[serialized.name] = true;
  16498. }
  16499. };
  16500. }
  16501. var cache = {
  16502. key: key,
  16503. sheet: new StyleSheet({
  16504. key: key,
  16505. container: container,
  16506. nonce: options.nonce,
  16507. speedy: options.speedy,
  16508. prepend: options.prepend,
  16509. insertionPoint: options.insertionPoint
  16510. }),
  16511. nonce: options.nonce,
  16512. inserted: inserted,
  16513. registered: {},
  16514. insert: _insert
  16515. };
  16516. cache.sheet.hydrate(nodesToHydrate);
  16517. return cache;
  16518. };
  16519. /* harmony default export */ var emotion_cache_browser_esm = (createCache);
  16520. ;// CONCATENATED MODULE: ./node_modules/@emotion/hash/dist/hash.browser.esm.js
  16521. /* eslint-disable */
  16522. // Inspired by https://github.com/garycourt/murmurhash-js
  16523. // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
  16524. function murmur2(str) {
  16525. // 'm' and 'r' are mixing constants generated offline.
  16526. // They're not really 'magic', they just happen to work well.
  16527. // const m = 0x5bd1e995;
  16528. // const r = 24;
  16529. // Initialize the hash
  16530. var h = 0; // Mix 4 bytes at a time into the hash
  16531. var k,
  16532. i = 0,
  16533. len = str.length;
  16534. for (; len >= 4; ++i, len -= 4) {
  16535. k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
  16536. k =
  16537. /* Math.imul(k, m): */
  16538. (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
  16539. k ^=
  16540. /* k >>> r: */
  16541. k >>> 24;
  16542. h =
  16543. /* Math.imul(k, m): */
  16544. (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
  16545. /* Math.imul(h, m): */
  16546. (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
  16547. } // Handle the last few bytes of the input array
  16548. switch (len) {
  16549. case 3:
  16550. h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
  16551. case 2:
  16552. h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
  16553. case 1:
  16554. h ^= str.charCodeAt(i) & 0xff;
  16555. h =
  16556. /* Math.imul(h, m): */
  16557. (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
  16558. } // Do a few final mixes of the hash to ensure the last few
  16559. // bytes are well-incorporated.
  16560. h ^= h >>> 13;
  16561. h =
  16562. /* Math.imul(h, m): */
  16563. (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
  16564. return ((h ^ h >>> 15) >>> 0).toString(36);
  16565. }
  16566. /* harmony default export */ var hash_browser_esm = (murmur2);
  16567. ;// CONCATENATED MODULE: ./node_modules/@emotion/unitless/dist/unitless.browser.esm.js
  16568. var unitlessKeys = {
  16569. animationIterationCount: 1,
  16570. borderImageOutset: 1,
  16571. borderImageSlice: 1,
  16572. borderImageWidth: 1,
  16573. boxFlex: 1,
  16574. boxFlexGroup: 1,
  16575. boxOrdinalGroup: 1,
  16576. columnCount: 1,
  16577. columns: 1,
  16578. flex: 1,
  16579. flexGrow: 1,
  16580. flexPositive: 1,
  16581. flexShrink: 1,
  16582. flexNegative: 1,
  16583. flexOrder: 1,
  16584. gridRow: 1,
  16585. gridRowEnd: 1,
  16586. gridRowSpan: 1,
  16587. gridRowStart: 1,
  16588. gridColumn: 1,
  16589. gridColumnEnd: 1,
  16590. gridColumnSpan: 1,
  16591. gridColumnStart: 1,
  16592. msGridRow: 1,
  16593. msGridRowSpan: 1,
  16594. msGridColumn: 1,
  16595. msGridColumnSpan: 1,
  16596. fontWeight: 1,
  16597. lineHeight: 1,
  16598. opacity: 1,
  16599. order: 1,
  16600. orphans: 1,
  16601. tabSize: 1,
  16602. widows: 1,
  16603. zIndex: 1,
  16604. zoom: 1,
  16605. WebkitLineClamp: 1,
  16606. // SVG-related properties
  16607. fillOpacity: 1,
  16608. floodOpacity: 1,
  16609. stopOpacity: 1,
  16610. strokeDasharray: 1,
  16611. strokeDashoffset: 1,
  16612. strokeMiterlimit: 1,
  16613. strokeOpacity: 1,
  16614. strokeWidth: 1
  16615. };
  16616. /* harmony default export */ var unitless_browser_esm = (unitlessKeys);
  16617. ;// CONCATENATED MODULE: ./node_modules/@emotion/memoize/dist/emotion-memoize.browser.esm.js
  16618. function memoize(fn) {
  16619. var cache = Object.create(null);
  16620. return function (arg) {
  16621. if (cache[arg] === undefined) cache[arg] = fn(arg);
  16622. return cache[arg];
  16623. };
  16624. }
  16625. /* harmony default export */ var emotion_memoize_browser_esm = (memoize);
  16626. ;// CONCATENATED MODULE: ./node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js
  16627. var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
  16628. var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).";
  16629. var hyphenateRegex = /[A-Z]|^ms/g;
  16630. var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
  16631. var isCustomProperty = function isCustomProperty(property) {
  16632. return property.charCodeAt(1) === 45;
  16633. };
  16634. var isProcessableValue = function isProcessableValue(value) {
  16635. return value != null && typeof value !== 'boolean';
  16636. };
  16637. var processStyleName = /* #__PURE__ */emotion_memoize_browser_esm(function (styleName) {
  16638. return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
  16639. });
  16640. var processStyleValue = function processStyleValue(key, value) {
  16641. switch (key) {
  16642. case 'animation':
  16643. case 'animationName':
  16644. {
  16645. if (typeof value === 'string') {
  16646. return value.replace(animationRegex, function (match, p1, p2) {
  16647. cursor = {
  16648. name: p1,
  16649. styles: p2,
  16650. next: cursor
  16651. };
  16652. return p1;
  16653. });
  16654. }
  16655. }
  16656. }
  16657. if (unitless_browser_esm[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
  16658. return value + 'px';
  16659. }
  16660. return value;
  16661. };
  16662. if (false) { var hyphenatedCache, hyphenPattern, msPattern, oldProcessStyleValue, contentValues, contentValuePattern; }
  16663. function handleInterpolation(mergedProps, registered, interpolation) {
  16664. if (interpolation == null) {
  16665. return '';
  16666. }
  16667. if (interpolation.__emotion_styles !== undefined) {
  16668. if (false) {}
  16669. return interpolation;
  16670. }
  16671. switch (typeof interpolation) {
  16672. case 'boolean':
  16673. {
  16674. return '';
  16675. }
  16676. case 'object':
  16677. {
  16678. if (interpolation.anim === 1) {
  16679. cursor = {
  16680. name: interpolation.name,
  16681. styles: interpolation.styles,
  16682. next: cursor
  16683. };
  16684. return interpolation.name;
  16685. }
  16686. if (interpolation.styles !== undefined) {
  16687. var next = interpolation.next;
  16688. if (next !== undefined) {
  16689. // not the most efficient thing ever but this is a pretty rare case
  16690. // and there will be very few iterations of this generally
  16691. while (next !== undefined) {
  16692. cursor = {
  16693. name: next.name,
  16694. styles: next.styles,
  16695. next: cursor
  16696. };
  16697. next = next.next;
  16698. }
  16699. }
  16700. var styles = interpolation.styles + ";";
  16701. if (false) {}
  16702. return styles;
  16703. }
  16704. return createStringFromObject(mergedProps, registered, interpolation);
  16705. }
  16706. case 'function':
  16707. {
  16708. if (mergedProps !== undefined) {
  16709. var previousCursor = cursor;
  16710. var result = interpolation(mergedProps);
  16711. cursor = previousCursor;
  16712. return handleInterpolation(mergedProps, registered, result);
  16713. } else if (false) {}
  16714. break;
  16715. }
  16716. case 'string':
  16717. if (false) { var replaced, matched; }
  16718. break;
  16719. } // finalize string values (regular strings and functions interpolated into css calls)
  16720. if (registered == null) {
  16721. return interpolation;
  16722. }
  16723. var cached = registered[interpolation];
  16724. return cached !== undefined ? cached : interpolation;
  16725. }
  16726. function createStringFromObject(mergedProps, registered, obj) {
  16727. var string = '';
  16728. if (Array.isArray(obj)) {
  16729. for (var i = 0; i < obj.length; i++) {
  16730. string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
  16731. }
  16732. } else {
  16733. for (var _key in obj) {
  16734. var value = obj[_key];
  16735. if (typeof value !== 'object') {
  16736. if (registered != null && registered[value] !== undefined) {
  16737. string += _key + "{" + registered[value] + "}";
  16738. } else if (isProcessableValue(value)) {
  16739. string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";";
  16740. }
  16741. } else {
  16742. if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') {}
  16743. if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
  16744. for (var _i = 0; _i < value.length; _i++) {
  16745. if (isProcessableValue(value[_i])) {
  16746. string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";";
  16747. }
  16748. }
  16749. } else {
  16750. var interpolated = handleInterpolation(mergedProps, registered, value);
  16751. switch (_key) {
  16752. case 'animation':
  16753. case 'animationName':
  16754. {
  16755. string += processStyleName(_key) + ":" + interpolated + ";";
  16756. break;
  16757. }
  16758. default:
  16759. {
  16760. if (false) {}
  16761. string += _key + "{" + interpolated + "}";
  16762. }
  16763. }
  16764. }
  16765. }
  16766. }
  16767. }
  16768. return string;
  16769. }
  16770. var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g;
  16771. var sourceMapPattern;
  16772. if (false) {} // this is the cursor for keyframes
  16773. // keyframes are stored on the SerializedStyles object as a linked list
  16774. var cursor;
  16775. var emotion_serialize_browser_esm_serializeStyles = function serializeStyles(args, registered, mergedProps) {
  16776. if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
  16777. return args[0];
  16778. }
  16779. var stringMode = true;
  16780. var styles = '';
  16781. cursor = undefined;
  16782. var strings = args[0];
  16783. if (strings == null || strings.raw === undefined) {
  16784. stringMode = false;
  16785. styles += handleInterpolation(mergedProps, registered, strings);
  16786. } else {
  16787. if (false) {}
  16788. styles += strings[0];
  16789. } // we start at 1 since we've already handled the first arg
  16790. for (var i = 1; i < args.length; i++) {
  16791. styles += handleInterpolation(mergedProps, registered, args[i]);
  16792. if (stringMode) {
  16793. if (false) {}
  16794. styles += strings[i];
  16795. }
  16796. }
  16797. var sourceMap;
  16798. if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time
  16799. labelPattern.lastIndex = 0;
  16800. var identifierName = '';
  16801. var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
  16802. while ((match = labelPattern.exec(styles)) !== null) {
  16803. identifierName += '-' + // $FlowFixMe we know it's not null
  16804. match[1];
  16805. }
  16806. var name = hash_browser_esm(styles) + identifierName;
  16807. if (false) {}
  16808. return {
  16809. name: name,
  16810. styles: styles,
  16811. next: cursor
  16812. };
  16813. };
  16814. ;// CONCATENATED MODULE: ./node_modules/@emotion/react/dist/emotion-element-cbed451f.browser.esm.js
  16815. var emotion_element_cbed451f_browser_esm_hasOwnProperty = {}.hasOwnProperty;
  16816. var EmotionCacheContext = /* #__PURE__ */(0,external_React_.createContext)( // we're doing this to avoid preconstruct's dead code elimination in this one case
  16817. // because this module is primarily intended for the browser and node
  16818. // but it's also required in react native and similar environments sometimes
  16819. // and we could have a special build just for that
  16820. // but this is much easier and the native packages
  16821. // might use a different theme context in the future anyway
  16822. typeof HTMLElement !== 'undefined' ? /* #__PURE__ */emotion_cache_browser_esm({
  16823. key: 'css'
  16824. }) : null);
  16825. if (false) {}
  16826. var CacheProvider = EmotionCacheContext.Provider;
  16827. var __unsafe_useEmotionCache = function useEmotionCache() {
  16828. return (0,external_React_.useContext)(EmotionCacheContext);
  16829. };
  16830. var emotion_element_cbed451f_browser_esm_withEmotionCache = function withEmotionCache(func) {
  16831. // $FlowFixMe
  16832. return /*#__PURE__*/(0,external_React_.forwardRef)(function (props, ref) {
  16833. // the cache will never be null in the browser
  16834. var cache = (0,external_React_.useContext)(EmotionCacheContext);
  16835. return func(props, cache, ref);
  16836. });
  16837. };
  16838. var emotion_element_cbed451f_browser_esm_ThemeContext = /* #__PURE__ */(0,external_React_.createContext)({});
  16839. if (false) {}
  16840. var useTheme = function useTheme() {
  16841. return useContext(emotion_element_cbed451f_browser_esm_ThemeContext);
  16842. };
  16843. var getTheme = function getTheme(outerTheme, theme) {
  16844. if (typeof theme === 'function') {
  16845. var mergedTheme = theme(outerTheme);
  16846. if (false) {}
  16847. return mergedTheme;
  16848. }
  16849. if (false) {}
  16850. return _extends({}, outerTheme, theme);
  16851. };
  16852. var createCacheWithTheme = /* #__PURE__ */(/* unused pure expression or super */ null && (weakMemoize(function (outerTheme) {
  16853. return weakMemoize(function (theme) {
  16854. return getTheme(outerTheme, theme);
  16855. });
  16856. })));
  16857. var ThemeProvider = function ThemeProvider(props) {
  16858. var theme = useContext(emotion_element_cbed451f_browser_esm_ThemeContext);
  16859. if (props.theme !== theme) {
  16860. theme = createCacheWithTheme(theme)(props.theme);
  16861. }
  16862. return /*#__PURE__*/createElement(emotion_element_cbed451f_browser_esm_ThemeContext.Provider, {
  16863. value: theme
  16864. }, props.children);
  16865. };
  16866. function withTheme(Component) {
  16867. var componentName = Component.displayName || Component.name || 'Component';
  16868. var render = function render(props, ref) {
  16869. var theme = useContext(emotion_element_cbed451f_browser_esm_ThemeContext);
  16870. return /*#__PURE__*/createElement(Component, _extends({
  16871. theme: theme,
  16872. ref: ref
  16873. }, props));
  16874. }; // $FlowFixMe
  16875. var WithTheme = /*#__PURE__*/forwardRef(render);
  16876. WithTheme.displayName = "WithTheme(" + componentName + ")";
  16877. return hoistNonReactStatics(WithTheme, Component);
  16878. }
  16879. var getLastPart = function getLastPart(functionName) {
  16880. // The match may be something like 'Object.createEmotionProps' or
  16881. // 'Loader.prototype.render'
  16882. var parts = functionName.split('.');
  16883. return parts[parts.length - 1];
  16884. };
  16885. var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
  16886. // V8
  16887. var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
  16888. if (match) return getLastPart(match[1]); // Safari / Firefox
  16889. match = /^([A-Za-z0-9$.]+)@/.exec(line);
  16890. if (match) return getLastPart(match[1]);
  16891. return undefined;
  16892. };
  16893. var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS
  16894. // identifiers, thus we only need to replace what is a valid character for JS,
  16895. // but not for CSS.
  16896. var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
  16897. return identifier.replace(/\$/g, '-');
  16898. };
  16899. var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
  16900. if (!stackTrace) return undefined;
  16901. var lines = stackTrace.split('\n');
  16902. for (var i = 0; i < lines.length; i++) {
  16903. var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error"
  16904. if (!functionName) continue; // If we reach one of these, we have gone too far and should quit
  16905. if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an
  16906. // uppercase letter
  16907. if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
  16908. }
  16909. return undefined;
  16910. };
  16911. var useInsertionEffect = external_React_['useInsertion' + 'Effect'] ? external_React_['useInsertion' + 'Effect'] : function useInsertionEffect(create) {
  16912. create();
  16913. };
  16914. function emotion_element_cbed451f_browser_esm_useInsertionEffectMaybe(create) {
  16915. useInsertionEffect(create);
  16916. }
  16917. var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
  16918. var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
  16919. var emotion_element_cbed451f_browser_esm_createEmotionProps = function createEmotionProps(type, props) {
  16920. if (false) {}
  16921. var newProps = {};
  16922. for (var key in props) {
  16923. if (emotion_element_cbed451f_browser_esm_hasOwnProperty.call(props, key)) {
  16924. newProps[key] = props[key];
  16925. }
  16926. }
  16927. newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when
  16928. // the label hasn't already been computed
  16929. if (false) { var label; }
  16930. return newProps;
  16931. };
  16932. var Insertion = function Insertion(_ref) {
  16933. var cache = _ref.cache,
  16934. serialized = _ref.serialized,
  16935. isStringTag = _ref.isStringTag;
  16936. registerStyles(cache, serialized, isStringTag);
  16937. var rules = emotion_element_cbed451f_browser_esm_useInsertionEffectMaybe(function () {
  16938. return insertStyles(cache, serialized, isStringTag);
  16939. });
  16940. return null;
  16941. };
  16942. var emotion_element_cbed451f_browser_esm_Emotion = /* #__PURE__ */(/* unused pure expression or super */ null && (emotion_element_cbed451f_browser_esm_withEmotionCache(function (props, cache, ref) {
  16943. var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
  16944. // not passing the registered cache to serializeStyles because it would
  16945. // make certain babel optimisations not possible
  16946. if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {
  16947. cssProp = cache.registered[cssProp];
  16948. }
  16949. var WrappedComponent = props[typePropName];
  16950. var registeredStyles = [cssProp];
  16951. var className = '';
  16952. if (typeof props.className === 'string') {
  16953. className = getRegisteredStyles(cache.registered, registeredStyles, props.className);
  16954. } else if (props.className != null) {
  16955. className = props.className + " ";
  16956. }
  16957. var serialized = serializeStyles(registeredStyles, undefined, useContext(emotion_element_cbed451f_browser_esm_ThemeContext));
  16958. if (false) { var labelFromStack; }
  16959. className += cache.key + "-" + serialized.name;
  16960. var newProps = {};
  16961. for (var key in props) {
  16962. if (emotion_element_cbed451f_browser_esm_hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && ( true || 0)) {
  16963. newProps[key] = props[key];
  16964. }
  16965. }
  16966. newProps.ref = ref;
  16967. newProps.className = className;
  16968. return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, {
  16969. cache: cache,
  16970. serialized: serialized,
  16971. isStringTag: typeof WrappedComponent === 'string'
  16972. }), /*#__PURE__*/createElement(WrappedComponent, newProps));
  16973. })));
  16974. if (false) {}
  16975. ;// CONCATENATED MODULE: ./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js
  16976. var isBrowser = "object" !== 'undefined';
  16977. function emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, classNames) {
  16978. var rawClassName = '';
  16979. classNames.split(' ').forEach(function (className) {
  16980. if (registered[className] !== undefined) {
  16981. registeredStyles.push(registered[className] + ";");
  16982. } else {
  16983. rawClassName += className + " ";
  16984. }
  16985. });
  16986. return rawClassName;
  16987. }
  16988. var emotion_utils_browser_esm_insertStyles = function insertStyles(cache, serialized, isStringTag) {
  16989. var className = cache.key + "-" + serialized.name;
  16990. if ( // we only need to add the styles to the registered cache if the
  16991. // class name could be used further down
  16992. // the tree but if it's a string tag, we know it won't
  16993. // so we don't have to add it to registered cache.
  16994. // this improves memory usage since we can avoid storing the whole style string
  16995. (isStringTag === false || // we need to always store it if we're in compat mode and
  16996. // in node since emotion-server relies on whether a style is in
  16997. // the registered cache to know whether a style is global or not
  16998. // also, note that this check will be dead code eliminated in the browser
  16999. isBrowser === false ) && cache.registered[className] === undefined) {
  17000. cache.registered[className] = serialized.styles;
  17001. }
  17002. if (cache.inserted[serialized.name] === undefined) {
  17003. var current = serialized;
  17004. do {
  17005. var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
  17006. current = current.next;
  17007. } while (current !== undefined);
  17008. }
  17009. };
  17010. ;// CONCATENATED MODULE: ./node_modules/@emotion/css/create-instance/dist/emotion-css-create-instance.esm.js
  17011. function insertWithoutScoping(cache, serialized) {
  17012. if (cache.inserted[serialized.name] === undefined) {
  17013. return cache.insert('', serialized, cache.sheet, true);
  17014. }
  17015. }
  17016. function merge(registered, css, className) {
  17017. var registeredStyles = [];
  17018. var rawClassName = emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, className);
  17019. if (registeredStyles.length < 2) {
  17020. return className;
  17021. }
  17022. return rawClassName + css(registeredStyles);
  17023. }
  17024. var createEmotion = function createEmotion(options) {
  17025. var cache = emotion_cache_browser_esm(options); // $FlowFixMe
  17026. cache.sheet.speedy = function (value) {
  17027. if (false) {}
  17028. this.isSpeedy = value;
  17029. };
  17030. cache.compat = true;
  17031. var css = function css() {
  17032. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  17033. args[_key] = arguments[_key];
  17034. }
  17035. var serialized = emotion_serialize_browser_esm_serializeStyles(args, cache.registered, undefined);
  17036. emotion_utils_browser_esm_insertStyles(cache, serialized, false);
  17037. return cache.key + "-" + serialized.name;
  17038. };
  17039. var keyframes = function keyframes() {
  17040. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  17041. args[_key2] = arguments[_key2];
  17042. }
  17043. var serialized = emotion_serialize_browser_esm_serializeStyles(args, cache.registered);
  17044. var animation = "animation-" + serialized.name;
  17045. insertWithoutScoping(cache, {
  17046. name: serialized.name,
  17047. styles: "@keyframes " + animation + "{" + serialized.styles + "}"
  17048. });
  17049. return animation;
  17050. };
  17051. var injectGlobal = function injectGlobal() {
  17052. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  17053. args[_key3] = arguments[_key3];
  17054. }
  17055. var serialized = emotion_serialize_browser_esm_serializeStyles(args, cache.registered);
  17056. insertWithoutScoping(cache, serialized);
  17057. };
  17058. var cx = function cx() {
  17059. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  17060. args[_key4] = arguments[_key4];
  17061. }
  17062. return merge(cache.registered, css, emotion_css_create_instance_esm_classnames(args));
  17063. };
  17064. return {
  17065. css: css,
  17066. cx: cx,
  17067. injectGlobal: injectGlobal,
  17068. keyframes: keyframes,
  17069. hydrate: function hydrate(ids) {
  17070. ids.forEach(function (key) {
  17071. cache.inserted[key] = true;
  17072. });
  17073. },
  17074. flush: function flush() {
  17075. cache.registered = {};
  17076. cache.inserted = {};
  17077. cache.sheet.flush();
  17078. },
  17079. // $FlowFixMe
  17080. sheet: cache.sheet,
  17081. cache: cache,
  17082. getRegisteredStyles: emotion_utils_browser_esm_getRegisteredStyles.bind(null, cache.registered),
  17083. merge: merge.bind(null, cache.registered, css)
  17084. };
  17085. };
  17086. var emotion_css_create_instance_esm_classnames = function classnames(args) {
  17087. var cls = '';
  17088. for (var i = 0; i < args.length; i++) {
  17089. var arg = args[i];
  17090. if (arg == null) continue;
  17091. var toAdd = void 0;
  17092. switch (typeof arg) {
  17093. case 'boolean':
  17094. break;
  17095. case 'object':
  17096. {
  17097. if (Array.isArray(arg)) {
  17098. toAdd = classnames(arg);
  17099. } else {
  17100. toAdd = '';
  17101. for (var k in arg) {
  17102. if (arg[k] && k) {
  17103. toAdd && (toAdd += ' ');
  17104. toAdd += k;
  17105. }
  17106. }
  17107. }
  17108. break;
  17109. }
  17110. default:
  17111. {
  17112. toAdd = arg;
  17113. }
  17114. }
  17115. if (toAdd) {
  17116. cls && (cls += ' ');
  17117. cls += toAdd;
  17118. }
  17119. }
  17120. return cls;
  17121. };
  17122. /* harmony default export */ var emotion_css_create_instance_esm = (createEmotion);
  17123. ;// CONCATENATED MODULE: ./node_modules/@emotion/css/dist/emotion-css.esm.js
  17124. var _createEmotion = emotion_css_create_instance_esm({
  17125. key: 'css'
  17126. }),
  17127. flush = _createEmotion.flush,
  17128. hydrate = _createEmotion.hydrate,
  17129. emotion_css_esm_cx = _createEmotion.cx,
  17130. emotion_css_esm_merge = _createEmotion.merge,
  17131. emotion_css_esm_getRegisteredStyles = _createEmotion.getRegisteredStyles,
  17132. injectGlobal = _createEmotion.injectGlobal,
  17133. keyframes = _createEmotion.keyframes,
  17134. css = _createEmotion.css,
  17135. sheet = _createEmotion.sheet,
  17136. cache = _createEmotion.cache;
  17137. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js
  17138. /**
  17139. * External dependencies
  17140. */
  17141. // eslint-disable-next-line no-restricted-imports
  17142. /**
  17143. * WordPress dependencies
  17144. */
  17145. const isSerializedStyles = o => typeof o !== 'undefined' && o !== null && ['name', 'styles'].every(p => typeof o[p] !== 'undefined');
  17146. /**
  17147. * Retrieve a `cx` function that knows how to handle `SerializedStyles`
  17148. * returned by the `@emotion/react` `css` function in addition to what
  17149. * `cx` normally knows how to handle. It also hooks into the Emotion
  17150. * Cache, allowing `css` calls to work inside iframes.
  17151. *
  17152. * @example
  17153. * import { css } from '@emotion/react';
  17154. *
  17155. * const styles = css`
  17156. * color: red
  17157. * `;
  17158. *
  17159. * function RedText( { className, ...props } ) {
  17160. * const cx = useCx();
  17161. *
  17162. * const classes = cx(styles, className);
  17163. *
  17164. * return <span className={classes} {...props} />;
  17165. * }
  17166. */
  17167. const useCx = () => {
  17168. const cache = __unsafe_useEmotionCache();
  17169. const cx = (0,external_wp_element_namespaceObject.useCallback)(function () {
  17170. if (cache === null) {
  17171. throw new Error('The `useCx` hook should be only used within a valid Emotion Cache Context');
  17172. }
  17173. for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {
  17174. classNames[_key] = arguments[_key];
  17175. }
  17176. return emotion_css_esm_cx(...classNames.map(arg => {
  17177. if (isSerializedStyles(arg)) {
  17178. emotion_utils_browser_esm_insertStyles(cache, arg, false);
  17179. return `${cache.key}-${arg.name}`;
  17180. }
  17181. return arg;
  17182. }));
  17183. }, [cache]);
  17184. return cx;
  17185. };
  17186. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/use-context-system.js
  17187. /**
  17188. * WordPress dependencies
  17189. */
  17190. /**
  17191. * Internal dependencies
  17192. */
  17193. /**
  17194. * @template TProps
  17195. * @typedef {TProps & { className: string }} ConnectedProps
  17196. */
  17197. /**
  17198. * Custom hook that derives registered props from the Context system.
  17199. * These derived props are then consolidated with incoming component props.
  17200. *
  17201. * @template {{ className?: string }} P
  17202. * @param {P} props Incoming props from the component.
  17203. * @param {string} namespace The namespace to register and to derive context props from.
  17204. * @return {ConnectedProps<P>} The connected props.
  17205. */
  17206. function useContextSystem(props, namespace) {
  17207. const contextSystemProps = useComponentsContext();
  17208. if (typeof namespace === 'undefined') {
  17209. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
  17210. }
  17211. const contextProps = (contextSystemProps === null || contextSystemProps === void 0 ? void 0 : contextSystemProps[namespace]) || {};
  17212. /* eslint-disable jsdoc/no-undefined-types */
  17213. /** @type {ConnectedProps<P>} */
  17214. // @ts-ignore We fill in the missing properties below
  17215. const finalComponentProps = { ...getConnectedNamespace(),
  17216. ...getNamespace(namespace)
  17217. };
  17218. /* eslint-enable jsdoc/no-undefined-types */
  17219. const {
  17220. _overrides: overrideProps,
  17221. ...otherContextProps
  17222. } = contextProps;
  17223. const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;
  17224. const cx = useCx();
  17225. const classes = cx(getStyledClassNameFromKey(namespace), props.className); // Provides the ability to customize the render of the component.
  17226. const rendered = typeof initialMergedProps.renderChildren === 'function' ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children;
  17227. for (const key in initialMergedProps) {
  17228. // @ts-ignore filling in missing props
  17229. finalComponentProps[key] = initialMergedProps[key];
  17230. }
  17231. for (const key in overrideProps) {
  17232. // @ts-ignore filling in missing props
  17233. finalComponentProps[key] = overrideProps[key];
  17234. } // @ts-ignore
  17235. finalComponentProps.children = rendered;
  17236. finalComponentProps.className = classes;
  17237. return finalComponentProps;
  17238. }
  17239. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/context-connect.js
  17240. /**
  17241. * External dependencies
  17242. */
  17243. /**
  17244. * WordPress dependencies
  17245. */
  17246. /**
  17247. * Internal dependencies
  17248. */
  17249. /**
  17250. * Forwards ref (React.ForwardRef) and "Connects" (or registers) a component
  17251. * within the Context system under a specified namespace.
  17252. *
  17253. * This is an (experimental) evolution of the initial connect() HOC.
  17254. * The hope is that we can improve render performance by removing functional
  17255. * component wrappers.
  17256. *
  17257. * @param Component The component to register into the Context system.
  17258. * @param namespace The namespace to register the component under.
  17259. * @param options
  17260. * @return The connected WordPressComponent
  17261. */
  17262. function contextConnect(Component, namespace) {
  17263. let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  17264. const {
  17265. memo: memoProp = false
  17266. } = options;
  17267. let WrappedComponent = (0,external_wp_element_namespaceObject.forwardRef)(Component);
  17268. if (memoProp) {
  17269. // @ts-ignore
  17270. WrappedComponent = (0,external_wp_element_namespaceObject.memo)(WrappedComponent);
  17271. }
  17272. if (typeof namespace === 'undefined') {
  17273. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
  17274. } // @ts-ignore internal property
  17275. let mergedNamespace = WrappedComponent[CONNECT_STATIC_NAMESPACE] || [namespace];
  17276. /**
  17277. * Consolidate (merge) namespaces before attaching it to the WrappedComponent.
  17278. */
  17279. if (Array.isArray(namespace)) {
  17280. mergedNamespace = [...mergedNamespace, ...namespace];
  17281. }
  17282. if (typeof namespace === 'string') {
  17283. mergedNamespace = [...mergedNamespace, namespace];
  17284. }
  17285. WrappedComponent.displayName = namespace; // @ts-ignore internal property
  17286. WrappedComponent[CONNECT_STATIC_NAMESPACE] = (0,external_lodash_namespaceObject.uniq)(mergedNamespace); // @ts-ignore WordPressComponent property
  17287. WrappedComponent.selector = `.${getStyledClassNameFromKey(namespace)}`; // @ts-ignore
  17288. return WrappedComponent;
  17289. }
  17290. /**
  17291. * Attempts to retrieve the connected namespace from a component.
  17292. *
  17293. * @param Component The component to retrieve a namespace from.
  17294. * @return The connected namespaces.
  17295. */
  17296. function getConnectNamespace(Component) {
  17297. if (!Component) return [];
  17298. let namespaces = []; // @ts-ignore internal property
  17299. if (Component[CONNECT_STATIC_NAMESPACE]) {
  17300. // @ts-ignore internal property
  17301. namespaces = Component[CONNECT_STATIC_NAMESPACE];
  17302. } // @ts-ignore
  17303. if (Component.type && Component.type[CONNECT_STATIC_NAMESPACE]) {
  17304. // @ts-ignore
  17305. namespaces = Component.type[CONNECT_STATIC_NAMESPACE];
  17306. }
  17307. return namespaces;
  17308. }
  17309. /**
  17310. * Checks to see if a component is connected within the Context system.
  17311. *
  17312. * @param Component The component to retrieve a namespace from.
  17313. * @param match The namespace to check.
  17314. */
  17315. function hasConnectNamespace(Component, match) {
  17316. if (!Component) return false;
  17317. if (typeof match === 'string') {
  17318. return getConnectNamespace(Component).includes(match);
  17319. }
  17320. if (Array.isArray(match)) {
  17321. return match.some(result => getConnectNamespace(Component).includes(result));
  17322. }
  17323. return false;
  17324. }
  17325. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/visually-hidden/styles.js
  17326. /** @type {import('react').CSSProperties} */
  17327. const visuallyHidden = {
  17328. border: 0,
  17329. clip: 'rect(1px, 1px, 1px, 1px)',
  17330. WebkitClipPath: 'inset( 50% )',
  17331. clipPath: 'inset( 50% )',
  17332. height: '1px',
  17333. margin: '-1px',
  17334. overflow: 'hidden',
  17335. padding: 0,
  17336. position: 'absolute',
  17337. width: '1px',
  17338. wordWrap: 'normal'
  17339. };
  17340. ;// CONCATENATED MODULE: ./node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.browser.esm.js
  17341. var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
  17342. var isPropValid = /* #__PURE__ */emotion_memoize_browser_esm(function (prop) {
  17343. return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
  17344. /* o */
  17345. && prop.charCodeAt(1) === 110
  17346. /* n */
  17347. && prop.charCodeAt(2) < 91;
  17348. }
  17349. /* Z+1 */
  17350. );
  17351. /* harmony default export */ var emotion_is_prop_valid_browser_esm = (isPropValid);
  17352. ;// CONCATENATED MODULE: ./node_modules/@emotion/styled/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js
  17353. var emotion_utils_browser_esm_isBrowser = "object" !== 'undefined';
  17354. function dist_emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, classNames) {
  17355. var rawClassName = '';
  17356. classNames.split(' ').forEach(function (className) {
  17357. if (registered[className] !== undefined) {
  17358. registeredStyles.push(registered[className] + ";");
  17359. } else {
  17360. rawClassName += className + " ";
  17361. }
  17362. });
  17363. return rawClassName;
  17364. }
  17365. var emotion_utils_browser_esm_registerStyles = function registerStyles(cache, serialized, isStringTag) {
  17366. var className = cache.key + "-" + serialized.name;
  17367. if ( // we only need to add the styles to the registered cache if the
  17368. // class name could be used further down
  17369. // the tree but if it's a string tag, we know it won't
  17370. // so we don't have to add it to registered cache.
  17371. // this improves memory usage since we can avoid storing the whole style string
  17372. (isStringTag === false || // we need to always store it if we're in compat mode and
  17373. // in node since emotion-server relies on whether a style is in
  17374. // the registered cache to know whether a style is global or not
  17375. // also, note that this check will be dead code eliminated in the browser
  17376. emotion_utils_browser_esm_isBrowser === false ) && cache.registered[className] === undefined) {
  17377. cache.registered[className] = serialized.styles;
  17378. }
  17379. };
  17380. var dist_emotion_utils_browser_esm_insertStyles = function insertStyles(cache, serialized, isStringTag) {
  17381. emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag);
  17382. var className = cache.key + "-" + serialized.name;
  17383. if (cache.inserted[serialized.name] === undefined) {
  17384. var current = serialized;
  17385. do {
  17386. var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
  17387. current = current.next;
  17388. } while (current !== undefined);
  17389. }
  17390. };
  17391. ;// CONCATENATED MODULE: ./node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js
  17392. var testOmitPropsOnStringTag = emotion_is_prop_valid_browser_esm;
  17393. var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) {
  17394. return key !== 'theme';
  17395. };
  17396. var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) {
  17397. return typeof tag === 'string' && // 96 is one less than the char code
  17398. // for "a" so this is checking that
  17399. // it's a lowercase character
  17400. tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;
  17401. };
  17402. var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) {
  17403. var shouldForwardProp;
  17404. if (options) {
  17405. var optionsShouldForwardProp = options.shouldForwardProp;
  17406. shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) {
  17407. return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName);
  17408. } : optionsShouldForwardProp;
  17409. }
  17410. if (typeof shouldForwardProp !== 'function' && isReal) {
  17411. shouldForwardProp = tag.__emotion_forwardProp;
  17412. }
  17413. return shouldForwardProp;
  17414. };
  17415. var emotion_styled_base_browser_esm_useInsertionEffect = external_React_['useInsertion' + 'Effect'] ? external_React_['useInsertion' + 'Effect'] : function useInsertionEffect(create) {
  17416. create();
  17417. };
  17418. function emotion_styled_base_browser_esm_useInsertionEffectMaybe(create) {
  17419. emotion_styled_base_browser_esm_useInsertionEffect(create);
  17420. }
  17421. var emotion_styled_base_browser_esm_ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
  17422. var emotion_styled_base_browser_esm_Insertion = function Insertion(_ref) {
  17423. var cache = _ref.cache,
  17424. serialized = _ref.serialized,
  17425. isStringTag = _ref.isStringTag;
  17426. emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag);
  17427. var rules = emotion_styled_base_browser_esm_useInsertionEffectMaybe(function () {
  17428. return dist_emotion_utils_browser_esm_insertStyles(cache, serialized, isStringTag);
  17429. });
  17430. return null;
  17431. };
  17432. var createStyled = function createStyled(tag, options) {
  17433. if (false) {}
  17434. var isReal = tag.__emotion_real === tag;
  17435. var baseTag = isReal && tag.__emotion_base || tag;
  17436. var identifierName;
  17437. var targetClassName;
  17438. if (options !== undefined) {
  17439. identifierName = options.label;
  17440. targetClassName = options.target;
  17441. }
  17442. var shouldForwardProp = composeShouldForwardProps(tag, options, isReal);
  17443. var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);
  17444. var shouldUseAs = !defaultShouldForwardProp('as');
  17445. return function () {
  17446. var args = arguments;
  17447. var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : [];
  17448. if (identifierName !== undefined) {
  17449. styles.push("label:" + identifierName + ";");
  17450. }
  17451. if (args[0] == null || args[0].raw === undefined) {
  17452. styles.push.apply(styles, args);
  17453. } else {
  17454. if (false) {}
  17455. styles.push(args[0][0]);
  17456. var len = args.length;
  17457. var i = 1;
  17458. for (; i < len; i++) {
  17459. if (false) {}
  17460. styles.push(args[i], args[0][i]);
  17461. }
  17462. } // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class
  17463. var Styled = emotion_element_cbed451f_browser_esm_withEmotionCache(function (props, cache, ref) {
  17464. var FinalTag = shouldUseAs && props.as || baseTag;
  17465. var className = '';
  17466. var classInterpolations = [];
  17467. var mergedProps = props;
  17468. if (props.theme == null) {
  17469. mergedProps = {};
  17470. for (var key in props) {
  17471. mergedProps[key] = props[key];
  17472. }
  17473. mergedProps.theme = (0,external_React_.useContext)(emotion_element_cbed451f_browser_esm_ThemeContext);
  17474. }
  17475. if (typeof props.className === 'string') {
  17476. className = dist_emotion_utils_browser_esm_getRegisteredStyles(cache.registered, classInterpolations, props.className);
  17477. } else if (props.className != null) {
  17478. className = props.className + " ";
  17479. }
  17480. var serialized = emotion_serialize_browser_esm_serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);
  17481. className += cache.key + "-" + serialized.name;
  17482. if (targetClassName !== undefined) {
  17483. className += " " + targetClassName;
  17484. }
  17485. var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;
  17486. var newProps = {};
  17487. for (var _key in props) {
  17488. if (shouldUseAs && _key === 'as') continue;
  17489. if ( // $FlowFixMe
  17490. finalShouldForwardProp(_key)) {
  17491. newProps[_key] = props[_key];
  17492. }
  17493. }
  17494. newProps.className = className;
  17495. newProps.ref = ref;
  17496. return /*#__PURE__*/(0,external_React_.createElement)(external_React_.Fragment, null, /*#__PURE__*/(0,external_React_.createElement)(emotion_styled_base_browser_esm_Insertion, {
  17497. cache: cache,
  17498. serialized: serialized,
  17499. isStringTag: typeof FinalTag === 'string'
  17500. }), /*#__PURE__*/(0,external_React_.createElement)(FinalTag, newProps));
  17501. });
  17502. Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")";
  17503. Styled.defaultProps = tag.defaultProps;
  17504. Styled.__emotion_real = Styled;
  17505. Styled.__emotion_base = baseTag;
  17506. Styled.__emotion_styles = styles;
  17507. Styled.__emotion_forwardProp = shouldForwardProp;
  17508. Object.defineProperty(Styled, 'toString', {
  17509. value: function value() {
  17510. if (targetClassName === undefined && "production" !== 'production') {} // $FlowFixMe: coerce undefined to string
  17511. return "." + targetClassName;
  17512. }
  17513. });
  17514. Styled.withComponent = function (nextTag, nextOptions) {
  17515. return createStyled(nextTag, extends_extends({}, options, nextOptions, {
  17516. shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)
  17517. })).apply(void 0, styles);
  17518. };
  17519. return Styled;
  17520. };
  17521. };
  17522. /* harmony default export */ var emotion_styled_base_browser_esm = (createStyled);
  17523. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/view/component.js
  17524. /**
  17525. * External dependencies
  17526. */
  17527. /**
  17528. * `View` is a core component that renders everything in the library.
  17529. * It is the principle component in the entire library.
  17530. *
  17531. * @example
  17532. * ```jsx
  17533. * import { View } from `@wordpress/components`;
  17534. *
  17535. * function Example() {
  17536. * return (
  17537. * <View>
  17538. * Code is Poetry
  17539. * </View>
  17540. * );
  17541. * }
  17542. * ```
  17543. *
  17544. * @type {import('../ui/context').WordPressComponent<'div', { children?: import('react').ReactNode }, true>}
  17545. */
  17546. // @ts-ignore
  17547. const View = emotion_styled_base_browser_esm("div", true ? {
  17548. target: "em57xhy0"
  17549. } : 0)( true ? "" : 0);
  17550. View.selector = '.components-view';
  17551. View.displayName = 'View';
  17552. /* harmony default export */ var component = (View);
  17553. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/visually-hidden/component.js
  17554. /**
  17555. * Internal dependencies
  17556. */
  17557. /**
  17558. * @param {import('../ui/context').WordPressComponentProps<{ children: import('react').ReactNode }, 'div'>} props
  17559. * @param {import('react').ForwardedRef<any>} forwardedRef
  17560. */
  17561. function VisuallyHidden(props, forwardedRef) {
  17562. const {
  17563. style: styleProp,
  17564. ...contextProps
  17565. } = useContextSystem(props, 'VisuallyHidden');
  17566. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  17567. ref: forwardedRef
  17568. }, contextProps, {
  17569. style: { ...visuallyHidden,
  17570. ...(styleProp || {})
  17571. }
  17572. }));
  17573. }
  17574. /**
  17575. * `VisuallyHidden` is a component used to render text intended to be visually
  17576. * hidden, but will show for alternate devices, for example a screen reader.
  17577. *
  17578. * @example
  17579. * ```jsx
  17580. * import { VisuallyHidden } from `@wordpress/components`;
  17581. *
  17582. * function Example() {
  17583. * return (
  17584. * <VisuallyHidden>
  17585. * <label>Code is Poetry</label>
  17586. * </VisuallyHidden>
  17587. * );
  17588. * }
  17589. * ```
  17590. */
  17591. const ConnectedVisuallyHidden = contextConnect(VisuallyHidden, 'VisuallyHidden');
  17592. /* harmony default export */ var visually_hidden_component = (ConnectedVisuallyHidden);
  17593. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/button/index.js
  17594. // @ts-nocheck
  17595. /**
  17596. * External dependencies
  17597. */
  17598. /**
  17599. * WordPress dependencies
  17600. */
  17601. /**
  17602. * Internal dependencies
  17603. */
  17604. const disabledEventsOnDisabledButton = ['onMouseDown', 'onClick'];
  17605. function useDeprecatedProps(_ref) {
  17606. let {
  17607. isDefault,
  17608. isPrimary,
  17609. isSecondary,
  17610. isTertiary,
  17611. isLink,
  17612. variant,
  17613. ...otherProps
  17614. } = _ref;
  17615. let computedVariant = variant;
  17616. if (isPrimary) {
  17617. var _computedVariant;
  17618. (_computedVariant = computedVariant) !== null && _computedVariant !== void 0 ? _computedVariant : computedVariant = 'primary';
  17619. }
  17620. if (isTertiary) {
  17621. var _computedVariant2;
  17622. (_computedVariant2 = computedVariant) !== null && _computedVariant2 !== void 0 ? _computedVariant2 : computedVariant = 'tertiary';
  17623. }
  17624. if (isSecondary) {
  17625. var _computedVariant3;
  17626. (_computedVariant3 = computedVariant) !== null && _computedVariant3 !== void 0 ? _computedVariant3 : computedVariant = 'secondary';
  17627. }
  17628. if (isDefault) {
  17629. var _computedVariant4;
  17630. external_wp_deprecated_default()('Button isDefault prop', {
  17631. since: '5.4',
  17632. alternative: 'variant="secondary"',
  17633. version: '6.2'
  17634. });
  17635. (_computedVariant4 = computedVariant) !== null && _computedVariant4 !== void 0 ? _computedVariant4 : computedVariant = 'secondary';
  17636. }
  17637. if (isLink) {
  17638. var _computedVariant5;
  17639. (_computedVariant5 = computedVariant) !== null && _computedVariant5 !== void 0 ? _computedVariant5 : computedVariant = 'link';
  17640. }
  17641. return { ...otherProps,
  17642. variant: computedVariant
  17643. };
  17644. }
  17645. function Button(props, ref) {
  17646. const {
  17647. href,
  17648. target,
  17649. isSmall,
  17650. isPressed,
  17651. isBusy,
  17652. isDestructive,
  17653. className,
  17654. disabled,
  17655. icon,
  17656. iconPosition = 'left',
  17657. iconSize,
  17658. showTooltip,
  17659. tooltipPosition,
  17660. shortcut,
  17661. label,
  17662. children,
  17663. text,
  17664. variant,
  17665. __experimentalIsFocusable: isFocusable,
  17666. describedBy,
  17667. ...additionalProps
  17668. } = useDeprecatedProps(props);
  17669. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Button, 'components-button__description');
  17670. const classes = classnames_default()('components-button', className, {
  17671. 'is-secondary': variant === 'secondary',
  17672. 'is-primary': variant === 'primary',
  17673. 'is-small': isSmall,
  17674. 'is-tertiary': variant === 'tertiary',
  17675. 'is-pressed': isPressed,
  17676. 'is-busy': isBusy,
  17677. 'is-link': variant === 'link',
  17678. 'is-destructive': isDestructive,
  17679. 'has-text': !!icon && !!children,
  17680. 'has-icon': !!icon
  17681. });
  17682. const trulyDisabled = disabled && !isFocusable;
  17683. const Tag = href !== undefined && !trulyDisabled ? 'a' : 'button';
  17684. const tagProps = Tag === 'a' ? {
  17685. href,
  17686. target
  17687. } : {
  17688. type: 'button',
  17689. disabled: trulyDisabled,
  17690. 'aria-pressed': isPressed
  17691. };
  17692. if (disabled && isFocusable) {
  17693. // In this case, the button will be disabled, but still focusable and
  17694. // perceivable by screen reader users.
  17695. tagProps['aria-disabled'] = true;
  17696. for (const disabledEvent of disabledEventsOnDisabledButton) {
  17697. additionalProps[disabledEvent] = event => {
  17698. event.stopPropagation();
  17699. event.preventDefault();
  17700. };
  17701. }
  17702. } // Should show the tooltip if...
  17703. const shouldShowTooltip = !trulyDisabled && ( // An explicit tooltip is passed or...
  17704. showTooltip && label || // There's a shortcut or...
  17705. shortcut || // There's a label and...
  17706. !!label && ( // The children are empty and...
  17707. !children || (0,external_lodash_namespaceObject.isArray)(children) && !children.length) && // The tooltip is not explicitly disabled.
  17708. false !== showTooltip);
  17709. const descriptionId = describedBy ? instanceId : null;
  17710. const describedById = additionalProps['aria-describedby'] || descriptionId;
  17711. const element = (0,external_wp_element_namespaceObject.createElement)(Tag, extends_extends({}, tagProps, additionalProps, {
  17712. className: classes,
  17713. "aria-label": additionalProps['aria-label'] || label,
  17714. "aria-describedby": describedById,
  17715. ref: ref
  17716. }), icon && iconPosition === 'left' && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  17717. icon: icon,
  17718. size: iconSize
  17719. }), text && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, text), icon && iconPosition === 'right' && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  17720. icon: icon,
  17721. size: iconSize
  17722. }), children);
  17723. if (!shouldShowTooltip) {
  17724. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, element, describedBy && (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, null, (0,external_wp_element_namespaceObject.createElement)("span", {
  17725. id: descriptionId
  17726. }, describedBy)));
  17727. }
  17728. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  17729. text: describedBy ? describedBy : label,
  17730. shortcut: shortcut,
  17731. position: tooltipPosition
  17732. }, element), describedBy && (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, null, (0,external_wp_element_namespaceObject.createElement)("span", {
  17733. id: descriptionId
  17734. }, describedBy)));
  17735. }
  17736. /* harmony default export */ var build_module_button = ((0,external_wp_element_namespaceObject.forwardRef)(Button));
  17737. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scroll-lock/index.js
  17738. /**
  17739. * WordPress dependencies
  17740. */
  17741. /*
  17742. * Setting `overflow: hidden` on html and body elements resets body scroll in iOS.
  17743. * Save scroll top so we can restore it after locking scroll.
  17744. *
  17745. * NOTE: It would be cleaner and possibly safer to find a localized solution such
  17746. * as preventing default on certain touchmove events.
  17747. */
  17748. let previousScrollTop = 0;
  17749. /**
  17750. * @param {boolean} locked
  17751. */
  17752. function setLocked(locked) {
  17753. const scrollingElement = document.scrollingElement || document.body;
  17754. if (locked) {
  17755. previousScrollTop = scrollingElement.scrollTop;
  17756. }
  17757. const methodName = locked ? 'add' : 'remove';
  17758. scrollingElement.classList[methodName]('lockscroll'); // Adding the class to the document element seems to be necessary in iOS.
  17759. document.documentElement.classList[methodName]('lockscroll');
  17760. if (!locked) {
  17761. scrollingElement.scrollTop = previousScrollTop;
  17762. }
  17763. }
  17764. let lockCounter = 0;
  17765. /**
  17766. * A component that will lock scrolling when it is mounted and unlock scrolling when it is unmounted.
  17767. *
  17768. * @return {null} Render nothing.
  17769. */
  17770. function ScrollLock() {
  17771. (0,external_wp_element_namespaceObject.useEffect)(() => {
  17772. if (lockCounter === 0) {
  17773. setLocked(true);
  17774. }
  17775. ++lockCounter;
  17776. return () => {
  17777. if (lockCounter === 1) {
  17778. setLocked(false);
  17779. }
  17780. --lockCounter;
  17781. };
  17782. }, []);
  17783. return null;
  17784. }
  17785. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/context.js
  17786. // @ts-nocheck
  17787. /**
  17788. * WordPress dependencies
  17789. */
  17790. const SlotFillContext = (0,external_wp_element_namespaceObject.createContext)({
  17791. registerSlot: () => {},
  17792. unregisterSlot: () => {},
  17793. registerFill: () => {},
  17794. unregisterFill: () => {},
  17795. getSlot: () => {},
  17796. getFills: () => {},
  17797. subscribe: () => {}
  17798. });
  17799. /* harmony default export */ var context = (SlotFillContext);
  17800. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/use-slot.js
  17801. // @ts-nocheck
  17802. /**
  17803. * WordPress dependencies
  17804. */
  17805. /**
  17806. * Internal dependencies
  17807. */
  17808. /**
  17809. * React hook returning the active slot given a name.
  17810. *
  17811. * @param {string} name Slot name.
  17812. * @return {Object} Slot object.
  17813. */
  17814. const useSlot = name => {
  17815. const {
  17816. getSlot,
  17817. subscribe
  17818. } = (0,external_wp_element_namespaceObject.useContext)(context);
  17819. const [slot, setSlot] = (0,external_wp_element_namespaceObject.useState)(getSlot(name));
  17820. (0,external_wp_element_namespaceObject.useEffect)(() => {
  17821. setSlot(getSlot(name));
  17822. const unsubscribe = subscribe(() => {
  17823. setSlot(getSlot(name));
  17824. });
  17825. return unsubscribe;
  17826. }, [name]);
  17827. return slot;
  17828. };
  17829. /* harmony default export */ var use_slot = (useSlot);
  17830. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/fill.js
  17831. // @ts-nocheck
  17832. /**
  17833. * External dependencies
  17834. */
  17835. /**
  17836. * WordPress dependencies
  17837. */
  17838. /**
  17839. * Internal dependencies
  17840. */
  17841. function FillComponent(_ref) {
  17842. let {
  17843. name,
  17844. children,
  17845. registerFill,
  17846. unregisterFill
  17847. } = _ref;
  17848. const slot = use_slot(name);
  17849. const ref = (0,external_wp_element_namespaceObject.useRef)({
  17850. name,
  17851. children
  17852. });
  17853. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  17854. registerFill(name, ref.current);
  17855. return () => unregisterFill(name, ref.current);
  17856. }, []);
  17857. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  17858. ref.current.children = children;
  17859. if (slot) {
  17860. slot.forceUpdate();
  17861. }
  17862. }, [children]);
  17863. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  17864. if (name === ref.current.name) {
  17865. // Ignore initial effect.
  17866. return;
  17867. }
  17868. unregisterFill(ref.current.name, ref.current);
  17869. ref.current.name = name;
  17870. registerFill(name, ref.current);
  17871. }, [name]);
  17872. if (!slot || !slot.node) {
  17873. return null;
  17874. } // If a function is passed as a child, provide it with the fillProps.
  17875. if ((0,external_lodash_namespaceObject.isFunction)(children)) {
  17876. children = children(slot.props.fillProps);
  17877. }
  17878. return (0,external_wp_element_namespaceObject.createPortal)(children, slot.node);
  17879. }
  17880. const Fill = props => (0,external_wp_element_namespaceObject.createElement)(context.Consumer, null, _ref2 => {
  17881. let {
  17882. registerFill,
  17883. unregisterFill
  17884. } = _ref2;
  17885. return (0,external_wp_element_namespaceObject.createElement)(FillComponent, extends_extends({}, props, {
  17886. registerFill: registerFill,
  17887. unregisterFill: unregisterFill
  17888. }));
  17889. });
  17890. /* harmony default export */ var fill = (Fill);
  17891. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/slot.js
  17892. // @ts-nocheck
  17893. /**
  17894. * External dependencies
  17895. */
  17896. /**
  17897. * WordPress dependencies
  17898. */
  17899. /**
  17900. * Internal dependencies
  17901. */
  17902. class SlotComponent extends external_wp_element_namespaceObject.Component {
  17903. constructor() {
  17904. super(...arguments);
  17905. this.isUnmounted = false;
  17906. this.bindNode = this.bindNode.bind(this);
  17907. }
  17908. componentDidMount() {
  17909. const {
  17910. registerSlot
  17911. } = this.props;
  17912. registerSlot(this.props.name, this);
  17913. }
  17914. componentWillUnmount() {
  17915. const {
  17916. unregisterSlot
  17917. } = this.props;
  17918. this.isUnmounted = true;
  17919. unregisterSlot(this.props.name, this);
  17920. }
  17921. componentDidUpdate(prevProps) {
  17922. const {
  17923. name,
  17924. unregisterSlot,
  17925. registerSlot
  17926. } = this.props;
  17927. if (prevProps.name !== name) {
  17928. unregisterSlot(prevProps.name);
  17929. registerSlot(name, this);
  17930. }
  17931. }
  17932. bindNode(node) {
  17933. this.node = node;
  17934. }
  17935. forceUpdate() {
  17936. if (this.isUnmounted) {
  17937. return;
  17938. }
  17939. super.forceUpdate();
  17940. }
  17941. render() {
  17942. const {
  17943. children,
  17944. name,
  17945. fillProps = {},
  17946. getFills
  17947. } = this.props;
  17948. const fills = (0,external_lodash_namespaceObject.map)(getFills(name, this), fill => {
  17949. const fillChildren = (0,external_lodash_namespaceObject.isFunction)(fill.children) ? fill.children(fillProps) : fill.children;
  17950. return external_wp_element_namespaceObject.Children.map(fillChildren, (child, childIndex) => {
  17951. if (!child || (0,external_lodash_namespaceObject.isString)(child)) {
  17952. return child;
  17953. }
  17954. const childKey = child.key || childIndex;
  17955. return (0,external_wp_element_namespaceObject.cloneElement)(child, {
  17956. key: childKey
  17957. });
  17958. });
  17959. }).filter( // In some cases fills are rendered only when some conditions apply.
  17960. // This ensures that we only use non-empty fills when rendering, i.e.,
  17961. // it allows us to render wrappers only when the fills are actually present.
  17962. (0,external_lodash_namespaceObject.negate)(external_wp_element_namespaceObject.isEmptyElement));
  17963. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_lodash_namespaceObject.isFunction)(children) ? children(fills) : fills);
  17964. }
  17965. }
  17966. const Slot = props => (0,external_wp_element_namespaceObject.createElement)(context.Consumer, null, _ref => {
  17967. let {
  17968. registerSlot,
  17969. unregisterSlot,
  17970. getFills
  17971. } = _ref;
  17972. return (0,external_wp_element_namespaceObject.createElement)(SlotComponent, extends_extends({}, props, {
  17973. registerSlot: registerSlot,
  17974. unregisterSlot: unregisterSlot,
  17975. getFills: getFills
  17976. }));
  17977. });
  17978. /* harmony default export */ var slot = (Slot);
  17979. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js
  17980. // @ts-nocheck
  17981. /**
  17982. * WordPress dependencies
  17983. */
  17984. const slot_fill_context_SlotFillContext = (0,external_wp_element_namespaceObject.createContext)({
  17985. slots: {},
  17986. fills: {},
  17987. registerSlot: () => {
  17988. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
  17989. },
  17990. updateSlot: () => {},
  17991. unregisterSlot: () => {},
  17992. registerFill: () => {},
  17993. unregisterFill: () => {}
  17994. });
  17995. /* harmony default export */ var slot_fill_context = (slot_fill_context_SlotFillContext);
  17996. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js
  17997. // @ts-nocheck
  17998. /**
  17999. * WordPress dependencies
  18000. */
  18001. /**
  18002. * Internal dependencies
  18003. */
  18004. function use_slot_useSlot(name) {
  18005. const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context);
  18006. const slot = registry.slots[name] || {};
  18007. const slotFills = registry.fills[name];
  18008. const fills = (0,external_wp_element_namespaceObject.useMemo)(() => slotFills || [], [slotFills]);
  18009. const updateSlot = (0,external_wp_element_namespaceObject.useCallback)(fillProps => {
  18010. registry.updateSlot(name, fillProps);
  18011. }, [name, registry.updateSlot]);
  18012. const unregisterSlot = (0,external_wp_element_namespaceObject.useCallback)(slotRef => {
  18013. registry.unregisterSlot(name, slotRef);
  18014. }, [name, registry.unregisterSlot]);
  18015. const registerFill = (0,external_wp_element_namespaceObject.useCallback)(fillRef => {
  18016. registry.registerFill(name, fillRef);
  18017. }, [name, registry.registerFill]);
  18018. const unregisterFill = (0,external_wp_element_namespaceObject.useCallback)(fillRef => {
  18019. registry.unregisterFill(name, fillRef);
  18020. }, [name, registry.unregisterFill]);
  18021. return { ...slot,
  18022. updateSlot,
  18023. unregisterSlot,
  18024. fills,
  18025. registerFill,
  18026. unregisterFill
  18027. };
  18028. }
  18029. ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js
  18030. // Unique ID creation requires a high quality random # generator. In the browser we therefore
  18031. // require the crypto API and do not support built-in fallback to lower quality random number
  18032. // generators (like Math.random()).
  18033. var getRandomValues;
  18034. var rnds8 = new Uint8Array(16);
  18035. function rng() {
  18036. // lazy load so that environments that need to polyfill have a chance to do so
  18037. if (!getRandomValues) {
  18038. // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
  18039. // find the complete implementation of crypto (msCrypto) on IE11.
  18040. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
  18041. if (!getRandomValues) {
  18042. throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
  18043. }
  18044. }
  18045. return getRandomValues(rnds8);
  18046. }
  18047. ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/regex.js
  18048. /* harmony default export */ var regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);
  18049. ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/validate.js
  18050. function validate(uuid) {
  18051. return typeof uuid === 'string' && regex.test(uuid);
  18052. }
  18053. /* harmony default export */ var esm_browser_validate = (validate);
  18054. ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js
  18055. /**
  18056. * Convert array of 16 byte values to UUID string format of the form:
  18057. * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  18058. */
  18059. var byteToHex = [];
  18060. for (var i = 0; i < 256; ++i) {
  18061. byteToHex.push((i + 0x100).toString(16).substr(1));
  18062. }
  18063. function stringify_stringify(arr) {
  18064. var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  18065. // Note: Be careful editing this code! It's been tuned for performance
  18066. // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
  18067. var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
  18068. // of the following:
  18069. // - One or more input array values don't map to a hex octet (leading to
  18070. // "undefined" in the uuid)
  18071. // - Invalid input values for the RFC `version` or `variant` fields
  18072. if (!esm_browser_validate(uuid)) {
  18073. throw TypeError('Stringified UUID is invalid');
  18074. }
  18075. return uuid;
  18076. }
  18077. /* harmony default export */ var esm_browser_stringify = (stringify_stringify);
  18078. ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js
  18079. function v4(options, buf, offset) {
  18080. options = options || {};
  18081. var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
  18082. rnds[6] = rnds[6] & 0x0f | 0x40;
  18083. rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
  18084. if (buf) {
  18085. offset = offset || 0;
  18086. for (var i = 0; i < 16; ++i) {
  18087. buf[offset + i] = rnds[i];
  18088. }
  18089. return buf;
  18090. }
  18091. return esm_browser_stringify(rnds);
  18092. }
  18093. /* harmony default export */ var esm_browser_v4 = (v4);
  18094. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/style-provider/index.js
  18095. // @ts-nocheck
  18096. /**
  18097. * External dependencies
  18098. */
  18099. const uuidCache = new Set();
  18100. const memoizedCreateCacheWithContainer = memize_default()(container => {
  18101. // Emotion only accepts alphabetical and hyphenated keys so we just strip the numbers from the UUID. It _should_ be fine.
  18102. let key = esm_browser_v4().replace(/[0-9]/g, '');
  18103. while (uuidCache.has(key)) {
  18104. key = esm_browser_v4().replace(/[0-9]/g, '');
  18105. }
  18106. uuidCache.add(key);
  18107. return emotion_cache_browser_esm({
  18108. container,
  18109. key
  18110. });
  18111. });
  18112. function StyleProvider(_ref) {
  18113. let {
  18114. children,
  18115. document
  18116. } = _ref;
  18117. if (!document) {
  18118. return null;
  18119. }
  18120. const cache = memoizedCreateCacheWithContainer(document.head);
  18121. return (0,external_wp_element_namespaceObject.createElement)(CacheProvider, {
  18122. value: cache
  18123. }, children);
  18124. }
  18125. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/fill.js
  18126. // @ts-nocheck
  18127. /**
  18128. * WordPress dependencies
  18129. */
  18130. /**
  18131. * Internal dependencies
  18132. */
  18133. function useForceUpdate() {
  18134. const [, setState] = (0,external_wp_element_namespaceObject.useState)({});
  18135. const mounted = (0,external_wp_element_namespaceObject.useRef)(true);
  18136. (0,external_wp_element_namespaceObject.useEffect)(() => {
  18137. return () => {
  18138. mounted.current = false;
  18139. };
  18140. }, []);
  18141. return () => {
  18142. if (mounted.current) {
  18143. setState({});
  18144. }
  18145. };
  18146. }
  18147. function fill_Fill(_ref) {
  18148. let {
  18149. name,
  18150. children
  18151. } = _ref;
  18152. const slot = use_slot_useSlot(name);
  18153. const ref = (0,external_wp_element_namespaceObject.useRef)({
  18154. rerender: useForceUpdate()
  18155. });
  18156. (0,external_wp_element_namespaceObject.useEffect)(() => {
  18157. // We register fills so we can keep track of their existance.
  18158. // Some Slot implementations need to know if there're already fills
  18159. // registered so they can choose to render themselves or not.
  18160. slot.registerFill(ref);
  18161. return () => {
  18162. slot.unregisterFill(ref);
  18163. };
  18164. }, [slot.registerFill, slot.unregisterFill]);
  18165. if (!slot.ref || !slot.ref.current) {
  18166. return null;
  18167. }
  18168. if (typeof children === 'function') {
  18169. children = children(slot.fillProps);
  18170. } // When using a `Fill`, the `children` will be rendered in the document of the
  18171. // `Slot`. This means that we need to wrap the `children` in a `StyleProvider`
  18172. // to make sure we're referencing the right document/iframe (instead of the
  18173. // context of the `Fill`'s parent).
  18174. const wrappedChildren = (0,external_wp_element_namespaceObject.createElement)(StyleProvider, {
  18175. document: slot.ref.current.ownerDocument
  18176. }, children);
  18177. return (0,external_wp_element_namespaceObject.createPortal)(wrappedChildren, slot.ref.current);
  18178. }
  18179. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot.js
  18180. // @ts-nocheck
  18181. /**
  18182. * WordPress dependencies
  18183. */
  18184. /**
  18185. * Internal dependencies
  18186. */
  18187. function slot_Slot(_ref, forwardedRef) {
  18188. let {
  18189. name,
  18190. fillProps = {},
  18191. as: Component = 'div',
  18192. ...props
  18193. } = _ref;
  18194. const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context);
  18195. const ref = (0,external_wp_element_namespaceObject.useRef)();
  18196. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  18197. registry.registerSlot(name, ref, fillProps);
  18198. return () => {
  18199. registry.unregisterSlot(name, ref);
  18200. }; // We are not including fillProps in the deps because we don't want to
  18201. // unregister and register the slot whenever fillProps change, which would
  18202. // cause the fill to be re-mounted. We are only considering the initial value
  18203. // of fillProps.
  18204. }, [registry.registerSlot, registry.unregisterSlot, name]); // fillProps may be an update that interacts with the layout, so we
  18205. // useLayoutEffect.
  18206. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  18207. registry.updateSlot(name, fillProps);
  18208. });
  18209. return (0,external_wp_element_namespaceObject.createElement)(Component, extends_extends({
  18210. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([forwardedRef, ref])
  18211. }, props));
  18212. }
  18213. /* harmony default export */ var bubbles_virtually_slot = ((0,external_wp_element_namespaceObject.forwardRef)(slot_Slot));
  18214. ;// CONCATENATED MODULE: external ["wp","isShallowEqual"]
  18215. var external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"];
  18216. var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject);
  18217. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js
  18218. // @ts-nocheck
  18219. /**
  18220. * WordPress dependencies
  18221. */
  18222. /**
  18223. * Internal dependencies
  18224. */
  18225. function useSlotRegistry() {
  18226. const [slots, setSlots] = (0,external_wp_element_namespaceObject.useState)({});
  18227. const [fills, setFills] = (0,external_wp_element_namespaceObject.useState)({});
  18228. const registerSlot = (0,external_wp_element_namespaceObject.useCallback)((name, ref, fillProps) => {
  18229. setSlots(prevSlots => {
  18230. const slot = prevSlots[name] || {};
  18231. return { ...prevSlots,
  18232. [name]: { ...slot,
  18233. ref: ref || slot.ref,
  18234. fillProps: fillProps || slot.fillProps || {}
  18235. }
  18236. };
  18237. });
  18238. }, []);
  18239. const unregisterSlot = (0,external_wp_element_namespaceObject.useCallback)((name, ref) => {
  18240. setSlots(prevSlots => {
  18241. const {
  18242. [name]: slot,
  18243. ...nextSlots
  18244. } = prevSlots; // Make sure we're not unregistering a slot registered by another element
  18245. // See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412
  18246. if ((slot === null || slot === void 0 ? void 0 : slot.ref) === ref) {
  18247. return nextSlots;
  18248. }
  18249. return prevSlots;
  18250. });
  18251. }, []);
  18252. const updateSlot = (0,external_wp_element_namespaceObject.useCallback)((name, fillProps) => {
  18253. const slot = slots[name];
  18254. if (!slot) {
  18255. return;
  18256. }
  18257. if (!external_wp_isShallowEqual_default()(slot.fillProps, fillProps)) {
  18258. slot.fillProps = fillProps;
  18259. const slotFills = fills[name];
  18260. if (slotFills) {
  18261. // Force update fills.
  18262. slotFills.map(fill => fill.current.rerender());
  18263. }
  18264. }
  18265. }, [slots, fills]);
  18266. const registerFill = (0,external_wp_element_namespaceObject.useCallback)((name, ref) => {
  18267. setFills(prevFills => ({ ...prevFills,
  18268. [name]: [...(prevFills[name] || []), ref]
  18269. }));
  18270. }, []);
  18271. const unregisterFill = (0,external_wp_element_namespaceObject.useCallback)((name, ref) => {
  18272. setFills(prevFills => {
  18273. if (prevFills[name]) {
  18274. return { ...prevFills,
  18275. [name]: prevFills[name].filter(fillRef => fillRef !== ref)
  18276. };
  18277. }
  18278. return prevFills;
  18279. });
  18280. }, []); // Memoizing the return value so it can be directly passed to Provider value
  18281. const registry = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  18282. slots,
  18283. fills,
  18284. registerSlot,
  18285. updateSlot,
  18286. unregisterSlot,
  18287. registerFill,
  18288. unregisterFill
  18289. }), [slots, fills, registerSlot, updateSlot, unregisterSlot, registerFill, unregisterFill]);
  18290. return registry;
  18291. }
  18292. function SlotFillProvider(_ref) {
  18293. let {
  18294. children
  18295. } = _ref;
  18296. const registry = useSlotRegistry();
  18297. return (0,external_wp_element_namespaceObject.createElement)(slot_fill_context.Provider, {
  18298. value: registry
  18299. }, children);
  18300. }
  18301. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/provider.js
  18302. // @ts-nocheck
  18303. /**
  18304. * External dependencies
  18305. */
  18306. /**
  18307. * WordPress dependencies
  18308. */
  18309. /**
  18310. * Internal dependencies
  18311. */
  18312. class provider_SlotFillProvider extends external_wp_element_namespaceObject.Component {
  18313. constructor() {
  18314. super(...arguments);
  18315. this.registerSlot = this.registerSlot.bind(this);
  18316. this.registerFill = this.registerFill.bind(this);
  18317. this.unregisterSlot = this.unregisterSlot.bind(this);
  18318. this.unregisterFill = this.unregisterFill.bind(this);
  18319. this.getSlot = this.getSlot.bind(this);
  18320. this.getFills = this.getFills.bind(this);
  18321. this.hasFills = this.hasFills.bind(this);
  18322. this.subscribe = this.subscribe.bind(this);
  18323. this.slots = {};
  18324. this.fills = {};
  18325. this.listeners = [];
  18326. this.contextValue = {
  18327. registerSlot: this.registerSlot,
  18328. unregisterSlot: this.unregisterSlot,
  18329. registerFill: this.registerFill,
  18330. unregisterFill: this.unregisterFill,
  18331. getSlot: this.getSlot,
  18332. getFills: this.getFills,
  18333. hasFills: this.hasFills,
  18334. subscribe: this.subscribe
  18335. };
  18336. }
  18337. registerSlot(name, slot) {
  18338. const previousSlot = this.slots[name];
  18339. this.slots[name] = slot;
  18340. this.triggerListeners(); // Sometimes the fills are registered after the initial render of slot
  18341. // But before the registerSlot call, we need to rerender the slot.
  18342. this.forceUpdateSlot(name); // If a new instance of a slot is being mounted while another with the
  18343. // same name exists, force its update _after_ the new slot has been
  18344. // assigned into the instance, such that its own rendering of children
  18345. // will be empty (the new Slot will subsume all fills for this name).
  18346. if (previousSlot) {
  18347. previousSlot.forceUpdate();
  18348. }
  18349. }
  18350. registerFill(name, instance) {
  18351. this.fills[name] = [...(this.fills[name] || []), instance];
  18352. this.forceUpdateSlot(name);
  18353. }
  18354. unregisterSlot(name, instance) {
  18355. // If a previous instance of a Slot by this name unmounts, do nothing,
  18356. // as the slot and its fills should only be removed for the current
  18357. // known instance.
  18358. if (this.slots[name] !== instance) {
  18359. return;
  18360. }
  18361. delete this.slots[name];
  18362. this.triggerListeners();
  18363. }
  18364. unregisterFill(name, instance) {
  18365. this.fills[name] = (0,external_lodash_namespaceObject.without)(this.fills[name], instance);
  18366. this.forceUpdateSlot(name);
  18367. }
  18368. getSlot(name) {
  18369. return this.slots[name];
  18370. }
  18371. getFills(name, slotInstance) {
  18372. // Fills should only be returned for the current instance of the slot
  18373. // in which they occupy.
  18374. if (this.slots[name] !== slotInstance) {
  18375. return [];
  18376. }
  18377. return this.fills[name];
  18378. }
  18379. hasFills(name) {
  18380. return this.fills[name] && !!this.fills[name].length;
  18381. }
  18382. forceUpdateSlot(name) {
  18383. const slot = this.getSlot(name);
  18384. if (slot) {
  18385. slot.forceUpdate();
  18386. }
  18387. }
  18388. triggerListeners() {
  18389. this.listeners.forEach(listener => listener());
  18390. }
  18391. subscribe(listener) {
  18392. this.listeners.push(listener);
  18393. return () => {
  18394. this.listeners = (0,external_lodash_namespaceObject.without)(this.listeners, listener);
  18395. };
  18396. }
  18397. render() {
  18398. return (0,external_wp_element_namespaceObject.createElement)(context.Provider, {
  18399. value: this.contextValue
  18400. }, this.props.children);
  18401. }
  18402. }
  18403. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/index.js
  18404. // @ts-nocheck
  18405. /**
  18406. * WordPress dependencies
  18407. */
  18408. /**
  18409. * Internal dependencies
  18410. */
  18411. function slot_fill_Fill(props) {
  18412. // We're adding both Fills here so they can register themselves before
  18413. // their respective slot has been registered. Only the Fill that has a slot
  18414. // will render. The other one will return null.
  18415. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(fill, props), (0,external_wp_element_namespaceObject.createElement)(fill_Fill, props));
  18416. }
  18417. const slot_fill_Slot = (0,external_wp_element_namespaceObject.forwardRef)((_ref, ref) => {
  18418. let {
  18419. bubblesVirtually,
  18420. ...props
  18421. } = _ref;
  18422. if (bubblesVirtually) {
  18423. return (0,external_wp_element_namespaceObject.createElement)(bubbles_virtually_slot, extends_extends({}, props, {
  18424. ref: ref
  18425. }));
  18426. }
  18427. return (0,external_wp_element_namespaceObject.createElement)(slot, props);
  18428. });
  18429. function Provider(_ref2) {
  18430. let {
  18431. children,
  18432. ...props
  18433. } = _ref2;
  18434. return (0,external_wp_element_namespaceObject.createElement)(provider_SlotFillProvider, props, (0,external_wp_element_namespaceObject.createElement)(SlotFillProvider, null, children));
  18435. }
  18436. function createSlotFill(name) {
  18437. const FillComponent = props => (0,external_wp_element_namespaceObject.createElement)(slot_fill_Fill, extends_extends({
  18438. name: name
  18439. }, props));
  18440. FillComponent.displayName = name + 'Fill';
  18441. const SlotComponent = props => (0,external_wp_element_namespaceObject.createElement)(slot_fill_Slot, extends_extends({
  18442. name: name
  18443. }, props));
  18444. SlotComponent.displayName = name + 'Slot';
  18445. SlotComponent.__unstableName = name;
  18446. return {
  18447. Fill: FillComponent,
  18448. Slot: SlotComponent
  18449. };
  18450. }
  18451. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/animate/index.js
  18452. /**
  18453. * External dependencies
  18454. */
  18455. /**
  18456. * @typedef {'top' | 'top left' | 'top right' | 'middle' | 'middle left' | 'middle right' | 'bottom' | 'bottom left' | 'bottom right'} AppearOrigin
  18457. * @typedef {'left' | 'right'} SlideInOrigin
  18458. * @typedef {{ type: 'appear'; origin?: AppearOrigin }} AppearOptions
  18459. * @typedef {{ type: 'slide-in'; origin?: SlideInOrigin }} SlideInOptions
  18460. * @typedef {{ type: 'loading' }} LoadingOptions
  18461. * @typedef {AppearOptions | SlideInOptions | LoadingOptions} GetAnimateOptions
  18462. */
  18463. /* eslint-disable jsdoc/valid-types */
  18464. /**
  18465. * @param {GetAnimateOptions['type']} type The animation type
  18466. * @return {'top' | 'left'} Default origin
  18467. */
  18468. function getDefaultOrigin(type) {
  18469. return type === 'appear' ? 'top' : 'left';
  18470. }
  18471. /* eslint-enable jsdoc/valid-types */
  18472. /**
  18473. * @param {GetAnimateOptions} options
  18474. *
  18475. * @return {string | void} ClassName that applies the animations
  18476. */
  18477. function getAnimateClassName(options) {
  18478. if (options.type === 'loading') {
  18479. return classnames_default()('components-animate__loading');
  18480. }
  18481. const {
  18482. type,
  18483. origin = getDefaultOrigin(type)
  18484. } = options;
  18485. if (type === 'appear') {
  18486. const [yAxis, xAxis = 'center'] = origin.split(' ');
  18487. return classnames_default()('components-animate__appear', {
  18488. ['is-from-' + xAxis]: xAxis !== 'center',
  18489. ['is-from-' + yAxis]: yAxis !== 'middle'
  18490. });
  18491. }
  18492. if (type === 'slide-in') {
  18493. return classnames_default()('components-animate__slide-in', 'is-from-' + origin);
  18494. }
  18495. } // @ts-ignore Reason: Planned for deprecation
  18496. function Animate(_ref) {
  18497. let {
  18498. type,
  18499. options = {},
  18500. children
  18501. } = _ref;
  18502. return children({
  18503. className: getAnimateClassName({
  18504. type,
  18505. ...options
  18506. })
  18507. });
  18508. }
  18509. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/index.js
  18510. // @ts-nocheck
  18511. /**
  18512. * External dependencies
  18513. */
  18514. /**
  18515. * WordPress dependencies
  18516. */
  18517. /**
  18518. * Internal dependencies
  18519. */
  18520. /**
  18521. * Name of slot in which popover should fill.
  18522. *
  18523. * @type {string}
  18524. */
  18525. const SLOT_NAME = 'Popover';
  18526. const slotNameContext = (0,external_wp_element_namespaceObject.createContext)();
  18527. function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) {
  18528. let anchorRef = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  18529. let shouldAnchorIncludePadding = arguments.length > 4 ? arguments[4] : undefined;
  18530. let container = arguments.length > 5 ? arguments[5] : undefined;
  18531. if (anchorRect) {
  18532. return anchorRect;
  18533. }
  18534. if (getAnchorRect) {
  18535. if (!anchorRefFallback.current) {
  18536. return;
  18537. }
  18538. const rect = getAnchorRect(anchorRefFallback.current);
  18539. return offsetIframe(rect, rect.ownerDocument || anchorRefFallback.current.ownerDocument, container);
  18540. }
  18541. if (anchorRef !== false) {
  18542. if (!anchorRef || !window.Range || !window.Element || !window.DOMRect) {
  18543. return;
  18544. } // Duck-type to check if `anchorRef` is an instance of Range
  18545. // `anchorRef instanceof window.Range` checks will break across document boundaries
  18546. // such as in an iframe.
  18547. if (typeof (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.cloneRange) === 'function') {
  18548. return offsetIframe((0,external_wp_dom_namespaceObject.getRectangleFromRange)(anchorRef), anchorRef.endContainer.ownerDocument, container);
  18549. } // Duck-type to check if `anchorRef` is an instance of Element
  18550. // `anchorRef instanceof window.Element` checks will break across document boundaries
  18551. // such as in an iframe.
  18552. if (typeof (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.getBoundingClientRect) === 'function') {
  18553. const rect = offsetIframe(anchorRef.getBoundingClientRect(), anchorRef.ownerDocument, container);
  18554. if (shouldAnchorIncludePadding) {
  18555. return rect;
  18556. }
  18557. return withoutPadding(rect, anchorRef);
  18558. }
  18559. const {
  18560. top,
  18561. bottom
  18562. } = anchorRef;
  18563. const topRect = top.getBoundingClientRect();
  18564. const bottomRect = bottom.getBoundingClientRect();
  18565. const rect = offsetIframe(new window.DOMRect(topRect.left, topRect.top, topRect.width, bottomRect.bottom - topRect.top), top.ownerDocument, container);
  18566. if (shouldAnchorIncludePadding) {
  18567. return rect;
  18568. }
  18569. return withoutPadding(rect, anchorRef);
  18570. }
  18571. if (!anchorRefFallback.current) {
  18572. return;
  18573. }
  18574. const {
  18575. parentNode
  18576. } = anchorRefFallback.current;
  18577. const rect = offsetIframe(parentNode.getBoundingClientRect(), parentNode.ownerDocument, container);
  18578. if (shouldAnchorIncludePadding) {
  18579. return rect;
  18580. }
  18581. return withoutPadding(rect, parentNode);
  18582. }
  18583. function popover_getComputedStyle(node) {
  18584. return node.ownerDocument.defaultView.getComputedStyle(node);
  18585. }
  18586. function withoutPadding(rect, element) {
  18587. const {
  18588. paddingTop,
  18589. paddingBottom,
  18590. paddingLeft,
  18591. paddingRight
  18592. } = popover_getComputedStyle(element);
  18593. const top = paddingTop ? parseInt(paddingTop, 10) : 0;
  18594. const bottom = paddingBottom ? parseInt(paddingBottom, 10) : 0;
  18595. const left = paddingLeft ? parseInt(paddingLeft, 10) : 0;
  18596. const right = paddingRight ? parseInt(paddingRight, 10) : 0;
  18597. return {
  18598. x: rect.left + left,
  18599. y: rect.top + top,
  18600. width: rect.width - left - right,
  18601. height: rect.height - top - bottom,
  18602. left: rect.left + left,
  18603. right: rect.right - right,
  18604. top: rect.top + top,
  18605. bottom: rect.bottom - bottom
  18606. };
  18607. }
  18608. /**
  18609. * Sets or removes an element attribute.
  18610. *
  18611. * @param {Element} element The element to modify.
  18612. * @param {string} name The attribute name to set or remove.
  18613. * @param {?string} value The value to set. A falsy value will remove the
  18614. * attribute.
  18615. */
  18616. function setAttribute(element, name, value) {
  18617. if (!value) {
  18618. if (element.hasAttribute(name)) {
  18619. element.removeAttribute(name);
  18620. }
  18621. } else if (element.getAttribute(name) !== value) {
  18622. element.setAttribute(name, value);
  18623. }
  18624. }
  18625. /**
  18626. * Sets or removes an element style property.
  18627. *
  18628. * @param {Element} element The element to modify.
  18629. * @param {string} property The property to set or remove.
  18630. * @param {?string} value The value to set. A falsy value will remove the
  18631. * property.
  18632. */
  18633. function setStyle(element, property) {
  18634. let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  18635. if (element.style[property] !== value) {
  18636. element.style[property] = value;
  18637. }
  18638. }
  18639. /**
  18640. * Sets or removes an element class.
  18641. *
  18642. * @param {Element} element The element to modify.
  18643. * @param {string} name The class to set or remove.
  18644. * @param {boolean} toggle True to set the class, false to remove.
  18645. */
  18646. function setClass(element, name, toggle) {
  18647. if (toggle) {
  18648. if (!element.classList.contains(name)) {
  18649. element.classList.add(name);
  18650. }
  18651. } else if (element.classList.contains(name)) {
  18652. element.classList.remove(name);
  18653. }
  18654. }
  18655. function getAnchorDocument(anchor) {
  18656. if (!anchor) {
  18657. return;
  18658. }
  18659. if (anchor.endContainer) {
  18660. return anchor.endContainer.ownerDocument;
  18661. }
  18662. if (anchor.top) {
  18663. return anchor.top.ownerDocument;
  18664. }
  18665. return anchor.ownerDocument;
  18666. }
  18667. const Popover = (_ref, ref) => {
  18668. let {
  18669. headerTitle,
  18670. onClose,
  18671. children,
  18672. className,
  18673. noArrow = true,
  18674. isAlternate,
  18675. // Disable reason: We generate the `...contentProps` rest as remainder
  18676. // of props which aren't explicitly handled by this component.
  18677. /* eslint-disable no-unused-vars */
  18678. position = 'bottom right',
  18679. range,
  18680. focusOnMount = 'firstElement',
  18681. anchorRef,
  18682. shouldAnchorIncludePadding,
  18683. anchorRect,
  18684. getAnchorRect,
  18685. expandOnMobile,
  18686. animate = true,
  18687. onFocusOutside,
  18688. __unstableStickyBoundaryElement,
  18689. __unstableSlotName = SLOT_NAME,
  18690. __unstableObserveElement,
  18691. __unstableBoundaryParent,
  18692. __unstableForcePosition,
  18693. __unstableForceXAlignment,
  18694. __unstableEditorCanvasWrapper,
  18695. /* eslint-enable no-unused-vars */
  18696. ...contentProps
  18697. } = _ref;
  18698. const anchorRefFallback = (0,external_wp_element_namespaceObject.useRef)(null);
  18699. const contentRef = (0,external_wp_element_namespaceObject.useRef)(null);
  18700. const containerRef = (0,external_wp_element_namespaceObject.useRef)();
  18701. const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  18702. const [animateOrigin, setAnimateOrigin] = (0,external_wp_element_namespaceObject.useState)();
  18703. const slotName = (0,external_wp_element_namespaceObject.useContext)(slotNameContext) || __unstableSlotName;
  18704. const slot = use_slot_useSlot(slotName);
  18705. const isExpanded = expandOnMobile && isMobileViewport;
  18706. const [containerResizeListener, contentSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
  18707. noArrow = isExpanded || noArrow;
  18708. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  18709. if (isExpanded) {
  18710. setClass(containerRef.current, 'is-without-arrow', noArrow);
  18711. setClass(containerRef.current, 'is-alternate', isAlternate);
  18712. setAttribute(containerRef.current, 'data-x-axis');
  18713. setAttribute(containerRef.current, 'data-y-axis');
  18714. setStyle(containerRef.current, 'top');
  18715. setStyle(containerRef.current, 'left');
  18716. setStyle(contentRef.current, 'maxHeight');
  18717. setStyle(contentRef.current, 'maxWidth');
  18718. return;
  18719. }
  18720. const refresh = () => {
  18721. if (!containerRef.current || !contentRef.current) {
  18722. return;
  18723. }
  18724. let anchor = computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect, anchorRef, shouldAnchorIncludePadding, containerRef.current);
  18725. if (!anchor) {
  18726. return;
  18727. }
  18728. const {
  18729. offsetParent,
  18730. ownerDocument
  18731. } = containerRef.current;
  18732. let relativeOffsetTop = 0; // If there is a positioned ancestor element that is not the body,
  18733. // subtract the position from the anchor rect. If the position of
  18734. // the popover is fixed, the offset parent is null or the body
  18735. // element, in which case the position is relative to the viewport.
  18736. // See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
  18737. if (offsetParent && offsetParent !== ownerDocument.body) {
  18738. const offsetParentRect = offsetParent.getBoundingClientRect();
  18739. relativeOffsetTop = offsetParentRect.top;
  18740. anchor = new window.DOMRect(anchor.left - offsetParentRect.left, anchor.top - offsetParentRect.top, anchor.width, anchor.height);
  18741. }
  18742. let boundaryElement;
  18743. if (__unstableBoundaryParent) {
  18744. boundaryElement = containerRef.current.parentElement;
  18745. }
  18746. const usedContentSize = !contentSize.height ? contentRef.current.getBoundingClientRect() : contentSize;
  18747. const {
  18748. popoverTop,
  18749. popoverLeft,
  18750. xAxis,
  18751. yAxis,
  18752. contentHeight,
  18753. contentWidth
  18754. } = computePopoverPosition(anchor, usedContentSize, position, __unstableStickyBoundaryElement, containerRef.current, relativeOffsetTop, boundaryElement, __unstableForcePosition, __unstableForceXAlignment, __unstableEditorCanvasWrapper);
  18755. if (typeof popoverTop === 'number' && typeof popoverLeft === 'number') {
  18756. setStyle(containerRef.current, 'top', popoverTop + 'px');
  18757. setStyle(containerRef.current, 'left', popoverLeft + 'px');
  18758. }
  18759. setClass(containerRef.current, 'is-without-arrow', noArrow || xAxis === 'center' && yAxis === 'middle');
  18760. setClass(containerRef.current, 'is-alternate', isAlternate);
  18761. setAttribute(containerRef.current, 'data-x-axis', xAxis);
  18762. setAttribute(containerRef.current, 'data-y-axis', yAxis);
  18763. setStyle(contentRef.current, 'maxHeight', typeof contentHeight === 'number' ? contentHeight + 'px' : '');
  18764. setStyle(contentRef.current, 'maxWidth', typeof contentWidth === 'number' ? contentWidth + 'px' : ''); // Compute the animation position.
  18765. const yAxisMapping = {
  18766. top: 'bottom',
  18767. bottom: 'top'
  18768. };
  18769. const xAxisMapping = {
  18770. left: 'right',
  18771. right: 'left'
  18772. };
  18773. const animateYAxis = yAxisMapping[yAxis] || 'middle';
  18774. const animateXAxis = xAxisMapping[xAxis] || 'center';
  18775. setAnimateOrigin(animateXAxis + ' ' + animateYAxis);
  18776. };
  18777. refresh();
  18778. const {
  18779. ownerDocument
  18780. } = containerRef.current;
  18781. const {
  18782. defaultView
  18783. } = ownerDocument;
  18784. /*
  18785. * There are sometimes we need to reposition or resize the popover that
  18786. * are not handled by the resize/scroll window events (i.e. CSS changes
  18787. * in the layout that changes the position of the anchor).
  18788. *
  18789. * For these situations, we refresh the popover every 0.5s
  18790. */
  18791. const intervalHandle = defaultView.setInterval(refresh, 500);
  18792. let rafId;
  18793. const refreshOnAnimationFrame = () => {
  18794. defaultView.cancelAnimationFrame(rafId);
  18795. rafId = defaultView.requestAnimationFrame(refresh);
  18796. }; // Sometimes a click trigger a layout change that affects the popover
  18797. // position. This is an opportunity to immediately refresh rather than
  18798. // at the interval.
  18799. defaultView.addEventListener('click', refreshOnAnimationFrame);
  18800. defaultView.addEventListener('resize', refresh);
  18801. defaultView.addEventListener('scroll', refresh, true);
  18802. const anchorDocument = getAnchorDocument(anchorRef); // If the anchor is within an iframe, the popover position also needs
  18803. // to refrest when the iframe content is scrolled or resized.
  18804. if (anchorDocument && anchorDocument !== ownerDocument) {
  18805. anchorDocument.defaultView.addEventListener('resize', refresh);
  18806. anchorDocument.defaultView.addEventListener('scroll', refresh, true);
  18807. }
  18808. let observer;
  18809. if (__unstableObserveElement) {
  18810. observer = new defaultView.MutationObserver(refresh);
  18811. observer.observe(__unstableObserveElement, {
  18812. attributes: true
  18813. });
  18814. }
  18815. return () => {
  18816. defaultView.clearInterval(intervalHandle);
  18817. defaultView.removeEventListener('resize', refresh);
  18818. defaultView.removeEventListener('scroll', refresh, true);
  18819. defaultView.removeEventListener('click', refreshOnAnimationFrame);
  18820. defaultView.cancelAnimationFrame(rafId);
  18821. if (anchorDocument && anchorDocument !== ownerDocument) {
  18822. var _anchorDocument$defau, _anchorDocument$defau2;
  18823. (_anchorDocument$defau = anchorDocument.defaultView) === null || _anchorDocument$defau === void 0 ? void 0 : _anchorDocument$defau.removeEventListener('resize', refresh);
  18824. (_anchorDocument$defau2 = anchorDocument.defaultView) === null || _anchorDocument$defau2 === void 0 ? void 0 : _anchorDocument$defau2.removeEventListener('scroll', refresh, true);
  18825. }
  18826. if (observer) {
  18827. observer.disconnect();
  18828. }
  18829. };
  18830. }, [isExpanded, anchorRect, getAnchorRect, anchorRef, shouldAnchorIncludePadding, position, contentSize, __unstableStickyBoundaryElement, __unstableObserveElement, __unstableBoundaryParent]);
  18831. const onDialogClose = (type, event) => {
  18832. // Ideally the popover should have just a single onClose prop and
  18833. // not three props that potentially do the same thing.
  18834. if (type === 'focus-outside' && onFocusOutside) {
  18835. onFocusOutside(event);
  18836. } else if (onClose) {
  18837. onClose();
  18838. }
  18839. };
  18840. const [dialogRef, dialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
  18841. focusOnMount,
  18842. __unstableOnClose: onDialogClose,
  18843. onClose: onDialogClose
  18844. });
  18845. const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([containerRef, dialogRef, ref]);
  18846. /** @type {false | string} */
  18847. const animateClassName = Boolean(animate && animateOrigin) && getAnimateClassName({
  18848. type: 'appear',
  18849. origin: animateOrigin
  18850. }); // Disable reason: We care to capture the _bubbled_ events from inputs
  18851. // within popover as inferring close intent.
  18852. let content = // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
  18853. // eslint-disable-next-line jsx-a11y/no-static-element-interactions
  18854. (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({
  18855. className: classnames_default()('components-popover', className, animateClassName, {
  18856. 'is-expanded': isExpanded,
  18857. 'is-without-arrow': noArrow,
  18858. 'is-alternate': isAlternate
  18859. })
  18860. }, contentProps, {
  18861. ref: mergedRefs
  18862. }, dialogProps, {
  18863. tabIndex: "-1"
  18864. }), isExpanded && (0,external_wp_element_namespaceObject.createElement)(ScrollLock, null), isExpanded && (0,external_wp_element_namespaceObject.createElement)("div", {
  18865. className: "components-popover__header"
  18866. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  18867. className: "components-popover__header-title"
  18868. }, headerTitle), (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  18869. className: "components-popover__close",
  18870. icon: library_close,
  18871. onClick: onClose
  18872. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  18873. ref: contentRef,
  18874. className: "components-popover__content"
  18875. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  18876. style: {
  18877. position: 'relative'
  18878. }
  18879. }, containerResizeListener, children)));
  18880. if (slot.ref) {
  18881. content = (0,external_wp_element_namespaceObject.createElement)(slot_fill_Fill, {
  18882. name: slotName
  18883. }, content);
  18884. }
  18885. if (anchorRef || anchorRect) {
  18886. return content;
  18887. }
  18888. return (0,external_wp_element_namespaceObject.createElement)("span", {
  18889. ref: anchorRefFallback
  18890. }, content);
  18891. };
  18892. const PopoverContainer = (0,external_wp_element_namespaceObject.forwardRef)(Popover);
  18893. function PopoverSlot(_ref2, ref) {
  18894. let {
  18895. name = SLOT_NAME
  18896. } = _ref2;
  18897. return (0,external_wp_element_namespaceObject.createElement)(slot_fill_Slot, {
  18898. bubblesVirtually: true,
  18899. name: name,
  18900. className: "popover-slot",
  18901. ref: ref
  18902. });
  18903. }
  18904. PopoverContainer.Slot = (0,external_wp_element_namespaceObject.forwardRef)(PopoverSlot);
  18905. PopoverContainer.__unstableSlotNameProvider = slotNameContext.Provider;
  18906. /* harmony default export */ var popover = (PopoverContainer);
  18907. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/shortcut/index.js
  18908. /**
  18909. * External dependencies
  18910. */
  18911. /** @typedef {string | { display: string, ariaLabel: string }} Shortcut */
  18912. /**
  18913. * @typedef Props
  18914. * @property {Shortcut} shortcut Shortcut configuration
  18915. * @property {string} [className] Classname
  18916. */
  18917. /**
  18918. * @param {Props} props Props
  18919. * @return {JSX.Element | null} Element
  18920. */
  18921. function Shortcut(_ref) {
  18922. let {
  18923. shortcut,
  18924. className
  18925. } = _ref;
  18926. if (!shortcut) {
  18927. return null;
  18928. }
  18929. let displayText;
  18930. let ariaLabel;
  18931. if ((0,external_lodash_namespaceObject.isString)(shortcut)) {
  18932. displayText = shortcut;
  18933. }
  18934. if ((0,external_lodash_namespaceObject.isObject)(shortcut)) {
  18935. displayText = shortcut.display;
  18936. ariaLabel = shortcut.ariaLabel;
  18937. }
  18938. return (0,external_wp_element_namespaceObject.createElement)("span", {
  18939. className: className,
  18940. "aria-label": ariaLabel
  18941. }, displayText);
  18942. }
  18943. /* harmony default export */ var build_module_shortcut = (Shortcut);
  18944. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tooltip/index.js
  18945. // @ts-nocheck
  18946. /**
  18947. * External dependencies
  18948. */
  18949. /**
  18950. * WordPress dependencies
  18951. */
  18952. /**
  18953. * Internal dependencies
  18954. */
  18955. /**
  18956. * Time over children to wait before showing tooltip
  18957. *
  18958. * @type {number}
  18959. */
  18960. const TOOLTIP_DELAY = 700;
  18961. const eventCatcher = (0,external_wp_element_namespaceObject.createElement)("div", {
  18962. className: "event-catcher"
  18963. });
  18964. const getDisabledElement = _ref => {
  18965. let {
  18966. eventHandlers,
  18967. child,
  18968. childrenWithPopover
  18969. } = _ref;
  18970. return (0,external_wp_element_namespaceObject.cloneElement)((0,external_wp_element_namespaceObject.createElement)("span", {
  18971. className: "disabled-element-wrapper"
  18972. }, (0,external_wp_element_namespaceObject.cloneElement)(eventCatcher, eventHandlers), (0,external_wp_element_namespaceObject.cloneElement)(child, {
  18973. children: childrenWithPopover
  18974. })), eventHandlers);
  18975. };
  18976. const getRegularElement = _ref2 => {
  18977. let {
  18978. child,
  18979. eventHandlers,
  18980. childrenWithPopover
  18981. } = _ref2;
  18982. return (0,external_wp_element_namespaceObject.cloneElement)(child, { ...eventHandlers,
  18983. children: childrenWithPopover
  18984. });
  18985. };
  18986. const addPopoverToGrandchildren = _ref3 => {
  18987. let {
  18988. grandchildren,
  18989. isOver,
  18990. position,
  18991. text,
  18992. shortcut
  18993. } = _ref3;
  18994. return (0,external_wp_element_namespaceObject.concatChildren)(grandchildren, isOver && (0,external_wp_element_namespaceObject.createElement)(popover, {
  18995. focusOnMount: false,
  18996. position: position,
  18997. className: "components-tooltip",
  18998. "aria-hidden": "true",
  18999. animate: false,
  19000. noArrow: true
  19001. }, text, (0,external_wp_element_namespaceObject.createElement)(build_module_shortcut, {
  19002. className: "components-tooltip__shortcut",
  19003. shortcut: shortcut
  19004. })));
  19005. };
  19006. const emitToChild = (children, eventName, event) => {
  19007. if (external_wp_element_namespaceObject.Children.count(children) !== 1) {
  19008. return;
  19009. }
  19010. const child = external_wp_element_namespaceObject.Children.only(children); // If the underlying element is disabled, do not emit the event.
  19011. if (child.props.disabled) {
  19012. return;
  19013. }
  19014. if (typeof child.props[eventName] === 'function') {
  19015. child.props[eventName](event);
  19016. }
  19017. };
  19018. function Tooltip(props) {
  19019. const {
  19020. children,
  19021. position,
  19022. text,
  19023. shortcut,
  19024. delay = TOOLTIP_DELAY
  19025. } = props;
  19026. /**
  19027. * Whether a mouse is currently pressed, used in determining whether
  19028. * to handle a focus event as displaying the tooltip immediately.
  19029. *
  19030. * @type {boolean}
  19031. */
  19032. const [isMouseDown, setIsMouseDown] = (0,external_wp_element_namespaceObject.useState)(false);
  19033. const [isOver, setIsOver] = (0,external_wp_element_namespaceObject.useState)(false);
  19034. const delayedSetIsOver = (0,external_wp_compose_namespaceObject.useDebounce)(setIsOver, delay);
  19035. const createMouseDown = event => {
  19036. // Preserve original child callback behavior.
  19037. emitToChild(children, 'onMouseDown', event); // On mouse down, the next `mouseup` should revert the value of the
  19038. // instance property and remove its own event handler. The bind is
  19039. // made on the document since the `mouseup` might not occur within
  19040. // the bounds of the element.
  19041. document.addEventListener('mouseup', cancelIsMouseDown);
  19042. setIsMouseDown(true);
  19043. };
  19044. const createMouseUp = event => {
  19045. emitToChild(children, 'onMouseUp', event);
  19046. document.removeEventListener('mouseup', cancelIsMouseDown);
  19047. setIsMouseDown(false);
  19048. };
  19049. const createMouseEvent = type => {
  19050. if (type === 'mouseUp') return createMouseUp;
  19051. if (type === 'mouseDown') return createMouseDown;
  19052. };
  19053. /**
  19054. * Prebound `isInMouseDown` handler, created as a constant reference to
  19055. * assure ability to remove in component unmount.
  19056. *
  19057. * @type {Function}
  19058. */
  19059. const cancelIsMouseDown = createMouseEvent('mouseUp');
  19060. const createToggleIsOver = (eventName, isDelayed) => {
  19061. return event => {
  19062. // Preserve original child callback behavior.
  19063. emitToChild(children, eventName, event); // Mouse events behave unreliably in React for disabled elements,
  19064. // firing on mouseenter but not mouseleave. Further, the default
  19065. // behavior for disabled elements in some browsers is to ignore
  19066. // mouse events. Don't bother trying to to handle them.
  19067. //
  19068. // See: https://github.com/facebook/react/issues/4251
  19069. if (event.currentTarget.disabled) {
  19070. return;
  19071. } // A focus event will occur as a result of a mouse click, but it
  19072. // should be disambiguated between interacting with the button and
  19073. // using an explicit focus shift as a cue to display the tooltip.
  19074. if ('focus' === event.type && isMouseDown) {
  19075. return;
  19076. } // Needed in case unsetting is over while delayed set pending, i.e.
  19077. // quickly blur/mouseleave before delayedSetIsOver is called.
  19078. delayedSetIsOver.cancel();
  19079. const _isOver = (0,external_lodash_namespaceObject.includes)(['focus', 'mouseenter'], event.type);
  19080. if (_isOver === isOver) {
  19081. return;
  19082. }
  19083. if (isDelayed) {
  19084. delayedSetIsOver(_isOver);
  19085. } else {
  19086. setIsOver(_isOver);
  19087. }
  19088. };
  19089. };
  19090. const clearOnUnmount = () => {
  19091. delayedSetIsOver.cancel();
  19092. document.removeEventListener('mouseup', cancelIsMouseDown);
  19093. };
  19094. (0,external_wp_element_namespaceObject.useEffect)(() => clearOnUnmount, []);
  19095. if (external_wp_element_namespaceObject.Children.count(children) !== 1) {
  19096. if (false) {}
  19097. return children;
  19098. }
  19099. const eventHandlers = {
  19100. onMouseEnter: createToggleIsOver('onMouseEnter', true),
  19101. onMouseLeave: createToggleIsOver('onMouseLeave'),
  19102. onClick: createToggleIsOver('onClick'),
  19103. onFocus: createToggleIsOver('onFocus'),
  19104. onBlur: createToggleIsOver('onBlur'),
  19105. onMouseDown: createMouseEvent('mouseDown')
  19106. };
  19107. const child = external_wp_element_namespaceObject.Children.only(children);
  19108. const {
  19109. children: grandchildren,
  19110. disabled
  19111. } = child.props;
  19112. const getElementWithPopover = disabled ? getDisabledElement : getRegularElement;
  19113. const popoverData = {
  19114. isOver,
  19115. position,
  19116. text,
  19117. shortcut
  19118. };
  19119. const childrenWithPopover = addPopoverToGrandchildren({
  19120. grandchildren,
  19121. ...popoverData
  19122. });
  19123. return getElementWithPopover({
  19124. child,
  19125. eventHandlers,
  19126. childrenWithPopover
  19127. });
  19128. }
  19129. /* harmony default export */ var tooltip = (Tooltip);
  19130. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/utils.js
  19131. /**
  19132. * External dependencies
  19133. */
  19134. /**
  19135. * WordPress dependencies
  19136. */
  19137. const GRID = [['top left', 'top center', 'top right'], ['center left', 'center center', 'center right'], ['bottom left', 'bottom center', 'bottom right']]; // Stored as map as i18n __() only accepts strings (not variables)
  19138. const ALIGNMENT_LABEL = {
  19139. 'top left': (0,external_wp_i18n_namespaceObject.__)('Top Left'),
  19140. 'top center': (0,external_wp_i18n_namespaceObject.__)('Top Center'),
  19141. 'top right': (0,external_wp_i18n_namespaceObject.__)('Top Right'),
  19142. 'center left': (0,external_wp_i18n_namespaceObject.__)('Center Left'),
  19143. 'center center': (0,external_wp_i18n_namespaceObject.__)('Center Center'),
  19144. 'center right': (0,external_wp_i18n_namespaceObject.__)('Center Right'),
  19145. 'bottom left': (0,external_wp_i18n_namespaceObject.__)('Bottom Left'),
  19146. 'bottom center': (0,external_wp_i18n_namespaceObject.__)('Bottom Center'),
  19147. 'bottom right': (0,external_wp_i18n_namespaceObject.__)('Bottom Right')
  19148. }; // Transforms GRID into a flat Array of values.
  19149. const ALIGNMENTS = (0,external_lodash_namespaceObject.flattenDeep)(GRID);
  19150. /**
  19151. * Parses and transforms an incoming value to better match the alignment values
  19152. *
  19153. * @param {string} value An alignment value to parse.
  19154. *
  19155. * @return {string} The parsed value.
  19156. */
  19157. function transformValue(value) {
  19158. const nextValue = value === 'center' ? 'center center' : value;
  19159. return nextValue.replace('-', ' ');
  19160. }
  19161. /**
  19162. * Creates an item ID based on a prefix ID and an alignment value.
  19163. *
  19164. * @param {string} prefixId An ID to prefix.
  19165. * @param {string} value An alignment value.
  19166. *
  19167. * @return {string} The item id.
  19168. */
  19169. function getItemId(prefixId, value) {
  19170. const valueId = transformValue(value).replace(' ', '-');
  19171. return `${prefixId}-${valueId}`;
  19172. }
  19173. /**
  19174. * Retrieves the alignment index from a value.
  19175. *
  19176. * @param {string} alignment Value to check.
  19177. *
  19178. * @return {number} The index of a matching alignment.
  19179. */
  19180. function getAlignmentIndex() {
  19181. let alignment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'center';
  19182. const item = transformValue(alignment).replace('-', ' ');
  19183. const index = ALIGNMENTS.indexOf(item);
  19184. return index > -1 ? index : undefined;
  19185. }
  19186. // EXTERNAL MODULE: ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js
  19187. var hoist_non_react_statics_cjs = __webpack_require__(1281);
  19188. ;// CONCATENATED MODULE: ./node_modules/@emotion/react/dist/emotion-react.browser.esm.js
  19189. var pkg = {
  19190. name: "@emotion/react",
  19191. version: "11.9.0",
  19192. main: "dist/emotion-react.cjs.js",
  19193. module: "dist/emotion-react.esm.js",
  19194. browser: {
  19195. "./dist/emotion-react.cjs.js": "./dist/emotion-react.browser.cjs.js",
  19196. "./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js"
  19197. },
  19198. types: "types/index.d.ts",
  19199. files: [
  19200. "src",
  19201. "dist",
  19202. "jsx-runtime",
  19203. "jsx-dev-runtime",
  19204. "_isolated-hnrs",
  19205. "types/*.d.ts",
  19206. "macro.js",
  19207. "macro.d.ts",
  19208. "macro.js.flow"
  19209. ],
  19210. sideEffects: false,
  19211. author: "Emotion Contributors",
  19212. license: "MIT",
  19213. scripts: {
  19214. "test:typescript": "dtslint types"
  19215. },
  19216. dependencies: {
  19217. "@babel/runtime": "^7.13.10",
  19218. "@emotion/babel-plugin": "^11.7.1",
  19219. "@emotion/cache": "^11.7.1",
  19220. "@emotion/serialize": "^1.0.3",
  19221. "@emotion/utils": "^1.1.0",
  19222. "@emotion/weak-memoize": "^0.2.5",
  19223. "hoist-non-react-statics": "^3.3.1"
  19224. },
  19225. peerDependencies: {
  19226. "@babel/core": "^7.0.0",
  19227. react: ">=16.8.0"
  19228. },
  19229. peerDependenciesMeta: {
  19230. "@babel/core": {
  19231. optional: true
  19232. },
  19233. "@types/react": {
  19234. optional: true
  19235. }
  19236. },
  19237. devDependencies: {
  19238. "@babel/core": "^7.13.10",
  19239. "@emotion/css": "11.9.0",
  19240. "@emotion/css-prettifier": "1.0.1",
  19241. "@emotion/server": "11.4.0",
  19242. "@emotion/styled": "11.8.1",
  19243. "@types/react": "^16.9.11",
  19244. dtslint: "^4.2.1",
  19245. "html-tag-names": "^1.1.2",
  19246. react: "16.14.0",
  19247. "svg-tag-names": "^1.1.1",
  19248. typescript: "^4.5.5"
  19249. },
  19250. repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
  19251. publishConfig: {
  19252. access: "public"
  19253. },
  19254. "umd:main": "dist/emotion-react.umd.min.js",
  19255. preconstruct: {
  19256. entrypoints: [
  19257. "./index.js",
  19258. "./jsx-runtime.js",
  19259. "./jsx-dev-runtime.js",
  19260. "./_isolated-hnrs.js"
  19261. ],
  19262. umdName: "emotionReact"
  19263. }
  19264. };
  19265. var jsx = function jsx(type, props) {
  19266. var args = arguments;
  19267. if (props == null || !hasOwnProperty.call(props, 'css')) {
  19268. // $FlowFixMe
  19269. return createElement.apply(undefined, args);
  19270. }
  19271. var argsLength = args.length;
  19272. var createElementArgArray = new Array(argsLength);
  19273. createElementArgArray[0] = Emotion;
  19274. createElementArgArray[1] = createEmotionProps(type, props);
  19275. for (var i = 2; i < argsLength; i++) {
  19276. createElementArgArray[i] = args[i];
  19277. } // $FlowFixMe
  19278. return createElement.apply(null, createElementArgArray);
  19279. };
  19280. var emotion_react_browser_esm_useInsertionEffect = external_React_['useInsertion' + 'Effect'] ? external_React_['useInsertion' + 'Effect'] : external_React_.useLayoutEffect;
  19281. var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
  19282. // initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
  19283. // initial client-side render from SSR, use place of hydrating tag
  19284. var Global = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache) {
  19285. if (false) {}
  19286. var styles = props.styles;
  19287. var serialized = serializeStyles([styles], undefined, useContext(ThemeContext));
  19288. // but it is based on a constant that will never change at runtime
  19289. // it's effectively like having two implementations and switching them out
  19290. // so it's not actually breaking anything
  19291. var sheetRef = useRef();
  19292. emotion_react_browser_esm_useInsertionEffect(function () {
  19293. var key = cache.key + "-global"; // use case of https://github.com/emotion-js/emotion/issues/2675
  19294. var sheet = new cache.sheet.constructor({
  19295. key: key,
  19296. nonce: cache.sheet.nonce,
  19297. container: cache.sheet.container,
  19298. speedy: cache.sheet.isSpeedy
  19299. });
  19300. var rehydrating = false; // $FlowFixMe
  19301. var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]");
  19302. if (cache.sheet.tags.length) {
  19303. sheet.before = cache.sheet.tags[0];
  19304. }
  19305. if (node !== null) {
  19306. rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s
  19307. node.setAttribute('data-emotion', key);
  19308. sheet.hydrate([node]);
  19309. }
  19310. sheetRef.current = [sheet, rehydrating];
  19311. return function () {
  19312. sheet.flush();
  19313. };
  19314. }, [cache]);
  19315. emotion_react_browser_esm_useInsertionEffect(function () {
  19316. var sheetRefCurrent = sheetRef.current;
  19317. var sheet = sheetRefCurrent[0],
  19318. rehydrating = sheetRefCurrent[1];
  19319. if (rehydrating) {
  19320. sheetRefCurrent[1] = false;
  19321. return;
  19322. }
  19323. if (serialized.next !== undefined) {
  19324. // insert keyframes
  19325. insertStyles(cache, serialized.next, true);
  19326. }
  19327. if (sheet.tags.length) {
  19328. // if this doesn't exist then it will be null so the style element will be appended
  19329. var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;
  19330. sheet.before = element;
  19331. sheet.flush();
  19332. }
  19333. cache.insert("", serialized, sheet, false);
  19334. }, [cache, serialized.name]);
  19335. return null;
  19336. })));
  19337. if (false) {}
  19338. function emotion_react_browser_esm_css() {
  19339. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  19340. args[_key] = arguments[_key];
  19341. }
  19342. return emotion_serialize_browser_esm_serializeStyles(args);
  19343. }
  19344. var emotion_react_browser_esm_keyframes = function keyframes() {
  19345. var insertable = emotion_react_browser_esm_css.apply(void 0, arguments);
  19346. var name = "animation-" + insertable.name; // $FlowFixMe
  19347. return {
  19348. name: name,
  19349. styles: "@keyframes " + name + "{" + insertable.styles + "}",
  19350. anim: 1,
  19351. toString: function toString() {
  19352. return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
  19353. }
  19354. };
  19355. };
  19356. var emotion_react_browser_esm_classnames = function classnames(args) {
  19357. var len = args.length;
  19358. var i = 0;
  19359. var cls = '';
  19360. for (; i < len; i++) {
  19361. var arg = args[i];
  19362. if (arg == null) continue;
  19363. var toAdd = void 0;
  19364. switch (typeof arg) {
  19365. case 'boolean':
  19366. break;
  19367. case 'object':
  19368. {
  19369. if (Array.isArray(arg)) {
  19370. toAdd = classnames(arg);
  19371. } else {
  19372. if (false) {}
  19373. toAdd = '';
  19374. for (var k in arg) {
  19375. if (arg[k] && k) {
  19376. toAdd && (toAdd += ' ');
  19377. toAdd += k;
  19378. }
  19379. }
  19380. }
  19381. break;
  19382. }
  19383. default:
  19384. {
  19385. toAdd = arg;
  19386. }
  19387. }
  19388. if (toAdd) {
  19389. cls && (cls += ' ');
  19390. cls += toAdd;
  19391. }
  19392. }
  19393. return cls;
  19394. };
  19395. function emotion_react_browser_esm_merge(registered, css, className) {
  19396. var registeredStyles = [];
  19397. var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
  19398. if (registeredStyles.length < 2) {
  19399. return className;
  19400. }
  19401. return rawClassName + css(registeredStyles);
  19402. }
  19403. var emotion_react_browser_esm_Insertion = function Insertion(_ref) {
  19404. var cache = _ref.cache,
  19405. serializedArr = _ref.serializedArr;
  19406. var rules = useInsertionEffectMaybe(function () {
  19407. for (var i = 0; i < serializedArr.length; i++) {
  19408. var res = insertStyles(cache, serializedArr[i], false);
  19409. }
  19410. });
  19411. return null;
  19412. };
  19413. var ClassNames = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache) {
  19414. var hasRendered = false;
  19415. var serializedArr = [];
  19416. var css = function css() {
  19417. if (hasRendered && "production" !== 'production') {}
  19418. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  19419. args[_key] = arguments[_key];
  19420. }
  19421. var serialized = serializeStyles(args, cache.registered);
  19422. serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`
  19423. registerStyles(cache, serialized, false);
  19424. return cache.key + "-" + serialized.name;
  19425. };
  19426. var cx = function cx() {
  19427. if (hasRendered && "production" !== 'production') {}
  19428. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  19429. args[_key2] = arguments[_key2];
  19430. }
  19431. return emotion_react_browser_esm_merge(cache.registered, css, emotion_react_browser_esm_classnames(args));
  19432. };
  19433. var content = {
  19434. css: css,
  19435. cx: cx,
  19436. theme: useContext(ThemeContext)
  19437. };
  19438. var ele = props.children(content);
  19439. hasRendered = true;
  19440. return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(emotion_react_browser_esm_Insertion, {
  19441. cache: cache,
  19442. serializedArr: serializedArr
  19443. }), ele);
  19444. })));
  19445. if (false) {}
  19446. if (false) { var globalKey, globalContext, isJest, emotion_react_browser_esm_isBrowser; }
  19447. ;// CONCATENATED MODULE: ./node_modules/colord/index.mjs
  19448. var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},colord_n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},colord_e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},colord_a=function(r){return{r:colord_e(r.r,0,255),g:colord_e(r.g,0,255),b:colord_e(r.b,0,255),a:colord_e(r.a)}},colord_o=function(r){return{r:colord_n(r.r),g:colord_n(r.g),b:colord_n(r.b),a:colord_n(r.a,3)}},colord_i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:colord_e(r.s,0,100),l:colord_e(r.l,0,100),a:colord_e(r.a)}},d=function(r){return{h:colord_n(r.h),s:colord_n(r.s),l:colord_n(r.l),a:colord_n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=colord_i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?colord_n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?colord_n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:colord_a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?colord_a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:colord_e(r.s,0,100),v:colord_e(r.v,0,100),a:colord_e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:colord_e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:colord_e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return colord_n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=colord_o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(colord_n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return colord_o(this.rgba)},r.prototype.toRgbString=function(){return r=colord_o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:colord_n(r.h),s:colord_n(r.s),v:colord_n(r.v),a:colord_n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):colord_n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):colord_n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};
  19449. ;// CONCATENATED MODULE: ./node_modules/colord/plugins/names.mjs
  19450. /* harmony default export */ function names(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])}
  19451. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/colors.js
  19452. /**
  19453. * External dependencies
  19454. */
  19455. k([names]);
  19456. /**
  19457. * Generating a CSS compliant rgba() color value.
  19458. *
  19459. * @param {string} hexValue The hex value to convert to rgba().
  19460. * @param {number} alpha The alpha value for opacity.
  19461. * @return {string} The converted rgba() color value.
  19462. *
  19463. * @example
  19464. * rgba( '#000000', 0.5 )
  19465. * // rgba(0, 0, 0, 0.5)
  19466. */
  19467. function rgba() {
  19468. let hexValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  19469. let alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  19470. return w(hexValue).alpha(alpha).toRgbString();
  19471. }
  19472. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/colors-values.js
  19473. /**
  19474. * External dependencies
  19475. */
  19476. /**
  19477. * Internal dependencies
  19478. */
  19479. const BASE = {
  19480. black: '#000',
  19481. white: '#fff'
  19482. };
  19483. /**
  19484. * TODO: Continue to update values as "G2" design evolves.
  19485. *
  19486. * "G2" refers to the movement to advance the interface of the block editor.
  19487. * https://github.com/WordPress/gutenberg/issues/18667
  19488. */
  19489. const G2 = {
  19490. blue: {
  19491. medium: {
  19492. focus: '#007cba',
  19493. focusDark: '#fff'
  19494. }
  19495. },
  19496. gray: {
  19497. 900: '#1e1e1e',
  19498. 700: '#757575',
  19499. // Meets 4.6:1 text contrast against white.
  19500. 600: '#949494',
  19501. // Meets 3:1 UI or large text contrast against white.
  19502. 400: '#ccc',
  19503. 300: '#ddd',
  19504. // Used for most borders.
  19505. 200: '#e0e0e0',
  19506. // Used sparingly for light borders.
  19507. 100: '#f0f0f0' // Used for light gray backgrounds.
  19508. },
  19509. darkGray: {
  19510. primary: '#1e1e1e',
  19511. heading: '#050505'
  19512. },
  19513. mediumGray: {
  19514. text: '#757575'
  19515. },
  19516. lightGray: {
  19517. ui: '#949494',
  19518. secondary: '#ccc',
  19519. tertiary: '#e7e8e9'
  19520. }
  19521. };
  19522. const DARK_GRAY = {
  19523. 900: '#191e23',
  19524. 800: '#23282d',
  19525. 700: '#32373c',
  19526. 600: '#40464d',
  19527. 500: '#555d66',
  19528. // Use this most of the time for dark items.
  19529. 400: '#606a73',
  19530. 300: '#6c7781',
  19531. // Lightest gray that can be used for AA text contrast.
  19532. 200: '#7e8993',
  19533. 150: '#8d96a0',
  19534. // Lightest gray that can be used for AA non-text contrast.
  19535. 100: '#8f98a1',
  19536. placeholder: rgba(G2.gray[900], 0.62)
  19537. };
  19538. const DARK_OPACITY = {
  19539. 900: rgba('#000510', 0.9),
  19540. 800: rgba('#00000a', 0.85),
  19541. 700: rgba('#06060b', 0.8),
  19542. 600: rgba('#000913', 0.75),
  19543. 500: rgba('#0a1829', 0.7),
  19544. 400: rgba('#0a1829', 0.65),
  19545. 300: rgba('#0e1c2e', 0.62),
  19546. 200: rgba('#162435', 0.55),
  19547. 100: rgba('#223443', 0.5),
  19548. backgroundFill: rgba(DARK_GRAY[700], 0.7)
  19549. };
  19550. const DARK_OPACITY_LIGHT = {
  19551. 900: rgba('#304455', 0.45),
  19552. 800: rgba('#425863', 0.4),
  19553. 700: rgba('#667886', 0.35),
  19554. 600: rgba('#7b86a2', 0.3),
  19555. 500: rgba('#9197a2', 0.25),
  19556. 400: rgba('#95959c', 0.2),
  19557. 300: rgba('#829493', 0.15),
  19558. 200: rgba('#8b8b96', 0.1),
  19559. 100: rgba('#747474', 0.05)
  19560. };
  19561. const LIGHT_GRAY = {
  19562. 900: '#a2aab2',
  19563. 800: '#b5bcc2',
  19564. 700: '#ccd0d4',
  19565. 600: '#d7dade',
  19566. 500: '#e2e4e7',
  19567. // Good for "grayed" items and borders.
  19568. 400: '#e8eaeb',
  19569. // Good for "readonly" input fields and special text selection.
  19570. 300: '#edeff0',
  19571. 200: '#f3f4f5',
  19572. 100: '#f8f9f9',
  19573. placeholder: rgba(BASE.white, 0.65)
  19574. };
  19575. const LIGHT_OPACITY_LIGHT = {
  19576. 900: rgba(BASE.white, 0.5),
  19577. 800: rgba(BASE.white, 0.45),
  19578. 700: rgba(BASE.white, 0.4),
  19579. 600: rgba(BASE.white, 0.35),
  19580. 500: rgba(BASE.white, 0.3),
  19581. 400: rgba(BASE.white, 0.25),
  19582. 300: rgba(BASE.white, 0.2),
  19583. 200: rgba(BASE.white, 0.15),
  19584. 100: rgba(BASE.white, 0.1),
  19585. backgroundFill: rgba(LIGHT_GRAY[300], 0.8)
  19586. }; // Additional colors.
  19587. // Some are from https://make.wordpress.org/design/handbook/foundations/colors/.
  19588. const BLUE = {
  19589. wordpress: {
  19590. 700: '#00669b'
  19591. },
  19592. dark: {
  19593. 900: '#0071a1'
  19594. },
  19595. medium: {
  19596. 900: '#006589',
  19597. 800: '#00739c',
  19598. 700: '#007fac',
  19599. 600: '#008dbe',
  19600. 500: '#00a0d2',
  19601. 400: '#33b3db',
  19602. 300: '#66c6e4',
  19603. 200: '#bfe7f3',
  19604. 100: '#e5f5fa',
  19605. highlight: '#b3e7fe',
  19606. focus: '#007cba'
  19607. }
  19608. };
  19609. const ALERT = {
  19610. yellow: '#f0b849',
  19611. red: '#d94f4f',
  19612. green: '#4ab866'
  19613. };
  19614. const ADMIN = {
  19615. theme: `var( --wp-admin-theme-color, ${BLUE.wordpress[700]})`,
  19616. themeDark10: `var( --wp-admin-theme-color-darker-10, ${BLUE.medium.focus})`
  19617. }; // Namespaced values for raw colors hex codes.
  19618. const UI = {
  19619. theme: ADMIN.theme,
  19620. background: BASE.white,
  19621. backgroundDisabled: LIGHT_GRAY[200],
  19622. border: G2.gray[700],
  19623. borderHover: G2.gray[700],
  19624. borderFocus: ADMIN.themeDark10,
  19625. borderDisabled: G2.gray[400],
  19626. borderLight: G2.gray[300],
  19627. label: DARK_GRAY[500],
  19628. textDisabled: DARK_GRAY[150],
  19629. textDark: BASE.white,
  19630. textLight: BASE.black
  19631. }; // Using Object.assign instead of { ...spread } syntax helps TypeScript
  19632. // to extract the correct type defs here.
  19633. const COLORS = Object.assign({}, BASE, {
  19634. darkGray: (0,external_lodash_namespaceObject.merge)({}, DARK_GRAY, G2.darkGray),
  19635. darkOpacity: DARK_OPACITY,
  19636. darkOpacityLight: DARK_OPACITY_LIGHT,
  19637. mediumGray: G2.mediumGray,
  19638. gray: G2.gray,
  19639. lightGray: (0,external_lodash_namespaceObject.merge)({}, LIGHT_GRAY, G2.lightGray),
  19640. lightGrayLight: LIGHT_OPACITY_LIGHT,
  19641. blue: (0,external_lodash_namespaceObject.merge)({}, BLUE, G2.blue),
  19642. alert: ALERT,
  19643. admin: ADMIN,
  19644. ui: UI
  19645. });
  19646. /* harmony default export */ var colors_values = ((/* unused pure expression or super */ null && (COLORS)));
  19647. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/reduce-motion.js
  19648. /**
  19649. * Allows users to opt-out of animations via OS-level preferences.
  19650. *
  19651. * @param {'transition' | 'animation' | string} [prop='transition'] CSS Property name
  19652. * @return {string} Generated CSS code for the reduced style
  19653. */
  19654. function reduceMotion() {
  19655. let prop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transition';
  19656. let style;
  19657. switch (prop) {
  19658. case 'transition':
  19659. style = 'transition-duration: 0ms;';
  19660. break;
  19661. case 'animation':
  19662. style = 'animation-duration: 1ms;';
  19663. break;
  19664. default:
  19665. style = `
  19666. animation-duration: 1ms;
  19667. transition-duration: 0ms;
  19668. `;
  19669. }
  19670. return `
  19671. @media ( prefers-reduced-motion: reduce ) {
  19672. ${style};
  19673. }
  19674. `;
  19675. }
  19676. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js
  19677. function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  19678. /**
  19679. * External dependencies
  19680. */
  19681. /**
  19682. * Internal dependencies
  19683. */
  19684. var _ref = true ? {
  19685. name: "lp9rn7",
  19686. styles: "border-radius:2px;box-sizing:border-box;display:grid;grid-template-columns:repeat( 3, 1fr );outline:none"
  19687. } : 0;
  19688. const rootBase = () => {
  19689. return _ref;
  19690. };
  19691. const rootSize = _ref2 => {
  19692. let {
  19693. size = 92
  19694. } = _ref2;
  19695. return /*#__PURE__*/emotion_react_browser_esm_css("grid-template-rows:repeat( 3, calc( ", size, "px / 3 ) );width:", size, "px;" + ( true ? "" : 0), true ? "" : 0);
  19696. };
  19697. const Root = emotion_styled_base_browser_esm("div", true ? {
  19698. target: "e1od1u4s3"
  19699. } : 0)(rootBase, ";border:1px solid transparent;cursor:pointer;grid-template-columns:auto;", rootSize, ";" + ( true ? "" : 0));
  19700. const Row = emotion_styled_base_browser_esm("div", true ? {
  19701. target: "e1od1u4s2"
  19702. } : 0)( true ? {
  19703. name: "1x5gbbj",
  19704. styles: "box-sizing:border-box;display:grid;grid-template-columns:repeat( 3, 1fr )"
  19705. } : 0);
  19706. const pointActive = _ref3 => {
  19707. let {
  19708. isActive
  19709. } = _ref3;
  19710. const boxShadow = isActive ? `0 0 0 2px ${COLORS.black}` : null;
  19711. const pointColor = isActive ? COLORS.black : COLORS.lightGray[800];
  19712. const pointColorHover = isActive ? COLORS.black : COLORS.blue.medium.focus;
  19713. return /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:", boxShadow, ";color:", pointColor, ";*:hover>&{color:", pointColorHover, ";}" + ( true ? "" : 0), true ? "" : 0);
  19714. };
  19715. const pointBase = props => {
  19716. return /*#__PURE__*/emotion_react_browser_esm_css("background:currentColor;box-sizing:border-box;display:grid;margin:auto;transition:all 120ms linear;", reduceMotion('transition'), " ", pointActive(props), ";" + ( true ? "" : 0), true ? "" : 0);
  19717. };
  19718. const Point = emotion_styled_base_browser_esm("span", true ? {
  19719. target: "e1od1u4s1"
  19720. } : 0)("height:6px;width:6px;", pointBase, ";" + ( true ? "" : 0));
  19721. const Cell = emotion_styled_base_browser_esm("span", true ? {
  19722. target: "e1od1u4s0"
  19723. } : 0)( true ? {
  19724. name: "rjf3ub",
  19725. styles: "appearance:none;border:none;box-sizing:border-box;margin:0;display:flex;position:relative;outline:none;align-items:center;justify-content:center;padding:0"
  19726. } : 0);
  19727. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/cell.js
  19728. /**
  19729. * Internal dependencies
  19730. */
  19731. /**
  19732. * Internal dependencies
  19733. */
  19734. function cell_Cell(_ref) {
  19735. let {
  19736. isActive = false,
  19737. value,
  19738. ...props
  19739. } = _ref;
  19740. const tooltipText = ALIGNMENT_LABEL[value];
  19741. return (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  19742. text: tooltipText
  19743. }, (0,external_wp_element_namespaceObject.createElement)(CompositeItem, extends_extends({
  19744. as: Cell,
  19745. role: "gridcell"
  19746. }, props), (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, null, value), (0,external_wp_element_namespaceObject.createElement)(Point, {
  19747. isActive: isActive,
  19748. role: "presentation"
  19749. })));
  19750. }
  19751. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/useSealedState.js
  19752. /**
  19753. * React custom hook that returns the very first value passed to `initialState`,
  19754. * even if it changes between re-renders.
  19755. */
  19756. function useSealedState(initialState) {
  19757. var _React$useState = (0,external_React_.useState)(initialState),
  19758. sealed = _React$useState[0];
  19759. return sealed;
  19760. }
  19761. ;// CONCATENATED MODULE: ./node_modules/reakit/es/reverse-30eaa122.js
  19762. function groupItems(items) {
  19763. var groups = [[]];
  19764. var _loop = function _loop() {
  19765. var item = _step.value;
  19766. var group = groups.find(function (g) {
  19767. return !g[0] || g[0].groupId === item.groupId;
  19768. });
  19769. if (group) {
  19770. group.push(item);
  19771. } else {
  19772. groups.push([item]);
  19773. }
  19774. };
  19775. for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
  19776. _loop();
  19777. }
  19778. return groups;
  19779. }
  19780. function flatten(grid) {
  19781. var flattened = [];
  19782. for (var _iterator = _createForOfIteratorHelperLoose(grid), _step; !(_step = _iterator()).done;) {
  19783. var row = _step.value;
  19784. flattened.push.apply(flattened, row);
  19785. }
  19786. return flattened;
  19787. }
  19788. function reverse(array) {
  19789. return array.slice().reverse();
  19790. }
  19791. ;// CONCATENATED MODULE: ./node_modules/reakit/es/findEnabledItemById-8ddca752.js
  19792. function findEnabledItemById(items, id) {
  19793. if (!id) return undefined;
  19794. return items === null || items === void 0 ? void 0 : items.find(function (item) {
  19795. return item.id === id && !item.disabled;
  19796. });
  19797. }
  19798. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/applyState.js
  19799. function isUpdater(argument) {
  19800. return typeof argument === "function";
  19801. }
  19802. /**
  19803. * Receives a `setState` argument and calls it with `currentValue` if it's a
  19804. * function. Otherwise return the argument as the new value.
  19805. *
  19806. * @example
  19807. * import { applyState } from "reakit-utils";
  19808. *
  19809. * applyState((value) => value + 1, 1); // 2
  19810. * applyState(2, 1); // 2
  19811. */
  19812. function applyState(argument, currentValue) {
  19813. if (isUpdater(argument)) {
  19814. return argument(currentValue);
  19815. }
  19816. return argument;
  19817. }
  19818. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Id/IdState.js
  19819. function unstable_useIdState(initialState) {
  19820. if (initialState === void 0) {
  19821. initialState = {};
  19822. }
  19823. var _useSealedState = useSealedState(initialState),
  19824. initialBaseId = _useSealedState.baseId;
  19825. var generateId = (0,external_React_.useContext)(unstable_IdContext);
  19826. var idCountRef = (0,external_React_.useRef)(0);
  19827. var _React$useState = (0,external_React_.useState)(function () {
  19828. return initialBaseId || generateId();
  19829. }),
  19830. baseId = _React$useState[0],
  19831. setBaseId = _React$useState[1];
  19832. return {
  19833. baseId: baseId,
  19834. setBaseId: setBaseId,
  19835. unstable_idCountRef: idCountRef
  19836. };
  19837. }
  19838. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/CompositeState.js
  19839. function isElementPreceding(element1, element2) {
  19840. return Boolean(element2.compareDocumentPosition(element1) & Node.DOCUMENT_POSITION_PRECEDING);
  19841. }
  19842. function findDOMIndex(items, item) {
  19843. return items.findIndex(function (currentItem) {
  19844. if (!currentItem.ref.current || !item.ref.current) {
  19845. return false;
  19846. }
  19847. return isElementPreceding(item.ref.current, currentItem.ref.current);
  19848. });
  19849. }
  19850. function getMaxLength(rows) {
  19851. var maxLength = 0;
  19852. for (var _iterator = _createForOfIteratorHelperLoose(rows), _step; !(_step = _iterator()).done;) {
  19853. var length = _step.value.length;
  19854. if (length > maxLength) {
  19855. maxLength = length;
  19856. }
  19857. }
  19858. return maxLength;
  19859. }
  19860. /**
  19861. * Turns [row1, row1, row2, row2] into [row1, row2, row1, row2]
  19862. */
  19863. function verticalizeItems(items) {
  19864. var groups = groupItems(items);
  19865. var maxLength = getMaxLength(groups);
  19866. var verticalized = [];
  19867. for (var i = 0; i < maxLength; i += 1) {
  19868. for (var _iterator = _createForOfIteratorHelperLoose(groups), _step; !(_step = _iterator()).done;) {
  19869. var group = _step.value;
  19870. if (group[i]) {
  19871. verticalized.push(_objectSpread2(_objectSpread2({}, group[i]), {}, {
  19872. // If there's no groupId, it means that it's not a grid composite,
  19873. // but a single row instead. So, instead of verticalizing it, that
  19874. // is, assigning a different groupId based on the column index, we
  19875. // keep it undefined so they will be part of the same group.
  19876. // It's useful when using up/down on one-dimensional composites.
  19877. groupId: group[i].groupId ? "" + i : undefined
  19878. }));
  19879. }
  19880. }
  19881. }
  19882. return verticalized;
  19883. }
  19884. function createEmptyItem(groupId) {
  19885. return {
  19886. id: "__EMPTY_ITEM__",
  19887. disabled: true,
  19888. ref: {
  19889. current: null
  19890. },
  19891. groupId: groupId
  19892. };
  19893. }
  19894. /**
  19895. * Turns [[row1, row1], [row2]] into [[row1, row1], [row2, row2]]
  19896. */
  19897. function fillGroups(groups, currentId, shift) {
  19898. var maxLength = getMaxLength(groups);
  19899. for (var _iterator = _createForOfIteratorHelperLoose(groups), _step; !(_step = _iterator()).done;) {
  19900. var group = _step.value;
  19901. for (var i = 0; i < maxLength; i += 1) {
  19902. var item = group[i];
  19903. if (!item || shift && item.disabled) {
  19904. var isFrist = i === 0;
  19905. var previousItem = isFrist && shift ? findFirstEnabledItem(group) : group[i - 1];
  19906. group[i] = previousItem && currentId !== (previousItem === null || previousItem === void 0 ? void 0 : previousItem.id) && shift ? previousItem : createEmptyItem(previousItem === null || previousItem === void 0 ? void 0 : previousItem.groupId);
  19907. }
  19908. }
  19909. }
  19910. return groups;
  19911. }
  19912. var nullItem = {
  19913. id: null,
  19914. ref: {
  19915. current: null
  19916. }
  19917. };
  19918. function placeItemsAfter(items, id, shouldInsertNullItem) {
  19919. var index = items.findIndex(function (item) {
  19920. return item.id === id;
  19921. });
  19922. return [].concat(items.slice(index + 1), shouldInsertNullItem ? [nullItem] : [], items.slice(0, index));
  19923. }
  19924. function getItemsInGroup(items, groupId) {
  19925. return items.filter(function (item) {
  19926. return item.groupId === groupId;
  19927. });
  19928. }
  19929. var map = {
  19930. horizontal: "vertical",
  19931. vertical: "horizontal"
  19932. };
  19933. function getOppositeOrientation(orientation) {
  19934. return orientation && map[orientation];
  19935. }
  19936. function addItemAtIndex(array, item, index) {
  19937. if (!(index in array)) {
  19938. return [].concat(array, [item]);
  19939. }
  19940. return [].concat(array.slice(0, index), [item], array.slice(index));
  19941. }
  19942. function sortBasedOnDOMPosition(items) {
  19943. var pairs = items.map(function (item, index) {
  19944. return [index, item];
  19945. });
  19946. var isOrderDifferent = false;
  19947. pairs.sort(function (_ref, _ref2) {
  19948. var indexA = _ref[0],
  19949. a = _ref[1];
  19950. var indexB = _ref2[0],
  19951. b = _ref2[1];
  19952. var elementA = a.ref.current;
  19953. var elementB = b.ref.current;
  19954. if (!elementA || !elementB) return 0; // a before b
  19955. if (isElementPreceding(elementA, elementB)) {
  19956. if (indexA > indexB) {
  19957. isOrderDifferent = true;
  19958. }
  19959. return -1;
  19960. } // a after b
  19961. if (indexA < indexB) {
  19962. isOrderDifferent = true;
  19963. }
  19964. return 1;
  19965. });
  19966. if (isOrderDifferent) {
  19967. return pairs.map(function (_ref3) {
  19968. var _ = _ref3[0],
  19969. item = _ref3[1];
  19970. return item;
  19971. });
  19972. }
  19973. return items;
  19974. }
  19975. function setItemsBasedOnDOMPosition(items, setItems) {
  19976. var sortedItems = sortBasedOnDOMPosition(items);
  19977. if (items !== sortedItems) {
  19978. setItems(sortedItems);
  19979. }
  19980. }
  19981. function getCommonParent(items) {
  19982. var _firstItem$ref$curren;
  19983. var firstItem = items[0],
  19984. nextItems = items.slice(1);
  19985. var parentElement = firstItem === null || firstItem === void 0 ? void 0 : (_firstItem$ref$curren = firstItem.ref.current) === null || _firstItem$ref$curren === void 0 ? void 0 : _firstItem$ref$curren.parentElement;
  19986. var _loop = function _loop() {
  19987. var parent = parentElement;
  19988. if (nextItems.every(function (item) {
  19989. return parent.contains(item.ref.current);
  19990. })) {
  19991. return {
  19992. v: parentElement
  19993. };
  19994. }
  19995. parentElement = parentElement.parentElement;
  19996. };
  19997. while (parentElement) {
  19998. var _ret = _loop();
  19999. if (typeof _ret === "object") return _ret.v;
  20000. }
  20001. return getDocument(parentElement).body;
  20002. } // istanbul ignore next: JSDOM doesn't support IntersectionObverser
  20003. // See https://github.com/jsdom/jsdom/issues/2032
  20004. function useIntersectionObserver(items, setItems) {
  20005. var previousItems = (0,external_React_.useRef)([]);
  20006. (0,external_React_.useEffect)(function () {
  20007. var callback = function callback() {
  20008. var hasPreviousItems = !!previousItems.current.length; // We don't want to sort items if items have been just registered.
  20009. if (hasPreviousItems) {
  20010. setItemsBasedOnDOMPosition(items, setItems);
  20011. }
  20012. previousItems.current = items;
  20013. };
  20014. var root = getCommonParent(items);
  20015. var observer = new IntersectionObserver(callback, {
  20016. root: root
  20017. });
  20018. for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
  20019. var item = _step.value;
  20020. if (item.ref.current) {
  20021. observer.observe(item.ref.current);
  20022. }
  20023. }
  20024. return function () {
  20025. observer.disconnect();
  20026. };
  20027. }, [items]);
  20028. }
  20029. function useTimeoutObserver(items, setItems) {
  20030. (0,external_React_.useEffect)(function () {
  20031. var callback = function callback() {
  20032. return setItemsBasedOnDOMPosition(items, setItems);
  20033. };
  20034. var timeout = setTimeout(callback, 250);
  20035. return function () {
  20036. return clearTimeout(timeout);
  20037. };
  20038. });
  20039. }
  20040. function useSortBasedOnDOMPosition(items, setItems) {
  20041. if (typeof IntersectionObserver === "function") {
  20042. useIntersectionObserver(items, setItems);
  20043. } else {
  20044. useTimeoutObserver(items, setItems);
  20045. }
  20046. }
  20047. function reducer(state, action) {
  20048. var virtual = state.unstable_virtual,
  20049. rtl = state.rtl,
  20050. orientation = state.orientation,
  20051. items = state.items,
  20052. groups = state.groups,
  20053. currentId = state.currentId,
  20054. loop = state.loop,
  20055. wrap = state.wrap,
  20056. pastIds = state.pastIds,
  20057. shift = state.shift,
  20058. moves = state.unstable_moves,
  20059. includesBaseElement = state.unstable_includesBaseElement,
  20060. initialVirtual = state.initialVirtual,
  20061. initialRTL = state.initialRTL,
  20062. initialOrientation = state.initialOrientation,
  20063. initialCurrentId = state.initialCurrentId,
  20064. initialLoop = state.initialLoop,
  20065. initialWrap = state.initialWrap,
  20066. initialShift = state.initialShift,
  20067. hasSetCurrentId = state.hasSetCurrentId;
  20068. switch (action.type) {
  20069. case "registerGroup":
  20070. {
  20071. var _group = action.group; // If there are no groups yet, just add it as the first one
  20072. if (groups.length === 0) {
  20073. return _objectSpread2(_objectSpread2({}, state), {}, {
  20074. groups: [_group]
  20075. });
  20076. } // Finds the group index based on DOM position
  20077. var index = findDOMIndex(groups, _group);
  20078. return _objectSpread2(_objectSpread2({}, state), {}, {
  20079. groups: addItemAtIndex(groups, _group, index)
  20080. });
  20081. }
  20082. case "unregisterGroup":
  20083. {
  20084. var _id = action.id;
  20085. var nextGroups = groups.filter(function (group) {
  20086. return group.id !== _id;
  20087. }); // The group isn't registered, so do nothing
  20088. if (nextGroups.length === groups.length) {
  20089. return state;
  20090. }
  20091. return _objectSpread2(_objectSpread2({}, state), {}, {
  20092. groups: nextGroups
  20093. });
  20094. }
  20095. case "registerItem":
  20096. {
  20097. var _item = action.item; // Finds the item group based on the DOM hierarchy
  20098. var _group2 = groups.find(function (r) {
  20099. var _r$ref$current;
  20100. return (_r$ref$current = r.ref.current) === null || _r$ref$current === void 0 ? void 0 : _r$ref$current.contains(_item.ref.current);
  20101. }); // Group will be null if it's a one-dimensional composite
  20102. var nextItem = _objectSpread2({
  20103. groupId: _group2 === null || _group2 === void 0 ? void 0 : _group2.id
  20104. }, _item);
  20105. var _index = findDOMIndex(items, nextItem);
  20106. var nextState = _objectSpread2(_objectSpread2({}, state), {}, {
  20107. items: addItemAtIndex(items, nextItem, _index)
  20108. });
  20109. if (!hasSetCurrentId && !moves && initialCurrentId === undefined) {
  20110. var _findFirstEnabledItem;
  20111. // Sets currentId to the first enabled item. This runs whenever an item
  20112. // is registered because the first enabled item may be registered
  20113. // asynchronously.
  20114. return _objectSpread2(_objectSpread2({}, nextState), {}, {
  20115. currentId: (_findFirstEnabledItem = findFirstEnabledItem(nextState.items)) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id
  20116. });
  20117. }
  20118. return nextState;
  20119. }
  20120. case "unregisterItem":
  20121. {
  20122. var _id2 = action.id;
  20123. var nextItems = items.filter(function (item) {
  20124. return item.id !== _id2;
  20125. }); // The item isn't registered, so do nothing
  20126. if (nextItems.length === items.length) {
  20127. return state;
  20128. } // Filters out the item that is being removed from the pastIds list
  20129. var nextPastIds = pastIds.filter(function (pastId) {
  20130. return pastId !== _id2;
  20131. });
  20132. var _nextState = _objectSpread2(_objectSpread2({}, state), {}, {
  20133. pastIds: nextPastIds,
  20134. items: nextItems
  20135. }); // If the current item is the item that is being removed, focus pastId
  20136. if (currentId && currentId === _id2) {
  20137. var nextId = includesBaseElement ? null : getCurrentId(_objectSpread2(_objectSpread2({}, _nextState), {}, {
  20138. currentId: nextPastIds[0]
  20139. }));
  20140. return _objectSpread2(_objectSpread2({}, _nextState), {}, {
  20141. currentId: nextId
  20142. });
  20143. }
  20144. return _nextState;
  20145. }
  20146. case "move":
  20147. {
  20148. var _id3 = action.id; // move() does nothing
  20149. if (_id3 === undefined) {
  20150. return state;
  20151. } // Removes the current item and the item that is receiving focus from the
  20152. // pastIds list
  20153. var filteredPastIds = pastIds.filter(function (pastId) {
  20154. return pastId !== currentId && pastId !== _id3;
  20155. }); // If there's a currentId, add it to the pastIds list so it can be focused
  20156. // if the new item gets removed or disabled
  20157. var _nextPastIds = currentId ? [currentId].concat(filteredPastIds) : filteredPastIds;
  20158. var _nextState2 = _objectSpread2(_objectSpread2({}, state), {}, {
  20159. pastIds: _nextPastIds
  20160. }); // move(null) will focus the composite element itself, not an item
  20161. if (_id3 === null) {
  20162. return _objectSpread2(_objectSpread2({}, _nextState2), {}, {
  20163. unstable_moves: moves + 1,
  20164. currentId: getCurrentId(_nextState2, _id3)
  20165. });
  20166. }
  20167. var _item2 = findEnabledItemById(items, _id3);
  20168. return _objectSpread2(_objectSpread2({}, _nextState2), {}, {
  20169. unstable_moves: _item2 ? moves + 1 : moves,
  20170. currentId: getCurrentId(_nextState2, _item2 === null || _item2 === void 0 ? void 0 : _item2.id)
  20171. });
  20172. }
  20173. case "next":
  20174. {
  20175. // If there's no item focused, we just move the first one
  20176. if (currentId == null) {
  20177. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  20178. type: "first"
  20179. }));
  20180. } // RTL doesn't make sense on vertical navigation
  20181. var isHorizontal = orientation !== "vertical";
  20182. var isRTL = rtl && isHorizontal;
  20183. var allItems = isRTL ? reverse(items) : items;
  20184. var currentItem = allItems.find(function (item) {
  20185. return item.id === currentId;
  20186. }); // If there's no item focused, we just move the first one
  20187. if (!currentItem) {
  20188. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  20189. type: "first"
  20190. }));
  20191. }
  20192. var isGrid = !!currentItem.groupId;
  20193. var currentIndex = allItems.indexOf(currentItem);
  20194. var _nextItems = allItems.slice(currentIndex + 1);
  20195. var nextItemsInGroup = getItemsInGroup(_nextItems, currentItem.groupId); // Home, End
  20196. if (action.allTheWay) {
  20197. // We reverse so we can get the last enabled item in the group. If it's
  20198. // RTL, nextItems and nextItemsInGroup are already reversed and don't
  20199. // have the items before the current one anymore. So we have to get
  20200. // items in group again with allItems.
  20201. var _nextItem2 = findFirstEnabledItem(isRTL ? getItemsInGroup(allItems, currentItem.groupId) : reverse(nextItemsInGroup));
  20202. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  20203. type: "move",
  20204. id: _nextItem2 === null || _nextItem2 === void 0 ? void 0 : _nextItem2.id
  20205. }));
  20206. }
  20207. var oppositeOrientation = getOppositeOrientation( // If it's a grid and orientation is not set, it's a next/previous
  20208. // call, which is inherently horizontal. up/down will call next with
  20209. // orientation set to vertical by default (see below on up/down cases).
  20210. isGrid ? orientation || "horizontal" : orientation);
  20211. var canLoop = loop && loop !== oppositeOrientation;
  20212. var canWrap = isGrid && wrap && wrap !== oppositeOrientation;
  20213. var hasNullItem = // `previous` and `up` will set action.hasNullItem, but when calling
  20214. // next directly, hasNullItem will only be true if it's not a grid and
  20215. // loop is set to true, which means that pressing right or down keys on
  20216. // grids will never focus the composite element. On one-dimensional
  20217. // composites that don't loop, pressing right or down keys also doesn't
  20218. // focus the composite element.
  20219. action.hasNullItem || !isGrid && canLoop && includesBaseElement;
  20220. if (canLoop) {
  20221. var loopItems = canWrap && !hasNullItem ? allItems : getItemsInGroup(allItems, currentItem.groupId); // Turns [0, 1, current, 3, 4] into [3, 4, 0, 1]
  20222. var sortedItems = placeItemsAfter(loopItems, currentId, hasNullItem);
  20223. var _nextItem3 = findFirstEnabledItem(sortedItems, currentId);
  20224. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  20225. type: "move",
  20226. id: _nextItem3 === null || _nextItem3 === void 0 ? void 0 : _nextItem3.id
  20227. }));
  20228. }
  20229. if (canWrap) {
  20230. var _nextItem4 = findFirstEnabledItem( // We can use nextItems, which contains all the next items, including
  20231. // items from other groups, to wrap between groups. However, if there
  20232. // is a null item (the composite element), we'll only use the next
  20233. // items in the group. So moving next from the last item will focus
  20234. // the composite element (null). On grid composites, horizontal
  20235. // navigation never focuses the composite element, only vertical.
  20236. hasNullItem ? nextItemsInGroup : _nextItems, currentId);
  20237. var _nextId = hasNullItem ? (_nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id) || null : _nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id;
  20238. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  20239. type: "move",
  20240. id: _nextId
  20241. }));
  20242. }
  20243. var _nextItem = findFirstEnabledItem(nextItemsInGroup, currentId);
  20244. if (!_nextItem && hasNullItem) {
  20245. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  20246. type: "move",
  20247. id: null
  20248. }));
  20249. }
  20250. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  20251. type: "move",
  20252. id: _nextItem === null || _nextItem === void 0 ? void 0 : _nextItem.id
  20253. }));
  20254. }
  20255. case "previous":
  20256. {
  20257. // If currentId is initially set to null, the composite element will be
  20258. // focusable while navigating with arrow keys. But, if it's a grid, we
  20259. // don't want to focus the composite element with horizontal navigation.
  20260. var _isGrid = !!groups.length;
  20261. var _hasNullItem = !_isGrid && includesBaseElement;
  20262. var _nextState3 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
  20263. items: reverse(items)
  20264. }), _objectSpread2(_objectSpread2({}, action), {}, {
  20265. type: "next",
  20266. hasNullItem: _hasNullItem
  20267. }));
  20268. return _objectSpread2(_objectSpread2({}, _nextState3), {}, {
  20269. items: items
  20270. });
  20271. }
  20272. case "down":
  20273. {
  20274. var shouldShift = shift && !action.allTheWay; // First, we make sure groups have the same number of items by filling it
  20275. // with disabled fake items. Then, we reorganize the items list so
  20276. // [1-1, 1-2, 2-1, 2-2] becomes [1-1, 2-1, 1-2, 2-2].
  20277. var verticalItems = verticalizeItems(flatten(fillGroups(groupItems(items), currentId, shouldShift)));
  20278. var _canLoop = loop && loop !== "horizontal"; // Pressing down arrow key will only focus the composite element if loop
  20279. // is true or vertical.
  20280. var _hasNullItem2 = _canLoop && includesBaseElement;
  20281. var _nextState4 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
  20282. orientation: "vertical",
  20283. items: verticalItems
  20284. }), _objectSpread2(_objectSpread2({}, action), {}, {
  20285. type: "next",
  20286. hasNullItem: _hasNullItem2
  20287. }));
  20288. return _objectSpread2(_objectSpread2({}, _nextState4), {}, {
  20289. orientation: orientation,
  20290. items: items
  20291. });
  20292. }
  20293. case "up":
  20294. {
  20295. var _shouldShift = shift && !action.allTheWay;
  20296. var _verticalItems = verticalizeItems(reverse(flatten(fillGroups(groupItems(items), currentId, _shouldShift)))); // If currentId is initially set to null, we'll always focus the
  20297. // composite element when the up arrow key is pressed in the first row.
  20298. var _hasNullItem3 = includesBaseElement;
  20299. var _nextState5 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
  20300. orientation: "vertical",
  20301. items: _verticalItems
  20302. }), _objectSpread2(_objectSpread2({}, action), {}, {
  20303. type: "next",
  20304. hasNullItem: _hasNullItem3
  20305. }));
  20306. return _objectSpread2(_objectSpread2({}, _nextState5), {}, {
  20307. orientation: orientation,
  20308. items: items
  20309. });
  20310. }
  20311. case "first":
  20312. {
  20313. var firstItem = findFirstEnabledItem(items);
  20314. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  20315. type: "move",
  20316. id: firstItem === null || firstItem === void 0 ? void 0 : firstItem.id
  20317. }));
  20318. }
  20319. case "last":
  20320. {
  20321. var _nextState6 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
  20322. items: reverse(items)
  20323. }), _objectSpread2(_objectSpread2({}, action), {}, {
  20324. type: "first"
  20325. }));
  20326. return _objectSpread2(_objectSpread2({}, _nextState6), {}, {
  20327. items: items
  20328. });
  20329. }
  20330. case "sort":
  20331. {
  20332. return _objectSpread2(_objectSpread2({}, state), {}, {
  20333. items: sortBasedOnDOMPosition(items),
  20334. groups: sortBasedOnDOMPosition(groups)
  20335. });
  20336. }
  20337. case "setVirtual":
  20338. return _objectSpread2(_objectSpread2({}, state), {}, {
  20339. unstable_virtual: applyState(action.virtual, virtual)
  20340. });
  20341. case "setRTL":
  20342. return _objectSpread2(_objectSpread2({}, state), {}, {
  20343. rtl: applyState(action.rtl, rtl)
  20344. });
  20345. case "setOrientation":
  20346. return _objectSpread2(_objectSpread2({}, state), {}, {
  20347. orientation: applyState(action.orientation, orientation)
  20348. });
  20349. case "setCurrentId":
  20350. {
  20351. var nextCurrentId = getCurrentId(_objectSpread2(_objectSpread2({}, state), {}, {
  20352. currentId: applyState(action.currentId, currentId)
  20353. }));
  20354. return _objectSpread2(_objectSpread2({}, state), {}, {
  20355. currentId: nextCurrentId,
  20356. hasSetCurrentId: true
  20357. });
  20358. }
  20359. case "setLoop":
  20360. return _objectSpread2(_objectSpread2({}, state), {}, {
  20361. loop: applyState(action.loop, loop)
  20362. });
  20363. case "setWrap":
  20364. return _objectSpread2(_objectSpread2({}, state), {}, {
  20365. wrap: applyState(action.wrap, wrap)
  20366. });
  20367. case "setShift":
  20368. return _objectSpread2(_objectSpread2({}, state), {}, {
  20369. shift: applyState(action.shift, shift)
  20370. });
  20371. case "setIncludesBaseElement":
  20372. {
  20373. return _objectSpread2(_objectSpread2({}, state), {}, {
  20374. unstable_includesBaseElement: applyState(action.includesBaseElement, includesBaseElement)
  20375. });
  20376. }
  20377. case "reset":
  20378. return _objectSpread2(_objectSpread2({}, state), {}, {
  20379. unstable_virtual: initialVirtual,
  20380. rtl: initialRTL,
  20381. orientation: initialOrientation,
  20382. currentId: getCurrentId(_objectSpread2(_objectSpread2({}, state), {}, {
  20383. currentId: initialCurrentId
  20384. })),
  20385. loop: initialLoop,
  20386. wrap: initialWrap,
  20387. shift: initialShift,
  20388. unstable_moves: 0,
  20389. pastIds: []
  20390. });
  20391. case "setItems":
  20392. {
  20393. return _objectSpread2(_objectSpread2({}, state), {}, {
  20394. items: action.items
  20395. });
  20396. }
  20397. default:
  20398. throw new Error();
  20399. }
  20400. }
  20401. function useAction(fn) {
  20402. return (0,external_React_.useCallback)(fn, []);
  20403. }
  20404. function useIsUnmountedRef() {
  20405. var isUnmountedRef = (0,external_React_.useRef)(false);
  20406. useIsomorphicEffect(function () {
  20407. return function () {
  20408. isUnmountedRef.current = true;
  20409. };
  20410. }, []);
  20411. return isUnmountedRef;
  20412. }
  20413. function useCompositeState(initialState) {
  20414. if (initialState === void 0) {
  20415. initialState = {};
  20416. }
  20417. var _useSealedState = useSealedState(initialState),
  20418. _useSealedState$unsta = _useSealedState.unstable_virtual,
  20419. virtual = _useSealedState$unsta === void 0 ? false : _useSealedState$unsta,
  20420. _useSealedState$rtl = _useSealedState.rtl,
  20421. rtl = _useSealedState$rtl === void 0 ? false : _useSealedState$rtl,
  20422. orientation = _useSealedState.orientation,
  20423. currentId = _useSealedState.currentId,
  20424. _useSealedState$loop = _useSealedState.loop,
  20425. loop = _useSealedState$loop === void 0 ? false : _useSealedState$loop,
  20426. _useSealedState$wrap = _useSealedState.wrap,
  20427. wrap = _useSealedState$wrap === void 0 ? false : _useSealedState$wrap,
  20428. _useSealedState$shift = _useSealedState.shift,
  20429. shift = _useSealedState$shift === void 0 ? false : _useSealedState$shift,
  20430. unstable_includesBaseElement = _useSealedState.unstable_includesBaseElement,
  20431. sealed = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_useSealedState, ["unstable_virtual", "rtl", "orientation", "currentId", "loop", "wrap", "shift", "unstable_includesBaseElement"]);
  20432. var idState = unstable_useIdState(sealed);
  20433. var _React$useReducer = (0,external_React_.useReducer)(reducer, {
  20434. unstable_virtual: virtual,
  20435. rtl: rtl,
  20436. orientation: orientation,
  20437. items: [],
  20438. groups: [],
  20439. currentId: currentId,
  20440. loop: loop,
  20441. wrap: wrap,
  20442. shift: shift,
  20443. unstable_moves: 0,
  20444. pastIds: [],
  20445. unstable_includesBaseElement: unstable_includesBaseElement != null ? unstable_includesBaseElement : currentId === null,
  20446. initialVirtual: virtual,
  20447. initialRTL: rtl,
  20448. initialOrientation: orientation,
  20449. initialCurrentId: currentId,
  20450. initialLoop: loop,
  20451. initialWrap: wrap,
  20452. initialShift: shift
  20453. }),
  20454. _React$useReducer$ = _React$useReducer[0],
  20455. pastIds = _React$useReducer$.pastIds,
  20456. initialVirtual = _React$useReducer$.initialVirtual,
  20457. initialRTL = _React$useReducer$.initialRTL,
  20458. initialOrientation = _React$useReducer$.initialOrientation,
  20459. initialCurrentId = _React$useReducer$.initialCurrentId,
  20460. initialLoop = _React$useReducer$.initialLoop,
  20461. initialWrap = _React$useReducer$.initialWrap,
  20462. initialShift = _React$useReducer$.initialShift,
  20463. hasSetCurrentId = _React$useReducer$.hasSetCurrentId,
  20464. state = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_React$useReducer$, ["pastIds", "initialVirtual", "initialRTL", "initialOrientation", "initialCurrentId", "initialLoop", "initialWrap", "initialShift", "hasSetCurrentId"]),
  20465. dispatch = _React$useReducer[1];
  20466. var _React$useState = (0,external_React_.useState)(false),
  20467. hasActiveWidget = _React$useState[0],
  20468. setHasActiveWidget = _React$useState[1]; // register/unregister may be called when this component is unmounted. We
  20469. // store the unmounted state here so we don't update the state if it's true.
  20470. // This only happens in a very specific situation.
  20471. // See https://github.com/reakit/reakit/issues/650
  20472. var isUnmountedRef = useIsUnmountedRef();
  20473. var setItems = (0,external_React_.useCallback)(function (items) {
  20474. return dispatch({
  20475. type: "setItems",
  20476. items: items
  20477. });
  20478. }, []);
  20479. useSortBasedOnDOMPosition(state.items, setItems);
  20480. return _objectSpread2(_objectSpread2(_objectSpread2({}, idState), state), {}, {
  20481. unstable_hasActiveWidget: hasActiveWidget,
  20482. unstable_setHasActiveWidget: setHasActiveWidget,
  20483. registerItem: useAction(function (item) {
  20484. if (isUnmountedRef.current) return;
  20485. dispatch({
  20486. type: "registerItem",
  20487. item: item
  20488. });
  20489. }),
  20490. unregisterItem: useAction(function (id) {
  20491. if (isUnmountedRef.current) return;
  20492. dispatch({
  20493. type: "unregisterItem",
  20494. id: id
  20495. });
  20496. }),
  20497. registerGroup: useAction(function (group) {
  20498. if (isUnmountedRef.current) return;
  20499. dispatch({
  20500. type: "registerGroup",
  20501. group: group
  20502. });
  20503. }),
  20504. unregisterGroup: useAction(function (id) {
  20505. if (isUnmountedRef.current) return;
  20506. dispatch({
  20507. type: "unregisterGroup",
  20508. id: id
  20509. });
  20510. }),
  20511. move: useAction(function (id) {
  20512. return dispatch({
  20513. type: "move",
  20514. id: id
  20515. });
  20516. }),
  20517. next: useAction(function (allTheWay) {
  20518. return dispatch({
  20519. type: "next",
  20520. allTheWay: allTheWay
  20521. });
  20522. }),
  20523. previous: useAction(function (allTheWay) {
  20524. return dispatch({
  20525. type: "previous",
  20526. allTheWay: allTheWay
  20527. });
  20528. }),
  20529. up: useAction(function (allTheWay) {
  20530. return dispatch({
  20531. type: "up",
  20532. allTheWay: allTheWay
  20533. });
  20534. }),
  20535. down: useAction(function (allTheWay) {
  20536. return dispatch({
  20537. type: "down",
  20538. allTheWay: allTheWay
  20539. });
  20540. }),
  20541. first: useAction(function () {
  20542. return dispatch({
  20543. type: "first"
  20544. });
  20545. }),
  20546. last: useAction(function () {
  20547. return dispatch({
  20548. type: "last"
  20549. });
  20550. }),
  20551. sort: useAction(function () {
  20552. return dispatch({
  20553. type: "sort"
  20554. });
  20555. }),
  20556. unstable_setVirtual: useAction(function (value) {
  20557. return dispatch({
  20558. type: "setVirtual",
  20559. virtual: value
  20560. });
  20561. }),
  20562. setRTL: useAction(function (value) {
  20563. return dispatch({
  20564. type: "setRTL",
  20565. rtl: value
  20566. });
  20567. }),
  20568. setOrientation: useAction(function (value) {
  20569. return dispatch({
  20570. type: "setOrientation",
  20571. orientation: value
  20572. });
  20573. }),
  20574. setCurrentId: useAction(function (value) {
  20575. return dispatch({
  20576. type: "setCurrentId",
  20577. currentId: value
  20578. });
  20579. }),
  20580. setLoop: useAction(function (value) {
  20581. return dispatch({
  20582. type: "setLoop",
  20583. loop: value
  20584. });
  20585. }),
  20586. setWrap: useAction(function (value) {
  20587. return dispatch({
  20588. type: "setWrap",
  20589. wrap: value
  20590. });
  20591. }),
  20592. setShift: useAction(function (value) {
  20593. return dispatch({
  20594. type: "setShift",
  20595. shift: value
  20596. });
  20597. }),
  20598. unstable_setIncludesBaseElement: useAction(function (value) {
  20599. return dispatch({
  20600. type: "setIncludesBaseElement",
  20601. includesBaseElement: value
  20602. });
  20603. }),
  20604. reset: useAction(function () {
  20605. return dispatch({
  20606. type: "reset"
  20607. });
  20608. })
  20609. });
  20610. }
  20611. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/fireBlurEvent.js
  20612. function createFocusEvent(element, type, eventInit) {
  20613. if (eventInit === void 0) {
  20614. eventInit = {};
  20615. }
  20616. if (typeof FocusEvent === "function") {
  20617. return new FocusEvent(type, eventInit);
  20618. }
  20619. return createEvent(element, type, eventInit);
  20620. }
  20621. /**
  20622. * Creates and dispatches a blur event in a way that also works on IE 11.
  20623. *
  20624. * @example
  20625. * import { fireBlurEvent } from "reakit-utils";
  20626. *
  20627. * fireBlurEvent(document.getElementById("id"));
  20628. */
  20629. function fireBlurEvent(element, eventInit) {
  20630. var event = createFocusEvent(element, "blur", eventInit);
  20631. var defaultAllowed = element.dispatchEvent(event);
  20632. var bubbleInit = _rollupPluginBabelHelpers_1f0bf8c2_objectSpread2(_rollupPluginBabelHelpers_1f0bf8c2_objectSpread2({}, eventInit), {}, {
  20633. bubbles: true
  20634. });
  20635. element.dispatchEvent(createFocusEvent(element, "focusout", bubbleInit));
  20636. return defaultAllowed;
  20637. }
  20638. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/fireKeyboardEvent.js
  20639. function createKeyboardEvent(element, type, eventInit) {
  20640. if (eventInit === void 0) {
  20641. eventInit = {};
  20642. }
  20643. if (typeof KeyboardEvent === "function") {
  20644. return new KeyboardEvent(type, eventInit);
  20645. } // IE 11 doesn't support Event constructors
  20646. var event = getDocument(element).createEvent("KeyboardEvent");
  20647. event.initKeyboardEvent(type, eventInit.bubbles, eventInit.cancelable, getWindow(element), eventInit.key, eventInit.location, eventInit.ctrlKey, eventInit.altKey, eventInit.shiftKey, eventInit.metaKey);
  20648. return event;
  20649. }
  20650. /**
  20651. * Creates and dispatches `KeyboardEvent` in a way that also works on IE 11.
  20652. *
  20653. * @example
  20654. * import { fireKeyboardEvent } from "reakit-utils";
  20655. *
  20656. * fireKeyboardEvent(document.getElementById("id"), "keydown", {
  20657. * key: "ArrowDown",
  20658. * shiftKey: true,
  20659. * });
  20660. */
  20661. function fireKeyboardEvent(element, type, eventInit) {
  20662. return element.dispatchEvent(createKeyboardEvent(element, type, eventInit));
  20663. }
  20664. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/getNextActiveElementOnBlur.js
  20665. var isIE11 = canUseDOM && "msCrypto" in window;
  20666. /**
  20667. * Cross-browser method that returns the next active element (the element that
  20668. * is receiving focus) after a blur event is dispatched. It receives the blur
  20669. * event object as the argument.
  20670. *
  20671. * @example
  20672. * import { getNextActiveElementOnBlur } from "reakit-utils";
  20673. *
  20674. * const element = document.getElementById("id");
  20675. * element.addEventListener("blur", (event) => {
  20676. * const nextActiveElement = getNextActiveElementOnBlur(event);
  20677. * });
  20678. */
  20679. function getNextActiveElementOnBlur(event) {
  20680. // IE 11 doesn't support event.relatedTarget on blur.
  20681. // document.activeElement points the the next active element.
  20682. // On modern browsers, document.activeElement points to the current target.
  20683. if (isIE11) {
  20684. var activeElement = getActiveElement_getActiveElement(event.currentTarget);
  20685. return activeElement;
  20686. }
  20687. return event.relatedTarget;
  20688. }
  20689. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/Composite.js
  20690. var Composite_isIE11 = canUseDOM && "msCrypto" in window;
  20691. function canProxyKeyboardEvent(event) {
  20692. if (!isSelfTarget(event)) return false;
  20693. if (event.metaKey) return false;
  20694. if (event.key === "Tab") return false;
  20695. return true;
  20696. }
  20697. function useKeyboardEventProxy(virtual, currentItem, htmlEventHandler) {
  20698. var eventHandlerRef = useLiveRef(htmlEventHandler);
  20699. return (0,external_React_.useCallback)(function (event) {
  20700. var _eventHandlerRef$curr;
  20701. (_eventHandlerRef$curr = eventHandlerRef.current) === null || _eventHandlerRef$curr === void 0 ? void 0 : _eventHandlerRef$curr.call(eventHandlerRef, event);
  20702. if (event.defaultPrevented) return;
  20703. if (virtual && canProxyKeyboardEvent(event)) {
  20704. var currentElement = currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current;
  20705. if (currentElement) {
  20706. if (!fireKeyboardEvent(currentElement, event.type, event)) {
  20707. event.preventDefault();
  20708. } // The event will be triggered on the composite item and then
  20709. // propagated up to this composite element again, so we can pretend
  20710. // that it wasn't called on this component in the first place.
  20711. if (event.currentTarget.contains(currentElement)) {
  20712. event.stopPropagation();
  20713. }
  20714. }
  20715. }
  20716. }, [virtual, currentItem]);
  20717. } // istanbul ignore next
  20718. function useActiveElementRef(elementRef) {
  20719. var activeElementRef = (0,external_React_.useRef)(null);
  20720. (0,external_React_.useEffect)(function () {
  20721. var document = getDocument(elementRef.current);
  20722. var onFocus = function onFocus(event) {
  20723. var target = event.target;
  20724. activeElementRef.current = target;
  20725. };
  20726. document.addEventListener("focus", onFocus, true);
  20727. return function () {
  20728. document.removeEventListener("focus", onFocus, true);
  20729. };
  20730. }, []);
  20731. return activeElementRef;
  20732. }
  20733. function findFirstEnabledItemInTheLastRow(items) {
  20734. return findFirstEnabledItem(flatten(reverse(groupItems(items))));
  20735. }
  20736. function isItem(items, element) {
  20737. return items === null || items === void 0 ? void 0 : items.some(function (item) {
  20738. return !!element && item.ref.current === element;
  20739. });
  20740. }
  20741. function useScheduleUserFocus(currentItem) {
  20742. var currentItemRef = useLiveRef(currentItem);
  20743. var _React$useReducer = (0,external_React_.useReducer)(function (n) {
  20744. return n + 1;
  20745. }, 0),
  20746. scheduled = _React$useReducer[0],
  20747. schedule = _React$useReducer[1];
  20748. (0,external_React_.useEffect)(function () {
  20749. var _currentItemRef$curre;
  20750. var currentElement = (_currentItemRef$curre = currentItemRef.current) === null || _currentItemRef$curre === void 0 ? void 0 : _currentItemRef$curre.ref.current;
  20751. if (scheduled && currentElement) {
  20752. userFocus(currentElement);
  20753. }
  20754. }, [scheduled]);
  20755. return schedule;
  20756. }
  20757. var useComposite = createHook({
  20758. name: "Composite",
  20759. compose: [useTabbable],
  20760. keys: COMPOSITE_KEYS,
  20761. useOptions: function useOptions(options) {
  20762. return _objectSpread2(_objectSpread2({}, options), {}, {
  20763. currentId: getCurrentId(options)
  20764. });
  20765. },
  20766. useProps: function useProps(options, _ref) {
  20767. var htmlRef = _ref.ref,
  20768. htmlOnFocusCapture = _ref.onFocusCapture,
  20769. htmlOnFocus = _ref.onFocus,
  20770. htmlOnBlurCapture = _ref.onBlurCapture,
  20771. htmlOnKeyDown = _ref.onKeyDown,
  20772. htmlOnKeyDownCapture = _ref.onKeyDownCapture,
  20773. htmlOnKeyUpCapture = _ref.onKeyUpCapture,
  20774. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["ref", "onFocusCapture", "onFocus", "onBlurCapture", "onKeyDown", "onKeyDownCapture", "onKeyUpCapture"]);
  20775. var ref = (0,external_React_.useRef)(null);
  20776. var currentItem = findEnabledItemById(options.items, options.currentId);
  20777. var previousElementRef = (0,external_React_.useRef)(null);
  20778. var onFocusCaptureRef = useLiveRef(htmlOnFocusCapture);
  20779. var onFocusRef = useLiveRef(htmlOnFocus);
  20780. var onBlurCaptureRef = useLiveRef(htmlOnBlurCapture);
  20781. var onKeyDownRef = useLiveRef(htmlOnKeyDown);
  20782. var scheduleUserFocus = useScheduleUserFocus(currentItem); // IE 11 doesn't support event.relatedTarget, so we use the active element
  20783. // ref instead.
  20784. var activeElementRef = Composite_isIE11 ? useActiveElementRef(ref) : undefined;
  20785. (0,external_React_.useEffect)(function () {
  20786. var element = ref.current;
  20787. if (options.unstable_moves && !currentItem) {
  20788. false ? 0 : void 0; // If composite.move(null) has been called, the composite container
  20789. // will receive focus.
  20790. element === null || element === void 0 ? void 0 : element.focus();
  20791. }
  20792. }, [options.unstable_moves, currentItem]);
  20793. var onKeyDownCapture = useKeyboardEventProxy(options.unstable_virtual, currentItem, htmlOnKeyDownCapture);
  20794. var onKeyUpCapture = useKeyboardEventProxy(options.unstable_virtual, currentItem, htmlOnKeyUpCapture);
  20795. var onFocusCapture = (0,external_React_.useCallback)(function (event) {
  20796. var _onFocusCaptureRef$cu;
  20797. (_onFocusCaptureRef$cu = onFocusCaptureRef.current) === null || _onFocusCaptureRef$cu === void 0 ? void 0 : _onFocusCaptureRef$cu.call(onFocusCaptureRef, event);
  20798. if (event.defaultPrevented) return;
  20799. if (!options.unstable_virtual) return; // IE11 doesn't support event.relatedTarget, so we use the active
  20800. // element ref instead.
  20801. var previousActiveElement = (activeElementRef === null || activeElementRef === void 0 ? void 0 : activeElementRef.current) || event.relatedTarget;
  20802. var previousActiveElementWasItem = isItem(options.items, previousActiveElement);
  20803. if (isSelfTarget(event) && previousActiveElementWasItem) {
  20804. // Composite has been focused as a result of an item receiving focus.
  20805. // The composite item will move focus back to the composite
  20806. // container. In this case, we don't want to propagate this
  20807. // additional event nor call the onFocus handler passed to
  20808. // <Composite onFocus={...} />.
  20809. event.stopPropagation(); // We keep track of the previous active item element so we can
  20810. // manually fire a blur event on it later when the focus is moved to
  20811. // another item on the onBlurCapture event below.
  20812. previousElementRef.current = previousActiveElement;
  20813. }
  20814. }, [options.unstable_virtual, options.items]);
  20815. var onFocus = (0,external_React_.useCallback)(function (event) {
  20816. var _onFocusRef$current;
  20817. (_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
  20818. if (event.defaultPrevented) return;
  20819. if (options.unstable_virtual) {
  20820. if (isSelfTarget(event)) {
  20821. // This means that the composite element has been focused while the
  20822. // composite item has not. For example, by clicking on the
  20823. // composite element without touching any item, or by tabbing into
  20824. // the composite element. In this case, we want to trigger focus on
  20825. // the item, just like it would happen with roving tabindex.
  20826. // When it receives focus, the composite item will put focus back
  20827. // on the composite element, in which case hasItemWithFocus will be
  20828. // true.
  20829. scheduleUserFocus();
  20830. }
  20831. } else if (isSelfTarget(event)) {
  20832. var _options$setCurrentId;
  20833. // When the roving tabindex composite gets intentionally focused (for
  20834. // example, by clicking directly on it, and not on an item), we make
  20835. // sure to set the current id to null (which means the composite
  20836. // itself is focused).
  20837. (_options$setCurrentId = options.setCurrentId) === null || _options$setCurrentId === void 0 ? void 0 : _options$setCurrentId.call(options, null);
  20838. }
  20839. }, [options.unstable_virtual, options.setCurrentId]);
  20840. var onBlurCapture = (0,external_React_.useCallback)(function (event) {
  20841. var _onBlurCaptureRef$cur;
  20842. (_onBlurCaptureRef$cur = onBlurCaptureRef.current) === null || _onBlurCaptureRef$cur === void 0 ? void 0 : _onBlurCaptureRef$cur.call(onBlurCaptureRef, event);
  20843. if (event.defaultPrevented) return;
  20844. if (!options.unstable_virtual) return; // When virtual is set to true, we move focus from the composite
  20845. // container (this component) to the composite item that is being
  20846. // selected. Then we move focus back to the composite container. This
  20847. // is so we can provide the same API as the roving tabindex method,
  20848. // which means people can attach onFocus/onBlur handlers on the
  20849. // CompositeItem component regardless of whether it's virtual or not.
  20850. // This sequence of blurring and focusing items and composite may be
  20851. // confusing, so we ignore intermediate focus and blurs by stopping its
  20852. // propagation and not calling the passed onBlur handler (htmlOnBlur).
  20853. var currentElement = (currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current) || null;
  20854. var nextActiveElement = getNextActiveElementOnBlur(event);
  20855. var nextActiveElementIsItem = isItem(options.items, nextActiveElement);
  20856. if (isSelfTarget(event) && nextActiveElementIsItem) {
  20857. // This is an intermediate blur event: blurring the composite
  20858. // container to focus an item (nextActiveElement).
  20859. if (nextActiveElement === currentElement) {
  20860. // The next active element will be the same as the current item in
  20861. // the state in two scenarios:
  20862. // - Moving focus with keyboard: the state is updated before the
  20863. // blur event is triggered, so here the current item is already
  20864. // pointing to the next active element.
  20865. // - Clicking on the current active item with a pointer: this
  20866. // will trigger blur on the composite element and then the next
  20867. // active element will be the same as the current item. Clicking on
  20868. // an item other than the current one doesn't end up here as the
  20869. // currentItem state will be updated only after it.
  20870. if (previousElementRef.current && previousElementRef.current !== nextActiveElement) {
  20871. // If there's a previous active item and it's not a click action,
  20872. // then we fire a blur event on it so it will work just like if
  20873. // it had DOM focus before (like when using roving tabindex).
  20874. fireBlurEvent(previousElementRef.current, event);
  20875. }
  20876. } else if (currentElement) {
  20877. // This will be true when the next active element is not the
  20878. // current element, but there's a current item. This will only
  20879. // happen when clicking with a pointer on a different item, when
  20880. // there's already an item selected, in which case currentElement
  20881. // is the item that is getting blurred, and nextActiveElement is
  20882. // the item that is being clicked.
  20883. fireBlurEvent(currentElement, event);
  20884. } // We want to ignore intermediate blur events, so we stop its
  20885. // propagation and return early so onFocus will not be called.
  20886. event.stopPropagation();
  20887. } else {
  20888. var targetIsItem = isItem(options.items, event.target);
  20889. if (!targetIsItem && currentElement) {
  20890. // If target is not a composite item, it may be the composite
  20891. // element itself (isSelfTarget) or a tabbable element inside the
  20892. // composite widget. This may be triggered by clicking outside the
  20893. // composite widget or by tabbing out of it. In either cases we
  20894. // want to fire a blur event on the current item.
  20895. fireBlurEvent(currentElement, event);
  20896. }
  20897. }
  20898. }, [options.unstable_virtual, options.items, currentItem]);
  20899. var onKeyDown = (0,external_React_.useCallback)(function (event) {
  20900. var _onKeyDownRef$current, _options$groups;
  20901. (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
  20902. if (event.defaultPrevented) return;
  20903. if (options.currentId !== null) return;
  20904. if (!isSelfTarget(event)) return;
  20905. var isVertical = options.orientation !== "horizontal";
  20906. var isHorizontal = options.orientation !== "vertical";
  20907. var isGrid = !!((_options$groups = options.groups) !== null && _options$groups !== void 0 && _options$groups.length);
  20908. var up = function up() {
  20909. if (isGrid) {
  20910. var item = findFirstEnabledItemInTheLastRow(options.items);
  20911. if (item !== null && item !== void 0 && item.id) {
  20912. var _options$move;
  20913. (_options$move = options.move) === null || _options$move === void 0 ? void 0 : _options$move.call(options, item.id);
  20914. }
  20915. } else {
  20916. var _options$last;
  20917. (_options$last = options.last) === null || _options$last === void 0 ? void 0 : _options$last.call(options);
  20918. }
  20919. };
  20920. var keyMap = {
  20921. ArrowUp: (isGrid || isVertical) && up,
  20922. ArrowRight: (isGrid || isHorizontal) && options.first,
  20923. ArrowDown: (isGrid || isVertical) && options.first,
  20924. ArrowLeft: (isGrid || isHorizontal) && options.last,
  20925. Home: options.first,
  20926. End: options.last,
  20927. PageUp: options.first,
  20928. PageDown: options.last
  20929. };
  20930. var action = keyMap[event.key];
  20931. if (action) {
  20932. event.preventDefault();
  20933. action();
  20934. }
  20935. }, [options.currentId, options.orientation, options.groups, options.items, options.move, options.last, options.first]);
  20936. return _objectSpread2({
  20937. ref: useForkRef(ref, htmlRef),
  20938. id: options.baseId,
  20939. onFocus: onFocus,
  20940. onFocusCapture: onFocusCapture,
  20941. onBlurCapture: onBlurCapture,
  20942. onKeyDownCapture: onKeyDownCapture,
  20943. onKeyDown: onKeyDown,
  20944. onKeyUpCapture: onKeyUpCapture,
  20945. "aria-activedescendant": options.unstable_virtual ? (currentItem === null || currentItem === void 0 ? void 0 : currentItem.id) || undefined : undefined
  20946. }, htmlProps);
  20947. },
  20948. useComposeProps: function useComposeProps(options, htmlProps) {
  20949. htmlProps = useRole(options, htmlProps, true);
  20950. var tabbableHTMLProps = useTabbable(options, htmlProps, true);
  20951. if (options.unstable_virtual || options.currentId === null) {
  20952. // Composite will only be tabbable by default if the focus is managed
  20953. // using aria-activedescendant, which requires DOM focus on the container
  20954. // element (the composite)
  20955. return _objectSpread2({
  20956. tabIndex: 0
  20957. }, tabbableHTMLProps);
  20958. }
  20959. return _objectSpread2(_objectSpread2({}, htmlProps), {}, {
  20960. ref: tabbableHTMLProps.ref
  20961. });
  20962. }
  20963. });
  20964. var Composite = createComponent({
  20965. as: "div",
  20966. useHook: useComposite,
  20967. useCreateElement: function useCreateElement$1(type, props, children) {
  20968. false ? 0 : void 0;
  20969. return useCreateElement(type, props, children);
  20970. }
  20971. });
  20972. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Group/Group.js
  20973. // Automatically generated
  20974. var GROUP_KEYS = [];
  20975. var useGroup = createHook({
  20976. name: "Group",
  20977. compose: useRole,
  20978. keys: GROUP_KEYS,
  20979. useProps: function useProps(_, htmlProps) {
  20980. return _objectSpread2({
  20981. role: "group"
  20982. }, htmlProps);
  20983. }
  20984. });
  20985. var Group = createComponent({
  20986. as: "div",
  20987. useHook: useGroup
  20988. });
  20989. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/CompositeGroup.js
  20990. var useCompositeGroup = createHook({
  20991. name: "CompositeGroup",
  20992. compose: [useGroup, unstable_useId],
  20993. keys: COMPOSITE_GROUP_KEYS,
  20994. propsAreEqual: function propsAreEqual(prev, next) {
  20995. if (!next.id || prev.id !== next.id) {
  20996. return useGroup.unstable_propsAreEqual(prev, next);
  20997. }
  20998. var prevCurrentId = prev.currentId,
  20999. prevMoves = prev.unstable_moves,
  21000. prevProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(prev, ["currentId", "unstable_moves"]);
  21001. var nextCurrentId = next.currentId,
  21002. nextMoves = next.unstable_moves,
  21003. nextProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(next, ["currentId", "unstable_moves"]);
  21004. if (prev.items && next.items) {
  21005. var prevCurrentItem = findEnabledItemById(prev.items, prevCurrentId);
  21006. var nextCurrentItem = findEnabledItemById(next.items, nextCurrentId);
  21007. var prevGroupId = prevCurrentItem === null || prevCurrentItem === void 0 ? void 0 : prevCurrentItem.groupId;
  21008. var nextGroupId = nextCurrentItem === null || nextCurrentItem === void 0 ? void 0 : nextCurrentItem.groupId;
  21009. if (next.id === nextGroupId || next.id === prevGroupId) {
  21010. return false;
  21011. }
  21012. }
  21013. return useGroup.unstable_propsAreEqual(prevProps, nextProps);
  21014. },
  21015. useProps: function useProps(options, _ref) {
  21016. var htmlRef = _ref.ref,
  21017. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["ref"]);
  21018. var ref = (0,external_React_.useRef)(null);
  21019. var id = options.id; // We need this to be called before CompositeItems' register
  21020. useIsomorphicEffect(function () {
  21021. var _options$registerGrou;
  21022. if (!id) return undefined;
  21023. (_options$registerGrou = options.registerGroup) === null || _options$registerGrou === void 0 ? void 0 : _options$registerGrou.call(options, {
  21024. id: id,
  21025. ref: ref
  21026. });
  21027. return function () {
  21028. var _options$unregisterGr;
  21029. (_options$unregisterGr = options.unregisterGroup) === null || _options$unregisterGr === void 0 ? void 0 : _options$unregisterGr.call(options, id);
  21030. };
  21031. }, [id, options.registerGroup, options.unregisterGroup]);
  21032. return _objectSpread2({
  21033. ref: useForkRef(ref, htmlRef)
  21034. }, htmlProps);
  21035. }
  21036. });
  21037. var CompositeGroup = createComponent({
  21038. as: "div",
  21039. useHook: useCompositeGroup
  21040. });
  21041. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js
  21042. function alignment_matrix_control_icon_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  21043. /**
  21044. * External dependencies
  21045. */
  21046. /**
  21047. * Internal dependencies
  21048. */
  21049. const alignment_matrix_control_icon_styles_rootSize = () => {
  21050. const padding = 1.5;
  21051. const size = 24;
  21052. return /*#__PURE__*/emotion_react_browser_esm_css({
  21053. gridTemplateRows: `repeat( 3, calc( ${size - padding * 2}px / 3))`,
  21054. padding,
  21055. maxHeight: size,
  21056. maxWidth: size
  21057. }, true ? "" : 0, true ? "" : 0);
  21058. };
  21059. const rootPointerEvents = _ref => {
  21060. let {
  21061. disablePointerEvents
  21062. } = _ref;
  21063. return /*#__PURE__*/emotion_react_browser_esm_css({
  21064. pointerEvents: disablePointerEvents ? 'none' : null
  21065. }, true ? "" : 0, true ? "" : 0);
  21066. };
  21067. const Wrapper = emotion_styled_base_browser_esm("div", true ? {
  21068. target: "elqsdmc2"
  21069. } : 0)( true ? {
  21070. name: "ogl07i",
  21071. styles: "box-sizing:border-box;padding:2px"
  21072. } : 0);
  21073. const alignment_matrix_control_icon_styles_Root = emotion_styled_base_browser_esm("div", true ? {
  21074. target: "elqsdmc1"
  21075. } : 0)("transform-origin:top left;height:100%;width:100%;", rootBase, ";", alignment_matrix_control_icon_styles_rootSize, ";", rootPointerEvents, ";" + ( true ? "" : 0));
  21076. const alignment_matrix_control_icon_styles_pointActive = _ref2 => {
  21077. let {
  21078. isActive
  21079. } = _ref2;
  21080. const boxShadow = isActive ? `0 0 0 1px currentColor` : null;
  21081. return /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:", boxShadow, ";color:currentColor;*:hover>&{color:currentColor;}" + ( true ? "" : 0), true ? "" : 0);
  21082. };
  21083. const alignment_matrix_control_icon_styles_Point = emotion_styled_base_browser_esm("span", true ? {
  21084. target: "elqsdmc0"
  21085. } : 0)("height:2px;width:2px;", pointBase, ";", alignment_matrix_control_icon_styles_pointActive, ";" + ( true ? "" : 0));
  21086. const alignment_matrix_control_icon_styles_Cell = Cell;
  21087. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/icon.js
  21088. /**
  21089. * External dependencies
  21090. */
  21091. /**
  21092. * Internal dependencies
  21093. */
  21094. const BASE_SIZE = 24;
  21095. function AlignmentMatrixControlIcon(_ref) {
  21096. let {
  21097. className,
  21098. disablePointerEvents = true,
  21099. size = BASE_SIZE,
  21100. style = {},
  21101. value = 'center',
  21102. ...props
  21103. } = _ref;
  21104. const alignIndex = getAlignmentIndex(value);
  21105. const scale = (size / BASE_SIZE).toFixed(2);
  21106. const classes = classnames_default()('component-alignment-matrix-control-icon', className);
  21107. const styles = { ...style,
  21108. transform: `scale(${scale})`
  21109. };
  21110. return (0,external_wp_element_namespaceObject.createElement)(alignment_matrix_control_icon_styles_Root, extends_extends({}, props, {
  21111. className: classes,
  21112. disablePointerEvents: disablePointerEvents,
  21113. role: "presentation",
  21114. size: size,
  21115. style: styles
  21116. }), ALIGNMENTS.map((align, index) => {
  21117. const isActive = alignIndex === index;
  21118. return (0,external_wp_element_namespaceObject.createElement)(alignment_matrix_control_icon_styles_Cell, {
  21119. key: align
  21120. }, (0,external_wp_element_namespaceObject.createElement)(alignment_matrix_control_icon_styles_Point, {
  21121. isActive: isActive
  21122. }));
  21123. }));
  21124. }
  21125. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/index.js
  21126. /**
  21127. * External dependencies
  21128. */
  21129. /**
  21130. * WordPress dependencies
  21131. */
  21132. /**
  21133. * Internal dependencies
  21134. */
  21135. function useBaseId(id) {
  21136. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(AlignmentMatrixControl, 'alignment-matrix-control');
  21137. return id || instanceId;
  21138. }
  21139. function AlignmentMatrixControl(_ref) {
  21140. let {
  21141. className,
  21142. id,
  21143. label = (0,external_wp_i18n_namespaceObject.__)('Alignment Matrix Control'),
  21144. defaultValue = 'center center',
  21145. value,
  21146. onChange = external_lodash_namespaceObject.noop,
  21147. width = 92,
  21148. ...props
  21149. } = _ref;
  21150. const [immutableDefaultValue] = (0,external_wp_element_namespaceObject.useState)(value !== null && value !== void 0 ? value : defaultValue);
  21151. const baseId = useBaseId(id);
  21152. const initialCurrentId = getItemId(baseId, immutableDefaultValue);
  21153. const composite = useCompositeState({
  21154. baseId,
  21155. currentId: initialCurrentId,
  21156. rtl: (0,external_wp_i18n_namespaceObject.isRTL)()
  21157. });
  21158. const handleOnChange = nextValue => {
  21159. onChange(nextValue);
  21160. };
  21161. (0,external_wp_element_namespaceObject.useEffect)(() => {
  21162. if (typeof value !== 'undefined') {
  21163. composite.setCurrentId(getItemId(baseId, value));
  21164. }
  21165. }, [value, composite.setCurrentId]);
  21166. const classes = classnames_default()('component-alignment-matrix-control', className);
  21167. return (0,external_wp_element_namespaceObject.createElement)(Composite, extends_extends({}, props, composite, {
  21168. "aria-label": label,
  21169. as: Root,
  21170. className: classes,
  21171. role: "grid",
  21172. width: width
  21173. }), GRID.map((cells, index) => (0,external_wp_element_namespaceObject.createElement)(CompositeGroup, extends_extends({}, composite, {
  21174. as: Row,
  21175. role: "row",
  21176. key: index
  21177. }), cells.map(cell => {
  21178. const cellId = getItemId(baseId, cell);
  21179. const isActive = composite.currentId === cellId;
  21180. return (0,external_wp_element_namespaceObject.createElement)(cell_Cell, extends_extends({}, composite, {
  21181. id: cellId,
  21182. isActive: isActive,
  21183. key: cell,
  21184. value: cell,
  21185. onFocus: () => handleOnChange(cell),
  21186. tabIndex: isActive ? 0 : -1
  21187. }));
  21188. }))));
  21189. }
  21190. AlignmentMatrixControl.Icon = AlignmentMatrixControlIcon;
  21191. ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.js
  21192. /*! *****************************************************************************
  21193. Copyright (c) Microsoft Corporation.
  21194. Permission to use, copy, modify, and/or distribute this software for any
  21195. purpose with or without fee is hereby granted.
  21196. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  21197. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  21198. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  21199. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  21200. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  21201. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  21202. PERFORMANCE OF THIS SOFTWARE.
  21203. ***************************************************************************** */
  21204. /* global Reflect, Promise */
  21205. var extendStatics = function(d, b) {
  21206. extendStatics = Object.setPrototypeOf ||
  21207. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  21208. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  21209. return extendStatics(d, b);
  21210. };
  21211. function __extends(d, b) {
  21212. if (typeof b !== "function" && b !== null)
  21213. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  21214. extendStatics(d, b);
  21215. function __() { this.constructor = d; }
  21216. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  21217. }
  21218. var __assign = function() {
  21219. __assign = Object.assign || function __assign(t) {
  21220. for (var s, i = 1, n = arguments.length; i < n; i++) {
  21221. s = arguments[i];
  21222. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  21223. }
  21224. return t;
  21225. }
  21226. return __assign.apply(this, arguments);
  21227. }
  21228. function __rest(s, e) {
  21229. var t = {};
  21230. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  21231. t[p] = s[p];
  21232. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  21233. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  21234. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  21235. t[p[i]] = s[p[i]];
  21236. }
  21237. return t;
  21238. }
  21239. function __decorate(decorators, target, key, desc) {
  21240. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  21241. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21242. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  21243. return c > 3 && r && Object.defineProperty(target, key, r), r;
  21244. }
  21245. function __param(paramIndex, decorator) {
  21246. return function (target, key) { decorator(target, key, paramIndex); }
  21247. }
  21248. function __metadata(metadataKey, metadataValue) {
  21249. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  21250. }
  21251. function __awaiter(thisArg, _arguments, P, generator) {
  21252. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  21253. return new (P || (P = Promise))(function (resolve, reject) {
  21254. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  21255. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  21256. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  21257. step((generator = generator.apply(thisArg, _arguments || [])).next());
  21258. });
  21259. }
  21260. function __generator(thisArg, body) {
  21261. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  21262. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  21263. function verb(n) { return function (v) { return step([n, v]); }; }
  21264. function step(op) {
  21265. if (f) throw new TypeError("Generator is already executing.");
  21266. while (_) try {
  21267. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  21268. if (y = 0, t) op = [op[0] & 2, t.value];
  21269. switch (op[0]) {
  21270. case 0: case 1: t = op; break;
  21271. case 4: _.label++; return { value: op[1], done: false };
  21272. case 5: _.label++; y = op[1]; op = [0]; continue;
  21273. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  21274. default:
  21275. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  21276. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  21277. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  21278. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  21279. if (t[2]) _.ops.pop();
  21280. _.trys.pop(); continue;
  21281. }
  21282. op = body.call(thisArg, _);
  21283. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  21284. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  21285. }
  21286. }
  21287. var __createBinding = Object.create ? (function(o, m, k, k2) {
  21288. if (k2 === undefined) k2 = k;
  21289. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  21290. }) : (function(o, m, k, k2) {
  21291. if (k2 === undefined) k2 = k;
  21292. o[k2] = m[k];
  21293. });
  21294. function __exportStar(m, o) {
  21295. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
  21296. }
  21297. function __values(o) {
  21298. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  21299. if (m) return m.call(o);
  21300. if (o && typeof o.length === "number") return {
  21301. next: function () {
  21302. if (o && i >= o.length) o = void 0;
  21303. return { value: o && o[i++], done: !o };
  21304. }
  21305. };
  21306. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  21307. }
  21308. function tslib_es6_read(o, n) {
  21309. var m = typeof Symbol === "function" && o[Symbol.iterator];
  21310. if (!m) return o;
  21311. var i = m.call(o), r, ar = [], e;
  21312. try {
  21313. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  21314. }
  21315. catch (error) { e = { error: error }; }
  21316. finally {
  21317. try {
  21318. if (r && !r.done && (m = i["return"])) m.call(i);
  21319. }
  21320. finally { if (e) throw e.error; }
  21321. }
  21322. return ar;
  21323. }
  21324. /** @deprecated */
  21325. function __spread() {
  21326. for (var ar = [], i = 0; i < arguments.length; i++)
  21327. ar = ar.concat(tslib_es6_read(arguments[i]));
  21328. return ar;
  21329. }
  21330. /** @deprecated */
  21331. function __spreadArrays() {
  21332. for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
  21333. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  21334. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  21335. r[k] = a[j];
  21336. return r;
  21337. }
  21338. function tslib_es6_spreadArray(to, from, pack) {
  21339. if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
  21340. if (ar || !(i in from)) {
  21341. if (!ar) ar = Array.prototype.slice.call(from, 0, i);
  21342. ar[i] = from[i];
  21343. }
  21344. }
  21345. return to.concat(ar || Array.prototype.slice.call(from));
  21346. }
  21347. function __await(v) {
  21348. return this instanceof __await ? (this.v = v, this) : new __await(v);
  21349. }
  21350. function __asyncGenerator(thisArg, _arguments, generator) {
  21351. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  21352. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  21353. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  21354. function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
  21355. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  21356. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  21357. function fulfill(value) { resume("next", value); }
  21358. function reject(value) { resume("throw", value); }
  21359. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  21360. }
  21361. function __asyncDelegator(o) {
  21362. var i, p;
  21363. return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
  21364. function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  21365. }
  21366. function __asyncValues(o) {
  21367. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  21368. var m = o[Symbol.asyncIterator], i;
  21369. return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
  21370. function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
  21371. function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  21372. }
  21373. function __makeTemplateObject(cooked, raw) {
  21374. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  21375. return cooked;
  21376. };
  21377. var __setModuleDefault = Object.create ? (function(o, v) {
  21378. Object.defineProperty(o, "default", { enumerable: true, value: v });
  21379. }) : function(o, v) {
  21380. o["default"] = v;
  21381. };
  21382. function __importStar(mod) {
  21383. if (mod && mod.__esModule) return mod;
  21384. var result = {};
  21385. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  21386. __setModuleDefault(result, mod);
  21387. return result;
  21388. }
  21389. function __importDefault(mod) {
  21390. return (mod && mod.__esModule) ? mod : { default: mod };
  21391. }
  21392. function __classPrivateFieldGet(receiver, state, kind, f) {
  21393. if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
  21394. if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
  21395. return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
  21396. }
  21397. function __classPrivateFieldSet(receiver, state, value, kind, f) {
  21398. if (kind === "m") throw new TypeError("Private method is not writable");
  21399. if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
  21400. if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
  21401. return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
  21402. }
  21403. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/definitions.mjs
  21404. var createDefinition = function (propNames) { return ({
  21405. isEnabled: function (props) { return propNames.some(function (name) { return !!props[name]; }); },
  21406. }); };
  21407. var featureDefinitions = {
  21408. measureLayout: createDefinition(["layout", "layoutId", "drag"]),
  21409. animation: createDefinition([
  21410. "animate",
  21411. "exit",
  21412. "variants",
  21413. "whileHover",
  21414. "whileTap",
  21415. "whileFocus",
  21416. "whileDrag",
  21417. "whileInView",
  21418. ]),
  21419. exit: createDefinition(["exit"]),
  21420. drag: createDefinition(["drag", "dragControls"]),
  21421. focus: createDefinition(["whileFocus"]),
  21422. hover: createDefinition(["whileHover", "onHoverStart", "onHoverEnd"]),
  21423. tap: createDefinition(["whileTap", "onTap", "onTapStart", "onTapCancel"]),
  21424. pan: createDefinition([
  21425. "onPan",
  21426. "onPanStart",
  21427. "onPanSessionStart",
  21428. "onPanEnd",
  21429. ]),
  21430. inView: createDefinition([
  21431. "whileInView",
  21432. "onViewportEnter",
  21433. "onViewportLeave",
  21434. ]),
  21435. };
  21436. function loadFeatures(features) {
  21437. for (var key in features) {
  21438. if (features[key] === null)
  21439. continue;
  21440. if (key === "projectionNodeConstructor") {
  21441. featureDefinitions.projectionNodeConstructor = features[key];
  21442. }
  21443. else {
  21444. featureDefinitions[key].Component = features[key];
  21445. }
  21446. }
  21447. }
  21448. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/LazyContext.mjs
  21449. var LazyContext = (0,external_React_.createContext)({ strict: false });
  21450. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/use-features.mjs
  21451. var featureNames = Object.keys(featureDefinitions);
  21452. var numFeatures = featureNames.length;
  21453. /**
  21454. * Load features via renderless components based on the provided MotionProps.
  21455. */
  21456. function useFeatures(props, visualElement, preloadedFeatures) {
  21457. var features = [];
  21458. var lazyContext = (0,external_React_.useContext)(LazyContext);
  21459. if (!visualElement)
  21460. return null;
  21461. /**
  21462. * If we're in development mode, check to make sure we're not rendering a motion component
  21463. * as a child of LazyMotion, as this will break the file-size benefits of using it.
  21464. */
  21465. if (false) {}
  21466. for (var i = 0; i < numFeatures; i++) {
  21467. var name_1 = featureNames[i];
  21468. var _a = featureDefinitions[name_1], isEnabled = _a.isEnabled, Component = _a.Component;
  21469. /**
  21470. * It might be possible in the future to use this moment to
  21471. * dynamically request functionality. In initial tests this
  21472. * was producing a lot of duplication amongst bundles.
  21473. */
  21474. if (isEnabled(props) && Component) {
  21475. features.push(external_React_.createElement(Component, __assign({ key: name_1 }, props, { visualElement: visualElement })));
  21476. }
  21477. }
  21478. return features;
  21479. }
  21480. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionConfigContext.mjs
  21481. /**
  21482. * @public
  21483. */
  21484. var MotionConfigContext = (0,external_React_.createContext)({
  21485. transformPagePoint: function (p) { return p; },
  21486. isStatic: false,
  21487. reducedMotion: "never",
  21488. });
  21489. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionContext/index.mjs
  21490. var MotionContext = (0,external_React_.createContext)({});
  21491. function useVisualElementContext() {
  21492. return (0,external_React_.useContext)(MotionContext).visualElement;
  21493. }
  21494. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/PresenceContext.mjs
  21495. /**
  21496. * @public
  21497. */
  21498. var PresenceContext_PresenceContext = (0,external_React_.createContext)(null);
  21499. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-browser.mjs
  21500. var is_browser_isBrowser = typeof document !== "undefined";
  21501. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs
  21502. var useIsomorphicLayoutEffect = is_browser_isBrowser ? external_React_.useLayoutEffect : external_React_.useEffect;
  21503. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-reduced-motion.mjs
  21504. // Does this device prefer reduced motion? Returns `null` server-side.
  21505. var prefersReducedMotion = { current: null };
  21506. var hasDetected = false;
  21507. function initPrefersReducedMotion() {
  21508. hasDetected = true;
  21509. if (!is_browser_isBrowser)
  21510. return;
  21511. if (window.matchMedia) {
  21512. var motionMediaQuery_1 = window.matchMedia("(prefers-reduced-motion)");
  21513. var setReducedMotionPreferences = function () {
  21514. return (prefersReducedMotion.current = motionMediaQuery_1.matches);
  21515. };
  21516. motionMediaQuery_1.addListener(setReducedMotionPreferences);
  21517. setReducedMotionPreferences();
  21518. }
  21519. else {
  21520. prefersReducedMotion.current = false;
  21521. }
  21522. }
  21523. /**
  21524. * A hook that returns `true` if we should be using reduced motion based on the current device's Reduced Motion setting.
  21525. *
  21526. * This can be used to implement changes to your UI based on Reduced Motion. For instance, replacing motion-sickness inducing
  21527. * `x`/`y` animations with `opacity`, disabling the autoplay of background videos, or turning off parallax motion.
  21528. *
  21529. * It will actively respond to changes and re-render your components with the latest setting.
  21530. *
  21531. * ```jsx
  21532. * export function Sidebar({ isOpen }) {
  21533. * const shouldReduceMotion = useReducedMotion()
  21534. * const closedX = shouldReduceMotion ? 0 : "-100%"
  21535. *
  21536. * return (
  21537. * <motion.div animate={{
  21538. * opacity: isOpen ? 1 : 0,
  21539. * x: isOpen ? 0 : closedX
  21540. * }} />
  21541. * )
  21542. * }
  21543. * ```
  21544. *
  21545. * @return boolean
  21546. *
  21547. * @public
  21548. */
  21549. function useReducedMotion() {
  21550. /**
  21551. * Lazy initialisation of prefersReducedMotion
  21552. */
  21553. !hasDetected && initPrefersReducedMotion();
  21554. var _a = tslib_es6_read((0,external_React_.useState)(prefersReducedMotion.current), 1), shouldReduceMotion = _a[0];
  21555. /**
  21556. * TODO See if people miss automatically updating shouldReduceMotion setting
  21557. */
  21558. return shouldReduceMotion;
  21559. }
  21560. function useReducedMotionConfig() {
  21561. var reducedMotionPreference = useReducedMotion();
  21562. var reducedMotion = (0,external_React_.useContext)(MotionConfigContext).reducedMotion;
  21563. if (reducedMotion === "never") {
  21564. return false;
  21565. }
  21566. else if (reducedMotion === "always") {
  21567. return true;
  21568. }
  21569. else {
  21570. return reducedMotionPreference;
  21571. }
  21572. }
  21573. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs
  21574. function useVisualElement(Component, visualState, props, createVisualElement) {
  21575. var lazyContext = (0,external_React_.useContext)(LazyContext);
  21576. var parent = useVisualElementContext();
  21577. var presenceContext = (0,external_React_.useContext)(PresenceContext_PresenceContext);
  21578. var shouldReduceMotion = useReducedMotionConfig();
  21579. var visualElementRef = (0,external_React_.useRef)(undefined);
  21580. /**
  21581. * If we haven't preloaded a renderer, check to see if we have one lazy-loaded
  21582. */
  21583. if (!createVisualElement)
  21584. createVisualElement = lazyContext.renderer;
  21585. if (!visualElementRef.current && createVisualElement) {
  21586. visualElementRef.current = createVisualElement(Component, {
  21587. visualState: visualState,
  21588. parent: parent,
  21589. props: props,
  21590. presenceId: presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.id,
  21591. blockInitialAnimation: (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false,
  21592. shouldReduceMotion: shouldReduceMotion,
  21593. });
  21594. }
  21595. var visualElement = visualElementRef.current;
  21596. useIsomorphicLayoutEffect(function () {
  21597. visualElement === null || visualElement === void 0 ? void 0 : visualElement.syncRender();
  21598. });
  21599. (0,external_React_.useEffect)(function () {
  21600. var _a;
  21601. (_a = visualElement === null || visualElement === void 0 ? void 0 : visualElement.animationState) === null || _a === void 0 ? void 0 : _a.animateChanges();
  21602. });
  21603. useIsomorphicLayoutEffect(function () { return function () { return visualElement === null || visualElement === void 0 ? void 0 : visualElement.notifyUnmount(); }; }, []);
  21604. return visualElement;
  21605. }
  21606. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-ref-object.mjs
  21607. function is_ref_object_isRefObject(ref) {
  21608. return (typeof ref === "object" &&
  21609. Object.prototype.hasOwnProperty.call(ref, "current"));
  21610. }
  21611. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.mjs
  21612. /**
  21613. * Creates a ref function that, when called, hydrates the provided
  21614. * external ref and VisualElement.
  21615. */
  21616. function useMotionRef(visualState, visualElement, externalRef) {
  21617. return (0,external_React_.useCallback)(function (instance) {
  21618. var _a;
  21619. instance && ((_a = visualState.mount) === null || _a === void 0 ? void 0 : _a.call(visualState, instance));
  21620. if (visualElement) {
  21621. instance
  21622. ? visualElement.mount(instance)
  21623. : visualElement.unmount();
  21624. }
  21625. if (externalRef) {
  21626. if (typeof externalRef === "function") {
  21627. externalRef(instance);
  21628. }
  21629. else if (is_ref_object_isRefObject(externalRef)) {
  21630. externalRef.current = instance;
  21631. }
  21632. }
  21633. },
  21634. /**
  21635. * Only pass a new ref callback to React if we've received a visual element
  21636. * factory. Otherwise we'll be mounting/remounting every time externalRef
  21637. * or other dependencies change.
  21638. */
  21639. [visualElement]);
  21640. }
  21641. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/variants.mjs
  21642. /**
  21643. * Decides if the supplied variable is an array of variant labels
  21644. */
  21645. function isVariantLabels(v) {
  21646. return Array.isArray(v);
  21647. }
  21648. /**
  21649. * Decides if the supplied variable is variant label
  21650. */
  21651. function isVariantLabel(v) {
  21652. return typeof v === "string" || isVariantLabels(v);
  21653. }
  21654. /**
  21655. * Creates an object containing the latest state of every MotionValue on a VisualElement
  21656. */
  21657. function getCurrent(visualElement) {
  21658. var current = {};
  21659. visualElement.forEachValue(function (value, key) { return (current[key] = value.get()); });
  21660. return current;
  21661. }
  21662. /**
  21663. * Creates an object containing the latest velocity of every MotionValue on a VisualElement
  21664. */
  21665. function getVelocity(visualElement) {
  21666. var velocity = {};
  21667. visualElement.forEachValue(function (value, key) { return (velocity[key] = value.getVelocity()); });
  21668. return velocity;
  21669. }
  21670. function resolveVariantFromProps(props, definition, custom, currentValues, currentVelocity) {
  21671. var _a;
  21672. if (currentValues === void 0) { currentValues = {}; }
  21673. if (currentVelocity === void 0) { currentVelocity = {}; }
  21674. /**
  21675. * If the variant definition is a function, resolve.
  21676. */
  21677. if (typeof definition === "function") {
  21678. definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity);
  21679. }
  21680. /**
  21681. * If the variant definition is a variant label, or
  21682. * the function returned a variant label, resolve.
  21683. */
  21684. if (typeof definition === "string") {
  21685. definition = (_a = props.variants) === null || _a === void 0 ? void 0 : _a[definition];
  21686. }
  21687. /**
  21688. * At this point we've resolved both functions and variant labels,
  21689. * but the resolved variant label might itself have been a function.
  21690. * If so, resolve. This can only have returned a valid target object.
  21691. */
  21692. if (typeof definition === "function") {
  21693. definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity);
  21694. }
  21695. return definition;
  21696. }
  21697. function resolveVariant(visualElement, definition, custom) {
  21698. var props = visualElement.getProps();
  21699. return resolveVariantFromProps(props, definition, custom !== null && custom !== void 0 ? custom : props.custom, getCurrent(visualElement), getVelocity(visualElement));
  21700. }
  21701. function checkIfControllingVariants(props) {
  21702. var _a;
  21703. return (typeof ((_a = props.animate) === null || _a === void 0 ? void 0 : _a.start) === "function" ||
  21704. isVariantLabel(props.initial) ||
  21705. isVariantLabel(props.animate) ||
  21706. isVariantLabel(props.whileHover) ||
  21707. isVariantLabel(props.whileDrag) ||
  21708. isVariantLabel(props.whileTap) ||
  21709. isVariantLabel(props.whileFocus) ||
  21710. isVariantLabel(props.exit));
  21711. }
  21712. function checkIfVariantNode(props) {
  21713. return Boolean(checkIfControllingVariants(props) || props.variants);
  21714. }
  21715. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionContext/utils.mjs
  21716. function getCurrentTreeVariants(props, context) {
  21717. if (checkIfControllingVariants(props)) {
  21718. var initial = props.initial, animate = props.animate;
  21719. return {
  21720. initial: initial === false || isVariantLabel(initial)
  21721. ? initial
  21722. : undefined,
  21723. animate: isVariantLabel(animate) ? animate : undefined,
  21724. };
  21725. }
  21726. return props.inherit !== false ? context : {};
  21727. }
  21728. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionContext/create.mjs
  21729. function useCreateMotionContext(props) {
  21730. var _a = getCurrentTreeVariants(props, (0,external_React_.useContext)(MotionContext)), initial = _a.initial, animate = _a.animate;
  21731. return (0,external_React_.useMemo)(function () { return ({ initial: initial, animate: animate }); }, [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
  21732. }
  21733. function variantLabelsAsDependency(prop) {
  21734. return Array.isArray(prop) ? prop.join(" ") : prop;
  21735. }
  21736. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-constant.mjs
  21737. /**
  21738. * Creates a constant value over the lifecycle of a component.
  21739. *
  21740. * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer
  21741. * a guarantee that it won't re-run for performance reasons later on. By using `useConstant`
  21742. * you can ensure that initialisers don't execute twice or more.
  21743. */
  21744. function useConstant(init) {
  21745. var ref = (0,external_React_.useRef)(null);
  21746. if (ref.current === null) {
  21747. ref.current = init();
  21748. }
  21749. return ref.current;
  21750. }
  21751. ;// CONCATENATED MODULE: ./node_modules/framesync/dist/es/on-next-frame.mjs
  21752. const defaultTimestep = (1 / 60) * 1000;
  21753. const getCurrentTime = typeof performance !== "undefined"
  21754. ? () => performance.now()
  21755. : () => Date.now();
  21756. const onNextFrame = typeof window !== "undefined"
  21757. ? (callback) => window.requestAnimationFrame(callback)
  21758. : (callback) => setTimeout(() => callback(getCurrentTime()), defaultTimestep);
  21759. ;// CONCATENATED MODULE: ./node_modules/framesync/dist/es/create-render-step.mjs
  21760. function createRenderStep(runNextFrame) {
  21761. let toRun = [];
  21762. let toRunNextFrame = [];
  21763. let numToRun = 0;
  21764. let isProcessing = false;
  21765. let flushNextFrame = false;
  21766. const toKeepAlive = new WeakSet();
  21767. const step = {
  21768. schedule: (callback, keepAlive = false, immediate = false) => {
  21769. const addToCurrentFrame = immediate && isProcessing;
  21770. const buffer = addToCurrentFrame ? toRun : toRunNextFrame;
  21771. if (keepAlive)
  21772. toKeepAlive.add(callback);
  21773. if (buffer.indexOf(callback) === -1) {
  21774. buffer.push(callback);
  21775. if (addToCurrentFrame && isProcessing)
  21776. numToRun = toRun.length;
  21777. }
  21778. return callback;
  21779. },
  21780. cancel: (callback) => {
  21781. const index = toRunNextFrame.indexOf(callback);
  21782. if (index !== -1)
  21783. toRunNextFrame.splice(index, 1);
  21784. toKeepAlive.delete(callback);
  21785. },
  21786. process: (frameData) => {
  21787. if (isProcessing) {
  21788. flushNextFrame = true;
  21789. return;
  21790. }
  21791. isProcessing = true;
  21792. [toRun, toRunNextFrame] = [toRunNextFrame, toRun];
  21793. toRunNextFrame.length = 0;
  21794. numToRun = toRun.length;
  21795. if (numToRun) {
  21796. for (let i = 0; i < numToRun; i++) {
  21797. const callback = toRun[i];
  21798. callback(frameData);
  21799. if (toKeepAlive.has(callback)) {
  21800. step.schedule(callback);
  21801. runNextFrame();
  21802. }
  21803. }
  21804. }
  21805. isProcessing = false;
  21806. if (flushNextFrame) {
  21807. flushNextFrame = false;
  21808. step.process(frameData);
  21809. }
  21810. },
  21811. };
  21812. return step;
  21813. }
  21814. ;// CONCATENATED MODULE: ./node_modules/framesync/dist/es/index.mjs
  21815. const maxElapsed = 40;
  21816. let useDefaultElapsed = true;
  21817. let runNextFrame = false;
  21818. let isProcessing = false;
  21819. const es_frame = {
  21820. delta: 0,
  21821. timestamp: 0,
  21822. };
  21823. const stepsOrder = [
  21824. "read",
  21825. "update",
  21826. "preRender",
  21827. "render",
  21828. "postRender",
  21829. ];
  21830. const steps = stepsOrder.reduce((acc, key) => {
  21831. acc[key] = createRenderStep(() => (runNextFrame = true));
  21832. return acc;
  21833. }, {});
  21834. const sync = stepsOrder.reduce((acc, key) => {
  21835. const step = steps[key];
  21836. acc[key] = (process, keepAlive = false, immediate = false) => {
  21837. if (!runNextFrame)
  21838. startLoop();
  21839. return step.schedule(process, keepAlive, immediate);
  21840. };
  21841. return acc;
  21842. }, {});
  21843. const cancelSync = stepsOrder.reduce((acc, key) => {
  21844. acc[key] = steps[key].cancel;
  21845. return acc;
  21846. }, {});
  21847. const flushSync = stepsOrder.reduce((acc, key) => {
  21848. acc[key] = () => steps[key].process(es_frame);
  21849. return acc;
  21850. }, {});
  21851. const processStep = (stepId) => steps[stepId].process(es_frame);
  21852. const processFrame = (timestamp) => {
  21853. runNextFrame = false;
  21854. es_frame.delta = useDefaultElapsed
  21855. ? defaultTimestep
  21856. : Math.max(Math.min(timestamp - es_frame.timestamp, maxElapsed), 1);
  21857. es_frame.timestamp = timestamp;
  21858. isProcessing = true;
  21859. stepsOrder.forEach(processStep);
  21860. isProcessing = false;
  21861. if (runNextFrame) {
  21862. useDefaultElapsed = false;
  21863. onNextFrame(processFrame);
  21864. }
  21865. };
  21866. const startLoop = () => {
  21867. runNextFrame = true;
  21868. useDefaultElapsed = true;
  21869. if (!isProcessing)
  21870. onNextFrame(processFrame);
  21871. };
  21872. const getFrameData = () => es_frame;
  21873. /* harmony default export */ var es = (sync);
  21874. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/mix.mjs
  21875. const mix = (from, to, progress) => -progress * from + progress * to + from;
  21876. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/velocity-per-second.mjs
  21877. function velocityPerSecond(velocity, frameDuration) {
  21878. return frameDuration ? velocity * (1000 / frameDuration) : 0;
  21879. }
  21880. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/array.mjs
  21881. function addUniqueItem(arr, item) {
  21882. arr.indexOf(item) === -1 && arr.push(item);
  21883. }
  21884. function removeItem(arr, item) {
  21885. var index = arr.indexOf(item);
  21886. index > -1 && arr.splice(index, 1);
  21887. }
  21888. // Adapted from array-move
  21889. function moveItem(_a, fromIndex, toIndex) {
  21890. var _b = __read(_a), arr = _b.slice(0);
  21891. var startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;
  21892. if (startIndex >= 0 && startIndex < arr.length) {
  21893. var endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;
  21894. var _c = __read(arr.splice(fromIndex, 1), 1), item = _c[0];
  21895. arr.splice(endIndex, 0, item);
  21896. }
  21897. return arr;
  21898. }
  21899. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/subscription-manager.mjs
  21900. var SubscriptionManager = /** @class */ (function () {
  21901. function SubscriptionManager() {
  21902. this.subscriptions = [];
  21903. }
  21904. SubscriptionManager.prototype.add = function (handler) {
  21905. var _this = this;
  21906. addUniqueItem(this.subscriptions, handler);
  21907. return function () { return removeItem(_this.subscriptions, handler); };
  21908. };
  21909. SubscriptionManager.prototype.notify = function (a, b, c) {
  21910. var numSubscriptions = this.subscriptions.length;
  21911. if (!numSubscriptions)
  21912. return;
  21913. if (numSubscriptions === 1) {
  21914. /**
  21915. * If there's only a single handler we can just call it without invoking a loop.
  21916. */
  21917. this.subscriptions[0](a, b, c);
  21918. }
  21919. else {
  21920. for (var i = 0; i < numSubscriptions; i++) {
  21921. /**
  21922. * Check whether the handler exists before firing as it's possible
  21923. * the subscriptions were modified during this loop running.
  21924. */
  21925. var handler = this.subscriptions[i];
  21926. handler && handler(a, b, c);
  21927. }
  21928. }
  21929. };
  21930. SubscriptionManager.prototype.getSize = function () {
  21931. return this.subscriptions.length;
  21932. };
  21933. SubscriptionManager.prototype.clear = function () {
  21934. this.subscriptions.length = 0;
  21935. };
  21936. return SubscriptionManager;
  21937. }());
  21938. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/index.mjs
  21939. var isFloat = function (value) {
  21940. return !isNaN(parseFloat(value));
  21941. };
  21942. /**
  21943. * `MotionValue` is used to track the state and velocity of motion values.
  21944. *
  21945. * @public
  21946. */
  21947. var MotionValue = /** @class */ (function () {
  21948. /**
  21949. * @param init - The initiating value
  21950. * @param config - Optional configuration options
  21951. *
  21952. * - `transformer`: A function to transform incoming values with.
  21953. *
  21954. * @internal
  21955. */
  21956. function MotionValue(init) {
  21957. var _this = this;
  21958. /**
  21959. * Duration, in milliseconds, since last updating frame.
  21960. *
  21961. * @internal
  21962. */
  21963. this.timeDelta = 0;
  21964. /**
  21965. * Timestamp of the last time this `MotionValue` was updated.
  21966. *
  21967. * @internal
  21968. */
  21969. this.lastUpdated = 0;
  21970. /**
  21971. * Functions to notify when the `MotionValue` updates.
  21972. *
  21973. * @internal
  21974. */
  21975. this.updateSubscribers = new SubscriptionManager();
  21976. /**
  21977. * Functions to notify when the velocity updates.
  21978. *
  21979. * @internal
  21980. */
  21981. this.velocityUpdateSubscribers = new SubscriptionManager();
  21982. /**
  21983. * Functions to notify when the `MotionValue` updates and `render` is set to `true`.
  21984. *
  21985. * @internal
  21986. */
  21987. this.renderSubscribers = new SubscriptionManager();
  21988. /**
  21989. * Tracks whether this value can output a velocity. Currently this is only true
  21990. * if the value is numerical, but we might be able to widen the scope here and support
  21991. * other value types.
  21992. *
  21993. * @internal
  21994. */
  21995. this.canTrackVelocity = false;
  21996. this.updateAndNotify = function (v, render) {
  21997. if (render === void 0) { render = true; }
  21998. _this.prev = _this.current;
  21999. _this.current = v;
  22000. // Update timestamp
  22001. var _a = getFrameData(), delta = _a.delta, timestamp = _a.timestamp;
  22002. if (_this.lastUpdated !== timestamp) {
  22003. _this.timeDelta = delta;
  22004. _this.lastUpdated = timestamp;
  22005. es.postRender(_this.scheduleVelocityCheck);
  22006. }
  22007. // Update update subscribers
  22008. if (_this.prev !== _this.current) {
  22009. _this.updateSubscribers.notify(_this.current);
  22010. }
  22011. // Update velocity subscribers
  22012. if (_this.velocityUpdateSubscribers.getSize()) {
  22013. _this.velocityUpdateSubscribers.notify(_this.getVelocity());
  22014. }
  22015. // Update render subscribers
  22016. if (render) {
  22017. _this.renderSubscribers.notify(_this.current);
  22018. }
  22019. };
  22020. /**
  22021. * Schedule a velocity check for the next frame.
  22022. *
  22023. * This is an instanced and bound function to prevent generating a new
  22024. * function once per frame.
  22025. *
  22026. * @internal
  22027. */
  22028. this.scheduleVelocityCheck = function () { return es.postRender(_this.velocityCheck); };
  22029. /**
  22030. * Updates `prev` with `current` if the value hasn't been updated this frame.
  22031. * This ensures velocity calculations return `0`.
  22032. *
  22033. * This is an instanced and bound function to prevent generating a new
  22034. * function once per frame.
  22035. *
  22036. * @internal
  22037. */
  22038. this.velocityCheck = function (_a) {
  22039. var timestamp = _a.timestamp;
  22040. if (timestamp !== _this.lastUpdated) {
  22041. _this.prev = _this.current;
  22042. _this.velocityUpdateSubscribers.notify(_this.getVelocity());
  22043. }
  22044. };
  22045. this.hasAnimated = false;
  22046. this.prev = this.current = init;
  22047. this.canTrackVelocity = isFloat(this.current);
  22048. }
  22049. /**
  22050. * Adds a function that will be notified when the `MotionValue` is updated.
  22051. *
  22052. * It returns a function that, when called, will cancel the subscription.
  22053. *
  22054. * When calling `onChange` inside a React component, it should be wrapped with the
  22055. * `useEffect` hook. As it returns an unsubscribe function, this should be returned
  22056. * from the `useEffect` function to ensure you don't add duplicate subscribers..
  22057. *
  22058. * ```jsx
  22059. * export const MyComponent = () => {
  22060. * const x = useMotionValue(0)
  22061. * const y = useMotionValue(0)
  22062. * const opacity = useMotionValue(1)
  22063. *
  22064. * useEffect(() => {
  22065. * function updateOpacity() {
  22066. * const maxXY = Math.max(x.get(), y.get())
  22067. * const newOpacity = transform(maxXY, [0, 100], [1, 0])
  22068. * opacity.set(newOpacity)
  22069. * }
  22070. *
  22071. * const unsubscribeX = x.onChange(updateOpacity)
  22072. * const unsubscribeY = y.onChange(updateOpacity)
  22073. *
  22074. * return () => {
  22075. * unsubscribeX()
  22076. * unsubscribeY()
  22077. * }
  22078. * }, [])
  22079. *
  22080. * return <motion.div style={{ x }} />
  22081. * }
  22082. * ```
  22083. *
  22084. * @internalremarks
  22085. *
  22086. * We could look into a `useOnChange` hook if the above lifecycle management proves confusing.
  22087. *
  22088. * ```jsx
  22089. * useOnChange(x, () => {})
  22090. * ```
  22091. *
  22092. * @param subscriber - A function that receives the latest value.
  22093. * @returns A function that, when called, will cancel this subscription.
  22094. *
  22095. * @public
  22096. */
  22097. MotionValue.prototype.onChange = function (subscription) {
  22098. return this.updateSubscribers.add(subscription);
  22099. };
  22100. MotionValue.prototype.clearListeners = function () {
  22101. this.updateSubscribers.clear();
  22102. };
  22103. /**
  22104. * Adds a function that will be notified when the `MotionValue` requests a render.
  22105. *
  22106. * @param subscriber - A function that's provided the latest value.
  22107. * @returns A function that, when called, will cancel this subscription.
  22108. *
  22109. * @internal
  22110. */
  22111. MotionValue.prototype.onRenderRequest = function (subscription) {
  22112. // Render immediately
  22113. subscription(this.get());
  22114. return this.renderSubscribers.add(subscription);
  22115. };
  22116. /**
  22117. * Attaches a passive effect to the `MotionValue`.
  22118. *
  22119. * @internal
  22120. */
  22121. MotionValue.prototype.attach = function (passiveEffect) {
  22122. this.passiveEffect = passiveEffect;
  22123. };
  22124. /**
  22125. * Sets the state of the `MotionValue`.
  22126. *
  22127. * @remarks
  22128. *
  22129. * ```jsx
  22130. * const x = useMotionValue(0)
  22131. * x.set(10)
  22132. * ```
  22133. *
  22134. * @param latest - Latest value to set.
  22135. * @param render - Whether to notify render subscribers. Defaults to `true`
  22136. *
  22137. * @public
  22138. */
  22139. MotionValue.prototype.set = function (v, render) {
  22140. if (render === void 0) { render = true; }
  22141. if (!render || !this.passiveEffect) {
  22142. this.updateAndNotify(v, render);
  22143. }
  22144. else {
  22145. this.passiveEffect(v, this.updateAndNotify);
  22146. }
  22147. };
  22148. /**
  22149. * Returns the latest state of `MotionValue`
  22150. *
  22151. * @returns - The latest state of `MotionValue`
  22152. *
  22153. * @public
  22154. */
  22155. MotionValue.prototype.get = function () {
  22156. return this.current;
  22157. };
  22158. /**
  22159. * @public
  22160. */
  22161. MotionValue.prototype.getPrevious = function () {
  22162. return this.prev;
  22163. };
  22164. /**
  22165. * Returns the latest velocity of `MotionValue`
  22166. *
  22167. * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
  22168. *
  22169. * @public
  22170. */
  22171. MotionValue.prototype.getVelocity = function () {
  22172. // This could be isFloat(this.prev) && isFloat(this.current), but that would be wasteful
  22173. return this.canTrackVelocity
  22174. ? // These casts could be avoided if parseFloat would be typed better
  22175. velocityPerSecond(parseFloat(this.current) -
  22176. parseFloat(this.prev), this.timeDelta)
  22177. : 0;
  22178. };
  22179. /**
  22180. * Registers a new animation to control this `MotionValue`. Only one
  22181. * animation can drive a `MotionValue` at one time.
  22182. *
  22183. * ```jsx
  22184. * value.start()
  22185. * ```
  22186. *
  22187. * @param animation - A function that starts the provided animation
  22188. *
  22189. * @internal
  22190. */
  22191. MotionValue.prototype.start = function (animation) {
  22192. var _this = this;
  22193. this.stop();
  22194. return new Promise(function (resolve) {
  22195. _this.hasAnimated = true;
  22196. _this.stopAnimation = animation(resolve);
  22197. }).then(function () { return _this.clearAnimation(); });
  22198. };
  22199. /**
  22200. * Stop the currently active animation.
  22201. *
  22202. * @public
  22203. */
  22204. MotionValue.prototype.stop = function () {
  22205. if (this.stopAnimation)
  22206. this.stopAnimation();
  22207. this.clearAnimation();
  22208. };
  22209. /**
  22210. * Returns `true` if this value is currently animating.
  22211. *
  22212. * @public
  22213. */
  22214. MotionValue.prototype.isAnimating = function () {
  22215. return !!this.stopAnimation;
  22216. };
  22217. MotionValue.prototype.clearAnimation = function () {
  22218. this.stopAnimation = null;
  22219. };
  22220. /**
  22221. * Destroy and clean up subscribers to this `MotionValue`.
  22222. *
  22223. * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
  22224. * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
  22225. * created a `MotionValue` via the `motionValue` function.
  22226. *
  22227. * @public
  22228. */
  22229. MotionValue.prototype.destroy = function () {
  22230. this.updateSubscribers.clear();
  22231. this.renderSubscribers.clear();
  22232. this.stop();
  22233. };
  22234. return MotionValue;
  22235. }());
  22236. /**
  22237. * @internal
  22238. */
  22239. function motionValue(init) {
  22240. return new MotionValue(init);
  22241. }
  22242. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/utils/is-motion-value.mjs
  22243. var isMotionValue = function (value) {
  22244. return Boolean(value !== null && typeof value === "object" && value.getVelocity);
  22245. };
  22246. ;// CONCATENATED MODULE: ./node_modules/hey-listen/dist/hey-listen.es.js
  22247. var warning = function () { };
  22248. var invariant = function () { };
  22249. if (false) {}
  22250. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/clamp.mjs
  22251. const clamp = (min, max, v) => Math.min(Math.max(v, min), max);
  22252. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/utils/find-spring.mjs
  22253. const safeMin = 0.001;
  22254. const minDuration = 0.01;
  22255. const maxDuration = 10.0;
  22256. const minDamping = 0.05;
  22257. const maxDamping = 1;
  22258. function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, }) {
  22259. let envelope;
  22260. let derivative;
  22261. warning(duration <= maxDuration * 1000, "Spring duration must be 10 seconds or less");
  22262. let dampingRatio = 1 - bounce;
  22263. dampingRatio = clamp(minDamping, maxDamping, dampingRatio);
  22264. duration = clamp(minDuration, maxDuration, duration / 1000);
  22265. if (dampingRatio < 1) {
  22266. envelope = (undampedFreq) => {
  22267. const exponentialDecay = undampedFreq * dampingRatio;
  22268. const delta = exponentialDecay * duration;
  22269. const a = exponentialDecay - velocity;
  22270. const b = calcAngularFreq(undampedFreq, dampingRatio);
  22271. const c = Math.exp(-delta);
  22272. return safeMin - (a / b) * c;
  22273. };
  22274. derivative = (undampedFreq) => {
  22275. const exponentialDecay = undampedFreq * dampingRatio;
  22276. const delta = exponentialDecay * duration;
  22277. const d = delta * velocity + velocity;
  22278. const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;
  22279. const f = Math.exp(-delta);
  22280. const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);
  22281. const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;
  22282. return (factor * ((d - e) * f)) / g;
  22283. };
  22284. }
  22285. else {
  22286. envelope = (undampedFreq) => {
  22287. const a = Math.exp(-undampedFreq * duration);
  22288. const b = (undampedFreq - velocity) * duration + 1;
  22289. return -safeMin + a * b;
  22290. };
  22291. derivative = (undampedFreq) => {
  22292. const a = Math.exp(-undampedFreq * duration);
  22293. const b = (velocity - undampedFreq) * (duration * duration);
  22294. return a * b;
  22295. };
  22296. }
  22297. const initialGuess = 5 / duration;
  22298. const undampedFreq = approximateRoot(envelope, derivative, initialGuess);
  22299. duration = duration * 1000;
  22300. if (isNaN(undampedFreq)) {
  22301. return {
  22302. stiffness: 100,
  22303. damping: 10,
  22304. duration,
  22305. };
  22306. }
  22307. else {
  22308. const stiffness = Math.pow(undampedFreq, 2) * mass;
  22309. return {
  22310. stiffness,
  22311. damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
  22312. duration,
  22313. };
  22314. }
  22315. }
  22316. const rootIterations = 12;
  22317. function approximateRoot(envelope, derivative, initialGuess) {
  22318. let result = initialGuess;
  22319. for (let i = 1; i < rootIterations; i++) {
  22320. result = result - envelope(result) / derivative(result);
  22321. }
  22322. return result;
  22323. }
  22324. function calcAngularFreq(undampedFreq, dampingRatio) {
  22325. return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
  22326. }
  22327. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/generators/spring.mjs
  22328. const durationKeys = ["duration", "bounce"];
  22329. const physicsKeys = ["stiffness", "damping", "mass"];
  22330. function isSpringType(options, keys) {
  22331. return keys.some((key) => options[key] !== undefined);
  22332. }
  22333. function getSpringOptions(options) {
  22334. let springOptions = Object.assign({ velocity: 0.0, stiffness: 100, damping: 10, mass: 1.0, isResolvedFromDuration: false }, options);
  22335. if (!isSpringType(options, physicsKeys) &&
  22336. isSpringType(options, durationKeys)) {
  22337. const derived = findSpring(options);
  22338. springOptions = Object.assign(Object.assign(Object.assign({}, springOptions), derived), { velocity: 0.0, mass: 1.0 });
  22339. springOptions.isResolvedFromDuration = true;
  22340. }
  22341. return springOptions;
  22342. }
  22343. function spring(_a) {
  22344. var { from = 0.0, to = 1.0, restSpeed = 2, restDelta } = _a, options = __rest(_a, ["from", "to", "restSpeed", "restDelta"]);
  22345. const state = { done: false, value: from };
  22346. let { stiffness, damping, mass, velocity, duration, isResolvedFromDuration, } = getSpringOptions(options);
  22347. let resolveSpring = zero;
  22348. let resolveVelocity = zero;
  22349. function createSpring() {
  22350. const initialVelocity = velocity ? -(velocity / 1000) : 0.0;
  22351. const initialDelta = to - from;
  22352. const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
  22353. const undampedAngularFreq = Math.sqrt(stiffness / mass) / 1000;
  22354. if (restDelta === undefined) {
  22355. restDelta = Math.min(Math.abs(to - from) / 100, 0.4);
  22356. }
  22357. if (dampingRatio < 1) {
  22358. const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
  22359. resolveSpring = (t) => {
  22360. const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
  22361. return (to -
  22362. envelope *
  22363. (((initialVelocity +
  22364. dampingRatio * undampedAngularFreq * initialDelta) /
  22365. angularFreq) *
  22366. Math.sin(angularFreq * t) +
  22367. initialDelta * Math.cos(angularFreq * t)));
  22368. };
  22369. resolveVelocity = (t) => {
  22370. const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
  22371. return (dampingRatio *
  22372. undampedAngularFreq *
  22373. envelope *
  22374. ((Math.sin(angularFreq * t) *
  22375. (initialVelocity +
  22376. dampingRatio *
  22377. undampedAngularFreq *
  22378. initialDelta)) /
  22379. angularFreq +
  22380. initialDelta * Math.cos(angularFreq * t)) -
  22381. envelope *
  22382. (Math.cos(angularFreq * t) *
  22383. (initialVelocity +
  22384. dampingRatio *
  22385. undampedAngularFreq *
  22386. initialDelta) -
  22387. angularFreq *
  22388. initialDelta *
  22389. Math.sin(angularFreq * t)));
  22390. };
  22391. }
  22392. else if (dampingRatio === 1) {
  22393. resolveSpring = (t) => to -
  22394. Math.exp(-undampedAngularFreq * t) *
  22395. (initialDelta +
  22396. (initialVelocity + undampedAngularFreq * initialDelta) *
  22397. t);
  22398. }
  22399. else {
  22400. const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
  22401. resolveSpring = (t) => {
  22402. const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
  22403. const freqForT = Math.min(dampedAngularFreq * t, 300);
  22404. return (to -
  22405. (envelope *
  22406. ((initialVelocity +
  22407. dampingRatio * undampedAngularFreq * initialDelta) *
  22408. Math.sinh(freqForT) +
  22409. dampedAngularFreq *
  22410. initialDelta *
  22411. Math.cosh(freqForT))) /
  22412. dampedAngularFreq);
  22413. };
  22414. }
  22415. }
  22416. createSpring();
  22417. return {
  22418. next: (t) => {
  22419. const current = resolveSpring(t);
  22420. if (!isResolvedFromDuration) {
  22421. const currentVelocity = resolveVelocity(t) * 1000;
  22422. const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
  22423. const isBelowDisplacementThreshold = Math.abs(to - current) <= restDelta;
  22424. state.done =
  22425. isBelowVelocityThreshold && isBelowDisplacementThreshold;
  22426. }
  22427. else {
  22428. state.done = t >= duration;
  22429. }
  22430. state.value = state.done ? to : current;
  22431. return state;
  22432. },
  22433. flipTarget: () => {
  22434. velocity = -velocity;
  22435. [from, to] = [to, from];
  22436. createSpring();
  22437. },
  22438. };
  22439. }
  22440. spring.needsInterpolation = (a, b) => typeof a === "string" || typeof b === "string";
  22441. const zero = (_t) => 0;
  22442. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/progress.mjs
  22443. const progress = (from, to, value) => {
  22444. const toFromDifference = to - from;
  22445. return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
  22446. };
  22447. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/utils.mjs
  22448. const utils_clamp = (min, max) => (v) => Math.max(Math.min(v, max), min);
  22449. const sanitize = (v) => (v % 1 ? Number(v.toFixed(5)) : v);
  22450. const floatRegex = /(-)?([\d]*\.?[\d])+/g;
  22451. const colorRegex = /(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi;
  22452. const singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;
  22453. function isString(v) {
  22454. return typeof v === 'string';
  22455. }
  22456. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/numbers/index.mjs
  22457. const number = {
  22458. test: (v) => typeof v === 'number',
  22459. parse: parseFloat,
  22460. transform: (v) => v,
  22461. };
  22462. const alpha = Object.assign(Object.assign({}, number), { transform: utils_clamp(0, 1) });
  22463. const scale = Object.assign(Object.assign({}, number), { default: 1 });
  22464. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/utils.mjs
  22465. const isColorString = (type, testProp) => (v) => {
  22466. return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) ||
  22467. (testProp && Object.prototype.hasOwnProperty.call(v, testProp)));
  22468. };
  22469. const splitColor = (aName, bName, cName) => (v) => {
  22470. if (!isString(v))
  22471. return v;
  22472. const [a, b, c, alpha] = v.match(floatRegex);
  22473. return {
  22474. [aName]: parseFloat(a),
  22475. [bName]: parseFloat(b),
  22476. [cName]: parseFloat(c),
  22477. alpha: alpha !== undefined ? parseFloat(alpha) : 1,
  22478. };
  22479. };
  22480. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/rgba.mjs
  22481. const clampRgbUnit = utils_clamp(0, 255);
  22482. const rgbUnit = Object.assign(Object.assign({}, number), { transform: (v) => Math.round(clampRgbUnit(v)) });
  22483. const rgba_rgba = {
  22484. test: isColorString('rgb', 'red'),
  22485. parse: splitColor('red', 'green', 'blue'),
  22486. transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => 'rgba(' +
  22487. rgbUnit.transform(red) +
  22488. ', ' +
  22489. rgbUnit.transform(green) +
  22490. ', ' +
  22491. rgbUnit.transform(blue) +
  22492. ', ' +
  22493. sanitize(alpha.transform(alpha$1)) +
  22494. ')',
  22495. };
  22496. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/hex.mjs
  22497. function parseHex(v) {
  22498. let r = '';
  22499. let g = '';
  22500. let b = '';
  22501. let a = '';
  22502. if (v.length > 5) {
  22503. r = v.substr(1, 2);
  22504. g = v.substr(3, 2);
  22505. b = v.substr(5, 2);
  22506. a = v.substr(7, 2);
  22507. }
  22508. else {
  22509. r = v.substr(1, 1);
  22510. g = v.substr(2, 1);
  22511. b = v.substr(3, 1);
  22512. a = v.substr(4, 1);
  22513. r += r;
  22514. g += g;
  22515. b += b;
  22516. a += a;
  22517. }
  22518. return {
  22519. red: parseInt(r, 16),
  22520. green: parseInt(g, 16),
  22521. blue: parseInt(b, 16),
  22522. alpha: a ? parseInt(a, 16) / 255 : 1,
  22523. };
  22524. }
  22525. const hex = {
  22526. test: isColorString('#'),
  22527. parse: parseHex,
  22528. transform: rgba_rgba.transform,
  22529. };
  22530. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/numbers/units.mjs
  22531. const createUnitType = (unit) => ({
  22532. test: (v) => isString(v) && v.endsWith(unit) && v.split(' ').length === 1,
  22533. parse: parseFloat,
  22534. transform: (v) => `${v}${unit}`,
  22535. });
  22536. const degrees = createUnitType('deg');
  22537. const percent = createUnitType('%');
  22538. const px = createUnitType('px');
  22539. const vh = createUnitType('vh');
  22540. const vw = createUnitType('vw');
  22541. const progressPercentage = Object.assign(Object.assign({}, percent), { parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100) });
  22542. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/hsla.mjs
  22543. const hsla = {
  22544. test: isColorString('hsl', 'hue'),
  22545. parse: splitColor('hue', 'saturation', 'lightness'),
  22546. transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
  22547. return ('hsla(' +
  22548. Math.round(hue) +
  22549. ', ' +
  22550. percent.transform(sanitize(saturation)) +
  22551. ', ' +
  22552. percent.transform(sanitize(lightness)) +
  22553. ', ' +
  22554. sanitize(alpha.transform(alpha$1)) +
  22555. ')');
  22556. },
  22557. };
  22558. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/hsla-to-rgba.mjs
  22559. function hueToRgb(p, q, t) {
  22560. if (t < 0)
  22561. t += 1;
  22562. if (t > 1)
  22563. t -= 1;
  22564. if (t < 1 / 6)
  22565. return p + (q - p) * 6 * t;
  22566. if (t < 1 / 2)
  22567. return q;
  22568. if (t < 2 / 3)
  22569. return p + (q - p) * (2 / 3 - t) * 6;
  22570. return p;
  22571. }
  22572. function hslaToRgba({ hue, saturation, lightness, alpha }) {
  22573. hue /= 360;
  22574. saturation /= 100;
  22575. lightness /= 100;
  22576. let red = 0;
  22577. let green = 0;
  22578. let blue = 0;
  22579. if (!saturation) {
  22580. red = green = blue = lightness;
  22581. }
  22582. else {
  22583. const q = lightness < 0.5
  22584. ? lightness * (1 + saturation)
  22585. : lightness + saturation - lightness * saturation;
  22586. const p = 2 * lightness - q;
  22587. red = hueToRgb(p, q, hue + 1 / 3);
  22588. green = hueToRgb(p, q, hue);
  22589. blue = hueToRgb(p, q, hue - 1 / 3);
  22590. }
  22591. return {
  22592. red: Math.round(red * 255),
  22593. green: Math.round(green * 255),
  22594. blue: Math.round(blue * 255),
  22595. alpha,
  22596. };
  22597. }
  22598. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/mix-color.mjs
  22599. const mixLinearColor = (from, to, v) => {
  22600. const fromExpo = from * from;
  22601. const toExpo = to * to;
  22602. return Math.sqrt(Math.max(0, v * (toExpo - fromExpo) + fromExpo));
  22603. };
  22604. const colorTypes = [hex, rgba_rgba, hsla];
  22605. const getColorType = (v) => colorTypes.find((type) => type.test(v));
  22606. const notAnimatable = (color) => `'${color}' is not an animatable color. Use the equivalent color code instead.`;
  22607. const mixColor = (from, to) => {
  22608. let fromColorType = getColorType(from);
  22609. let toColorType = getColorType(to);
  22610. invariant(!!fromColorType, notAnimatable(from));
  22611. invariant(!!toColorType, notAnimatable(to));
  22612. let fromColor = fromColorType.parse(from);
  22613. let toColor = toColorType.parse(to);
  22614. if (fromColorType === hsla) {
  22615. fromColor = hslaToRgba(fromColor);
  22616. fromColorType = rgba_rgba;
  22617. }
  22618. if (toColorType === hsla) {
  22619. toColor = hslaToRgba(toColor);
  22620. toColorType = rgba_rgba;
  22621. }
  22622. const blended = Object.assign({}, fromColor);
  22623. return (v) => {
  22624. for (const key in blended) {
  22625. if (key !== "alpha") {
  22626. blended[key] = mixLinearColor(fromColor[key], toColor[key], v);
  22627. }
  22628. }
  22629. blended.alpha = mix(fromColor.alpha, toColor.alpha, v);
  22630. return fromColorType.transform(blended);
  22631. };
  22632. };
  22633. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/index.mjs
  22634. const color = {
  22635. test: (v) => rgba_rgba.test(v) || hex.test(v) || hsla.test(v),
  22636. parse: (v) => {
  22637. if (rgba_rgba.test(v)) {
  22638. return rgba_rgba.parse(v);
  22639. }
  22640. else if (hsla.test(v)) {
  22641. return hsla.parse(v);
  22642. }
  22643. else {
  22644. return hex.parse(v);
  22645. }
  22646. },
  22647. transform: (v) => {
  22648. return isString(v)
  22649. ? v
  22650. : v.hasOwnProperty('red')
  22651. ? rgba_rgba.transform(v)
  22652. : hsla.transform(v);
  22653. },
  22654. };
  22655. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/complex/index.mjs
  22656. const colorToken = '${c}';
  22657. const numberToken = '${n}';
  22658. function test(v) {
  22659. var _a, _b, _c, _d;
  22660. return (isNaN(v) &&
  22661. isString(v) &&
  22662. ((_b = (_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = v.match(colorRegex)) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0);
  22663. }
  22664. function analyse(v) {
  22665. if (typeof v === 'number')
  22666. v = `${v}`;
  22667. const values = [];
  22668. let numColors = 0;
  22669. const colors = v.match(colorRegex);
  22670. if (colors) {
  22671. numColors = colors.length;
  22672. v = v.replace(colorRegex, colorToken);
  22673. values.push(...colors.map(color.parse));
  22674. }
  22675. const numbers = v.match(floatRegex);
  22676. if (numbers) {
  22677. v = v.replace(floatRegex, numberToken);
  22678. values.push(...numbers.map(number.parse));
  22679. }
  22680. return { values, numColors, tokenised: v };
  22681. }
  22682. function complex_parse(v) {
  22683. return analyse(v).values;
  22684. }
  22685. function createTransformer(v) {
  22686. const { values, numColors, tokenised } = analyse(v);
  22687. const numValues = values.length;
  22688. return (v) => {
  22689. let output = tokenised;
  22690. for (let i = 0; i < numValues; i++) {
  22691. output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i]));
  22692. }
  22693. return output;
  22694. };
  22695. }
  22696. const convertNumbersToZero = (v) => typeof v === 'number' ? 0 : v;
  22697. function getAnimatableNone(v) {
  22698. const parsed = complex_parse(v);
  22699. const transformer = createTransformer(v);
  22700. return transformer(parsed.map(convertNumbersToZero));
  22701. }
  22702. const complex = { test, parse: complex_parse, createTransformer, getAnimatableNone };
  22703. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/inc.mjs
  22704. const zeroPoint = {
  22705. x: 0,
  22706. y: 0,
  22707. z: 0
  22708. };
  22709. const isNum = (v) => typeof v === 'number';
  22710. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/pipe.mjs
  22711. const combineFunctions = (a, b) => (v) => b(a(v));
  22712. const pipe = (...transformers) => transformers.reduce(combineFunctions);
  22713. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/mix-complex.mjs
  22714. function getMixer(origin, target) {
  22715. if (isNum(origin)) {
  22716. return (v) => mix(origin, target, v);
  22717. }
  22718. else if (color.test(origin)) {
  22719. return mixColor(origin, target);
  22720. }
  22721. else {
  22722. return mixComplex(origin, target);
  22723. }
  22724. }
  22725. const mixArray = (from, to) => {
  22726. const output = [...from];
  22727. const numValues = output.length;
  22728. const blendValue = from.map((fromThis, i) => getMixer(fromThis, to[i]));
  22729. return (v) => {
  22730. for (let i = 0; i < numValues; i++) {
  22731. output[i] = blendValue[i](v);
  22732. }
  22733. return output;
  22734. };
  22735. };
  22736. const mixObject = (origin, target) => {
  22737. const output = Object.assign(Object.assign({}, origin), target);
  22738. const blendValue = {};
  22739. for (const key in output) {
  22740. if (origin[key] !== undefined && target[key] !== undefined) {
  22741. blendValue[key] = getMixer(origin[key], target[key]);
  22742. }
  22743. }
  22744. return (v) => {
  22745. for (const key in blendValue) {
  22746. output[key] = blendValue[key](v);
  22747. }
  22748. return output;
  22749. };
  22750. };
  22751. function mix_complex_analyse(value) {
  22752. const parsed = complex.parse(value);
  22753. const numValues = parsed.length;
  22754. let numNumbers = 0;
  22755. let numRGB = 0;
  22756. let numHSL = 0;
  22757. for (let i = 0; i < numValues; i++) {
  22758. if (numNumbers || typeof parsed[i] === "number") {
  22759. numNumbers++;
  22760. }
  22761. else {
  22762. if (parsed[i].hue !== undefined) {
  22763. numHSL++;
  22764. }
  22765. else {
  22766. numRGB++;
  22767. }
  22768. }
  22769. }
  22770. return { parsed, numNumbers, numRGB, numHSL };
  22771. }
  22772. const mixComplex = (origin, target) => {
  22773. const template = complex.createTransformer(target);
  22774. const originStats = mix_complex_analyse(origin);
  22775. const targetStats = mix_complex_analyse(target);
  22776. const canInterpolate = originStats.numHSL === targetStats.numHSL &&
  22777. originStats.numRGB === targetStats.numRGB &&
  22778. originStats.numNumbers >= targetStats.numNumbers;
  22779. if (canInterpolate) {
  22780. return pipe(mixArray(originStats.parsed, targetStats.parsed), template);
  22781. }
  22782. else {
  22783. warning(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`);
  22784. return (p) => `${p > 0 ? target : origin}`;
  22785. }
  22786. };
  22787. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/interpolate.mjs
  22788. const mixNumber = (from, to) => (p) => mix(from, to, p);
  22789. function detectMixerFactory(v) {
  22790. if (typeof v === 'number') {
  22791. return mixNumber;
  22792. }
  22793. else if (typeof v === 'string') {
  22794. if (color.test(v)) {
  22795. return mixColor;
  22796. }
  22797. else {
  22798. return mixComplex;
  22799. }
  22800. }
  22801. else if (Array.isArray(v)) {
  22802. return mixArray;
  22803. }
  22804. else if (typeof v === 'object') {
  22805. return mixObject;
  22806. }
  22807. }
  22808. function createMixers(output, ease, customMixer) {
  22809. const mixers = [];
  22810. const mixerFactory = customMixer || detectMixerFactory(output[0]);
  22811. const numMixers = output.length - 1;
  22812. for (let i = 0; i < numMixers; i++) {
  22813. let mixer = mixerFactory(output[i], output[i + 1]);
  22814. if (ease) {
  22815. const easingFunction = Array.isArray(ease) ? ease[i] : ease;
  22816. mixer = pipe(easingFunction, mixer);
  22817. }
  22818. mixers.push(mixer);
  22819. }
  22820. return mixers;
  22821. }
  22822. function fastInterpolate([from, to], [mixer]) {
  22823. return (v) => mixer(progress(from, to, v));
  22824. }
  22825. function slowInterpolate(input, mixers) {
  22826. const inputLength = input.length;
  22827. const lastInputIndex = inputLength - 1;
  22828. return (v) => {
  22829. let mixerIndex = 0;
  22830. let foundMixerIndex = false;
  22831. if (v <= input[0]) {
  22832. foundMixerIndex = true;
  22833. }
  22834. else if (v >= input[lastInputIndex]) {
  22835. mixerIndex = lastInputIndex - 1;
  22836. foundMixerIndex = true;
  22837. }
  22838. if (!foundMixerIndex) {
  22839. let i = 1;
  22840. for (; i < inputLength; i++) {
  22841. if (input[i] > v || i === lastInputIndex) {
  22842. break;
  22843. }
  22844. }
  22845. mixerIndex = i - 1;
  22846. }
  22847. const progressInRange = progress(input[mixerIndex], input[mixerIndex + 1], v);
  22848. return mixers[mixerIndex](progressInRange);
  22849. };
  22850. }
  22851. function interpolate(input, output, { clamp: isClamp = true, ease, mixer } = {}) {
  22852. const inputLength = input.length;
  22853. invariant(inputLength === output.length, 'Both input and output ranges must be the same length');
  22854. invariant(!ease || !Array.isArray(ease) || ease.length === inputLength - 1, 'Array of easing functions must be of length `input.length - 1`, as it applies to the transitions **between** the defined values.');
  22855. if (input[0] > input[inputLength - 1]) {
  22856. input = [].concat(input);
  22857. output = [].concat(output);
  22858. input.reverse();
  22859. output.reverse();
  22860. }
  22861. const mixers = createMixers(output, ease, mixer);
  22862. const interpolator = inputLength === 2
  22863. ? fastInterpolate(input, mixers)
  22864. : slowInterpolate(input, mixers);
  22865. return isClamp
  22866. ? (v) => interpolator(clamp(input[0], input[inputLength - 1], v))
  22867. : interpolator;
  22868. }
  22869. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/easing/utils.mjs
  22870. const reverseEasing = easing => p => 1 - easing(1 - p);
  22871. const mirrorEasing = easing => p => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;
  22872. const createExpoIn = (power) => p => Math.pow(p, power);
  22873. const createBackIn = (power) => p => p * p * ((power + 1) * p - power);
  22874. const createAnticipate = (power) => {
  22875. const backEasing = createBackIn(power);
  22876. return p => (p *= 2) < 1
  22877. ? 0.5 * backEasing(p)
  22878. : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
  22879. };
  22880. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/easing/index.mjs
  22881. const DEFAULT_OVERSHOOT_STRENGTH = 1.525;
  22882. const BOUNCE_FIRST_THRESHOLD = 4.0 / 11.0;
  22883. const BOUNCE_SECOND_THRESHOLD = 8.0 / 11.0;
  22884. const BOUNCE_THIRD_THRESHOLD = 9.0 / 10.0;
  22885. const linear = p => p;
  22886. const easeIn = createExpoIn(2);
  22887. const easeOut = reverseEasing(easeIn);
  22888. const easeInOut = mirrorEasing(easeIn);
  22889. const circIn = p => 1 - Math.sin(Math.acos(p));
  22890. const circOut = reverseEasing(circIn);
  22891. const circInOut = mirrorEasing(circOut);
  22892. const backIn = createBackIn(DEFAULT_OVERSHOOT_STRENGTH);
  22893. const backOut = reverseEasing(backIn);
  22894. const backInOut = mirrorEasing(backIn);
  22895. const anticipate = createAnticipate(DEFAULT_OVERSHOOT_STRENGTH);
  22896. const ca = 4356.0 / 361.0;
  22897. const cb = 35442.0 / 1805.0;
  22898. const cc = 16061.0 / 1805.0;
  22899. const bounceOut = (p) => {
  22900. if (p === 1 || p === 0)
  22901. return p;
  22902. const p2 = p * p;
  22903. return p < BOUNCE_FIRST_THRESHOLD
  22904. ? 7.5625 * p2
  22905. : p < BOUNCE_SECOND_THRESHOLD
  22906. ? 9.075 * p2 - 9.9 * p + 3.4
  22907. : p < BOUNCE_THIRD_THRESHOLD
  22908. ? ca * p2 - cb * p + cc
  22909. : 10.8 * p * p - 20.52 * p + 10.72;
  22910. };
  22911. const bounceIn = reverseEasing(bounceOut);
  22912. const bounceInOut = (p) => p < 0.5
  22913. ? 0.5 * (1.0 - bounceOut(1.0 - p * 2.0))
  22914. : 0.5 * bounceOut(p * 2.0 - 1.0) + 0.5;
  22915. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/generators/keyframes.mjs
  22916. function defaultEasing(values, easing) {
  22917. return values.map(() => easing || easeInOut).splice(0, values.length - 1);
  22918. }
  22919. function defaultOffset(values) {
  22920. const numValues = values.length;
  22921. return values.map((_value, i) => i !== 0 ? i / (numValues - 1) : 0);
  22922. }
  22923. function convertOffsetToTimes(offset, duration) {
  22924. return offset.map((o) => o * duration);
  22925. }
  22926. function keyframes_keyframes({ from = 0, to = 1, ease, offset, duration = 300, }) {
  22927. const state = { done: false, value: from };
  22928. const values = Array.isArray(to) ? to : [from, to];
  22929. const times = convertOffsetToTimes(offset && offset.length === values.length
  22930. ? offset
  22931. : defaultOffset(values), duration);
  22932. function createInterpolator() {
  22933. return interpolate(times, values, {
  22934. ease: Array.isArray(ease) ? ease : defaultEasing(values, ease),
  22935. });
  22936. }
  22937. let interpolator = createInterpolator();
  22938. return {
  22939. next: (t) => {
  22940. state.value = interpolator(t);
  22941. state.done = t >= duration;
  22942. return state;
  22943. },
  22944. flipTarget: () => {
  22945. values.reverse();
  22946. interpolator = createInterpolator();
  22947. },
  22948. };
  22949. }
  22950. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/generators/decay.mjs
  22951. function decay({ velocity = 0, from = 0, power = 0.8, timeConstant = 350, restDelta = 0.5, modifyTarget, }) {
  22952. const state = { done: false, value: from };
  22953. let amplitude = power * velocity;
  22954. const ideal = from + amplitude;
  22955. const target = modifyTarget === undefined ? ideal : modifyTarget(ideal);
  22956. if (target !== ideal)
  22957. amplitude = target - from;
  22958. return {
  22959. next: (t) => {
  22960. const delta = -amplitude * Math.exp(-t / timeConstant);
  22961. state.done = !(delta > restDelta || delta < -restDelta);
  22962. state.value = state.done ? target : target + delta;
  22963. return state;
  22964. },
  22965. flipTarget: () => { },
  22966. };
  22967. }
  22968. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/utils/detect-animation-from-options.mjs
  22969. const types = { keyframes: keyframes_keyframes, spring: spring, decay: decay };
  22970. function detectAnimationFromOptions(config) {
  22971. if (Array.isArray(config.to)) {
  22972. return keyframes_keyframes;
  22973. }
  22974. else if (types[config.type]) {
  22975. return types[config.type];
  22976. }
  22977. const keys = new Set(Object.keys(config));
  22978. if (keys.has("ease") ||
  22979. (keys.has("duration") && !keys.has("dampingRatio"))) {
  22980. return keyframes_keyframes;
  22981. }
  22982. else if (keys.has("dampingRatio") ||
  22983. keys.has("stiffness") ||
  22984. keys.has("mass") ||
  22985. keys.has("damping") ||
  22986. keys.has("restSpeed") ||
  22987. keys.has("restDelta")) {
  22988. return spring;
  22989. }
  22990. return keyframes_keyframes;
  22991. }
  22992. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/utils/elapsed.mjs
  22993. function loopElapsed(elapsed, duration, delay = 0) {
  22994. return elapsed - duration - delay;
  22995. }
  22996. function reverseElapsed(elapsed, duration, delay = 0, isForwardPlayback = true) {
  22997. return isForwardPlayback
  22998. ? loopElapsed(duration + -elapsed, duration, delay)
  22999. : duration - (elapsed - duration) + delay;
  23000. }
  23001. function hasRepeatDelayElapsed(elapsed, duration, delay, isForwardPlayback) {
  23002. return isForwardPlayback ? elapsed >= duration + delay : elapsed <= -delay;
  23003. }
  23004. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/index.mjs
  23005. const framesync = (update) => {
  23006. const passTimestamp = ({ delta }) => update(delta);
  23007. return {
  23008. start: () => es.update(passTimestamp, true),
  23009. stop: () => cancelSync.update(passTimestamp),
  23010. };
  23011. };
  23012. function animate(_a) {
  23013. var _b, _c;
  23014. var { from, autoplay = true, driver = framesync, elapsed = 0, repeat: repeatMax = 0, repeatType = "loop", repeatDelay = 0, onPlay, onStop, onComplete, onRepeat, onUpdate } = _a, options = __rest(_a, ["from", "autoplay", "driver", "elapsed", "repeat", "repeatType", "repeatDelay", "onPlay", "onStop", "onComplete", "onRepeat", "onUpdate"]);
  23015. let { to } = options;
  23016. let driverControls;
  23017. let repeatCount = 0;
  23018. let computedDuration = options.duration;
  23019. let latest;
  23020. let isComplete = false;
  23021. let isForwardPlayback = true;
  23022. let interpolateFromNumber;
  23023. const animator = detectAnimationFromOptions(options);
  23024. if ((_c = (_b = animator).needsInterpolation) === null || _c === void 0 ? void 0 : _c.call(_b, from, to)) {
  23025. interpolateFromNumber = interpolate([0, 100], [from, to], {
  23026. clamp: false,
  23027. });
  23028. from = 0;
  23029. to = 100;
  23030. }
  23031. const animation = animator(Object.assign(Object.assign({}, options), { from, to }));
  23032. function repeat() {
  23033. repeatCount++;
  23034. if (repeatType === "reverse") {
  23035. isForwardPlayback = repeatCount % 2 === 0;
  23036. elapsed = reverseElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback);
  23037. }
  23038. else {
  23039. elapsed = loopElapsed(elapsed, computedDuration, repeatDelay);
  23040. if (repeatType === "mirror")
  23041. animation.flipTarget();
  23042. }
  23043. isComplete = false;
  23044. onRepeat && onRepeat();
  23045. }
  23046. function complete() {
  23047. driverControls.stop();
  23048. onComplete && onComplete();
  23049. }
  23050. function update(delta) {
  23051. if (!isForwardPlayback)
  23052. delta = -delta;
  23053. elapsed += delta;
  23054. if (!isComplete) {
  23055. const state = animation.next(Math.max(0, elapsed));
  23056. latest = state.value;
  23057. if (interpolateFromNumber)
  23058. latest = interpolateFromNumber(latest);
  23059. isComplete = isForwardPlayback ? state.done : elapsed <= 0;
  23060. }
  23061. onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(latest);
  23062. if (isComplete) {
  23063. if (repeatCount === 0)
  23064. computedDuration !== null && computedDuration !== void 0 ? computedDuration : (computedDuration = elapsed);
  23065. if (repeatCount < repeatMax) {
  23066. hasRepeatDelayElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback) && repeat();
  23067. }
  23068. else {
  23069. complete();
  23070. }
  23071. }
  23072. }
  23073. function play() {
  23074. onPlay === null || onPlay === void 0 ? void 0 : onPlay();
  23075. driverControls = driver(update);
  23076. driverControls.start();
  23077. }
  23078. autoplay && play();
  23079. return {
  23080. stop: () => {
  23081. onStop === null || onStop === void 0 ? void 0 : onStop();
  23082. driverControls.stop();
  23083. },
  23084. };
  23085. }
  23086. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/inertia.mjs
  23087. function inertia({ from = 0, velocity = 0, min, max, power = 0.8, timeConstant = 750, bounceStiffness = 500, bounceDamping = 10, restDelta = 1, modifyTarget, driver, onUpdate, onComplete, onStop, }) {
  23088. let currentAnimation;
  23089. function isOutOfBounds(v) {
  23090. return (min !== undefined && v < min) || (max !== undefined && v > max);
  23091. }
  23092. function boundaryNearest(v) {
  23093. if (min === undefined)
  23094. return max;
  23095. if (max === undefined)
  23096. return min;
  23097. return Math.abs(min - v) < Math.abs(max - v) ? min : max;
  23098. }
  23099. function startAnimation(options) {
  23100. currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.stop();
  23101. currentAnimation = animate(Object.assign(Object.assign({}, options), { driver, onUpdate: (v) => {
  23102. var _a;
  23103. onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(v);
  23104. (_a = options.onUpdate) === null || _a === void 0 ? void 0 : _a.call(options, v);
  23105. }, onComplete,
  23106. onStop }));
  23107. }
  23108. function startSpring(options) {
  23109. startAnimation(Object.assign({ type: "spring", stiffness: bounceStiffness, damping: bounceDamping, restDelta }, options));
  23110. }
  23111. if (isOutOfBounds(from)) {
  23112. startSpring({ from, velocity, to: boundaryNearest(from) });
  23113. }
  23114. else {
  23115. let target = power * velocity + from;
  23116. if (typeof modifyTarget !== "undefined")
  23117. target = modifyTarget(target);
  23118. const boundary = boundaryNearest(target);
  23119. const heading = boundary === min ? -1 : 1;
  23120. let prev;
  23121. let current;
  23122. const checkBoundary = (v) => {
  23123. prev = current;
  23124. current = v;
  23125. velocity = velocityPerSecond(v - prev, getFrameData().delta);
  23126. if ((heading === 1 && v > boundary) ||
  23127. (heading === -1 && v < boundary)) {
  23128. startSpring({ from: v, to: boundary, velocity });
  23129. }
  23130. };
  23131. startAnimation({
  23132. type: "decay",
  23133. from,
  23134. velocity,
  23135. timeConstant,
  23136. power,
  23137. restDelta,
  23138. modifyTarget,
  23139. onUpdate: isOutOfBounds(target) ? checkBoundary : undefined,
  23140. });
  23141. }
  23142. return {
  23143. stop: () => currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.stop(),
  23144. };
  23145. }
  23146. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/time-conversion.mjs
  23147. /**
  23148. * Converts seconds to milliseconds
  23149. *
  23150. * @param seconds - Time in seconds.
  23151. * @return milliseconds - Converted time in milliseconds.
  23152. */
  23153. var secondsToMilliseconds = function (seconds) { return seconds * 1000; };
  23154. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/easing/cubic-bezier.mjs
  23155. const cubic_bezier_a = (a1, a2) => 1.0 - 3.0 * a2 + 3.0 * a1;
  23156. const cubic_bezier_b = (a1, a2) => 3.0 * a2 - 6.0 * a1;
  23157. const cubic_bezier_c = (a1) => 3.0 * a1;
  23158. const calcBezier = (t, a1, a2) => ((cubic_bezier_a(a1, a2) * t + cubic_bezier_b(a1, a2)) * t + cubic_bezier_c(a1)) * t;
  23159. const getSlope = (t, a1, a2) => 3.0 * cubic_bezier_a(a1, a2) * t * t + 2.0 * cubic_bezier_b(a1, a2) * t + cubic_bezier_c(a1);
  23160. const subdivisionPrecision = 0.0000001;
  23161. const subdivisionMaxIterations = 10;
  23162. function binarySubdivide(aX, aA, aB, mX1, mX2) {
  23163. let currentX;
  23164. let currentT;
  23165. let i = 0;
  23166. do {
  23167. currentT = aA + (aB - aA) / 2.0;
  23168. currentX = calcBezier(currentT, mX1, mX2) - aX;
  23169. if (currentX > 0.0) {
  23170. aB = currentT;
  23171. }
  23172. else {
  23173. aA = currentT;
  23174. }
  23175. } while (Math.abs(currentX) > subdivisionPrecision &&
  23176. ++i < subdivisionMaxIterations);
  23177. return currentT;
  23178. }
  23179. const newtonIterations = 8;
  23180. const newtonMinSlope = 0.001;
  23181. function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
  23182. for (let i = 0; i < newtonIterations; ++i) {
  23183. const currentSlope = getSlope(aGuessT, mX1, mX2);
  23184. if (currentSlope === 0.0) {
  23185. return aGuessT;
  23186. }
  23187. const currentX = calcBezier(aGuessT, mX1, mX2) - aX;
  23188. aGuessT -= currentX / currentSlope;
  23189. }
  23190. return aGuessT;
  23191. }
  23192. const kSplineTableSize = 11;
  23193. const kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
  23194. function cubicBezier(mX1, mY1, mX2, mY2) {
  23195. if (mX1 === mY1 && mX2 === mY2)
  23196. return linear;
  23197. const sampleValues = new Float32Array(kSplineTableSize);
  23198. for (let i = 0; i < kSplineTableSize; ++i) {
  23199. sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
  23200. }
  23201. function getTForX(aX) {
  23202. let intervalStart = 0.0;
  23203. let currentSample = 1;
  23204. const lastSample = kSplineTableSize - 1;
  23205. for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
  23206. intervalStart += kSampleStepSize;
  23207. }
  23208. --currentSample;
  23209. const dist = (aX - sampleValues[currentSample]) /
  23210. (sampleValues[currentSample + 1] - sampleValues[currentSample]);
  23211. const guessForT = intervalStart + dist * kSampleStepSize;
  23212. const initialSlope = getSlope(guessForT, mX1, mX2);
  23213. if (initialSlope >= newtonMinSlope) {
  23214. return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
  23215. }
  23216. else if (initialSlope === 0.0) {
  23217. return guessForT;
  23218. }
  23219. else {
  23220. return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
  23221. }
  23222. }
  23223. return (t) => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);
  23224. }
  23225. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/easing.mjs
  23226. var easingLookup = {
  23227. linear: linear,
  23228. easeIn: easeIn,
  23229. easeInOut: easeInOut,
  23230. easeOut: easeOut,
  23231. circIn: circIn,
  23232. circInOut: circInOut,
  23233. circOut: circOut,
  23234. backIn: backIn,
  23235. backInOut: backInOut,
  23236. backOut: backOut,
  23237. anticipate: anticipate,
  23238. bounceIn: bounceIn,
  23239. bounceInOut: bounceInOut,
  23240. bounceOut: bounceOut,
  23241. };
  23242. var easingDefinitionToFunction = function (definition) {
  23243. if (Array.isArray(definition)) {
  23244. // If cubic bezier definition, create bezier curve
  23245. invariant(definition.length === 4, "Cubic bezier arrays must contain four numerical values.");
  23246. var _a = tslib_es6_read(definition, 4), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];
  23247. return cubicBezier(x1, y1, x2, y2);
  23248. }
  23249. else if (typeof definition === "string") {
  23250. // Else lookup from table
  23251. invariant(easingLookup[definition] !== undefined, "Invalid easing type '".concat(definition, "'"));
  23252. return easingLookup[definition];
  23253. }
  23254. return definition;
  23255. };
  23256. var isEasingArray = function (ease) {
  23257. return Array.isArray(ease) && typeof ease[0] !== "number";
  23258. };
  23259. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-animatable.mjs
  23260. /**
  23261. * Check if a value is animatable. Examples:
  23262. *
  23263. * ✅: 100, "100px", "#fff"
  23264. * ❌: "block", "url(2.jpg)"
  23265. * @param value
  23266. *
  23267. * @internal
  23268. */
  23269. var isAnimatable = function (key, value) {
  23270. // If the list of keys tat might be non-animatable grows, replace with Set
  23271. if (key === "zIndex")
  23272. return false;
  23273. // If it's a number or a keyframes array, we can animate it. We might at some point
  23274. // need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,
  23275. // but for now lets leave it like this for performance reasons
  23276. if (typeof value === "number" || Array.isArray(value))
  23277. return true;
  23278. if (typeof value === "string" && // It's animatable if we have a string
  23279. complex.test(value) && // And it contains numbers and/or colors
  23280. !value.startsWith("url(") // Unless it starts with "url("
  23281. ) {
  23282. return true;
  23283. }
  23284. return false;
  23285. };
  23286. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs
  23287. var isKeyframesTarget = function (v) {
  23288. return Array.isArray(v);
  23289. };
  23290. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/default-transitions.mjs
  23291. var underDampedSpring = function () { return ({
  23292. type: "spring",
  23293. stiffness: 500,
  23294. damping: 25,
  23295. restSpeed: 10,
  23296. }); };
  23297. var criticallyDampedSpring = function (to) { return ({
  23298. type: "spring",
  23299. stiffness: 550,
  23300. damping: to === 0 ? 2 * Math.sqrt(550) : 30,
  23301. restSpeed: 10,
  23302. }); };
  23303. var linearTween = function () { return ({
  23304. type: "keyframes",
  23305. ease: "linear",
  23306. duration: 0.3,
  23307. }); };
  23308. var default_transitions_keyframes = function (values) { return ({
  23309. type: "keyframes",
  23310. duration: 0.8,
  23311. values: values,
  23312. }); };
  23313. var defaultTransitions = {
  23314. x: underDampedSpring,
  23315. y: underDampedSpring,
  23316. z: underDampedSpring,
  23317. rotate: underDampedSpring,
  23318. rotateX: underDampedSpring,
  23319. rotateY: underDampedSpring,
  23320. rotateZ: underDampedSpring,
  23321. scaleX: criticallyDampedSpring,
  23322. scaleY: criticallyDampedSpring,
  23323. scale: criticallyDampedSpring,
  23324. opacity: linearTween,
  23325. backgroundColor: linearTween,
  23326. color: linearTween,
  23327. default: criticallyDampedSpring,
  23328. };
  23329. var getDefaultTransition = function (valueKey, to) {
  23330. var transitionFactory;
  23331. if (isKeyframesTarget(to)) {
  23332. transitionFactory = default_transitions_keyframes;
  23333. }
  23334. else {
  23335. transitionFactory =
  23336. defaultTransitions[valueKey] || defaultTransitions.default;
  23337. }
  23338. return __assign({ to: to }, transitionFactory(to));
  23339. };
  23340. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/complex/filter.mjs
  23341. const maxDefaults = new Set(['brightness', 'contrast', 'saturate', 'opacity']);
  23342. function applyDefaultFilter(v) {
  23343. let [name, value] = v.slice(0, -1).split('(');
  23344. if (name === 'drop-shadow')
  23345. return v;
  23346. const [number] = value.match(floatRegex) || [];
  23347. if (!number)
  23348. return v;
  23349. const unit = value.replace(number, '');
  23350. let defaultValue = maxDefaults.has(name) ? 1 : 0;
  23351. if (number !== value)
  23352. defaultValue *= 100;
  23353. return name + '(' + defaultValue + unit + ')';
  23354. }
  23355. const functionRegex = /([a-z-]*)\(.*?\)/g;
  23356. const filter = Object.assign(Object.assign({}, complex), { getAnimatableNone: (v) => {
  23357. const functions = v.match(functionRegex);
  23358. return functions ? functions.map(applyDefaultFilter).join(' ') : v;
  23359. } });
  23360. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/type-int.mjs
  23361. var type_int_int = __assign(__assign({}, number), { transform: Math.round });
  23362. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/number.mjs
  23363. var numberValueTypes = {
  23364. // Border props
  23365. borderWidth: px,
  23366. borderTopWidth: px,
  23367. borderRightWidth: px,
  23368. borderBottomWidth: px,
  23369. borderLeftWidth: px,
  23370. borderRadius: px,
  23371. radius: px,
  23372. borderTopLeftRadius: px,
  23373. borderTopRightRadius: px,
  23374. borderBottomRightRadius: px,
  23375. borderBottomLeftRadius: px,
  23376. // Positioning props
  23377. width: px,
  23378. maxWidth: px,
  23379. height: px,
  23380. maxHeight: px,
  23381. size: px,
  23382. top: px,
  23383. right: px,
  23384. bottom: px,
  23385. left: px,
  23386. // Spacing props
  23387. padding: px,
  23388. paddingTop: px,
  23389. paddingRight: px,
  23390. paddingBottom: px,
  23391. paddingLeft: px,
  23392. margin: px,
  23393. marginTop: px,
  23394. marginRight: px,
  23395. marginBottom: px,
  23396. marginLeft: px,
  23397. // Transform props
  23398. rotate: degrees,
  23399. rotateX: degrees,
  23400. rotateY: degrees,
  23401. rotateZ: degrees,
  23402. scale: scale,
  23403. scaleX: scale,
  23404. scaleY: scale,
  23405. scaleZ: scale,
  23406. skew: degrees,
  23407. skewX: degrees,
  23408. skewY: degrees,
  23409. distance: px,
  23410. translateX: px,
  23411. translateY: px,
  23412. translateZ: px,
  23413. x: px,
  23414. y: px,
  23415. z: px,
  23416. perspective: px,
  23417. transformPerspective: px,
  23418. opacity: alpha,
  23419. originX: progressPercentage,
  23420. originY: progressPercentage,
  23421. originZ: px,
  23422. // Misc
  23423. zIndex: type_int_int,
  23424. // SVG
  23425. fillOpacity: alpha,
  23426. strokeOpacity: alpha,
  23427. numOctaves: type_int_int,
  23428. };
  23429. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/defaults.mjs
  23430. /**
  23431. * A map of default value types for common values
  23432. */
  23433. var defaultValueTypes = __assign(__assign({}, numberValueTypes), {
  23434. // Color props
  23435. color: color, backgroundColor: color, outlineColor: color, fill: color, stroke: color,
  23436. // Border props
  23437. borderColor: color, borderTopColor: color, borderRightColor: color, borderBottomColor: color, borderLeftColor: color, filter: filter, WebkitFilter: filter });
  23438. /**
  23439. * Gets the default ValueType for the provided value key
  23440. */
  23441. var getDefaultValueType = function (key) { return defaultValueTypes[key]; };
  23442. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs
  23443. function animatable_none_getAnimatableNone(key, value) {
  23444. var _a;
  23445. var defaultValueType = getDefaultValueType(key);
  23446. if (defaultValueType !== filter)
  23447. defaultValueType = complex;
  23448. // If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
  23449. return (_a = defaultValueType.getAnimatableNone) === null || _a === void 0 ? void 0 : _a.call(defaultValueType, value);
  23450. }
  23451. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-instant-transition-state.mjs
  23452. var instantAnimationState = {
  23453. current: false,
  23454. };
  23455. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/resolve-value.mjs
  23456. var isCustomValue = function (v) {
  23457. return Boolean(v && typeof v === "object" && v.mix && v.toValue);
  23458. };
  23459. var resolveFinalValueInKeyframes = function (v) {
  23460. // TODO maybe throw if v.length - 1 is placeholder token?
  23461. return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
  23462. };
  23463. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/transitions.mjs
  23464. /**
  23465. * Decide whether a transition is defined on a given Transition.
  23466. * This filters out orchestration options and returns true
  23467. * if any options are left.
  23468. */
  23469. function isTransitionDefined(_a) {
  23470. _a.when; _a.delay; _a.delayChildren; _a.staggerChildren; _a.staggerDirection; _a.repeat; _a.repeatType; _a.repeatDelay; _a.from; var transition = __rest(_a, ["when", "delay", "delayChildren", "staggerChildren", "staggerDirection", "repeat", "repeatType", "repeatDelay", "from"]);
  23471. return !!Object.keys(transition).length;
  23472. }
  23473. var legacyRepeatWarning = false;
  23474. /**
  23475. * Convert Framer Motion's Transition type into Popmotion-compatible options.
  23476. */
  23477. function convertTransitionToAnimationOptions(_a) {
  23478. var ease = _a.ease, times = _a.times, yoyo = _a.yoyo, flip = _a.flip, loop = _a.loop, transition = __rest(_a, ["ease", "times", "yoyo", "flip", "loop"]);
  23479. var options = __assign({}, transition);
  23480. if (times)
  23481. options["offset"] = times;
  23482. /**
  23483. * Convert any existing durations from seconds to milliseconds
  23484. */
  23485. if (transition.duration)
  23486. options["duration"] = secondsToMilliseconds(transition.duration);
  23487. if (transition.repeatDelay)
  23488. options.repeatDelay = secondsToMilliseconds(transition.repeatDelay);
  23489. /**
  23490. * Map easing names to Popmotion's easing functions
  23491. */
  23492. if (ease) {
  23493. options["ease"] = isEasingArray(ease)
  23494. ? ease.map(easingDefinitionToFunction)
  23495. : easingDefinitionToFunction(ease);
  23496. }
  23497. /**
  23498. * Support legacy transition API
  23499. */
  23500. if (transition.type === "tween")
  23501. options.type = "keyframes";
  23502. /**
  23503. * TODO: These options are officially removed from the API.
  23504. */
  23505. if (yoyo || loop || flip) {
  23506. warning(!legacyRepeatWarning, "yoyo, loop and flip have been removed from the API. Replace with repeat and repeatType options.");
  23507. legacyRepeatWarning = true;
  23508. if (yoyo) {
  23509. options.repeatType = "reverse";
  23510. }
  23511. else if (loop) {
  23512. options.repeatType = "loop";
  23513. }
  23514. else if (flip) {
  23515. options.repeatType = "mirror";
  23516. }
  23517. options.repeat = loop || yoyo || flip || transition.repeat;
  23518. }
  23519. /**
  23520. * TODO: Popmotion 9 has the ability to automatically detect whether to use
  23521. * a keyframes or spring animation, but does so by detecting velocity and other spring options.
  23522. * It'd be good to introduce a similar thing here.
  23523. */
  23524. if (transition.type !== "spring")
  23525. options.type = "keyframes";
  23526. return options;
  23527. }
  23528. /**
  23529. * Get the delay for a value by checking Transition with decreasing specificity.
  23530. */
  23531. function getDelayFromTransition(transition, key) {
  23532. var _a, _b;
  23533. var valueTransition = getValueTransition(transition, key) || {};
  23534. return (_b = (_a = valueTransition.delay) !== null && _a !== void 0 ? _a : transition.delay) !== null && _b !== void 0 ? _b : 0;
  23535. }
  23536. function hydrateKeyframes(options) {
  23537. if (Array.isArray(options.to) && options.to[0] === null) {
  23538. options.to = tslib_es6_spreadArray([], tslib_es6_read(options.to), false);
  23539. options.to[0] = options.from;
  23540. }
  23541. return options;
  23542. }
  23543. function getPopmotionAnimationOptions(transition, options, key) {
  23544. var _a;
  23545. if (Array.isArray(options.to)) {
  23546. (_a = transition.duration) !== null && _a !== void 0 ? _a : (transition.duration = 0.8);
  23547. }
  23548. hydrateKeyframes(options);
  23549. /**
  23550. * Get a default transition if none is determined to be defined.
  23551. */
  23552. if (!isTransitionDefined(transition)) {
  23553. transition = __assign(__assign({}, transition), getDefaultTransition(key, options.to));
  23554. }
  23555. return __assign(__assign({}, options), convertTransitionToAnimationOptions(transition));
  23556. }
  23557. /**
  23558. *
  23559. */
  23560. function getAnimation(key, value, target, transition, onComplete) {
  23561. var _a;
  23562. var valueTransition = getValueTransition(transition, key);
  23563. var origin = (_a = valueTransition.from) !== null && _a !== void 0 ? _a : value.get();
  23564. var isTargetAnimatable = isAnimatable(key, target);
  23565. if (origin === "none" && isTargetAnimatable && typeof target === "string") {
  23566. /**
  23567. * If we're trying to animate from "none", try and get an animatable version
  23568. * of the target. This could be improved to work both ways.
  23569. */
  23570. origin = animatable_none_getAnimatableNone(key, target);
  23571. }
  23572. else if (isZero(origin) && typeof target === "string") {
  23573. origin = getZeroUnit(target);
  23574. }
  23575. else if (!Array.isArray(target) &&
  23576. isZero(target) &&
  23577. typeof origin === "string") {
  23578. target = getZeroUnit(origin);
  23579. }
  23580. var isOriginAnimatable = isAnimatable(key, origin);
  23581. warning(isOriginAnimatable === isTargetAnimatable, "You are trying to animate ".concat(key, " from \"").concat(origin, "\" to \"").concat(target, "\". ").concat(origin, " is not an animatable value - to enable this animation set ").concat(origin, " to a value animatable to ").concat(target, " via the `style` property."));
  23582. function start() {
  23583. var options = {
  23584. from: origin,
  23585. to: target,
  23586. velocity: value.getVelocity(),
  23587. onComplete: onComplete,
  23588. onUpdate: function (v) { return value.set(v); },
  23589. };
  23590. return valueTransition.type === "inertia" ||
  23591. valueTransition.type === "decay"
  23592. ? inertia(__assign(__assign({}, options), valueTransition))
  23593. : animate(__assign(__assign({}, getPopmotionAnimationOptions(valueTransition, options, key)), { onUpdate: function (v) {
  23594. var _a;
  23595. options.onUpdate(v);
  23596. (_a = valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, v);
  23597. }, onComplete: function () {
  23598. var _a;
  23599. options.onComplete();
  23600. (_a = valueTransition.onComplete) === null || _a === void 0 ? void 0 : _a.call(valueTransition);
  23601. } }));
  23602. }
  23603. function set() {
  23604. var _a, _b;
  23605. var finalTarget = resolveFinalValueInKeyframes(target);
  23606. value.set(finalTarget);
  23607. onComplete();
  23608. (_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, finalTarget);
  23609. (_b = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onComplete) === null || _b === void 0 ? void 0 : _b.call(valueTransition);
  23610. return { stop: function () { } };
  23611. }
  23612. return !isOriginAnimatable ||
  23613. !isTargetAnimatable ||
  23614. valueTransition.type === false
  23615. ? set
  23616. : start;
  23617. }
  23618. function isZero(value) {
  23619. return (value === 0 ||
  23620. (typeof value === "string" &&
  23621. parseFloat(value) === 0 &&
  23622. value.indexOf(" ") === -1));
  23623. }
  23624. function getZeroUnit(potentialUnitType) {
  23625. return typeof potentialUnitType === "number"
  23626. ? 0
  23627. : animatable_none_getAnimatableNone("", potentialUnitType);
  23628. }
  23629. function getValueTransition(transition, key) {
  23630. return transition[key] || transition["default"] || transition;
  23631. }
  23632. /**
  23633. * Start animation on a MotionValue. This function is an interface between
  23634. * Framer Motion and Popmotion
  23635. *
  23636. * @internal
  23637. */
  23638. function startAnimation(key, value, target, transition) {
  23639. if (transition === void 0) { transition = {}; }
  23640. if (instantAnimationState.current) {
  23641. transition = { type: false };
  23642. }
  23643. return value.start(function (onComplete) {
  23644. var delayTimer;
  23645. var controls;
  23646. var animation = getAnimation(key, value, target, transition, onComplete);
  23647. var delay = getDelayFromTransition(transition, key);
  23648. var start = function () { return (controls = animation()); };
  23649. if (delay) {
  23650. delayTimer = window.setTimeout(start, secondsToMilliseconds(delay));
  23651. }
  23652. else {
  23653. start();
  23654. }
  23655. return function () {
  23656. clearTimeout(delayTimer);
  23657. controls === null || controls === void 0 ? void 0 : controls.stop();
  23658. };
  23659. });
  23660. }
  23661. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/animate.mjs
  23662. /**
  23663. * Animate a single value or a `MotionValue`.
  23664. *
  23665. * The first argument is either a `MotionValue` to animate, or an initial animation value.
  23666. *
  23667. * The second is either a value to animate to, or an array of keyframes to animate through.
  23668. *
  23669. * The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`.
  23670. *
  23671. * Returns `AnimationPlaybackControls`, currently just a `stop` method.
  23672. *
  23673. * ```javascript
  23674. * const x = useMotionValue(0)
  23675. *
  23676. * useEffect(() => {
  23677. * const controls = animate(x, 100, {
  23678. * type: "spring",
  23679. * stiffness: 2000,
  23680. * onComplete: v => {}
  23681. * })
  23682. *
  23683. * return controls.stop
  23684. * })
  23685. * ```
  23686. *
  23687. * @public
  23688. */
  23689. function animate_animate(from, to, transition) {
  23690. if (transition === void 0) { transition = {}; }
  23691. var value = isMotionValue(from) ? from : motionValue(from);
  23692. startAnimation("", value, to, transition);
  23693. return {
  23694. stop: function () { return value.stop(); },
  23695. isAnimating: function () { return value.isAnimating(); },
  23696. };
  23697. }
  23698. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/animation/mix-values.mjs
  23699. var borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
  23700. var numBorders = borders.length;
  23701. var asNumber = function (value) {
  23702. return typeof value === "string" ? parseFloat(value) : value;
  23703. };
  23704. var isPx = function (value) {
  23705. return typeof value === "number" || px.test(value);
  23706. };
  23707. function mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) {
  23708. var _a, _b, _c, _d;
  23709. if (shouldCrossfadeOpacity) {
  23710. target.opacity = mix(0,
  23711. // (follow?.opacity as number) ?? 0,
  23712. // TODO Reinstate this if only child
  23713. (_a = lead.opacity) !== null && _a !== void 0 ? _a : 1, easeCrossfadeIn(progress));
  23714. target.opacityExit = mix((_b = follow.opacity) !== null && _b !== void 0 ? _b : 1, 0, easeCrossfadeOut(progress));
  23715. }
  23716. else if (isOnlyMember) {
  23717. target.opacity = mix((_c = follow.opacity) !== null && _c !== void 0 ? _c : 1, (_d = lead.opacity) !== null && _d !== void 0 ? _d : 1, progress);
  23718. }
  23719. /**
  23720. * Mix border radius
  23721. */
  23722. for (var i = 0; i < numBorders; i++) {
  23723. var borderLabel = "border".concat(borders[i], "Radius");
  23724. var followRadius = getRadius(follow, borderLabel);
  23725. var leadRadius = getRadius(lead, borderLabel);
  23726. if (followRadius === undefined && leadRadius === undefined)
  23727. continue;
  23728. followRadius || (followRadius = 0);
  23729. leadRadius || (leadRadius = 0);
  23730. var canMix = followRadius === 0 ||
  23731. leadRadius === 0 ||
  23732. isPx(followRadius) === isPx(leadRadius);
  23733. if (canMix) {
  23734. target[borderLabel] = Math.max(mix(asNumber(followRadius), asNumber(leadRadius), progress), 0);
  23735. if (percent.test(leadRadius) || percent.test(followRadius)) {
  23736. target[borderLabel] += "%";
  23737. }
  23738. }
  23739. else {
  23740. target[borderLabel] = leadRadius;
  23741. }
  23742. }
  23743. /**
  23744. * Mix rotation
  23745. */
  23746. if (follow.rotate || lead.rotate) {
  23747. target.rotate = mix(follow.rotate || 0, lead.rotate || 0, progress);
  23748. }
  23749. }
  23750. function getRadius(values, radiusName) {
  23751. var _a;
  23752. return (_a = values[radiusName]) !== null && _a !== void 0 ? _a : values.borderRadius;
  23753. }
  23754. // /**
  23755. // * We only want to mix the background color if there's a follow element
  23756. // * that we're not crossfading opacity between. For instance with switch
  23757. // * AnimateSharedLayout animations, this helps the illusion of a continuous
  23758. // * element being animated but also cuts down on the number of paints triggered
  23759. // * for elements where opacity is doing that work for us.
  23760. // */
  23761. // if (
  23762. // !hasFollowElement &&
  23763. // latestLeadValues.backgroundColor &&
  23764. // latestFollowValues.backgroundColor
  23765. // ) {
  23766. // /**
  23767. // * This isn't ideal performance-wise as mixColor is creating a new function every frame.
  23768. // * We could probably create a mixer that runs at the start of the animation but
  23769. // * the idea behind the crossfader is that it runs dynamically between two potentially
  23770. // * changing targets (ie opacity or borderRadius may be animating independently via variants)
  23771. // */
  23772. // leadState.backgroundColor = followState.backgroundColor = mixColor(
  23773. // latestFollowValues.backgroundColor as string,
  23774. // latestLeadValues.backgroundColor as string
  23775. // )(p)
  23776. // }
  23777. var easeCrossfadeIn = compress(0, 0.5, circOut);
  23778. var easeCrossfadeOut = compress(0.5, 0.95, linear);
  23779. function compress(min, max, easing) {
  23780. return function (p) {
  23781. // Could replace ifs with clamp
  23782. if (p < min)
  23783. return 0;
  23784. if (p > max)
  23785. return 1;
  23786. return easing(progress(min, max, p));
  23787. };
  23788. }
  23789. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/copy.mjs
  23790. /**
  23791. * Reset an axis to the provided origin box.
  23792. *
  23793. * This is a mutative operation.
  23794. */
  23795. function copyAxisInto(axis, originAxis) {
  23796. axis.min = originAxis.min;
  23797. axis.max = originAxis.max;
  23798. }
  23799. /**
  23800. * Reset a box to the provided origin box.
  23801. *
  23802. * This is a mutative operation.
  23803. */
  23804. function copyBoxInto(box, originBox) {
  23805. copyAxisInto(box.x, originBox.x);
  23806. copyAxisInto(box.y, originBox.y);
  23807. }
  23808. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/utils/has-transform.mjs
  23809. function isIdentityScale(scale) {
  23810. return scale === undefined || scale === 1;
  23811. }
  23812. function hasScale(_a) {
  23813. var scale = _a.scale, scaleX = _a.scaleX, scaleY = _a.scaleY;
  23814. return (!isIdentityScale(scale) ||
  23815. !isIdentityScale(scaleX) ||
  23816. !isIdentityScale(scaleY));
  23817. }
  23818. function hasTransform(values) {
  23819. return (hasScale(values) ||
  23820. hasTranslate(values.x) ||
  23821. hasTranslate(values.y) ||
  23822. values.z ||
  23823. values.rotate ||
  23824. values.rotateX ||
  23825. values.rotateY);
  23826. }
  23827. function hasTranslate(value) {
  23828. return value && value !== "0%";
  23829. }
  23830. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/delta-apply.mjs
  23831. /**
  23832. * Scales a point based on a factor and an originPoint
  23833. */
  23834. function scalePoint(point, scale, originPoint) {
  23835. var distanceFromOrigin = point - originPoint;
  23836. var scaled = scale * distanceFromOrigin;
  23837. return originPoint + scaled;
  23838. }
  23839. /**
  23840. * Applies a translate/scale delta to a point
  23841. */
  23842. function applyPointDelta(point, translate, scale, originPoint, boxScale) {
  23843. if (boxScale !== undefined) {
  23844. point = scalePoint(point, boxScale, originPoint);
  23845. }
  23846. return scalePoint(point, scale, originPoint) + translate;
  23847. }
  23848. /**
  23849. * Applies a translate/scale delta to an axis
  23850. */
  23851. function applyAxisDelta(axis, translate, scale, originPoint, boxScale) {
  23852. if (translate === void 0) { translate = 0; }
  23853. if (scale === void 0) { scale = 1; }
  23854. axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale);
  23855. axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale);
  23856. }
  23857. /**
  23858. * Applies a translate/scale delta to a box
  23859. */
  23860. function applyBoxDelta(box, _a) {
  23861. var x = _a.x, y = _a.y;
  23862. applyAxisDelta(box.x, x.translate, x.scale, x.originPoint);
  23863. applyAxisDelta(box.y, y.translate, y.scale, y.originPoint);
  23864. }
  23865. /**
  23866. * Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms
  23867. * in a tree upon our box before then calculating how to project it into our desired viewport-relative box
  23868. *
  23869. * This is the final nested loop within updateLayoutDelta for future refactoring
  23870. */
  23871. function applyTreeDeltas(box, treeScale, treePath, isSharedTransition) {
  23872. var _a, _b;
  23873. if (isSharedTransition === void 0) { isSharedTransition = false; }
  23874. var treeLength = treePath.length;
  23875. if (!treeLength)
  23876. return;
  23877. // Reset the treeScale
  23878. treeScale.x = treeScale.y = 1;
  23879. var node;
  23880. var delta;
  23881. for (var i = 0; i < treeLength; i++) {
  23882. node = treePath[i];
  23883. delta = node.projectionDelta;
  23884. if (((_b = (_a = node.instance) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.display) === "contents")
  23885. continue;
  23886. if (isSharedTransition &&
  23887. node.options.layoutScroll &&
  23888. node.scroll &&
  23889. node !== node.root) {
  23890. transformBox(box, { x: -node.scroll.x, y: -node.scroll.y });
  23891. }
  23892. if (delta) {
  23893. // Incoporate each ancestor's scale into a culmulative treeScale for this component
  23894. treeScale.x *= delta.x.scale;
  23895. treeScale.y *= delta.y.scale;
  23896. // Apply each ancestor's calculated delta into this component's recorded layout box
  23897. applyBoxDelta(box, delta);
  23898. }
  23899. if (isSharedTransition && hasTransform(node.latestValues)) {
  23900. transformBox(box, node.latestValues);
  23901. }
  23902. }
  23903. }
  23904. function translateAxis(axis, distance) {
  23905. axis.min = axis.min + distance;
  23906. axis.max = axis.max + distance;
  23907. }
  23908. /**
  23909. * Apply a transform to an axis from the latest resolved motion values.
  23910. * This function basically acts as a bridge between a flat motion value map
  23911. * and applyAxisDelta
  23912. */
  23913. function transformAxis(axis, transforms, _a) {
  23914. var _b = tslib_es6_read(_a, 3), key = _b[0], scaleKey = _b[1], originKey = _b[2];
  23915. var axisOrigin = transforms[originKey] !== undefined ? transforms[originKey] : 0.5;
  23916. var originPoint = mix(axis.min, axis.max, axisOrigin);
  23917. // Apply the axis delta to the final axis
  23918. applyAxisDelta(axis, transforms[key], transforms[scaleKey], originPoint, transforms.scale);
  23919. }
  23920. /**
  23921. * The names of the motion values we want to apply as translation, scale and origin.
  23922. */
  23923. var xKeys = ["x", "scaleX", "originX"];
  23924. var yKeys = ["y", "scaleY", "originY"];
  23925. /**
  23926. * Apply a transform to a box from the latest resolved motion values.
  23927. */
  23928. function transformBox(box, transform) {
  23929. transformAxis(box.x, transform, xKeys);
  23930. transformAxis(box.y, transform, yKeys);
  23931. }
  23932. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/is-point.mjs
  23933. const isPoint = (point) => point.hasOwnProperty('x') && point.hasOwnProperty('y');
  23934. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/is-point-3d.mjs
  23935. const isPoint3D = (point) => isPoint(point) && point.hasOwnProperty('z');
  23936. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/distance.mjs
  23937. const distance1D = (a, b) => Math.abs(a - b);
  23938. function distance(a, b) {
  23939. if (isNum(a) && isNum(b)) {
  23940. return distance1D(a, b);
  23941. }
  23942. else if (isPoint(a) && isPoint(b)) {
  23943. const xDelta = distance1D(a.x, b.x);
  23944. const yDelta = distance1D(a.y, b.y);
  23945. const zDelta = isPoint3D(a) && isPoint3D(b) ? distance1D(a.z, b.z) : 0;
  23946. return Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2) + Math.pow(zDelta, 2));
  23947. }
  23948. }
  23949. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/delta-calc.mjs
  23950. function calcLength(axis) {
  23951. return axis.max - axis.min;
  23952. }
  23953. function isNear(value, target, maxDistance) {
  23954. if (target === void 0) { target = 0; }
  23955. if (maxDistance === void 0) { maxDistance = 0.01; }
  23956. return distance(value, target) < maxDistance;
  23957. }
  23958. function calcAxisDelta(delta, source, target, origin) {
  23959. if (origin === void 0) { origin = 0.5; }
  23960. delta.origin = origin;
  23961. delta.originPoint = mix(source.min, source.max, delta.origin);
  23962. delta.scale = calcLength(target) / calcLength(source);
  23963. if (isNear(delta.scale, 1, 0.0001) || isNaN(delta.scale))
  23964. delta.scale = 1;
  23965. delta.translate =
  23966. mix(target.min, target.max, delta.origin) - delta.originPoint;
  23967. if (isNear(delta.translate) || isNaN(delta.translate))
  23968. delta.translate = 0;
  23969. }
  23970. function calcBoxDelta(delta, source, target, origin) {
  23971. calcAxisDelta(delta.x, source.x, target.x, origin === null || origin === void 0 ? void 0 : origin.originX);
  23972. calcAxisDelta(delta.y, source.y, target.y, origin === null || origin === void 0 ? void 0 : origin.originY);
  23973. }
  23974. function calcRelativeAxis(target, relative, parent) {
  23975. target.min = parent.min + relative.min;
  23976. target.max = target.min + calcLength(relative);
  23977. }
  23978. function calcRelativeBox(target, relative, parent) {
  23979. calcRelativeAxis(target.x, relative.x, parent.x);
  23980. calcRelativeAxis(target.y, relative.y, parent.y);
  23981. }
  23982. function calcRelativeAxisPosition(target, layout, parent) {
  23983. target.min = layout.min - parent.min;
  23984. target.max = target.min + calcLength(layout);
  23985. }
  23986. function calcRelativePosition(target, layout, parent) {
  23987. calcRelativeAxisPosition(target.x, layout.x, parent.x);
  23988. calcRelativeAxisPosition(target.y, layout.y, parent.y);
  23989. }
  23990. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/delta-remove.mjs
  23991. /**
  23992. * Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse
  23993. */
  23994. function removePointDelta(point, translate, scale, originPoint, boxScale) {
  23995. point -= translate;
  23996. point = scalePoint(point, 1 / scale, originPoint);
  23997. if (boxScale !== undefined) {
  23998. point = scalePoint(point, 1 / boxScale, originPoint);
  23999. }
  24000. return point;
  24001. }
  24002. /**
  24003. * Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse
  24004. */
  24005. function removeAxisDelta(axis, translate, scale, origin, boxScale, originAxis, sourceAxis) {
  24006. if (translate === void 0) { translate = 0; }
  24007. if (scale === void 0) { scale = 1; }
  24008. if (origin === void 0) { origin = 0.5; }
  24009. if (originAxis === void 0) { originAxis = axis; }
  24010. if (sourceAxis === void 0) { sourceAxis = axis; }
  24011. if (percent.test(translate)) {
  24012. translate = parseFloat(translate);
  24013. var relativeProgress = mix(sourceAxis.min, sourceAxis.max, translate / 100);
  24014. translate = relativeProgress - sourceAxis.min;
  24015. }
  24016. if (typeof translate !== "number")
  24017. return;
  24018. var originPoint = mix(originAxis.min, originAxis.max, origin);
  24019. if (axis === originAxis)
  24020. originPoint -= translate;
  24021. axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale);
  24022. axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale);
  24023. }
  24024. /**
  24025. * Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse
  24026. * and acts as a bridge between motion values and removeAxisDelta
  24027. */
  24028. function removeAxisTransforms(axis, transforms, _a, origin, sourceAxis) {
  24029. var _b = tslib_es6_read(_a, 3), key = _b[0], scaleKey = _b[1], originKey = _b[2];
  24030. removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale, origin, sourceAxis);
  24031. }
  24032. /**
  24033. * The names of the motion values we want to apply as translation, scale and origin.
  24034. */
  24035. var delta_remove_xKeys = ["x", "scaleX", "originX"];
  24036. var delta_remove_yKeys = ["y", "scaleY", "originY"];
  24037. /**
  24038. * Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse
  24039. * and acts as a bridge between motion values and removeAxisDelta
  24040. */
  24041. function removeBoxTransforms(box, transforms, originBox, sourceBox) {
  24042. removeAxisTransforms(box.x, transforms, delta_remove_xKeys, originBox === null || originBox === void 0 ? void 0 : originBox.x, sourceBox === null || sourceBox === void 0 ? void 0 : sourceBox.x);
  24043. removeAxisTransforms(box.y, transforms, delta_remove_yKeys, originBox === null || originBox === void 0 ? void 0 : originBox.y, sourceBox === null || sourceBox === void 0 ? void 0 : sourceBox.y);
  24044. }
  24045. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/models.mjs
  24046. var createAxisDelta = function () { return ({
  24047. translate: 0,
  24048. scale: 1,
  24049. origin: 0,
  24050. originPoint: 0,
  24051. }); };
  24052. var createDelta = function () { return ({
  24053. x: createAxisDelta(),
  24054. y: createAxisDelta(),
  24055. }); };
  24056. var createAxis = function () { return ({ min: 0, max: 0 }); };
  24057. var createBox = function () { return ({
  24058. x: createAxis(),
  24059. y: createAxis(),
  24060. }); };
  24061. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/utils.mjs
  24062. function isAxisDeltaZero(delta) {
  24063. return delta.translate === 0 && delta.scale === 1;
  24064. }
  24065. function isDeltaZero(delta) {
  24066. return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);
  24067. }
  24068. function boxEquals(a, b) {
  24069. return (a.x.min === b.x.min &&
  24070. a.x.max === b.x.max &&
  24071. a.y.min === b.y.min &&
  24072. a.y.max === b.y.max);
  24073. }
  24074. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/shared/stack.mjs
  24075. var NodeStack = /** @class */ (function () {
  24076. function NodeStack() {
  24077. this.members = [];
  24078. }
  24079. NodeStack.prototype.add = function (node) {
  24080. addUniqueItem(this.members, node);
  24081. node.scheduleRender();
  24082. };
  24083. NodeStack.prototype.remove = function (node) {
  24084. removeItem(this.members, node);
  24085. if (node === this.prevLead) {
  24086. this.prevLead = undefined;
  24087. }
  24088. if (node === this.lead) {
  24089. var prevLead = this.members[this.members.length - 1];
  24090. if (prevLead) {
  24091. this.promote(prevLead);
  24092. }
  24093. }
  24094. };
  24095. NodeStack.prototype.relegate = function (node) {
  24096. var indexOfNode = this.members.findIndex(function (member) { return node === member; });
  24097. if (indexOfNode === 0)
  24098. return false;
  24099. /**
  24100. * Find the next projection node that is present
  24101. */
  24102. var prevLead;
  24103. for (var i = indexOfNode; i >= 0; i--) {
  24104. var member = this.members[i];
  24105. if (member.isPresent !== false) {
  24106. prevLead = member;
  24107. break;
  24108. }
  24109. }
  24110. if (prevLead) {
  24111. this.promote(prevLead);
  24112. return true;
  24113. }
  24114. else {
  24115. return false;
  24116. }
  24117. };
  24118. NodeStack.prototype.promote = function (node, preserveFollowOpacity) {
  24119. var _a;
  24120. var prevLead = this.lead;
  24121. if (node === prevLead)
  24122. return;
  24123. this.prevLead = prevLead;
  24124. this.lead = node;
  24125. node.show();
  24126. if (prevLead) {
  24127. prevLead.instance && prevLead.scheduleRender();
  24128. node.scheduleRender();
  24129. node.resumeFrom = prevLead;
  24130. if (preserveFollowOpacity) {
  24131. node.resumeFrom.preserveOpacity = true;
  24132. }
  24133. if (prevLead.snapshot) {
  24134. node.snapshot = prevLead.snapshot;
  24135. node.snapshot.latestValues =
  24136. prevLead.animationValues || prevLead.latestValues;
  24137. node.snapshot.isShared = true;
  24138. }
  24139. if ((_a = node.root) === null || _a === void 0 ? void 0 : _a.isUpdating) {
  24140. node.isLayoutDirty = true;
  24141. }
  24142. var crossfade = node.options.crossfade;
  24143. if (crossfade === false) {
  24144. prevLead.hide();
  24145. }
  24146. /**
  24147. * TODO:
  24148. * - Test border radius when previous node was deleted
  24149. * - boxShadow mixing
  24150. * - Shared between element A in scrolled container and element B (scroll stays the same or changes)
  24151. * - Shared between element A in transformed container and element B (transform stays the same or changes)
  24152. * - Shared between element A in scrolled page and element B (scroll stays the same or changes)
  24153. * ---
  24154. * - Crossfade opacity of root nodes
  24155. * - layoutId changes after animation
  24156. * - layoutId changes mid animation
  24157. */
  24158. }
  24159. };
  24160. NodeStack.prototype.exitAnimationComplete = function () {
  24161. this.members.forEach(function (node) {
  24162. var _a, _b, _c, _d, _e;
  24163. (_b = (_a = node.options).onExitComplete) === null || _b === void 0 ? void 0 : _b.call(_a);
  24164. (_e = (_c = node.resumingFrom) === null || _c === void 0 ? void 0 : (_d = _c.options).onExitComplete) === null || _e === void 0 ? void 0 : _e.call(_d);
  24165. });
  24166. };
  24167. NodeStack.prototype.scheduleRender = function () {
  24168. this.members.forEach(function (node) {
  24169. node.instance && node.scheduleRender(false);
  24170. });
  24171. };
  24172. /**
  24173. * Clear any leads that have been removed this render to prevent them from being
  24174. * used in future animations and to prevent memory leaks
  24175. */
  24176. NodeStack.prototype.removeLeadSnapshot = function () {
  24177. if (this.lead && this.lead.snapshot) {
  24178. this.lead.snapshot = undefined;
  24179. }
  24180. };
  24181. return NodeStack;
  24182. }());
  24183. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/styles/scale-correction.mjs
  24184. var scaleCorrectors = {};
  24185. function addScaleCorrector(correctors) {
  24186. Object.assign(scaleCorrectors, correctors);
  24187. }
  24188. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/styles/transform.mjs
  24189. var identityProjection = "translate3d(0px, 0px, 0) scale(1, 1)";
  24190. function buildProjectionTransform(delta, treeScale, latestTransform) {
  24191. /**
  24192. * The translations we use to calculate are always relative to the viewport coordinate space.
  24193. * But when we apply scales, we also scale the coordinate space of an element and its children.
  24194. * For instance if we have a treeScale (the culmination of all parent scales) of 0.5 and we need
  24195. * to move an element 100 pixels, we actually need to move it 200 in within that scaled space.
  24196. */
  24197. var xTranslate = delta.x.translate / treeScale.x;
  24198. var yTranslate = delta.y.translate / treeScale.y;
  24199. var transform = "translate3d(".concat(xTranslate, "px, ").concat(yTranslate, "px, 0) ");
  24200. if (latestTransform) {
  24201. var rotate = latestTransform.rotate, rotateX = latestTransform.rotateX, rotateY = latestTransform.rotateY;
  24202. if (rotate)
  24203. transform += "rotate(".concat(rotate, "deg) ");
  24204. if (rotateX)
  24205. transform += "rotateX(".concat(rotateX, "deg) ");
  24206. if (rotateY)
  24207. transform += "rotateY(".concat(rotateY, "deg) ");
  24208. }
  24209. transform += "scale(".concat(delta.x.scale, ", ").concat(delta.y.scale, ")");
  24210. return transform === identityProjection ? "none" : transform;
  24211. }
  24212. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/utils/each-axis.mjs
  24213. function eachAxis(callback) {
  24214. return [callback("x"), callback("y")];
  24215. }
  24216. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/transform.mjs
  24217. /**
  24218. * A list of all transformable axes. We'll use this list to generated a version
  24219. * of each axes for each transform.
  24220. */
  24221. var transformAxes = ["", "X", "Y", "Z"];
  24222. /**
  24223. * An ordered array of each transformable value. By default, transform values
  24224. * will be sorted to this order.
  24225. */
  24226. var order = ["translate", "scale", "rotate", "skew"];
  24227. /**
  24228. * Generate a list of every possible transform key.
  24229. */
  24230. var transformProps = ["transformPerspective", "x", "y", "z"];
  24231. order.forEach(function (operationKey) {
  24232. return transformAxes.forEach(function (axesKey) {
  24233. return transformProps.push(operationKey + axesKey);
  24234. });
  24235. });
  24236. /**
  24237. * A function to use with Array.sort to sort transform keys by their default order.
  24238. */
  24239. function sortTransformProps(a, b) {
  24240. return transformProps.indexOf(a) - transformProps.indexOf(b);
  24241. }
  24242. /**
  24243. * A quick lookup for transform props.
  24244. */
  24245. var transformPropSet = new Set(transformProps);
  24246. function isTransformProp(key) {
  24247. return transformPropSet.has(key);
  24248. }
  24249. /**
  24250. * A quick lookup for transform origin props
  24251. */
  24252. var transformOriginProps = new Set(["originX", "originY", "originZ"]);
  24253. function isTransformOriginProp(key) {
  24254. return transformOriginProps.has(key);
  24255. }
  24256. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/compare-by-depth.mjs
  24257. var compareByDepth = function (a, b) {
  24258. return a.depth - b.depth;
  24259. };
  24260. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/flat-tree.mjs
  24261. var FlatTree = /** @class */ (function () {
  24262. function FlatTree() {
  24263. this.children = [];
  24264. this.isDirty = false;
  24265. }
  24266. FlatTree.prototype.add = function (child) {
  24267. addUniqueItem(this.children, child);
  24268. this.isDirty = true;
  24269. };
  24270. FlatTree.prototype.remove = function (child) {
  24271. removeItem(this.children, child);
  24272. this.isDirty = true;
  24273. };
  24274. FlatTree.prototype.forEach = function (callback) {
  24275. this.isDirty && this.children.sort(compareByDepth);
  24276. this.isDirty = false;
  24277. this.children.forEach(callback);
  24278. };
  24279. return FlatTree;
  24280. }());
  24281. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.mjs
  24282. /**
  24283. * If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
  24284. *
  24285. * TODO: Remove and move to library
  24286. *
  24287. * @internal
  24288. */
  24289. function resolveMotionValue(value) {
  24290. var unwrappedValue = isMotionValue(value) ? value.get() : value;
  24291. return isCustomValue(unwrappedValue)
  24292. ? unwrappedValue.toValue()
  24293. : unwrappedValue;
  24294. }
  24295. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/create-projection-node.mjs
  24296. /**
  24297. * We use 1000 as the animation target as 0-1000 maps better to pixels than 0-1
  24298. * which has a noticeable difference in spring animations
  24299. */
  24300. var animationTarget = 1000;
  24301. /**
  24302. * This should only ever be modified on the client otherwise it'll
  24303. * persist through server requests. If we need instanced states we
  24304. * could lazy-init via root.
  24305. */
  24306. var globalProjectionState = {
  24307. /**
  24308. * Global flag as to whether the tree has animated since the last time
  24309. * we resized the window
  24310. */
  24311. hasAnimatedSinceResize: true,
  24312. /**
  24313. * We set this to true once, on the first update. Any nodes added to the tree beyond that
  24314. * update will be given a `data-projection-id` attribute.
  24315. */
  24316. hasEverUpdated: false,
  24317. };
  24318. function createProjectionNode(_a) {
  24319. var attachResizeListener = _a.attachResizeListener, defaultParent = _a.defaultParent, measureScroll = _a.measureScroll, resetTransform = _a.resetTransform;
  24320. return /** @class */ (function () {
  24321. function ProjectionNode(id, latestValues, parent) {
  24322. var _this = this;
  24323. if (latestValues === void 0) { latestValues = {}; }
  24324. if (parent === void 0) { parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent(); }
  24325. /**
  24326. * A Set containing all this component's children. This is used to iterate
  24327. * through the children.
  24328. *
  24329. * TODO: This could be faster to iterate as a flat array stored on the root node.
  24330. */
  24331. this.children = new Set();
  24332. /**
  24333. * Options for the node. We use this to configure what kind of layout animations
  24334. * we should perform (if any).
  24335. */
  24336. this.options = {};
  24337. /**
  24338. * We use this to detect when its safe to shut down part of a projection tree.
  24339. * We have to keep projecting children for scale correction and relative projection
  24340. * until all their parents stop performing layout animations.
  24341. */
  24342. this.isTreeAnimating = false;
  24343. this.isAnimationBlocked = false;
  24344. /**
  24345. * Flag to true if we think this layout has been changed. We can't always know this,
  24346. * currently we set it to true every time a component renders, or if it has a layoutDependency
  24347. * if that has changed between renders. Additionally, components can be grouped by LayoutGroup
  24348. * and if one node is dirtied, they all are.
  24349. */
  24350. this.isLayoutDirty = false;
  24351. /**
  24352. * Block layout updates for instant layout transitions throughout the tree.
  24353. */
  24354. this.updateManuallyBlocked = false;
  24355. this.updateBlockedByResize = false;
  24356. /**
  24357. * Set to true between the start of the first `willUpdate` call and the end of the `didUpdate`
  24358. * call.
  24359. */
  24360. this.isUpdating = false;
  24361. /**
  24362. * If this is an SVG element we currently disable projection transforms
  24363. */
  24364. this.isSVG = false;
  24365. /**
  24366. * Flag to true (during promotion) if a node doing an instant layout transition needs to reset
  24367. * its projection styles.
  24368. */
  24369. this.needsReset = false;
  24370. /**
  24371. * Flags whether this node should have its transform reset prior to measuring.
  24372. */
  24373. this.shouldResetTransform = false;
  24374. /**
  24375. * An object representing the calculated contextual/accumulated/tree scale.
  24376. * This will be used to scale calculcated projection transforms, as these are
  24377. * calculated in screen-space but need to be scaled for elements to actually
  24378. * make it to their calculated destinations.
  24379. *
  24380. * TODO: Lazy-init
  24381. */
  24382. this.treeScale = { x: 1, y: 1 };
  24383. /**
  24384. *
  24385. */
  24386. this.eventHandlers = new Map();
  24387. // Note: Currently only running on root node
  24388. this.potentialNodes = new Map();
  24389. this.checkUpdateFailed = function () {
  24390. if (_this.isUpdating) {
  24391. _this.isUpdating = false;
  24392. _this.clearAllSnapshots();
  24393. }
  24394. };
  24395. this.updateProjection = function () {
  24396. _this.nodes.forEach(resolveTargetDelta);
  24397. _this.nodes.forEach(calcProjection);
  24398. };
  24399. this.hasProjected = false;
  24400. this.isVisible = true;
  24401. this.animationProgress = 0;
  24402. /**
  24403. * Shared layout
  24404. */
  24405. // TODO Only running on root node
  24406. this.sharedNodes = new Map();
  24407. this.id = id;
  24408. this.latestValues = latestValues;
  24409. this.root = parent ? parent.root || parent : this;
  24410. this.path = parent ? tslib_es6_spreadArray(tslib_es6_spreadArray([], tslib_es6_read(parent.path), false), [parent], false) : [];
  24411. this.parent = parent;
  24412. this.depth = parent ? parent.depth + 1 : 0;
  24413. id && this.root.registerPotentialNode(id, this);
  24414. for (var i = 0; i < this.path.length; i++) {
  24415. this.path[i].shouldResetTransform = true;
  24416. }
  24417. if (this.root === this)
  24418. this.nodes = new FlatTree();
  24419. }
  24420. ProjectionNode.prototype.addEventListener = function (name, handler) {
  24421. if (!this.eventHandlers.has(name)) {
  24422. this.eventHandlers.set(name, new SubscriptionManager());
  24423. }
  24424. return this.eventHandlers.get(name).add(handler);
  24425. };
  24426. ProjectionNode.prototype.notifyListeners = function (name) {
  24427. var args = [];
  24428. for (var _i = 1; _i < arguments.length; _i++) {
  24429. args[_i - 1] = arguments[_i];
  24430. }
  24431. var subscriptionManager = this.eventHandlers.get(name);
  24432. subscriptionManager === null || subscriptionManager === void 0 ? void 0 : subscriptionManager.notify.apply(subscriptionManager, tslib_es6_spreadArray([], tslib_es6_read(args), false));
  24433. };
  24434. ProjectionNode.prototype.hasListeners = function (name) {
  24435. return this.eventHandlers.has(name);
  24436. };
  24437. ProjectionNode.prototype.registerPotentialNode = function (id, node) {
  24438. this.potentialNodes.set(id, node);
  24439. };
  24440. /**
  24441. * Lifecycles
  24442. */
  24443. ProjectionNode.prototype.mount = function (instance, isLayoutDirty) {
  24444. var _this = this;
  24445. var _a;
  24446. if (isLayoutDirty === void 0) { isLayoutDirty = false; }
  24447. if (this.instance)
  24448. return;
  24449. this.isSVG =
  24450. instance instanceof SVGElement && instance.tagName !== "svg";
  24451. this.instance = instance;
  24452. var _b = this.options, layoutId = _b.layoutId, layout = _b.layout, visualElement = _b.visualElement;
  24453. if (visualElement && !visualElement.getInstance()) {
  24454. visualElement.mount(instance);
  24455. }
  24456. this.root.nodes.add(this);
  24457. (_a = this.parent) === null || _a === void 0 ? void 0 : _a.children.add(this);
  24458. this.id && this.root.potentialNodes.delete(this.id);
  24459. if (isLayoutDirty && (layout || layoutId)) {
  24460. this.isLayoutDirty = true;
  24461. }
  24462. if (attachResizeListener) {
  24463. var unblockTimeout_1;
  24464. var resizeUnblockUpdate_1 = function () {
  24465. return (_this.root.updateBlockedByResize = false);
  24466. };
  24467. attachResizeListener(instance, function () {
  24468. _this.root.updateBlockedByResize = true;
  24469. clearTimeout(unblockTimeout_1);
  24470. unblockTimeout_1 = window.setTimeout(resizeUnblockUpdate_1, 250);
  24471. if (globalProjectionState.hasAnimatedSinceResize) {
  24472. globalProjectionState.hasAnimatedSinceResize = false;
  24473. _this.nodes.forEach(finishAnimation);
  24474. }
  24475. });
  24476. }
  24477. if (layoutId) {
  24478. this.root.registerSharedNode(layoutId, this);
  24479. }
  24480. // Only register the handler if it requires layout animation
  24481. if (this.options.animate !== false &&
  24482. visualElement &&
  24483. (layoutId || layout)) {
  24484. this.addEventListener("didUpdate", function (_a) {
  24485. var _b, _c, _d, _e, _f;
  24486. var delta = _a.delta, hasLayoutChanged = _a.hasLayoutChanged, hasRelativeTargetChanged = _a.hasRelativeTargetChanged, newLayout = _a.layout;
  24487. if (_this.isTreeAnimationBlocked()) {
  24488. _this.target = undefined;
  24489. _this.relativeTarget = undefined;
  24490. return;
  24491. }
  24492. // TODO: Check here if an animation exists
  24493. var layoutTransition = (_c = (_b = _this.options.transition) !== null && _b !== void 0 ? _b : visualElement.getDefaultTransition()) !== null && _c !== void 0 ? _c : defaultLayoutTransition;
  24494. var _g = visualElement.getProps(), onLayoutAnimationStart = _g.onLayoutAnimationStart, onLayoutAnimationComplete = _g.onLayoutAnimationComplete;
  24495. /**
  24496. * The target layout of the element might stay the same,
  24497. * but its position relative to its parent has changed.
  24498. */
  24499. var targetChanged = !_this.targetLayout ||
  24500. !boxEquals(_this.targetLayout, newLayout) ||
  24501. hasRelativeTargetChanged;
  24502. /**
  24503. * If the layout hasn't seemed to have changed, it might be that the
  24504. * element is visually in the same place in the document but its position
  24505. * relative to its parent has indeed changed. So here we check for that.
  24506. */
  24507. var hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeTargetChanged;
  24508. if (((_d = _this.resumeFrom) === null || _d === void 0 ? void 0 : _d.instance) ||
  24509. hasOnlyRelativeTargetChanged ||
  24510. (hasLayoutChanged &&
  24511. (targetChanged || !_this.currentAnimation))) {
  24512. if (_this.resumeFrom) {
  24513. _this.resumingFrom = _this.resumeFrom;
  24514. _this.resumingFrom.resumingFrom = undefined;
  24515. }
  24516. _this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
  24517. var animationOptions = __assign(__assign({}, getValueTransition(layoutTransition, "layout")), { onPlay: onLayoutAnimationStart, onComplete: onLayoutAnimationComplete });
  24518. if (visualElement.shouldReduceMotion) {
  24519. animationOptions.delay = 0;
  24520. animationOptions.type = false;
  24521. }
  24522. _this.startAnimation(animationOptions);
  24523. }
  24524. else {
  24525. /**
  24526. * If the layout hasn't changed and we have an animation that hasn't started yet,
  24527. * finish it immediately. Otherwise it will be animating from a location
  24528. * that was probably never commited to screen and look like a jumpy box.
  24529. */
  24530. if (!hasLayoutChanged &&
  24531. _this.animationProgress === 0) {
  24532. _this.finishAnimation();
  24533. }
  24534. _this.isLead() && ((_f = (_e = _this.options).onExitComplete) === null || _f === void 0 ? void 0 : _f.call(_e));
  24535. }
  24536. _this.targetLayout = newLayout;
  24537. });
  24538. }
  24539. };
  24540. ProjectionNode.prototype.unmount = function () {
  24541. var _a, _b;
  24542. this.options.layoutId && this.willUpdate();
  24543. this.root.nodes.remove(this);
  24544. (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.remove(this);
  24545. (_b = this.parent) === null || _b === void 0 ? void 0 : _b.children.delete(this);
  24546. this.instance = undefined;
  24547. cancelSync.preRender(this.updateProjection);
  24548. };
  24549. // only on the root
  24550. ProjectionNode.prototype.blockUpdate = function () {
  24551. this.updateManuallyBlocked = true;
  24552. };
  24553. ProjectionNode.prototype.unblockUpdate = function () {
  24554. this.updateManuallyBlocked = false;
  24555. };
  24556. ProjectionNode.prototype.isUpdateBlocked = function () {
  24557. return this.updateManuallyBlocked || this.updateBlockedByResize;
  24558. };
  24559. ProjectionNode.prototype.isTreeAnimationBlocked = function () {
  24560. var _a;
  24561. return (this.isAnimationBlocked ||
  24562. ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isTreeAnimationBlocked()) ||
  24563. false);
  24564. };
  24565. // Note: currently only running on root node
  24566. ProjectionNode.prototype.startUpdate = function () {
  24567. var _a;
  24568. if (this.isUpdateBlocked())
  24569. return;
  24570. this.isUpdating = true;
  24571. (_a = this.nodes) === null || _a === void 0 ? void 0 : _a.forEach(resetRotation);
  24572. };
  24573. ProjectionNode.prototype.willUpdate = function (shouldNotifyListeners) {
  24574. var _a, _b, _c;
  24575. if (shouldNotifyListeners === void 0) { shouldNotifyListeners = true; }
  24576. if (this.root.isUpdateBlocked()) {
  24577. (_b = (_a = this.options).onExitComplete) === null || _b === void 0 ? void 0 : _b.call(_a);
  24578. return;
  24579. }
  24580. !this.root.isUpdating && this.root.startUpdate();
  24581. if (this.isLayoutDirty)
  24582. return;
  24583. this.isLayoutDirty = true;
  24584. for (var i = 0; i < this.path.length; i++) {
  24585. var node = this.path[i];
  24586. node.shouldResetTransform = true;
  24587. /**
  24588. * TODO: Check we haven't updated the scroll
  24589. * since the last didUpdate
  24590. */
  24591. node.updateScroll();
  24592. }
  24593. var _d = this.options, layoutId = _d.layoutId, layout = _d.layout;
  24594. if (layoutId === undefined && !layout)
  24595. return;
  24596. var transformTemplate = (_c = this.options.visualElement) === null || _c === void 0 ? void 0 : _c.getProps().transformTemplate;
  24597. this.prevTransformTemplateValue = transformTemplate === null || transformTemplate === void 0 ? void 0 : transformTemplate(this.latestValues, "");
  24598. this.updateSnapshot();
  24599. shouldNotifyListeners && this.notifyListeners("willUpdate");
  24600. };
  24601. // Note: Currently only running on root node
  24602. ProjectionNode.prototype.didUpdate = function () {
  24603. var updateWasBlocked = this.isUpdateBlocked();
  24604. // When doing an instant transition, we skip the layout update,
  24605. // but should still clean up the measurements so that the next
  24606. // snapshot could be taken correctly.
  24607. if (updateWasBlocked) {
  24608. this.unblockUpdate();
  24609. this.clearAllSnapshots();
  24610. this.nodes.forEach(clearMeasurements);
  24611. return;
  24612. }
  24613. if (!this.isUpdating)
  24614. return;
  24615. this.isUpdating = false;
  24616. /**
  24617. * Search for and mount newly-added projection elements.
  24618. *
  24619. * TODO: Every time a new component is rendered we could search up the tree for
  24620. * the closest mounted node and query from there rather than document.
  24621. */
  24622. if (this.potentialNodes.size) {
  24623. this.potentialNodes.forEach(mountNodeEarly);
  24624. this.potentialNodes.clear();
  24625. }
  24626. /**
  24627. * Write
  24628. */
  24629. this.nodes.forEach(resetTransformStyle);
  24630. /**
  24631. * Read ==================
  24632. */
  24633. // Update layout measurements of updated children
  24634. this.nodes.forEach(updateLayout);
  24635. /**
  24636. * Write
  24637. */
  24638. // Notify listeners that the layout is updated
  24639. this.nodes.forEach(notifyLayoutUpdate);
  24640. this.clearAllSnapshots();
  24641. // Flush any scheduled updates
  24642. flushSync.update();
  24643. flushSync.preRender();
  24644. flushSync.render();
  24645. };
  24646. ProjectionNode.prototype.clearAllSnapshots = function () {
  24647. this.nodes.forEach(clearSnapshot);
  24648. this.sharedNodes.forEach(removeLeadSnapshots);
  24649. };
  24650. ProjectionNode.prototype.scheduleUpdateProjection = function () {
  24651. es.preRender(this.updateProjection, false, true);
  24652. };
  24653. ProjectionNode.prototype.scheduleCheckAfterUnmount = function () {
  24654. var _this = this;
  24655. /**
  24656. * If the unmounting node is in a layoutGroup and did trigger a willUpdate,
  24657. * we manually call didUpdate to give a chance to the siblings to animate.
  24658. * Otherwise, cleanup all snapshots to prevents future nodes from reusing them.
  24659. */
  24660. es.postRender(function () {
  24661. if (_this.isLayoutDirty) {
  24662. _this.root.didUpdate();
  24663. }
  24664. else {
  24665. _this.root.checkUpdateFailed();
  24666. }
  24667. });
  24668. };
  24669. /**
  24670. * Update measurements
  24671. */
  24672. ProjectionNode.prototype.updateSnapshot = function () {
  24673. if (this.snapshot || !this.instance)
  24674. return;
  24675. var measured = this.measure();
  24676. var layout = this.removeTransform(this.removeElementScroll(measured));
  24677. roundBox(layout);
  24678. this.snapshot = {
  24679. measured: measured,
  24680. layout: layout,
  24681. latestValues: {},
  24682. };
  24683. };
  24684. ProjectionNode.prototype.updateLayout = function () {
  24685. var _a;
  24686. if (!this.instance)
  24687. return;
  24688. // TODO: Incorporate into a forwarded scroll offset
  24689. this.updateScroll();
  24690. if (!(this.options.alwaysMeasureLayout && this.isLead()) &&
  24691. !this.isLayoutDirty) {
  24692. return;
  24693. }
  24694. /**
  24695. * When a node is mounted, it simply resumes from the prevLead's
  24696. * snapshot instead of taking a new one, but the ancestors scroll
  24697. * might have updated while the prevLead is unmounted. We need to
  24698. * update the scroll again to make sure the layout we measure is
  24699. * up to date.
  24700. */
  24701. if (this.resumeFrom && !this.resumeFrom.instance) {
  24702. for (var i = 0; i < this.path.length; i++) {
  24703. var node = this.path[i];
  24704. node.updateScroll();
  24705. }
  24706. }
  24707. var measured = this.measure();
  24708. roundBox(measured);
  24709. var prevLayout = this.layout;
  24710. this.layout = {
  24711. measured: measured,
  24712. actual: this.removeElementScroll(measured),
  24713. };
  24714. this.layoutCorrected = createBox();
  24715. this.isLayoutDirty = false;
  24716. this.projectionDelta = undefined;
  24717. this.notifyListeners("measure", this.layout.actual);
  24718. (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.notifyLayoutMeasure(this.layout.actual, prevLayout === null || prevLayout === void 0 ? void 0 : prevLayout.actual);
  24719. };
  24720. ProjectionNode.prototype.updateScroll = function () {
  24721. if (this.options.layoutScroll && this.instance) {
  24722. this.scroll = measureScroll(this.instance);
  24723. }
  24724. };
  24725. ProjectionNode.prototype.resetTransform = function () {
  24726. var _a;
  24727. if (!resetTransform)
  24728. return;
  24729. var isResetRequested = this.isLayoutDirty || this.shouldResetTransform;
  24730. var hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);
  24731. var transformTemplate = (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.getProps().transformTemplate;
  24732. var transformTemplateValue = transformTemplate === null || transformTemplate === void 0 ? void 0 : transformTemplate(this.latestValues, "");
  24733. var transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;
  24734. if (isResetRequested &&
  24735. (hasProjection ||
  24736. hasTransform(this.latestValues) ||
  24737. transformTemplateHasChanged)) {
  24738. resetTransform(this.instance, transformTemplateValue);
  24739. this.shouldResetTransform = false;
  24740. this.scheduleRender();
  24741. }
  24742. };
  24743. ProjectionNode.prototype.measure = function () {
  24744. var visualElement = this.options.visualElement;
  24745. if (!visualElement)
  24746. return createBox();
  24747. var box = visualElement.measureViewportBox();
  24748. // Remove viewport scroll to give page-relative coordinates
  24749. var scroll = this.root.scroll;
  24750. if (scroll) {
  24751. translateAxis(box.x, scroll.x);
  24752. translateAxis(box.y, scroll.y);
  24753. }
  24754. return box;
  24755. };
  24756. ProjectionNode.prototype.removeElementScroll = function (box) {
  24757. var boxWithoutScroll = createBox();
  24758. copyBoxInto(boxWithoutScroll, box);
  24759. /**
  24760. * Performance TODO: Keep a cumulative scroll offset down the tree
  24761. * rather than loop back up the path.
  24762. */
  24763. for (var i = 0; i < this.path.length; i++) {
  24764. var node = this.path[i];
  24765. var scroll_1 = node.scroll, options = node.options;
  24766. if (node !== this.root && scroll_1 && options.layoutScroll) {
  24767. translateAxis(boxWithoutScroll.x, scroll_1.x);
  24768. translateAxis(boxWithoutScroll.y, scroll_1.y);
  24769. }
  24770. }
  24771. return boxWithoutScroll;
  24772. };
  24773. ProjectionNode.prototype.applyTransform = function (box, transformOnly) {
  24774. if (transformOnly === void 0) { transformOnly = false; }
  24775. var withTransforms = createBox();
  24776. copyBoxInto(withTransforms, box);
  24777. for (var i = 0; i < this.path.length; i++) {
  24778. var node = this.path[i];
  24779. if (!transformOnly &&
  24780. node.options.layoutScroll &&
  24781. node.scroll &&
  24782. node !== node.root) {
  24783. transformBox(withTransforms, {
  24784. x: -node.scroll.x,
  24785. y: -node.scroll.y,
  24786. });
  24787. }
  24788. if (!hasTransform(node.latestValues))
  24789. continue;
  24790. transformBox(withTransforms, node.latestValues);
  24791. }
  24792. if (hasTransform(this.latestValues)) {
  24793. transformBox(withTransforms, this.latestValues);
  24794. }
  24795. return withTransforms;
  24796. };
  24797. ProjectionNode.prototype.removeTransform = function (box) {
  24798. var _a;
  24799. var boxWithoutTransform = createBox();
  24800. copyBoxInto(boxWithoutTransform, box);
  24801. for (var i = 0; i < this.path.length; i++) {
  24802. var node = this.path[i];
  24803. if (!node.instance)
  24804. continue;
  24805. if (!hasTransform(node.latestValues))
  24806. continue;
  24807. hasScale(node.latestValues) && node.updateSnapshot();
  24808. var sourceBox = createBox();
  24809. var nodeBox = node.measure();
  24810. copyBoxInto(sourceBox, nodeBox);
  24811. removeBoxTransforms(boxWithoutTransform, node.latestValues, (_a = node.snapshot) === null || _a === void 0 ? void 0 : _a.layout, sourceBox);
  24812. }
  24813. if (hasTransform(this.latestValues)) {
  24814. removeBoxTransforms(boxWithoutTransform, this.latestValues);
  24815. }
  24816. return boxWithoutTransform;
  24817. };
  24818. /**
  24819. *
  24820. */
  24821. ProjectionNode.prototype.setTargetDelta = function (delta) {
  24822. this.targetDelta = delta;
  24823. this.root.scheduleUpdateProjection();
  24824. };
  24825. ProjectionNode.prototype.setOptions = function (options) {
  24826. var _a;
  24827. this.options = __assign(__assign(__assign({}, this.options), options), { crossfade: (_a = options.crossfade) !== null && _a !== void 0 ? _a : true });
  24828. };
  24829. ProjectionNode.prototype.clearMeasurements = function () {
  24830. this.scroll = undefined;
  24831. this.layout = undefined;
  24832. this.snapshot = undefined;
  24833. this.prevTransformTemplateValue = undefined;
  24834. this.targetDelta = undefined;
  24835. this.target = undefined;
  24836. this.isLayoutDirty = false;
  24837. };
  24838. /**
  24839. * Frame calculations
  24840. */
  24841. ProjectionNode.prototype.resolveTargetDelta = function () {
  24842. var _a;
  24843. var _b = this.options, layout = _b.layout, layoutId = _b.layoutId;
  24844. /**
  24845. * If we have no layout, we can't perform projection, so early return
  24846. */
  24847. if (!this.layout || !(layout || layoutId))
  24848. return;
  24849. /**
  24850. * If we don't have a targetDelta but do have a layout, we can attempt to resolve
  24851. * a relativeParent. This will allow a component to perform scale correction
  24852. * even if no animation has started.
  24853. */
  24854. // TODO If this is unsuccessful this currently happens every frame
  24855. if (!this.targetDelta && !this.relativeTarget) {
  24856. // TODO: This is a semi-repetition of further down this function, make DRY
  24857. this.relativeParent = this.getClosestProjectingParent();
  24858. if (this.relativeParent && this.relativeParent.layout) {
  24859. this.relativeTarget = createBox();
  24860. this.relativeTargetOrigin = createBox();
  24861. calcRelativePosition(this.relativeTargetOrigin, this.layout.actual, this.relativeParent.layout.actual);
  24862. copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
  24863. }
  24864. }
  24865. /**
  24866. * If we have no relative target or no target delta our target isn't valid
  24867. * for this frame.
  24868. */
  24869. if (!this.relativeTarget && !this.targetDelta)
  24870. return;
  24871. /**
  24872. * Lazy-init target data structure
  24873. */
  24874. if (!this.target) {
  24875. this.target = createBox();
  24876. this.targetWithTransforms = createBox();
  24877. }
  24878. /**
  24879. * If we've got a relative box for this component, resolve it into a target relative to the parent.
  24880. */
  24881. if (this.relativeTarget &&
  24882. this.relativeTargetOrigin &&
  24883. ((_a = this.relativeParent) === null || _a === void 0 ? void 0 : _a.target)) {
  24884. calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
  24885. /**
  24886. * If we've only got a targetDelta, resolve it into a target
  24887. */
  24888. }
  24889. else if (this.targetDelta) {
  24890. if (Boolean(this.resumingFrom)) {
  24891. // TODO: This is creating a new object every frame
  24892. this.target = this.applyTransform(this.layout.actual);
  24893. }
  24894. else {
  24895. copyBoxInto(this.target, this.layout.actual);
  24896. }
  24897. applyBoxDelta(this.target, this.targetDelta);
  24898. }
  24899. else {
  24900. /**
  24901. * If no target, use own layout as target
  24902. */
  24903. copyBoxInto(this.target, this.layout.actual);
  24904. }
  24905. /**
  24906. * If we've been told to attempt to resolve a relative target, do so.
  24907. */
  24908. if (this.attemptToResolveRelativeTarget) {
  24909. this.attemptToResolveRelativeTarget = false;
  24910. this.relativeParent = this.getClosestProjectingParent();
  24911. if (this.relativeParent &&
  24912. Boolean(this.relativeParent.resumingFrom) ===
  24913. Boolean(this.resumingFrom) &&
  24914. !this.relativeParent.options.layoutScroll &&
  24915. this.relativeParent.target) {
  24916. this.relativeTarget = createBox();
  24917. this.relativeTargetOrigin = createBox();
  24918. calcRelativePosition(this.relativeTargetOrigin, this.target, this.relativeParent.target);
  24919. copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
  24920. }
  24921. }
  24922. };
  24923. ProjectionNode.prototype.getClosestProjectingParent = function () {
  24924. if (!this.parent || hasTransform(this.parent.latestValues))
  24925. return undefined;
  24926. if ((this.parent.relativeTarget || this.parent.targetDelta) &&
  24927. this.parent.layout) {
  24928. return this.parent;
  24929. }
  24930. else {
  24931. return this.parent.getClosestProjectingParent();
  24932. }
  24933. };
  24934. ProjectionNode.prototype.calcProjection = function () {
  24935. var _a;
  24936. var _b = this.options, layout = _b.layout, layoutId = _b.layoutId;
  24937. /**
  24938. * If this section of the tree isn't animating we can
  24939. * delete our target sources for the following frame.
  24940. */
  24941. this.isTreeAnimating = Boolean(((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isTreeAnimating) ||
  24942. this.currentAnimation ||
  24943. this.pendingAnimation);
  24944. if (!this.isTreeAnimating) {
  24945. this.targetDelta = this.relativeTarget = undefined;
  24946. }
  24947. if (!this.layout || !(layout || layoutId))
  24948. return;
  24949. var lead = this.getLead();
  24950. /**
  24951. * Reset the corrected box with the latest values from box, as we're then going
  24952. * to perform mutative operations on it.
  24953. */
  24954. copyBoxInto(this.layoutCorrected, this.layout.actual);
  24955. /**
  24956. * Apply all the parent deltas to this box to produce the corrected box. This
  24957. * is the layout box, as it will appear on screen as a result of the transforms of its parents.
  24958. */
  24959. applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, Boolean(this.resumingFrom) || this !== lead);
  24960. var target = lead.target;
  24961. if (!target)
  24962. return;
  24963. if (!this.projectionDelta) {
  24964. this.projectionDelta = createDelta();
  24965. this.projectionDeltaWithTransform = createDelta();
  24966. }
  24967. var prevTreeScaleX = this.treeScale.x;
  24968. var prevTreeScaleY = this.treeScale.y;
  24969. var prevProjectionTransform = this.projectionTransform;
  24970. /**
  24971. * Update the delta between the corrected box and the target box before user-set transforms were applied.
  24972. * This will allow us to calculate the corrected borderRadius and boxShadow to compensate
  24973. * for our layout reprojection, but still allow them to be scaled correctly by the user.
  24974. * It might be that to simplify this we may want to accept that user-set scale is also corrected
  24975. * and we wouldn't have to keep and calc both deltas, OR we could support a user setting
  24976. * to allow people to choose whether these styles are corrected based on just the
  24977. * layout reprojection or the final bounding box.
  24978. */
  24979. calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);
  24980. this.projectionTransform = buildProjectionTransform(this.projectionDelta, this.treeScale);
  24981. if (this.projectionTransform !== prevProjectionTransform ||
  24982. this.treeScale.x !== prevTreeScaleX ||
  24983. this.treeScale.y !== prevTreeScaleY) {
  24984. this.hasProjected = true;
  24985. this.scheduleRender();
  24986. this.notifyListeners("projectionUpdate", target);
  24987. }
  24988. };
  24989. ProjectionNode.prototype.hide = function () {
  24990. this.isVisible = false;
  24991. // TODO: Schedule render
  24992. };
  24993. ProjectionNode.prototype.show = function () {
  24994. this.isVisible = true;
  24995. // TODO: Schedule render
  24996. };
  24997. ProjectionNode.prototype.scheduleRender = function (notifyAll) {
  24998. var _a, _b, _c;
  24999. if (notifyAll === void 0) { notifyAll = true; }
  25000. (_b = (_a = this.options).scheduleRender) === null || _b === void 0 ? void 0 : _b.call(_a);
  25001. notifyAll && ((_c = this.getStack()) === null || _c === void 0 ? void 0 : _c.scheduleRender());
  25002. if (this.resumingFrom && !this.resumingFrom.instance) {
  25003. this.resumingFrom = undefined;
  25004. }
  25005. };
  25006. ProjectionNode.prototype.setAnimationOrigin = function (delta, hasOnlyRelativeTargetChanged) {
  25007. var _this = this;
  25008. var _a;
  25009. if (hasOnlyRelativeTargetChanged === void 0) { hasOnlyRelativeTargetChanged = false; }
  25010. var snapshot = this.snapshot;
  25011. var snapshotLatestValues = (snapshot === null || snapshot === void 0 ? void 0 : snapshot.latestValues) || {};
  25012. var mixedValues = __assign({}, this.latestValues);
  25013. var targetDelta = createDelta();
  25014. this.relativeTarget = this.relativeTargetOrigin = undefined;
  25015. this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;
  25016. var relativeLayout = createBox();
  25017. var isSharedLayoutAnimation = snapshot === null || snapshot === void 0 ? void 0 : snapshot.isShared;
  25018. var isOnlyMember = (((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.members.length) || 0) <= 1;
  25019. var shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation &&
  25020. !isOnlyMember &&
  25021. this.options.crossfade === true &&
  25022. !this.path.some(hasOpacityCrossfade));
  25023. this.animationProgress = 0;
  25024. this.mixTargetDelta = function (latest) {
  25025. var _a;
  25026. var progress = latest / 1000;
  25027. mixAxisDelta(targetDelta.x, delta.x, progress);
  25028. mixAxisDelta(targetDelta.y, delta.y, progress);
  25029. _this.setTargetDelta(targetDelta);
  25030. if (_this.relativeTarget &&
  25031. _this.relativeTargetOrigin &&
  25032. _this.layout &&
  25033. ((_a = _this.relativeParent) === null || _a === void 0 ? void 0 : _a.layout)) {
  25034. calcRelativePosition(relativeLayout, _this.layout.actual, _this.relativeParent.layout.actual);
  25035. mixBox(_this.relativeTarget, _this.relativeTargetOrigin, relativeLayout, progress);
  25036. }
  25037. if (isSharedLayoutAnimation) {
  25038. _this.animationValues = mixedValues;
  25039. mixValues(mixedValues, snapshotLatestValues, _this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember);
  25040. }
  25041. _this.root.scheduleUpdateProjection();
  25042. _this.scheduleRender();
  25043. _this.animationProgress = progress;
  25044. };
  25045. this.mixTargetDelta(0);
  25046. };
  25047. ProjectionNode.prototype.startAnimation = function (options) {
  25048. var _this = this;
  25049. var _a, _b;
  25050. this.notifyListeners("animationStart");
  25051. (_a = this.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop();
  25052. if (this.resumingFrom) {
  25053. (_b = this.resumingFrom.currentAnimation) === null || _b === void 0 ? void 0 : _b.stop();
  25054. }
  25055. if (this.pendingAnimation) {
  25056. cancelSync.update(this.pendingAnimation);
  25057. this.pendingAnimation = undefined;
  25058. }
  25059. /**
  25060. * Start the animation in the next frame to have a frame with progress 0,
  25061. * where the target is the same as when the animation started, so we can
  25062. * calculate the relative positions correctly for instant transitions.
  25063. */
  25064. this.pendingAnimation = es.update(function () {
  25065. globalProjectionState.hasAnimatedSinceResize = true;
  25066. _this.currentAnimation = animate_animate(0, animationTarget, __assign(__assign({}, options), { onUpdate: function (latest) {
  25067. var _a;
  25068. _this.mixTargetDelta(latest);
  25069. (_a = options.onUpdate) === null || _a === void 0 ? void 0 : _a.call(options, latest);
  25070. }, onComplete: function () {
  25071. var _a;
  25072. (_a = options.onComplete) === null || _a === void 0 ? void 0 : _a.call(options);
  25073. _this.completeAnimation();
  25074. } }));
  25075. if (_this.resumingFrom) {
  25076. _this.resumingFrom.currentAnimation = _this.currentAnimation;
  25077. }
  25078. _this.pendingAnimation = undefined;
  25079. });
  25080. };
  25081. ProjectionNode.prototype.completeAnimation = function () {
  25082. var _a;
  25083. if (this.resumingFrom) {
  25084. this.resumingFrom.currentAnimation = undefined;
  25085. this.resumingFrom.preserveOpacity = undefined;
  25086. }
  25087. (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.exitAnimationComplete();
  25088. this.resumingFrom =
  25089. this.currentAnimation =
  25090. this.animationValues =
  25091. undefined;
  25092. this.notifyListeners("animationComplete");
  25093. };
  25094. ProjectionNode.prototype.finishAnimation = function () {
  25095. var _a;
  25096. if (this.currentAnimation) {
  25097. (_a = this.mixTargetDelta) === null || _a === void 0 ? void 0 : _a.call(this, animationTarget);
  25098. this.currentAnimation.stop();
  25099. }
  25100. this.completeAnimation();
  25101. };
  25102. ProjectionNode.prototype.applyTransformsToTarget = function () {
  25103. var _a = this.getLead(), targetWithTransforms = _a.targetWithTransforms, target = _a.target, layout = _a.layout, latestValues = _a.latestValues;
  25104. if (!targetWithTransforms || !target || !layout)
  25105. return;
  25106. copyBoxInto(targetWithTransforms, target);
  25107. /**
  25108. * Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal.
  25109. * This is the final box that we will then project into by calculating a transform delta and
  25110. * applying it to the corrected box.
  25111. */
  25112. transformBox(targetWithTransforms, latestValues);
  25113. /**
  25114. * Update the delta between the corrected box and the final target box, after
  25115. * user-set transforms are applied to it. This will be used by the renderer to
  25116. * create a transform style that will reproject the element from its actual layout
  25117. * into the desired bounding box.
  25118. */
  25119. calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);
  25120. };
  25121. ProjectionNode.prototype.registerSharedNode = function (layoutId, node) {
  25122. var _a, _b, _c;
  25123. if (!this.sharedNodes.has(layoutId)) {
  25124. this.sharedNodes.set(layoutId, new NodeStack());
  25125. }
  25126. var stack = this.sharedNodes.get(layoutId);
  25127. stack.add(node);
  25128. node.promote({
  25129. transition: (_a = node.options.initialPromotionConfig) === null || _a === void 0 ? void 0 : _a.transition,
  25130. preserveFollowOpacity: (_c = (_b = node.options.initialPromotionConfig) === null || _b === void 0 ? void 0 : _b.shouldPreserveFollowOpacity) === null || _c === void 0 ? void 0 : _c.call(_b, node),
  25131. });
  25132. };
  25133. ProjectionNode.prototype.isLead = function () {
  25134. var stack = this.getStack();
  25135. return stack ? stack.lead === this : true;
  25136. };
  25137. ProjectionNode.prototype.getLead = function () {
  25138. var _a;
  25139. var layoutId = this.options.layoutId;
  25140. return layoutId ? ((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.lead) || this : this;
  25141. };
  25142. ProjectionNode.prototype.getPrevLead = function () {
  25143. var _a;
  25144. var layoutId = this.options.layoutId;
  25145. return layoutId ? (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.prevLead : undefined;
  25146. };
  25147. ProjectionNode.prototype.getStack = function () {
  25148. var layoutId = this.options.layoutId;
  25149. if (layoutId)
  25150. return this.root.sharedNodes.get(layoutId);
  25151. };
  25152. ProjectionNode.prototype.promote = function (_a) {
  25153. var _b = _a === void 0 ? {} : _a, needsReset = _b.needsReset, transition = _b.transition, preserveFollowOpacity = _b.preserveFollowOpacity;
  25154. var stack = this.getStack();
  25155. if (stack)
  25156. stack.promote(this, preserveFollowOpacity);
  25157. if (needsReset) {
  25158. this.projectionDelta = undefined;
  25159. this.needsReset = true;
  25160. }
  25161. if (transition)
  25162. this.setOptions({ transition: transition });
  25163. };
  25164. ProjectionNode.prototype.relegate = function () {
  25165. var stack = this.getStack();
  25166. if (stack) {
  25167. return stack.relegate(this);
  25168. }
  25169. else {
  25170. return false;
  25171. }
  25172. };
  25173. ProjectionNode.prototype.resetRotation = function () {
  25174. var visualElement = this.options.visualElement;
  25175. if (!visualElement)
  25176. return;
  25177. // If there's no detected rotation values, we can early return without a forced render.
  25178. var hasRotate = false;
  25179. // Keep a record of all the values we've reset
  25180. var resetValues = {};
  25181. // Check the rotate value of all axes and reset to 0
  25182. for (var i = 0; i < transformAxes.length; i++) {
  25183. var axis = transformAxes[i];
  25184. var key = "rotate" + axis;
  25185. // If this rotation doesn't exist as a motion value, then we don't
  25186. // need to reset it
  25187. if (!visualElement.getStaticValue(key)) {
  25188. continue;
  25189. }
  25190. hasRotate = true;
  25191. // Record the rotation and then temporarily set it to 0
  25192. resetValues[key] = visualElement.getStaticValue(key);
  25193. visualElement.setStaticValue(key, 0);
  25194. }
  25195. // If there's no rotation values, we don't need to do any more.
  25196. if (!hasRotate)
  25197. return;
  25198. // Force a render of this element to apply the transform with all rotations
  25199. // set to 0.
  25200. visualElement === null || visualElement === void 0 ? void 0 : visualElement.syncRender();
  25201. // Put back all the values we reset
  25202. for (var key in resetValues) {
  25203. visualElement.setStaticValue(key, resetValues[key]);
  25204. }
  25205. // Schedule a render for the next frame. This ensures we won't visually
  25206. // see the element with the reset rotate value applied.
  25207. visualElement.scheduleRender();
  25208. };
  25209. ProjectionNode.prototype.getProjectionStyles = function (styleProp) {
  25210. var _a, _b, _c, _d, _e, _f;
  25211. if (styleProp === void 0) { styleProp = {}; }
  25212. // TODO: Return lifecycle-persistent object
  25213. var styles = {};
  25214. if (!this.instance || this.isSVG)
  25215. return styles;
  25216. if (!this.isVisible) {
  25217. return { visibility: "hidden" };
  25218. }
  25219. else {
  25220. styles.visibility = "";
  25221. }
  25222. var transformTemplate = (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.getProps().transformTemplate;
  25223. if (this.needsReset) {
  25224. this.needsReset = false;
  25225. styles.opacity = "";
  25226. styles.pointerEvents =
  25227. resolveMotionValue(styleProp.pointerEvents) || "";
  25228. styles.transform = transformTemplate
  25229. ? transformTemplate(this.latestValues, "")
  25230. : "none";
  25231. return styles;
  25232. }
  25233. var lead = this.getLead();
  25234. if (!this.projectionDelta || !this.layout || !lead.target) {
  25235. var emptyStyles = {};
  25236. if (this.options.layoutId) {
  25237. emptyStyles.opacity = (_b = this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1;
  25238. emptyStyles.pointerEvents =
  25239. resolveMotionValue(styleProp.pointerEvents) || "";
  25240. }
  25241. if (this.hasProjected && !hasTransform(this.latestValues)) {
  25242. emptyStyles.transform = transformTemplate
  25243. ? transformTemplate({}, "")
  25244. : "none";
  25245. this.hasProjected = false;
  25246. }
  25247. return emptyStyles;
  25248. }
  25249. var valuesToRender = lead.animationValues || lead.latestValues;
  25250. this.applyTransformsToTarget();
  25251. styles.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
  25252. if (transformTemplate) {
  25253. styles.transform = transformTemplate(valuesToRender, styles.transform);
  25254. }
  25255. var _g = this.projectionDelta, x = _g.x, y = _g.y;
  25256. styles.transformOrigin = "".concat(x.origin * 100, "% ").concat(y.origin * 100, "% 0");
  25257. if (lead.animationValues) {
  25258. /**
  25259. * If the lead component is animating, assign this either the entering/leaving
  25260. * opacity
  25261. */
  25262. styles.opacity =
  25263. lead === this
  25264. ? (_d = (_c = valuesToRender.opacity) !== null && _c !== void 0 ? _c : this.latestValues.opacity) !== null && _d !== void 0 ? _d : 1
  25265. : this.preserveOpacity
  25266. ? this.latestValues.opacity
  25267. : valuesToRender.opacityExit;
  25268. }
  25269. else {
  25270. /**
  25271. * Or we're not animating at all, set the lead component to its actual
  25272. * opacity and other components to hidden.
  25273. */
  25274. styles.opacity =
  25275. lead === this
  25276. ? (_e = valuesToRender.opacity) !== null && _e !== void 0 ? _e : ""
  25277. : (_f = valuesToRender.opacityExit) !== null && _f !== void 0 ? _f : 0;
  25278. }
  25279. /**
  25280. * Apply scale correction
  25281. */
  25282. for (var key in scaleCorrectors) {
  25283. if (valuesToRender[key] === undefined)
  25284. continue;
  25285. var _h = scaleCorrectors[key], correct = _h.correct, applyTo = _h.applyTo;
  25286. var corrected = correct(valuesToRender[key], lead);
  25287. if (applyTo) {
  25288. var num = applyTo.length;
  25289. for (var i = 0; i < num; i++) {
  25290. styles[applyTo[i]] = corrected;
  25291. }
  25292. }
  25293. else {
  25294. styles[key] = corrected;
  25295. }
  25296. }
  25297. /**
  25298. * Disable pointer events on follow components. This is to ensure
  25299. * that if a follow component covers a lead component it doesn't block
  25300. * pointer events on the lead.
  25301. */
  25302. if (this.options.layoutId) {
  25303. styles.pointerEvents =
  25304. lead === this
  25305. ? resolveMotionValue(styleProp.pointerEvents) || ""
  25306. : "none";
  25307. }
  25308. return styles;
  25309. };
  25310. ProjectionNode.prototype.clearSnapshot = function () {
  25311. this.resumeFrom = this.snapshot = undefined;
  25312. };
  25313. // Only run on root
  25314. ProjectionNode.prototype.resetTree = function () {
  25315. this.root.nodes.forEach(function (node) { var _a; return (_a = node.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop(); });
  25316. this.root.nodes.forEach(clearMeasurements);
  25317. this.root.sharedNodes.clear();
  25318. };
  25319. return ProjectionNode;
  25320. }());
  25321. }
  25322. function updateLayout(node) {
  25323. node.updateLayout();
  25324. }
  25325. function notifyLayoutUpdate(node) {
  25326. var _a, _b, _c, _d;
  25327. var snapshot = (_b = (_a = node.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) !== null && _b !== void 0 ? _b : node.snapshot;
  25328. if (node.isLead() &&
  25329. node.layout &&
  25330. snapshot &&
  25331. node.hasListeners("didUpdate")) {
  25332. var _e = node.layout, layout_1 = _e.actual, measuredLayout = _e.measured;
  25333. // TODO Maybe we want to also resize the layout snapshot so we don't trigger
  25334. // animations for instance if layout="size" and an element has only changed position
  25335. if (node.options.animationType === "size") {
  25336. eachAxis(function (axis) {
  25337. var axisSnapshot = snapshot.isShared
  25338. ? snapshot.measured[axis]
  25339. : snapshot.layout[axis];
  25340. var length = calcLength(axisSnapshot);
  25341. axisSnapshot.min = layout_1[axis].min;
  25342. axisSnapshot.max = axisSnapshot.min + length;
  25343. });
  25344. }
  25345. else if (node.options.animationType === "position") {
  25346. eachAxis(function (axis) {
  25347. var axisSnapshot = snapshot.isShared
  25348. ? snapshot.measured[axis]
  25349. : snapshot.layout[axis];
  25350. var length = calcLength(layout_1[axis]);
  25351. axisSnapshot.max = axisSnapshot.min + length;
  25352. });
  25353. }
  25354. var layoutDelta = createDelta();
  25355. calcBoxDelta(layoutDelta, layout_1, snapshot.layout);
  25356. var visualDelta = createDelta();
  25357. if (snapshot.isShared) {
  25358. calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measured);
  25359. }
  25360. else {
  25361. calcBoxDelta(visualDelta, layout_1, snapshot.layout);
  25362. }
  25363. var hasLayoutChanged = !isDeltaZero(layoutDelta);
  25364. var hasRelativeTargetChanged = false;
  25365. if (!node.resumeFrom) {
  25366. node.relativeParent = node.getClosestProjectingParent();
  25367. /**
  25368. * If the relativeParent is itself resuming from a different element then
  25369. * the relative snapshot is not relavent
  25370. */
  25371. if (node.relativeParent && !node.relativeParent.resumeFrom) {
  25372. var _f = node.relativeParent, parentSnapshot = _f.snapshot, parentLayout = _f.layout;
  25373. if (parentSnapshot && parentLayout) {
  25374. var relativeSnapshot = createBox();
  25375. calcRelativePosition(relativeSnapshot, snapshot.layout, parentSnapshot.layout);
  25376. var relativeLayout = createBox();
  25377. calcRelativePosition(relativeLayout, layout_1, parentLayout.actual);
  25378. if (!boxEquals(relativeSnapshot, relativeLayout)) {
  25379. hasRelativeTargetChanged = true;
  25380. }
  25381. }
  25382. }
  25383. }
  25384. node.notifyListeners("didUpdate", {
  25385. layout: layout_1,
  25386. snapshot: snapshot,
  25387. delta: visualDelta,
  25388. layoutDelta: layoutDelta,
  25389. hasLayoutChanged: hasLayoutChanged,
  25390. hasRelativeTargetChanged: hasRelativeTargetChanged,
  25391. });
  25392. }
  25393. else if (node.isLead()) {
  25394. (_d = (_c = node.options).onExitComplete) === null || _d === void 0 ? void 0 : _d.call(_c);
  25395. }
  25396. /**
  25397. * Clearing transition
  25398. * TODO: Investigate why this transition is being passed in as {type: false } from Framer
  25399. * and why we need it at all
  25400. */
  25401. node.options.transition = undefined;
  25402. }
  25403. function clearSnapshot(node) {
  25404. node.clearSnapshot();
  25405. }
  25406. function clearMeasurements(node) {
  25407. node.clearMeasurements();
  25408. }
  25409. function resetTransformStyle(node) {
  25410. var visualElement = node.options.visualElement;
  25411. if (visualElement === null || visualElement === void 0 ? void 0 : visualElement.getProps().onBeforeLayoutMeasure) {
  25412. visualElement.notifyBeforeLayoutMeasure();
  25413. }
  25414. node.resetTransform();
  25415. }
  25416. function finishAnimation(node) {
  25417. node.finishAnimation();
  25418. node.targetDelta = node.relativeTarget = node.target = undefined;
  25419. }
  25420. function resolveTargetDelta(node) {
  25421. node.resolveTargetDelta();
  25422. }
  25423. function calcProjection(node) {
  25424. node.calcProjection();
  25425. }
  25426. function resetRotation(node) {
  25427. node.resetRotation();
  25428. }
  25429. function removeLeadSnapshots(stack) {
  25430. stack.removeLeadSnapshot();
  25431. }
  25432. function mixAxisDelta(output, delta, p) {
  25433. output.translate = mix(delta.translate, 0, p);
  25434. output.scale = mix(delta.scale, 1, p);
  25435. output.origin = delta.origin;
  25436. output.originPoint = delta.originPoint;
  25437. }
  25438. function mixAxis(output, from, to, p) {
  25439. output.min = mix(from.min, to.min, p);
  25440. output.max = mix(from.max, to.max, p);
  25441. }
  25442. function mixBox(output, from, to, p) {
  25443. mixAxis(output.x, from.x, to.x, p);
  25444. mixAxis(output.y, from.y, to.y, p);
  25445. }
  25446. function hasOpacityCrossfade(node) {
  25447. return (node.animationValues && node.animationValues.opacityExit !== undefined);
  25448. }
  25449. var defaultLayoutTransition = {
  25450. duration: 0.45,
  25451. ease: [0.4, 0, 0.1, 1],
  25452. };
  25453. function mountNodeEarly(node, id) {
  25454. /**
  25455. * Rather than searching the DOM from document we can search the
  25456. * path for the deepest mounted ancestor and search from there
  25457. */
  25458. var searchNode = node.root;
  25459. for (var i = node.path.length - 1; i >= 0; i--) {
  25460. if (Boolean(node.path[i].instance)) {
  25461. searchNode = node.path[i];
  25462. break;
  25463. }
  25464. }
  25465. var searchElement = searchNode && searchNode !== node.root ? searchNode.instance : document;
  25466. var element = searchElement.querySelector("[data-projection-id=\"".concat(id, "\"]"));
  25467. if (element)
  25468. node.mount(element, true);
  25469. }
  25470. function roundAxis(axis) {
  25471. axis.min = Math.round(axis.min);
  25472. axis.max = Math.round(axis.max);
  25473. }
  25474. function roundBox(box) {
  25475. roundAxis(box.x);
  25476. roundAxis(box.y);
  25477. }
  25478. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/id.mjs
  25479. var id = 1;
  25480. function useProjectionId() {
  25481. return useConstant(function () {
  25482. if (globalProjectionState.hasEverUpdated) {
  25483. return id++;
  25484. }
  25485. });
  25486. }
  25487. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs
  25488. /**
  25489. * @internal
  25490. */
  25491. var LayoutGroupContext = (0,external_React_.createContext)({});
  25492. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs
  25493. /**
  25494. * @internal
  25495. */
  25496. var SwitchLayoutGroupContext = (0,external_React_.createContext)({});
  25497. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/use-projection.mjs
  25498. function useProjection(projectionId, _a, visualElement, ProjectionNodeConstructor) {
  25499. var _b;
  25500. var layoutId = _a.layoutId, layout = _a.layout, drag = _a.drag, dragConstraints = _a.dragConstraints, layoutScroll = _a.layoutScroll;
  25501. var initialPromotionConfig = (0,external_React_.useContext)(SwitchLayoutGroupContext);
  25502. if (!ProjectionNodeConstructor ||
  25503. !visualElement ||
  25504. (visualElement === null || visualElement === void 0 ? void 0 : visualElement.projection)) {
  25505. return;
  25506. }
  25507. visualElement.projection = new ProjectionNodeConstructor(projectionId, visualElement.getLatestValues(), (_b = visualElement.parent) === null || _b === void 0 ? void 0 : _b.projection);
  25508. visualElement.projection.setOptions({
  25509. layoutId: layoutId,
  25510. layout: layout,
  25511. alwaysMeasureLayout: Boolean(drag) || (dragConstraints && is_ref_object_isRefObject(dragConstraints)),
  25512. visualElement: visualElement,
  25513. scheduleRender: function () { return visualElement.scheduleRender(); },
  25514. /**
  25515. * TODO: Update options in an effect. This could be tricky as it'll be too late
  25516. * to update by the time layout animations run.
  25517. * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
  25518. * ensuring it gets called if there's no potential layout animations.
  25519. *
  25520. */
  25521. animationType: typeof layout === "string" ? layout : "both",
  25522. initialPromotionConfig: initialPromotionConfig,
  25523. layoutScroll: layoutScroll,
  25524. });
  25525. }
  25526. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/VisualElementHandler.mjs
  25527. var VisualElementHandler = /** @class */ (function (_super) {
  25528. __extends(VisualElementHandler, _super);
  25529. function VisualElementHandler() {
  25530. return _super !== null && _super.apply(this, arguments) || this;
  25531. }
  25532. /**
  25533. * Update visual element props as soon as we know this update is going to be commited.
  25534. */
  25535. VisualElementHandler.prototype.getSnapshotBeforeUpdate = function () {
  25536. this.updateProps();
  25537. return null;
  25538. };
  25539. VisualElementHandler.prototype.componentDidUpdate = function () { };
  25540. VisualElementHandler.prototype.updateProps = function () {
  25541. var _a = this.props, visualElement = _a.visualElement, props = _a.props;
  25542. if (visualElement)
  25543. visualElement.setProps(props);
  25544. };
  25545. VisualElementHandler.prototype.render = function () {
  25546. return this.props.children;
  25547. };
  25548. return VisualElementHandler;
  25549. }(external_React_.Component));
  25550. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/index.mjs
  25551. /**
  25552. * Create a `motion` component.
  25553. *
  25554. * This function accepts a Component argument, which can be either a string (ie "div"
  25555. * for `motion.div`), or an actual React component.
  25556. *
  25557. * Alongside this is a config option which provides a way of rendering the provided
  25558. * component "offline", or outside the React render cycle.
  25559. *
  25560. * @internal
  25561. */
  25562. function motion_createMotionComponent(_a) {
  25563. var preloadedFeatures = _a.preloadedFeatures, createVisualElement = _a.createVisualElement, projectionNodeConstructor = _a.projectionNodeConstructor, useRender = _a.useRender, useVisualState = _a.useVisualState, Component = _a.Component;
  25564. preloadedFeatures && loadFeatures(preloadedFeatures);
  25565. function MotionComponent(props, externalRef) {
  25566. var layoutId = useLayoutId(props);
  25567. props = __assign(__assign({}, props), { layoutId: layoutId });
  25568. /**
  25569. * If we're rendering in a static environment, we only visually update the component
  25570. * as a result of a React-rerender rather than interactions or animations. This
  25571. * means we don't need to load additional memory structures like VisualElement,
  25572. * or any gesture/animation features.
  25573. */
  25574. var config = (0,external_React_.useContext)(MotionConfigContext);
  25575. var features = null;
  25576. var context = useCreateMotionContext(props);
  25577. /**
  25578. * Create a unique projection ID for this component. If a new component is added
  25579. * during a layout animation we'll use this to query the DOM and hydrate its ref early, allowing
  25580. * us to measure it as soon as any layout effect flushes pending layout animations.
  25581. *
  25582. * Performance note: It'd be better not to have to search the DOM for these elements.
  25583. * For newly-entering components it could be enough to only correct treeScale, in which
  25584. * case we could mount in a scale-correction mode. This wouldn't be enough for
  25585. * shared element transitions however. Perhaps for those we could revert to a root node
  25586. * that gets forceRendered and layout animations are triggered on its layout effect.
  25587. */
  25588. var projectionId = config.isStatic ? undefined : useProjectionId();
  25589. /**
  25590. *
  25591. */
  25592. var visualState = useVisualState(props, config.isStatic);
  25593. if (!config.isStatic && is_browser_isBrowser) {
  25594. /**
  25595. * Create a VisualElement for this component. A VisualElement provides a common
  25596. * interface to renderer-specific APIs (ie DOM/Three.js etc) as well as
  25597. * providing a way of rendering to these APIs outside of the React render loop
  25598. * for more performant animations and interactions
  25599. */
  25600. context.visualElement = useVisualElement(Component, visualState, __assign(__assign({}, config), props), createVisualElement);
  25601. useProjection(projectionId, props, context.visualElement, projectionNodeConstructor ||
  25602. featureDefinitions.projectionNodeConstructor);
  25603. /**
  25604. * Load Motion gesture and animation features. These are rendered as renderless
  25605. * components so each feature can optionally make use of React lifecycle methods.
  25606. */
  25607. features = useFeatures(props, context.visualElement, preloadedFeatures);
  25608. }
  25609. /**
  25610. * The mount order and hierarchy is specific to ensure our element ref
  25611. * is hydrated by the time features fire their effects.
  25612. */
  25613. return (external_React_.createElement(VisualElementHandler, { visualElement: context.visualElement, props: __assign(__assign({}, config), props) },
  25614. features,
  25615. external_React_.createElement(MotionContext.Provider, { value: context }, useRender(Component, props, projectionId, useMotionRef(visualState, context.visualElement, externalRef), visualState, config.isStatic, context.visualElement))));
  25616. }
  25617. return (0,external_React_.forwardRef)(MotionComponent);
  25618. }
  25619. function useLayoutId(_a) {
  25620. var _b;
  25621. var layoutId = _a.layoutId;
  25622. var layoutGroupId = (_b = (0,external_React_.useContext)(LayoutGroupContext)) === null || _b === void 0 ? void 0 : _b.id;
  25623. return layoutGroupId && layoutId !== undefined
  25624. ? layoutGroupId + "-" + layoutId
  25625. : layoutId;
  25626. }
  25627. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/motion-proxy.mjs
  25628. /**
  25629. * Convert any React component into a `motion` component. The provided component
  25630. * **must** use `React.forwardRef` to the underlying DOM component you want to animate.
  25631. *
  25632. * ```jsx
  25633. * const Component = React.forwardRef((props, ref) => {
  25634. * return <div ref={ref} />
  25635. * })
  25636. *
  25637. * const MotionComponent = motion(Component)
  25638. * ```
  25639. *
  25640. * @public
  25641. */
  25642. function createMotionProxy(createConfig) {
  25643. function custom(Component, customMotionComponentConfig) {
  25644. if (customMotionComponentConfig === void 0) { customMotionComponentConfig = {}; }
  25645. return motion_createMotionComponent(createConfig(Component, customMotionComponentConfig));
  25646. }
  25647. if (typeof Proxy === "undefined") {
  25648. return custom;
  25649. }
  25650. /**
  25651. * A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.
  25652. * Rather than generating them anew every render.
  25653. */
  25654. var componentCache = new Map();
  25655. return new Proxy(custom, {
  25656. /**
  25657. * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
  25658. * The prop name is passed through as `key` and we can use that to generate a `motion`
  25659. * DOM component with that name.
  25660. */
  25661. get: function (_target, key) {
  25662. /**
  25663. * If this element doesn't exist in the component cache, create it and cache.
  25664. */
  25665. if (!componentCache.has(key)) {
  25666. componentCache.set(key, custom(key));
  25667. }
  25668. return componentCache.get(key);
  25669. },
  25670. });
  25671. }
  25672. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/lowercase-elements.mjs
  25673. /**
  25674. * We keep these listed seperately as we use the lowercase tag names as part
  25675. * of the runtime bundle to detect SVG components
  25676. */
  25677. var lowercaseSVGElements = [
  25678. "animate",
  25679. "circle",
  25680. "defs",
  25681. "desc",
  25682. "ellipse",
  25683. "g",
  25684. "image",
  25685. "line",
  25686. "filter",
  25687. "marker",
  25688. "mask",
  25689. "metadata",
  25690. "path",
  25691. "pattern",
  25692. "polygon",
  25693. "polyline",
  25694. "rect",
  25695. "stop",
  25696. "svg",
  25697. "switch",
  25698. "symbol",
  25699. "text",
  25700. "tspan",
  25701. "use",
  25702. "view",
  25703. ];
  25704. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs
  25705. function isSVGComponent(Component) {
  25706. if (
  25707. /**
  25708. * If it's not a string, it's a custom React component. Currently we only support
  25709. * HTML custom React components.
  25710. */
  25711. typeof Component !== "string" ||
  25712. /**
  25713. * If it contains a dash, the element is a custom HTML webcomponent.
  25714. */
  25715. Component.includes("-")) {
  25716. return false;
  25717. }
  25718. else if (
  25719. /**
  25720. * If it's in our list of lowercase SVG tags, it's an SVG component
  25721. */
  25722. lowercaseSVGElements.indexOf(Component) > -1 ||
  25723. /**
  25724. * If it contains a capital letter, it's an SVG component
  25725. */
  25726. /[A-Z]/.test(Component)) {
  25727. return true;
  25728. }
  25729. return false;
  25730. }
  25731. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs
  25732. function isForcedMotionValue(key, _a) {
  25733. var layout = _a.layout, layoutId = _a.layoutId;
  25734. return (isTransformProp(key) ||
  25735. isTransformOriginProp(key) ||
  25736. ((layout || layoutId !== undefined) &&
  25737. (!!scaleCorrectors[key] || key === "opacity")));
  25738. }
  25739. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/build-transform.mjs
  25740. var translateAlias = {
  25741. x: "translateX",
  25742. y: "translateY",
  25743. z: "translateZ",
  25744. transformPerspective: "perspective",
  25745. };
  25746. /**
  25747. * Build a CSS transform style from individual x/y/scale etc properties.
  25748. *
  25749. * This outputs with a default order of transforms/scales/rotations, this can be customised by
  25750. * providing a transformTemplate function.
  25751. */
  25752. function buildTransform(_a, _b, transformIsDefault, transformTemplate) {
  25753. var transform = _a.transform, transformKeys = _a.transformKeys;
  25754. var _c = _b.enableHardwareAcceleration, enableHardwareAcceleration = _c === void 0 ? true : _c, _d = _b.allowTransformNone, allowTransformNone = _d === void 0 ? true : _d;
  25755. // The transform string we're going to build into.
  25756. var transformString = "";
  25757. // Transform keys into their default order - this will determine the output order.
  25758. transformKeys.sort(sortTransformProps);
  25759. // Track whether the defined transform has a defined z so we don't add a
  25760. // second to enable hardware acceleration
  25761. var transformHasZ = false;
  25762. // Loop over each transform and build them into transformString
  25763. var numTransformKeys = transformKeys.length;
  25764. for (var i = 0; i < numTransformKeys; i++) {
  25765. var key = transformKeys[i];
  25766. transformString += "".concat(translateAlias[key] || key, "(").concat(transform[key], ") ");
  25767. if (key === "z")
  25768. transformHasZ = true;
  25769. }
  25770. if (!transformHasZ && enableHardwareAcceleration) {
  25771. transformString += "translateZ(0)";
  25772. }
  25773. else {
  25774. transformString = transformString.trim();
  25775. }
  25776. // If we have a custom `transform` template, pass our transform values and
  25777. // generated transformString to that before returning
  25778. if (transformTemplate) {
  25779. transformString = transformTemplate(transform, transformIsDefault ? "" : transformString);
  25780. }
  25781. else if (allowTransformNone && transformIsDefault) {
  25782. transformString = "none";
  25783. }
  25784. return transformString;
  25785. }
  25786. /**
  25787. * Build a transformOrigin style. Uses the same defaults as the browser for
  25788. * undefined origins.
  25789. */
  25790. function buildTransformOrigin(_a) {
  25791. var _b = _a.originX, originX = _b === void 0 ? "50%" : _b, _c = _a.originY, originY = _c === void 0 ? "50%" : _c, _d = _a.originZ, originZ = _d === void 0 ? 0 : _d;
  25792. return "".concat(originX, " ").concat(originY, " ").concat(originZ);
  25793. }
  25794. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs
  25795. /**
  25796. * Returns true if the provided key is a CSS variable
  25797. */
  25798. function isCSSVariable(key) {
  25799. return key.startsWith("--");
  25800. }
  25801. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs
  25802. /**
  25803. * Provided a value and a ValueType, returns the value as that value type.
  25804. */
  25805. var getValueAsType = function (value, type) {
  25806. return type && typeof value === "number"
  25807. ? type.transform(value)
  25808. : value;
  25809. };
  25810. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/build-styles.mjs
  25811. function buildHTMLStyles(state, latestValues, options, transformTemplate) {
  25812. var _a;
  25813. var style = state.style, vars = state.vars, transform = state.transform, transformKeys = state.transformKeys, transformOrigin = state.transformOrigin;
  25814. // Empty the transformKeys array. As we're throwing out refs to its items
  25815. // this might not be as cheap as suspected. Maybe using the array as a buffer
  25816. // with a manual incrementation would be better.
  25817. transformKeys.length = 0;
  25818. // Track whether we encounter any transform or transformOrigin values.
  25819. var hasTransform = false;
  25820. var hasTransformOrigin = false;
  25821. // Does the calculated transform essentially equal "none"?
  25822. var transformIsNone = true;
  25823. /**
  25824. * Loop over all our latest animated values and decide whether to handle them
  25825. * as a style or CSS variable.
  25826. *
  25827. * Transforms and transform origins are kept seperately for further processing.
  25828. */
  25829. for (var key in latestValues) {
  25830. var value = latestValues[key];
  25831. /**
  25832. * If this is a CSS variable we don't do any further processing.
  25833. */
  25834. if (isCSSVariable(key)) {
  25835. vars[key] = value;
  25836. continue;
  25837. }
  25838. // Convert the value to its default value type, ie 0 -> "0px"
  25839. var valueType = numberValueTypes[key];
  25840. var valueAsType = getValueAsType(value, valueType);
  25841. if (isTransformProp(key)) {
  25842. // If this is a transform, flag to enable further transform processing
  25843. hasTransform = true;
  25844. transform[key] = valueAsType;
  25845. transformKeys.push(key);
  25846. // If we already know we have a non-default transform, early return
  25847. if (!transformIsNone)
  25848. continue;
  25849. // Otherwise check to see if this is a default transform
  25850. if (value !== ((_a = valueType.default) !== null && _a !== void 0 ? _a : 0))
  25851. transformIsNone = false;
  25852. }
  25853. else if (isTransformOriginProp(key)) {
  25854. transformOrigin[key] = valueAsType;
  25855. // If this is a transform origin, flag and enable further transform-origin processing
  25856. hasTransformOrigin = true;
  25857. }
  25858. else {
  25859. style[key] = valueAsType;
  25860. }
  25861. }
  25862. if (hasTransform) {
  25863. style.transform = buildTransform(state, options, transformIsNone, transformTemplate);
  25864. }
  25865. else if (transformTemplate) {
  25866. style.transform = transformTemplate({}, "");
  25867. }
  25868. else if (!latestValues.transform && style.transform) {
  25869. style.transform = "none";
  25870. }
  25871. if (hasTransformOrigin) {
  25872. style.transformOrigin = buildTransformOrigin(transformOrigin);
  25873. }
  25874. }
  25875. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/create-render-state.mjs
  25876. var createHtmlRenderState = function () { return ({
  25877. style: {},
  25878. transform: {},
  25879. transformKeys: [],
  25880. transformOrigin: {},
  25881. vars: {},
  25882. }); };
  25883. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/use-props.mjs
  25884. function copyRawValuesOnly(target, source, props) {
  25885. for (var key in source) {
  25886. if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
  25887. target[key] = source[key];
  25888. }
  25889. }
  25890. }
  25891. function useInitialMotionValues(_a, visualState, isStatic) {
  25892. var transformTemplate = _a.transformTemplate;
  25893. return (0,external_React_.useMemo)(function () {
  25894. var state = createHtmlRenderState();
  25895. buildHTMLStyles(state, visualState, { enableHardwareAcceleration: !isStatic }, transformTemplate);
  25896. var vars = state.vars, style = state.style;
  25897. return __assign(__assign({}, vars), style);
  25898. }, [visualState]);
  25899. }
  25900. function useStyle(props, visualState, isStatic) {
  25901. var styleProp = props.style || {};
  25902. var style = {};
  25903. /**
  25904. * Copy non-Motion Values straight into style
  25905. */
  25906. copyRawValuesOnly(style, styleProp, props);
  25907. Object.assign(style, useInitialMotionValues(props, visualState, isStatic));
  25908. if (props.transformValues) {
  25909. style = props.transformValues(style);
  25910. }
  25911. return style;
  25912. }
  25913. function useHTMLProps(props, visualState, isStatic) {
  25914. // The `any` isn't ideal but it is the type of createElement props argument
  25915. var htmlProps = {};
  25916. var style = useStyle(props, visualState, isStatic);
  25917. if (Boolean(props.drag) && props.dragListener !== false) {
  25918. // Disable the ghost element when a user drags
  25919. htmlProps.draggable = false;
  25920. // Disable text selection
  25921. style.userSelect =
  25922. style.WebkitUserSelect =
  25923. style.WebkitTouchCallout =
  25924. "none";
  25925. // Disable scrolling on the draggable direction
  25926. style.touchAction =
  25927. props.drag === true
  25928. ? "none"
  25929. : "pan-".concat(props.drag === "x" ? "y" : "x");
  25930. }
  25931. htmlProps.style = style;
  25932. return htmlProps;
  25933. }
  25934. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs
  25935. /**
  25936. * A list of all valid MotionProps.
  25937. *
  25938. * @internalremarks
  25939. * This doesn't throw if a `MotionProp` name is missing - it should.
  25940. */
  25941. var validMotionProps = new Set([
  25942. "initial",
  25943. "animate",
  25944. "exit",
  25945. "style",
  25946. "variants",
  25947. "transition",
  25948. "transformTemplate",
  25949. "transformValues",
  25950. "custom",
  25951. "inherit",
  25952. "layout",
  25953. "layoutId",
  25954. "layoutDependency",
  25955. "onLayoutAnimationStart",
  25956. "onLayoutAnimationComplete",
  25957. "onLayoutMeasure",
  25958. "onBeforeLayoutMeasure",
  25959. "onAnimationStart",
  25960. "onAnimationComplete",
  25961. "onUpdate",
  25962. "onDragStart",
  25963. "onDrag",
  25964. "onDragEnd",
  25965. "onMeasureDragConstraints",
  25966. "onDirectionLock",
  25967. "onDragTransitionEnd",
  25968. "drag",
  25969. "dragControls",
  25970. "dragListener",
  25971. "dragConstraints",
  25972. "dragDirectionLock",
  25973. "dragSnapToOrigin",
  25974. "_dragX",
  25975. "_dragY",
  25976. "dragElastic",
  25977. "dragMomentum",
  25978. "dragPropagation",
  25979. "dragTransition",
  25980. "whileDrag",
  25981. "onPan",
  25982. "onPanStart",
  25983. "onPanEnd",
  25984. "onPanSessionStart",
  25985. "onTap",
  25986. "onTapStart",
  25987. "onTapCancel",
  25988. "onHoverStart",
  25989. "onHoverEnd",
  25990. "whileFocus",
  25991. "whileTap",
  25992. "whileHover",
  25993. "whileInView",
  25994. "onViewportEnter",
  25995. "onViewportLeave",
  25996. "viewport",
  25997. "layoutScroll",
  25998. ]);
  25999. /**
  26000. * Check whether a prop name is a valid `MotionProp` key.
  26001. *
  26002. * @param key - Name of the property to check
  26003. * @returns `true` is key is a valid `MotionProp`.
  26004. *
  26005. * @public
  26006. */
  26007. function isValidMotionProp(key) {
  26008. return validMotionProps.has(key);
  26009. }
  26010. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs
  26011. var shouldForward = function (key) { return !isValidMotionProp(key); };
  26012. function loadExternalIsValidProp(isValidProp) {
  26013. if (!isValidProp)
  26014. return;
  26015. // Explicitly filter our events
  26016. shouldForward = function (key) {
  26017. return key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
  26018. };
  26019. }
  26020. /**
  26021. * Emotion and Styled Components both allow users to pass through arbitrary props to their components
  26022. * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which
  26023. * of these should be passed to the underlying DOM node.
  26024. *
  26025. * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props
  26026. * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props
  26027. * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of
  26028. * `@emotion/is-prop-valid`, however to fix this problem we need to use it.
  26029. *
  26030. * By making it an optionalDependency we can offer this functionality only in the situations where it's
  26031. * actually required.
  26032. */
  26033. try {
  26034. /**
  26035. * We attempt to import this package but require won't be defined in esm environments, in that case
  26036. * isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed
  26037. * in favour of explicit injection.
  26038. */
  26039. loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
  26040. }
  26041. catch (_a) {
  26042. // We don't need to actually do anything here - the fallback is the existing `isPropValid`.
  26043. }
  26044. function filterProps(props, isDom, forwardMotionProps) {
  26045. var filteredProps = {};
  26046. for (var key in props) {
  26047. if (shouldForward(key) ||
  26048. (forwardMotionProps === true && isValidMotionProp(key)) ||
  26049. (!isDom && !isValidMotionProp(key)) ||
  26050. // If trying to use native HTML drag events, forward drag listeners
  26051. (props["draggable"] && key.startsWith("onDrag"))) {
  26052. filteredProps[key] = props[key];
  26053. }
  26054. }
  26055. return filteredProps;
  26056. }
  26057. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/transform-origin.mjs
  26058. function calcOrigin(origin, offset, size) {
  26059. return typeof origin === "string"
  26060. ? origin
  26061. : px.transform(offset + size * origin);
  26062. }
  26063. /**
  26064. * The SVG transform origin defaults are different to CSS and is less intuitive,
  26065. * so we use the measured dimensions of the SVG to reconcile these.
  26066. */
  26067. function calcSVGTransformOrigin(dimensions, originX, originY) {
  26068. var pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
  26069. var pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
  26070. return "".concat(pxOriginX, " ").concat(pxOriginY);
  26071. }
  26072. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/path.mjs
  26073. var dashKeys = {
  26074. offset: "stroke-dashoffset",
  26075. array: "stroke-dasharray",
  26076. };
  26077. var camelKeys = {
  26078. offset: "strokeDashoffset",
  26079. array: "strokeDasharray",
  26080. };
  26081. /**
  26082. * Build SVG path properties. Uses the path's measured length to convert
  26083. * our custom pathLength, pathSpacing and pathOffset into stroke-dashoffset
  26084. * and stroke-dasharray attributes.
  26085. *
  26086. * This function is mutative to reduce per-frame GC.
  26087. */
  26088. function buildSVGPath(attrs, length, spacing, offset, useDashCase) {
  26089. if (spacing === void 0) { spacing = 1; }
  26090. if (offset === void 0) { offset = 0; }
  26091. if (useDashCase === void 0) { useDashCase = true; }
  26092. // Normalise path length by setting SVG attribute pathLength to 1
  26093. attrs.pathLength = 1;
  26094. // We use dash case when setting attributes directly to the DOM node and camel case
  26095. // when defining props on a React component.
  26096. var keys = useDashCase ? dashKeys : camelKeys;
  26097. // Build the dash offset
  26098. attrs[keys.offset] = px.transform(-offset);
  26099. // Build the dash array
  26100. var pathLength = px.transform(length);
  26101. var pathSpacing = px.transform(spacing);
  26102. attrs[keys.array] = "".concat(pathLength, " ").concat(pathSpacing);
  26103. }
  26104. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.mjs
  26105. /**
  26106. * Build SVG visual attrbutes, like cx and style.transform
  26107. */
  26108. function buildSVGAttrs(state, _a, options, transformTemplate) {
  26109. var attrX = _a.attrX, attrY = _a.attrY, originX = _a.originX, originY = _a.originY, pathLength = _a.pathLength, _b = _a.pathSpacing, pathSpacing = _b === void 0 ? 1 : _b, _c = _a.pathOffset, pathOffset = _c === void 0 ? 0 : _c,
  26110. // This is object creation, which we try to avoid per-frame.
  26111. latest = __rest(_a, ["attrX", "attrY", "originX", "originY", "pathLength", "pathSpacing", "pathOffset"]);
  26112. buildHTMLStyles(state, latest, options, transformTemplate);
  26113. state.attrs = state.style;
  26114. state.style = {};
  26115. var attrs = state.attrs, style = state.style, dimensions = state.dimensions;
  26116. /**
  26117. * However, we apply transforms as CSS transforms. So if we detect a transform we take it from attrs
  26118. * and copy it into style.
  26119. */
  26120. if (attrs.transform) {
  26121. if (dimensions)
  26122. style.transform = attrs.transform;
  26123. delete attrs.transform;
  26124. }
  26125. // Parse transformOrigin
  26126. if (dimensions &&
  26127. (originX !== undefined || originY !== undefined || style.transform)) {
  26128. style.transformOrigin = calcSVGTransformOrigin(dimensions, originX !== undefined ? originX : 0.5, originY !== undefined ? originY : 0.5);
  26129. }
  26130. // Treat x/y not as shortcuts but as actual attributes
  26131. if (attrX !== undefined)
  26132. attrs.x = attrX;
  26133. if (attrY !== undefined)
  26134. attrs.y = attrY;
  26135. // Build SVG path if one has been defined
  26136. if (pathLength !== undefined) {
  26137. buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
  26138. }
  26139. }
  26140. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.mjs
  26141. var createSvgRenderState = function () { return (__assign(__assign({}, createHtmlRenderState()), { attrs: {} })); };
  26142. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/use-props.mjs
  26143. function useSVGProps(props, visualState) {
  26144. var visualProps = (0,external_React_.useMemo)(function () {
  26145. var state = createSvgRenderState();
  26146. buildSVGAttrs(state, visualState, { enableHardwareAcceleration: false }, props.transformTemplate);
  26147. return __assign(__assign({}, state.attrs), { style: __assign({}, state.style) });
  26148. }, [visualState]);
  26149. if (props.style) {
  26150. var rawStyles = {};
  26151. copyRawValuesOnly(rawStyles, props.style, props);
  26152. visualProps.style = __assign(__assign({}, rawStyles), visualProps.style);
  26153. }
  26154. return visualProps;
  26155. }
  26156. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/use-render.mjs
  26157. function createUseRender(forwardMotionProps) {
  26158. if (forwardMotionProps === void 0) { forwardMotionProps = false; }
  26159. var useRender = function (Component, props, projectionId, ref, _a, isStatic) {
  26160. var latestValues = _a.latestValues;
  26161. var useVisualProps = isSVGComponent(Component)
  26162. ? useSVGProps
  26163. : useHTMLProps;
  26164. var visualProps = useVisualProps(props, latestValues, isStatic);
  26165. var filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
  26166. var elementProps = __assign(__assign(__assign({}, filteredProps), visualProps), { ref: ref });
  26167. if (projectionId) {
  26168. elementProps["data-projection-id"] = projectionId;
  26169. }
  26170. return (0,external_React_.createElement)(Component, elementProps);
  26171. };
  26172. return useRender;
  26173. }
  26174. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs
  26175. var CAMEL_CASE_PATTERN = /([a-z])([A-Z])/g;
  26176. var REPLACE_TEMPLATE = "$1-$2";
  26177. /**
  26178. * Convert camelCase to dash-case properties.
  26179. */
  26180. var camelToDash = function (str) {
  26181. return str.replace(CAMEL_CASE_PATTERN, REPLACE_TEMPLATE).toLowerCase();
  26182. };
  26183. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/render.mjs
  26184. function renderHTML(element, _a, styleProp, projection) {
  26185. var style = _a.style, vars = _a.vars;
  26186. Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
  26187. // Loop over any CSS variables and assign those.
  26188. for (var key in vars) {
  26189. element.style.setProperty(key, vars[key]);
  26190. }
  26191. }
  26192. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs
  26193. /**
  26194. * A set of attribute names that are always read/written as camel case.
  26195. */
  26196. var camelCaseAttributes = new Set([
  26197. "baseFrequency",
  26198. "diffuseConstant",
  26199. "kernelMatrix",
  26200. "kernelUnitLength",
  26201. "keySplines",
  26202. "keyTimes",
  26203. "limitingConeAngle",
  26204. "markerHeight",
  26205. "markerWidth",
  26206. "numOctaves",
  26207. "targetX",
  26208. "targetY",
  26209. "surfaceScale",
  26210. "specularConstant",
  26211. "specularExponent",
  26212. "stdDeviation",
  26213. "tableValues",
  26214. "viewBox",
  26215. "gradientTransform",
  26216. "pathLength",
  26217. ]);
  26218. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/render.mjs
  26219. function renderSVG(element, renderState, _styleProp, projection) {
  26220. renderHTML(element, renderState, undefined, projection);
  26221. for (var key in renderState.attrs) {
  26222. element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);
  26223. }
  26224. }
  26225. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs
  26226. function scrapeMotionValuesFromProps(props) {
  26227. var style = props.style;
  26228. var newValues = {};
  26229. for (var key in style) {
  26230. if (isMotionValue(style[key]) || isForcedMotionValue(key, props)) {
  26231. newValues[key] = style[key];
  26232. }
  26233. }
  26234. return newValues;
  26235. }
  26236. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs
  26237. function scrape_motion_values_scrapeMotionValuesFromProps(props) {
  26238. var newValues = scrapeMotionValuesFromProps(props);
  26239. for (var key in props) {
  26240. if (isMotionValue(props[key])) {
  26241. var targetKey = key === "x" || key === "y" ? "attr" + key.toUpperCase() : key;
  26242. newValues[targetKey] = props[key];
  26243. }
  26244. }
  26245. return newValues;
  26246. }
  26247. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-animation-controls.mjs
  26248. function isAnimationControls(v) {
  26249. return typeof v === "object" && typeof v.start === "function";
  26250. }
  26251. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/use-visual-state.mjs
  26252. function makeState(_a, props, context, presenceContext) {
  26253. var scrapeMotionValuesFromProps = _a.scrapeMotionValuesFromProps, createRenderState = _a.createRenderState, onMount = _a.onMount;
  26254. var state = {
  26255. latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps),
  26256. renderState: createRenderState(),
  26257. };
  26258. if (onMount) {
  26259. state.mount = function (instance) { return onMount(props, instance, state); };
  26260. }
  26261. return state;
  26262. }
  26263. var makeUseVisualState = function (config) {
  26264. return function (props, isStatic) {
  26265. var context = (0,external_React_.useContext)(MotionContext);
  26266. var presenceContext = (0,external_React_.useContext)(PresenceContext_PresenceContext);
  26267. return isStatic
  26268. ? makeState(config, props, context, presenceContext)
  26269. : useConstant(function () {
  26270. return makeState(config, props, context, presenceContext);
  26271. });
  26272. };
  26273. };
  26274. function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
  26275. var values = {};
  26276. var blockInitialAnimation = (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false;
  26277. var motionValues = scrapeMotionValues(props);
  26278. for (var key in motionValues) {
  26279. values[key] = resolveMotionValue(motionValues[key]);
  26280. }
  26281. var initial = props.initial, animate = props.animate;
  26282. var isControllingVariants = checkIfControllingVariants(props);
  26283. var isVariantNode = checkIfVariantNode(props);
  26284. if (context &&
  26285. isVariantNode &&
  26286. !isControllingVariants &&
  26287. props.inherit !== false) {
  26288. initial !== null && initial !== void 0 ? initial : (initial = context.initial);
  26289. animate !== null && animate !== void 0 ? animate : (animate = context.animate);
  26290. }
  26291. var initialAnimationIsBlocked = blockInitialAnimation || initial === false;
  26292. var variantToSet = initialAnimationIsBlocked ? animate : initial;
  26293. if (variantToSet &&
  26294. typeof variantToSet !== "boolean" &&
  26295. !isAnimationControls(variantToSet)) {
  26296. var list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
  26297. list.forEach(function (definition) {
  26298. var resolved = resolveVariantFromProps(props, definition);
  26299. if (!resolved)
  26300. return;
  26301. var transitionEnd = resolved.transitionEnd; resolved.transition; var target = __rest(resolved, ["transitionEnd", "transition"]);
  26302. for (var key in target) {
  26303. var valueTarget = target[key];
  26304. if (Array.isArray(valueTarget)) {
  26305. /**
  26306. * Take final keyframe if the initial animation is blocked because
  26307. * we want to initialise at the end of that blocked animation.
  26308. */
  26309. var index = initialAnimationIsBlocked
  26310. ? valueTarget.length - 1
  26311. : 0;
  26312. valueTarget = valueTarget[index];
  26313. }
  26314. if (valueTarget !== null) {
  26315. values[key] = valueTarget;
  26316. }
  26317. }
  26318. for (var key in transitionEnd)
  26319. values[key] = transitionEnd[key];
  26320. });
  26321. }
  26322. return values;
  26323. }
  26324. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/config-motion.mjs
  26325. var svgMotionConfig = {
  26326. useVisualState: makeUseVisualState({
  26327. scrapeMotionValuesFromProps: scrape_motion_values_scrapeMotionValuesFromProps,
  26328. createRenderState: createSvgRenderState,
  26329. onMount: function (props, instance, _a) {
  26330. var renderState = _a.renderState, latestValues = _a.latestValues;
  26331. try {
  26332. renderState.dimensions =
  26333. typeof instance.getBBox ===
  26334. "function"
  26335. ? instance.getBBox()
  26336. : instance.getBoundingClientRect();
  26337. }
  26338. catch (e) {
  26339. // Most likely trying to measure an unrendered element under Firefox
  26340. renderState.dimensions = {
  26341. x: 0,
  26342. y: 0,
  26343. width: 0,
  26344. height: 0,
  26345. };
  26346. }
  26347. buildSVGAttrs(renderState, latestValues, { enableHardwareAcceleration: false }, props.transformTemplate);
  26348. renderSVG(instance, renderState);
  26349. },
  26350. }),
  26351. };
  26352. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/config-motion.mjs
  26353. var htmlMotionConfig = {
  26354. useVisualState: makeUseVisualState({
  26355. scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,
  26356. createRenderState: createHtmlRenderState,
  26357. }),
  26358. };
  26359. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/create-config.mjs
  26360. function create_config_createDomMotionConfig(Component, _a, preloadedFeatures, createVisualElement, projectionNodeConstructor) {
  26361. var _b = _a.forwardMotionProps, forwardMotionProps = _b === void 0 ? false : _b;
  26362. var baseConfig = isSVGComponent(Component)
  26363. ? svgMotionConfig
  26364. : htmlMotionConfig;
  26365. return __assign(__assign({}, baseConfig), { preloadedFeatures: preloadedFeatures, useRender: createUseRender(forwardMotionProps), createVisualElement: createVisualElement, projectionNodeConstructor: projectionNodeConstructor, Component: Component });
  26366. }
  26367. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/types.mjs
  26368. var AnimationType;
  26369. (function (AnimationType) {
  26370. AnimationType["Animate"] = "animate";
  26371. AnimationType["Hover"] = "whileHover";
  26372. AnimationType["Tap"] = "whileTap";
  26373. AnimationType["Drag"] = "whileDrag";
  26374. AnimationType["Focus"] = "whileFocus";
  26375. AnimationType["InView"] = "whileInView";
  26376. AnimationType["Exit"] = "exit";
  26377. })(AnimationType || (AnimationType = {}));
  26378. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/use-dom-event.mjs
  26379. function addDomEvent(target, eventName, handler, options) {
  26380. target.addEventListener(eventName, handler, options);
  26381. return function () { return target.removeEventListener(eventName, handler, options); };
  26382. }
  26383. /**
  26384. * Attaches an event listener directly to the provided DOM element.
  26385. *
  26386. * Bypassing React's event system can be desirable, for instance when attaching non-passive
  26387. * event handlers.
  26388. *
  26389. * ```jsx
  26390. * const ref = useRef(null)
  26391. *
  26392. * useDomEvent(ref, 'wheel', onWheel, { passive: false })
  26393. *
  26394. * return <div ref={ref} />
  26395. * ```
  26396. *
  26397. * @param ref - React.RefObject that's been provided to the element you want to bind the listener to.
  26398. * @param eventName - Name of the event you want listen for.
  26399. * @param handler - Function to fire when receiving the event.
  26400. * @param options - Options to pass to `Event.addEventListener`.
  26401. *
  26402. * @public
  26403. */
  26404. function useDomEvent(ref, eventName, handler, options) {
  26405. (0,external_React_.useEffect)(function () {
  26406. var element = ref.current;
  26407. if (handler && element) {
  26408. return addDomEvent(element, eventName, handler, options);
  26409. }
  26410. }, [ref, eventName, handler, options]);
  26411. }
  26412. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/use-focus-gesture.mjs
  26413. /**
  26414. *
  26415. * @param props
  26416. * @param ref
  26417. * @internal
  26418. */
  26419. function useFocusGesture(_a) {
  26420. var whileFocus = _a.whileFocus, visualElement = _a.visualElement;
  26421. var onFocus = function () {
  26422. var _a;
  26423. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Focus, true);
  26424. };
  26425. var onBlur = function () {
  26426. var _a;
  26427. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Focus, false);
  26428. };
  26429. useDomEvent(visualElement, "focus", whileFocus ? onFocus : undefined);
  26430. useDomEvent(visualElement, "blur", whileFocus ? onBlur : undefined);
  26431. }
  26432. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/utils/event-type.mjs
  26433. function isMouseEvent(event) {
  26434. // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.
  26435. if (typeof PointerEvent !== "undefined" && event instanceof PointerEvent) {
  26436. return !!(event.pointerType === "mouse");
  26437. }
  26438. return event instanceof MouseEvent;
  26439. }
  26440. function isTouchEvent(event) {
  26441. var hasTouches = !!event.touches;
  26442. return hasTouches;
  26443. }
  26444. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/event-info.mjs
  26445. /**
  26446. * Filters out events not attached to the primary pointer (currently left mouse button)
  26447. * @param eventHandler
  26448. */
  26449. function filterPrimaryPointer(eventHandler) {
  26450. return function (event) {
  26451. var isMouseEvent = event instanceof MouseEvent;
  26452. var isPrimaryPointer = !isMouseEvent ||
  26453. (isMouseEvent && event.button === 0);
  26454. if (isPrimaryPointer) {
  26455. eventHandler(event);
  26456. }
  26457. };
  26458. }
  26459. var defaultPagePoint = { pageX: 0, pageY: 0 };
  26460. function pointFromTouch(e, pointType) {
  26461. if (pointType === void 0) { pointType = "page"; }
  26462. var primaryTouch = e.touches[0] || e.changedTouches[0];
  26463. var point = primaryTouch || defaultPagePoint;
  26464. return {
  26465. x: point[pointType + "X"],
  26466. y: point[pointType + "Y"],
  26467. };
  26468. }
  26469. function pointFromMouse(point, pointType) {
  26470. if (pointType === void 0) { pointType = "page"; }
  26471. return {
  26472. x: point[pointType + "X"],
  26473. y: point[pointType + "Y"],
  26474. };
  26475. }
  26476. function extractEventInfo(event, pointType) {
  26477. if (pointType === void 0) { pointType = "page"; }
  26478. return {
  26479. point: isTouchEvent(event)
  26480. ? pointFromTouch(event, pointType)
  26481. : pointFromMouse(event, pointType),
  26482. };
  26483. }
  26484. var wrapHandler = function (handler, shouldFilterPrimaryPointer) {
  26485. if (shouldFilterPrimaryPointer === void 0) { shouldFilterPrimaryPointer = false; }
  26486. var listener = function (event) {
  26487. return handler(event, extractEventInfo(event));
  26488. };
  26489. return shouldFilterPrimaryPointer
  26490. ? filterPrimaryPointer(listener)
  26491. : listener;
  26492. };
  26493. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/utils.mjs
  26494. // We check for event support via functions in case they've been mocked by a testing suite.
  26495. var supportsPointerEvents = function () {
  26496. return is_browser_isBrowser && window.onpointerdown === null;
  26497. };
  26498. var supportsTouchEvents = function () {
  26499. return is_browser_isBrowser && window.ontouchstart === null;
  26500. };
  26501. var supportsMouseEvents = function () {
  26502. return is_browser_isBrowser && window.onmousedown === null;
  26503. };
  26504. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/use-pointer-event.mjs
  26505. var mouseEventNames = {
  26506. pointerdown: "mousedown",
  26507. pointermove: "mousemove",
  26508. pointerup: "mouseup",
  26509. pointercancel: "mousecancel",
  26510. pointerover: "mouseover",
  26511. pointerout: "mouseout",
  26512. pointerenter: "mouseenter",
  26513. pointerleave: "mouseleave",
  26514. };
  26515. var touchEventNames = {
  26516. pointerdown: "touchstart",
  26517. pointermove: "touchmove",
  26518. pointerup: "touchend",
  26519. pointercancel: "touchcancel",
  26520. };
  26521. function getPointerEventName(name) {
  26522. if (supportsPointerEvents()) {
  26523. return name;
  26524. }
  26525. else if (supportsTouchEvents()) {
  26526. return touchEventNames[name];
  26527. }
  26528. else if (supportsMouseEvents()) {
  26529. return mouseEventNames[name];
  26530. }
  26531. return name;
  26532. }
  26533. function addPointerEvent(target, eventName, handler, options) {
  26534. return addDomEvent(target, getPointerEventName(eventName), wrapHandler(handler, eventName === "pointerdown"), options);
  26535. }
  26536. function usePointerEvent(ref, eventName, handler, options) {
  26537. return useDomEvent(ref, getPointerEventName(eventName), handler && wrapHandler(handler, eventName === "pointerdown"), options);
  26538. }
  26539. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/utils/lock.mjs
  26540. function createLock(name) {
  26541. var lock = null;
  26542. return function () {
  26543. var openLock = function () {
  26544. lock = null;
  26545. };
  26546. if (lock === null) {
  26547. lock = name;
  26548. return openLock;
  26549. }
  26550. return false;
  26551. };
  26552. }
  26553. var globalHorizontalLock = createLock("dragHorizontal");
  26554. var globalVerticalLock = createLock("dragVertical");
  26555. function getGlobalLock(drag) {
  26556. var lock = false;
  26557. if (drag === "y") {
  26558. lock = globalVerticalLock();
  26559. }
  26560. else if (drag === "x") {
  26561. lock = globalHorizontalLock();
  26562. }
  26563. else {
  26564. var openHorizontal_1 = globalHorizontalLock();
  26565. var openVertical_1 = globalVerticalLock();
  26566. if (openHorizontal_1 && openVertical_1) {
  26567. lock = function () {
  26568. openHorizontal_1();
  26569. openVertical_1();
  26570. };
  26571. }
  26572. else {
  26573. // Release the locks because we don't use them
  26574. if (openHorizontal_1)
  26575. openHorizontal_1();
  26576. if (openVertical_1)
  26577. openVertical_1();
  26578. }
  26579. }
  26580. return lock;
  26581. }
  26582. function isDragActive() {
  26583. // Check the gesture lock - if we get it, it means no drag gesture is active
  26584. // and we can safely fire the tap gesture.
  26585. var openGestureLock = getGlobalLock(true);
  26586. if (!openGestureLock)
  26587. return true;
  26588. openGestureLock();
  26589. return false;
  26590. }
  26591. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/use-hover-gesture.mjs
  26592. function createHoverEvent(visualElement, isActive, callback) {
  26593. return function (event, info) {
  26594. var _a;
  26595. if (!isMouseEvent(event) || isDragActive())
  26596. return;
  26597. /**
  26598. * Ensure we trigger animations before firing event callback
  26599. */
  26600. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Hover, isActive);
  26601. callback === null || callback === void 0 ? void 0 : callback(event, info);
  26602. };
  26603. }
  26604. function useHoverGesture(_a) {
  26605. var onHoverStart = _a.onHoverStart, onHoverEnd = _a.onHoverEnd, whileHover = _a.whileHover, visualElement = _a.visualElement;
  26606. usePointerEvent(visualElement, "pointerenter", onHoverStart || whileHover
  26607. ? createHoverEvent(visualElement, true, onHoverStart)
  26608. : undefined);
  26609. usePointerEvent(visualElement, "pointerleave", onHoverEnd || whileHover
  26610. ? createHoverEvent(visualElement, false, onHoverEnd)
  26611. : undefined);
  26612. }
  26613. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/utils/is-node-or-child.mjs
  26614. /**
  26615. * Recursively traverse up the tree to check whether the provided child node
  26616. * is the parent or a descendant of it.
  26617. *
  26618. * @param parent - Element to find
  26619. * @param child - Element to test against parent
  26620. */
  26621. var isNodeOrChild = function (parent, child) {
  26622. if (!child) {
  26623. return false;
  26624. }
  26625. else if (parent === child) {
  26626. return true;
  26627. }
  26628. else {
  26629. return isNodeOrChild(parent, child.parentElement);
  26630. }
  26631. };
  26632. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-unmount-effect.mjs
  26633. function useUnmountEffect(callback) {
  26634. return (0,external_React_.useEffect)(function () { return function () { return callback(); }; }, []);
  26635. }
  26636. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/use-tap-gesture.mjs
  26637. /**
  26638. * @param handlers -
  26639. * @internal
  26640. */
  26641. function useTapGesture(_a) {
  26642. var onTap = _a.onTap, onTapStart = _a.onTapStart, onTapCancel = _a.onTapCancel, whileTap = _a.whileTap, visualElement = _a.visualElement;
  26643. var hasPressListeners = onTap || onTapStart || onTapCancel || whileTap;
  26644. var isPressing = (0,external_React_.useRef)(false);
  26645. var cancelPointerEndListeners = (0,external_React_.useRef)(null);
  26646. function removePointerEndListener() {
  26647. var _a;
  26648. (_a = cancelPointerEndListeners.current) === null || _a === void 0 ? void 0 : _a.call(cancelPointerEndListeners);
  26649. cancelPointerEndListeners.current = null;
  26650. }
  26651. function checkPointerEnd() {
  26652. var _a;
  26653. removePointerEndListener();
  26654. isPressing.current = false;
  26655. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Tap, false);
  26656. return !isDragActive();
  26657. }
  26658. function onPointerUp(event, info) {
  26659. if (!checkPointerEnd())
  26660. return;
  26661. /**
  26662. * We only count this as a tap gesture if the event.target is the same
  26663. * as, or a child of, this component's element
  26664. */
  26665. !isNodeOrChild(visualElement.getInstance(), event.target)
  26666. ? onTapCancel === null || onTapCancel === void 0 ? void 0 : onTapCancel(event, info)
  26667. : onTap === null || onTap === void 0 ? void 0 : onTap(event, info);
  26668. }
  26669. function onPointerCancel(event, info) {
  26670. if (!checkPointerEnd())
  26671. return;
  26672. onTapCancel === null || onTapCancel === void 0 ? void 0 : onTapCancel(event, info);
  26673. }
  26674. function onPointerDown(event, info) {
  26675. var _a;
  26676. removePointerEndListener();
  26677. if (isPressing.current)
  26678. return;
  26679. isPressing.current = true;
  26680. cancelPointerEndListeners.current = pipe(addPointerEvent(window, "pointerup", onPointerUp), addPointerEvent(window, "pointercancel", onPointerCancel));
  26681. /**
  26682. * Ensure we trigger animations before firing event callback
  26683. */
  26684. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Tap, true);
  26685. onTapStart === null || onTapStart === void 0 ? void 0 : onTapStart(event, info);
  26686. }
  26687. usePointerEvent(visualElement, "pointerdown", hasPressListeners ? onPointerDown : undefined);
  26688. useUnmountEffect(removePointerEndListener);
  26689. }
  26690. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/viewport/observers.mjs
  26691. /**
  26692. * Map an IntersectionHandler callback to an element. We only ever make one handler for one
  26693. * element, so even though these handlers might all be triggered by different
  26694. * observers, we can keep them in the same map.
  26695. */
  26696. var observerCallbacks = new WeakMap();
  26697. /**
  26698. * Multiple observers can be created for multiple element/document roots. Each with
  26699. * different settings. So here we store dictionaries of observers to each root,
  26700. * using serialised settings (threshold/margin) as lookup keys.
  26701. */
  26702. var observers = new WeakMap();
  26703. var fireObserverCallback = function (entry) {
  26704. var _a;
  26705. (_a = observerCallbacks.get(entry.target)) === null || _a === void 0 ? void 0 : _a(entry);
  26706. };
  26707. var fireAllObserverCallbacks = function (entries) {
  26708. entries.forEach(fireObserverCallback);
  26709. };
  26710. function initIntersectionObserver(_a) {
  26711. var root = _a.root, options = __rest(_a, ["root"]);
  26712. var lookupRoot = root || document;
  26713. /**
  26714. * If we don't have an observer lookup map for this root, create one.
  26715. */
  26716. if (!observers.has(lookupRoot)) {
  26717. observers.set(lookupRoot, {});
  26718. }
  26719. var rootObservers = observers.get(lookupRoot);
  26720. var key = JSON.stringify(options);
  26721. /**
  26722. * If we don't have an observer for this combination of root and settings,
  26723. * create one.
  26724. */
  26725. if (!rootObservers[key]) {
  26726. rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, __assign({ root: root }, options));
  26727. }
  26728. return rootObservers[key];
  26729. }
  26730. function observeIntersection(element, options, callback) {
  26731. var rootInteresectionObserver = initIntersectionObserver(options);
  26732. observerCallbacks.set(element, callback);
  26733. rootInteresectionObserver.observe(element);
  26734. return function () {
  26735. observerCallbacks.delete(element);
  26736. rootInteresectionObserver.unobserve(element);
  26737. };
  26738. }
  26739. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/viewport/use-viewport.mjs
  26740. function useViewport(_a) {
  26741. var visualElement = _a.visualElement, whileInView = _a.whileInView, onViewportEnter = _a.onViewportEnter, onViewportLeave = _a.onViewportLeave, _b = _a.viewport, viewport = _b === void 0 ? {} : _b;
  26742. var state = (0,external_React_.useRef)({
  26743. hasEnteredView: false,
  26744. isInView: false,
  26745. });
  26746. var shouldObserve = Boolean(whileInView || onViewportEnter || onViewportLeave);
  26747. if (viewport.once && state.current.hasEnteredView)
  26748. shouldObserve = false;
  26749. var useObserver = typeof IntersectionObserver === "undefined"
  26750. ? useMissingIntersectionObserver
  26751. : use_viewport_useIntersectionObserver;
  26752. useObserver(shouldObserve, state.current, visualElement, viewport);
  26753. }
  26754. var thresholdNames = {
  26755. some: 0,
  26756. all: 1,
  26757. };
  26758. function use_viewport_useIntersectionObserver(shouldObserve, state, visualElement, _a) {
  26759. var root = _a.root, rootMargin = _a.margin, _b = _a.amount, amount = _b === void 0 ? "some" : _b, once = _a.once;
  26760. (0,external_React_.useEffect)(function () {
  26761. if (!shouldObserve)
  26762. return;
  26763. var options = {
  26764. root: root === null || root === void 0 ? void 0 : root.current,
  26765. rootMargin: rootMargin,
  26766. threshold: typeof amount === "number" ? amount : thresholdNames[amount],
  26767. };
  26768. var intersectionCallback = function (entry) {
  26769. var _a;
  26770. var isIntersecting = entry.isIntersecting;
  26771. /**
  26772. * If there's been no change in the viewport state, early return.
  26773. */
  26774. if (state.isInView === isIntersecting)
  26775. return;
  26776. state.isInView = isIntersecting;
  26777. /**
  26778. * Handle hasEnteredView. If this is only meant to run once, and
  26779. * element isn't visible, early return. Otherwise set hasEnteredView to true.
  26780. */
  26781. if (once && !isIntersecting && state.hasEnteredView) {
  26782. return;
  26783. }
  26784. else if (isIntersecting) {
  26785. state.hasEnteredView = true;
  26786. }
  26787. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.InView, isIntersecting);
  26788. /**
  26789. * Use the latest committed props rather than the ones in scope
  26790. * when this observer is created
  26791. */
  26792. var props = visualElement.getProps();
  26793. var callback = isIntersecting
  26794. ? props.onViewportEnter
  26795. : props.onViewportLeave;
  26796. callback === null || callback === void 0 ? void 0 : callback(entry);
  26797. };
  26798. return observeIntersection(visualElement.getInstance(), options, intersectionCallback);
  26799. }, [shouldObserve, root, rootMargin, amount]);
  26800. }
  26801. /**
  26802. * If IntersectionObserver is missing, we activate inView and fire onViewportEnter
  26803. * on mount. This way, the page will be in the state the author expects users
  26804. * to see it in for everyone.
  26805. */
  26806. function useMissingIntersectionObserver(shouldObserve, state, visualElement, _a) {
  26807. var _b = _a.fallback, fallback = _b === void 0 ? true : _b;
  26808. (0,external_React_.useEffect)(function () {
  26809. if (!shouldObserve || !fallback)
  26810. return;
  26811. if (false) {}
  26812. /**
  26813. * Fire this in an rAF because, at this point, the animation state
  26814. * won't have flushed for the first time and there's certain logic in
  26815. * there that behaves differently on the initial animation.
  26816. *
  26817. * This hook should be quite rarely called so setting this in an rAF
  26818. * is preferred to changing the behaviour of the animation state.
  26819. */
  26820. requestAnimationFrame(function () {
  26821. var _a;
  26822. state.hasEnteredView = true;
  26823. var onViewportEnter = visualElement.getProps().onViewportEnter;
  26824. onViewportEnter === null || onViewportEnter === void 0 ? void 0 : onViewportEnter(null);
  26825. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.InView, true);
  26826. });
  26827. }, [shouldObserve]);
  26828. }
  26829. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/make-renderless-component.mjs
  26830. var makeRenderlessComponent = function (hook) { return function (props) {
  26831. hook(props);
  26832. return null;
  26833. }; };
  26834. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/gestures.mjs
  26835. var gestureAnimations = {
  26836. inView: makeRenderlessComponent(useViewport),
  26837. tap: makeRenderlessComponent(useTapGesture),
  26838. focus: makeRenderlessComponent(useFocusGesture),
  26839. hover: makeRenderlessComponent(useHoverGesture),
  26840. };
  26841. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-id.mjs
  26842. var counter = 0;
  26843. var incrementId = function () { return counter++; };
  26844. var useId = function () { return useConstant(incrementId); };
  26845. /**
  26846. * Ideally we'd use the following code to support React 18 optionally.
  26847. * But this fairly fails in Webpack (otherwise treeshaking wouldn't work at all).
  26848. * Need to come up with a different way of figuring this out.
  26849. */
  26850. // export const useId = (React as any).useId
  26851. // ? (React as any).useId
  26852. // : () => useConstant(incrementId)
  26853. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs
  26854. /**
  26855. * When a component is the child of `AnimatePresence`, it can use `usePresence`
  26856. * to access information about whether it's still present in the React tree.
  26857. *
  26858. * ```jsx
  26859. * import { usePresence } from "framer-motion"
  26860. *
  26861. * export const Component = () => {
  26862. * const [isPresent, safeToRemove] = usePresence()
  26863. *
  26864. * useEffect(() => {
  26865. * !isPresent && setTimeout(safeToRemove, 1000)
  26866. * }, [isPresent])
  26867. *
  26868. * return <div />
  26869. * }
  26870. * ```
  26871. *
  26872. * If `isPresent` is `false`, it means that a component has been removed the tree, but
  26873. * `AnimatePresence` won't really remove it until `safeToRemove` has been called.
  26874. *
  26875. * @public
  26876. */
  26877. function usePresence() {
  26878. var context = (0,external_React_.useContext)(PresenceContext_PresenceContext);
  26879. if (context === null)
  26880. return [true, null];
  26881. var isPresent = context.isPresent, onExitComplete = context.onExitComplete, register = context.register;
  26882. // It's safe to call the following hooks conditionally (after an early return) because the context will always
  26883. // either be null or non-null for the lifespan of the component.
  26884. // Replace with useId when released in React
  26885. var id = useId();
  26886. (0,external_React_.useEffect)(function () { return register(id); }, []);
  26887. var safeToRemove = function () { return onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete(id); };
  26888. return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
  26889. }
  26890. /**
  26891. * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.
  26892. * There is no `safeToRemove` function.
  26893. *
  26894. * ```jsx
  26895. * import { useIsPresent } from "framer-motion"
  26896. *
  26897. * export const Component = () => {
  26898. * const isPresent = useIsPresent()
  26899. *
  26900. * useEffect(() => {
  26901. * !isPresent && console.log("I've been removed!")
  26902. * }, [isPresent])
  26903. *
  26904. * return <div />
  26905. * }
  26906. * ```
  26907. *
  26908. * @public
  26909. */
  26910. function useIsPresent() {
  26911. return isPresent(useContext(PresenceContext));
  26912. }
  26913. function isPresent(context) {
  26914. return context === null ? true : context.isPresent;
  26915. }
  26916. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/shallow-compare.mjs
  26917. function shallowCompare(next, prev) {
  26918. if (!Array.isArray(prev))
  26919. return false;
  26920. var prevLength = prev.length;
  26921. if (prevLength !== next.length)
  26922. return false;
  26923. for (var i = 0; i < prevLength; i++) {
  26924. if (prev[i] !== next[i])
  26925. return false;
  26926. }
  26927. return true;
  26928. }
  26929. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-numerical-string.mjs
  26930. /**
  26931. * Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1"
  26932. */
  26933. var isNumericalString = function (v) { return /^\-?\d*\.?\d+$/.test(v); };
  26934. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-zero-value-string.mjs
  26935. /**
  26936. * Check if the value is a zero value string like "0px" or "0%"
  26937. */
  26938. var isZeroValueString = function (v) { return /^0[^.\s]+$/.test(v); };
  26939. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/test.mjs
  26940. /**
  26941. * Tests a provided value against a ValueType
  26942. */
  26943. var testValueType = function (v) { return function (type) { return type.test(v); }; };
  26944. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/type-auto.mjs
  26945. /**
  26946. * ValueType for "auto"
  26947. */
  26948. var auto = {
  26949. test: function (v) { return v === "auto"; },
  26950. parse: function (v) { return v; },
  26951. };
  26952. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/dimensions.mjs
  26953. /**
  26954. * A list of value types commonly used for dimensions
  26955. */
  26956. var dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];
  26957. /**
  26958. * Tests a dimensional value against the list of dimension ValueTypes
  26959. */
  26960. var findDimensionValueType = function (v) {
  26961. return dimensionValueTypes.find(testValueType(v));
  26962. };
  26963. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/find.mjs
  26964. /**
  26965. * A list of all ValueTypes
  26966. */
  26967. var valueTypes = tslib_es6_spreadArray(tslib_es6_spreadArray([], tslib_es6_read(dimensionValueTypes), false), [color, complex], false);
  26968. /**
  26969. * Tests a value against the list of ValueTypes
  26970. */
  26971. var findValueType = function (v) { return valueTypes.find(testValueType(v)); };
  26972. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/setters.mjs
  26973. /**
  26974. * Set VisualElement's MotionValue, creating a new MotionValue for it if
  26975. * it doesn't exist.
  26976. */
  26977. function setMotionValue(visualElement, key, value) {
  26978. if (visualElement.hasValue(key)) {
  26979. visualElement.getValue(key).set(value);
  26980. }
  26981. else {
  26982. visualElement.addValue(key, motionValue(value));
  26983. }
  26984. }
  26985. function setTarget(visualElement, definition) {
  26986. var resolved = resolveVariant(visualElement, definition);
  26987. var _a = resolved ? visualElement.makeTargetAnimatable(resolved, false) : {}, _b = _a.transitionEnd, transitionEnd = _b === void 0 ? {} : _b; _a.transition; var target = __rest(_a, ["transitionEnd", "transition"]);
  26988. target = __assign(__assign({}, target), transitionEnd);
  26989. for (var key in target) {
  26990. var value = resolveFinalValueInKeyframes(target[key]);
  26991. setMotionValue(visualElement, key, value);
  26992. }
  26993. }
  26994. function setVariants(visualElement, variantLabels) {
  26995. var reversedLabels = __spreadArray([], __read(variantLabels), false).reverse();
  26996. reversedLabels.forEach(function (key) {
  26997. var _a;
  26998. var variant = visualElement.getVariant(key);
  26999. variant && setTarget(visualElement, variant);
  27000. (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
  27001. setVariants(child, variantLabels);
  27002. });
  27003. });
  27004. }
  27005. function setValues(visualElement, definition) {
  27006. if (Array.isArray(definition)) {
  27007. return setVariants(visualElement, definition);
  27008. }
  27009. else if (typeof definition === "string") {
  27010. return setVariants(visualElement, [definition]);
  27011. }
  27012. else {
  27013. setTarget(visualElement, definition);
  27014. }
  27015. }
  27016. function checkTargetForNewValues(visualElement, target, origin) {
  27017. var _a, _b, _c;
  27018. var _d;
  27019. var newValueKeys = Object.keys(target).filter(function (key) { return !visualElement.hasValue(key); });
  27020. var numNewValues = newValueKeys.length;
  27021. if (!numNewValues)
  27022. return;
  27023. for (var i = 0; i < numNewValues; i++) {
  27024. var key = newValueKeys[i];
  27025. var targetValue = target[key];
  27026. var value = null;
  27027. /**
  27028. * If the target is a series of keyframes, we can use the first value
  27029. * in the array. If this first value is null, we'll still need to read from the DOM.
  27030. */
  27031. if (Array.isArray(targetValue)) {
  27032. value = targetValue[0];
  27033. }
  27034. /**
  27035. * If the target isn't keyframes, or the first keyframe was null, we need to
  27036. * first check if an origin value was explicitly defined in the transition as "from",
  27037. * if not read the value from the DOM. As an absolute fallback, take the defined target value.
  27038. */
  27039. if (value === null) {
  27040. value = (_b = (_a = origin[key]) !== null && _a !== void 0 ? _a : visualElement.readValue(key)) !== null && _b !== void 0 ? _b : target[key];
  27041. }
  27042. /**
  27043. * If value is still undefined or null, ignore it. Preferably this would throw,
  27044. * but this was causing issues in Framer.
  27045. */
  27046. if (value === undefined || value === null)
  27047. continue;
  27048. if (typeof value === "string" &&
  27049. (isNumericalString(value) || isZeroValueString(value))) {
  27050. // If this is a number read as a string, ie "0" or "200", convert it to a number
  27051. value = parseFloat(value);
  27052. }
  27053. else if (!findValueType(value) && complex.test(targetValue)) {
  27054. value = animatable_none_getAnimatableNone(key, targetValue);
  27055. }
  27056. visualElement.addValue(key, motionValue(value));
  27057. (_c = (_d = origin)[key]) !== null && _c !== void 0 ? _c : (_d[key] = value);
  27058. visualElement.setBaseTarget(key, value);
  27059. }
  27060. }
  27061. function getOriginFromTransition(key, transition) {
  27062. if (!transition)
  27063. return;
  27064. var valueTransition = transition[key] || transition["default"] || transition;
  27065. return valueTransition.from;
  27066. }
  27067. function getOrigin(target, transition, visualElement) {
  27068. var _a, _b;
  27069. var origin = {};
  27070. for (var key in target) {
  27071. origin[key] =
  27072. (_a = getOriginFromTransition(key, transition)) !== null && _a !== void 0 ? _a : (_b = visualElement.getValue(key)) === null || _b === void 0 ? void 0 : _b.get();
  27073. }
  27074. return origin;
  27075. }
  27076. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/animation.mjs
  27077. /**
  27078. * @internal
  27079. */
  27080. function animateVisualElement(visualElement, definition, options) {
  27081. if (options === void 0) { options = {}; }
  27082. visualElement.notifyAnimationStart(definition);
  27083. var animation;
  27084. if (Array.isArray(definition)) {
  27085. var animations = definition.map(function (variant) {
  27086. return animateVariant(visualElement, variant, options);
  27087. });
  27088. animation = Promise.all(animations);
  27089. }
  27090. else if (typeof definition === "string") {
  27091. animation = animateVariant(visualElement, definition, options);
  27092. }
  27093. else {
  27094. var resolvedDefinition = typeof definition === "function"
  27095. ? resolveVariant(visualElement, definition, options.custom)
  27096. : definition;
  27097. animation = animateTarget(visualElement, resolvedDefinition, options);
  27098. }
  27099. return animation.then(function () {
  27100. return visualElement.notifyAnimationComplete(definition);
  27101. });
  27102. }
  27103. function animateVariant(visualElement, variant, options) {
  27104. var _a;
  27105. if (options === void 0) { options = {}; }
  27106. var resolved = resolveVariant(visualElement, variant, options.custom);
  27107. var _b = (resolved || {}).transition, transition = _b === void 0 ? visualElement.getDefaultTransition() || {} : _b;
  27108. if (options.transitionOverride) {
  27109. transition = options.transitionOverride;
  27110. }
  27111. /**
  27112. * If we have a variant, create a callback that runs it as an animation.
  27113. * Otherwise, we resolve a Promise immediately for a composable no-op.
  27114. */
  27115. var getAnimation = resolved
  27116. ? function () { return animateTarget(visualElement, resolved, options); }
  27117. : function () { return Promise.resolve(); };
  27118. /**
  27119. * If we have children, create a callback that runs all their animations.
  27120. * Otherwise, we resolve a Promise immediately for a composable no-op.
  27121. */
  27122. var getChildAnimations = ((_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.size)
  27123. ? function (forwardDelay) {
  27124. if (forwardDelay === void 0) { forwardDelay = 0; }
  27125. var _a = transition.delayChildren, delayChildren = _a === void 0 ? 0 : _a, staggerChildren = transition.staggerChildren, staggerDirection = transition.staggerDirection;
  27126. return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options);
  27127. }
  27128. : function () { return Promise.resolve(); };
  27129. /**
  27130. * If the transition explicitly defines a "when" option, we need to resolve either
  27131. * this animation or all children animations before playing the other.
  27132. */
  27133. var when = transition.when;
  27134. if (when) {
  27135. var _c = tslib_es6_read(when === "beforeChildren"
  27136. ? [getAnimation, getChildAnimations]
  27137. : [getChildAnimations, getAnimation], 2), first = _c[0], last = _c[1];
  27138. return first().then(last);
  27139. }
  27140. else {
  27141. return Promise.all([getAnimation(), getChildAnimations(options.delay)]);
  27142. }
  27143. }
  27144. /**
  27145. * @internal
  27146. */
  27147. function animateTarget(visualElement, definition, _a) {
  27148. var _b;
  27149. var _c = _a === void 0 ? {} : _a, _d = _c.delay, delay = _d === void 0 ? 0 : _d, transitionOverride = _c.transitionOverride, type = _c.type;
  27150. var _e = visualElement.makeTargetAnimatable(definition), _f = _e.transition, transition = _f === void 0 ? visualElement.getDefaultTransition() : _f, transitionEnd = _e.transitionEnd, target = __rest(_e, ["transition", "transitionEnd"]);
  27151. if (transitionOverride)
  27152. transition = transitionOverride;
  27153. var animations = [];
  27154. var animationTypeState = type && ((_b = visualElement.animationState) === null || _b === void 0 ? void 0 : _b.getState()[type]);
  27155. for (var key in target) {
  27156. var value = visualElement.getValue(key);
  27157. var valueTarget = target[key];
  27158. if (!value ||
  27159. valueTarget === undefined ||
  27160. (animationTypeState &&
  27161. shouldBlockAnimation(animationTypeState, key))) {
  27162. continue;
  27163. }
  27164. var valueTransition = __assign({ delay: delay }, transition);
  27165. /**
  27166. * Make animation instant if this is a transform prop and we should reduce motion.
  27167. */
  27168. if (visualElement.shouldReduceMotion && isTransformProp(key)) {
  27169. valueTransition = __assign(__assign({}, valueTransition), { type: false, delay: 0 });
  27170. }
  27171. var animation = startAnimation(key, value, valueTarget, valueTransition);
  27172. animations.push(animation);
  27173. }
  27174. return Promise.all(animations).then(function () {
  27175. transitionEnd && setTarget(visualElement, transitionEnd);
  27176. });
  27177. }
  27178. function animateChildren(visualElement, variant, delayChildren, staggerChildren, staggerDirection, options) {
  27179. if (delayChildren === void 0) { delayChildren = 0; }
  27180. if (staggerChildren === void 0) { staggerChildren = 0; }
  27181. if (staggerDirection === void 0) { staggerDirection = 1; }
  27182. var animations = [];
  27183. var maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;
  27184. var generateStaggerDuration = staggerDirection === 1
  27185. ? function (i) {
  27186. if (i === void 0) { i = 0; }
  27187. return i * staggerChildren;
  27188. }
  27189. : function (i) {
  27190. if (i === void 0) { i = 0; }
  27191. return maxStaggerDuration - i * staggerChildren;
  27192. };
  27193. Array.from(visualElement.variantChildren)
  27194. .sort(sortByTreeOrder)
  27195. .forEach(function (child, i) {
  27196. animations.push(animateVariant(child, variant, __assign(__assign({}, options), { delay: delayChildren + generateStaggerDuration(i) })).then(function () { return child.notifyAnimationComplete(variant); }));
  27197. });
  27198. return Promise.all(animations);
  27199. }
  27200. function stopAnimation(visualElement) {
  27201. visualElement.forEachValue(function (value) { return value.stop(); });
  27202. }
  27203. function sortByTreeOrder(a, b) {
  27204. return a.sortNodePosition(b);
  27205. }
  27206. /**
  27207. * Decide whether we should block this animation. Previously, we achieved this
  27208. * just by checking whether the key was listed in protectedKeys, but this
  27209. * posed problems if an animation was triggered by afterChildren and protectedKeys
  27210. * had been set to true in the meantime.
  27211. */
  27212. function shouldBlockAnimation(_a, key) {
  27213. var protectedKeys = _a.protectedKeys, needsAnimating = _a.needsAnimating;
  27214. var shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
  27215. needsAnimating[key] = false;
  27216. return shouldBlock;
  27217. }
  27218. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/animation-state.mjs
  27219. var variantPriorityOrder = [
  27220. AnimationType.Animate,
  27221. AnimationType.InView,
  27222. AnimationType.Focus,
  27223. AnimationType.Hover,
  27224. AnimationType.Tap,
  27225. AnimationType.Drag,
  27226. AnimationType.Exit,
  27227. ];
  27228. var reversePriorityOrder = tslib_es6_spreadArray([], tslib_es6_read(variantPriorityOrder), false).reverse();
  27229. var numAnimationTypes = variantPriorityOrder.length;
  27230. function animateList(visualElement) {
  27231. return function (animations) {
  27232. return Promise.all(animations.map(function (_a) {
  27233. var animation = _a.animation, options = _a.options;
  27234. return animateVisualElement(visualElement, animation, options);
  27235. }));
  27236. };
  27237. }
  27238. function createAnimationState(visualElement) {
  27239. var animate = animateList(visualElement);
  27240. var state = createState();
  27241. var allAnimatedKeys = {};
  27242. var isInitialRender = true;
  27243. /**
  27244. * This function will be used to reduce the animation definitions for
  27245. * each active animation type into an object of resolved values for it.
  27246. */
  27247. var buildResolvedTypeValues = function (acc, definition) {
  27248. var resolved = resolveVariant(visualElement, definition);
  27249. if (resolved) {
  27250. resolved.transition; var transitionEnd = resolved.transitionEnd, target = __rest(resolved, ["transition", "transitionEnd"]);
  27251. acc = __assign(__assign(__assign({}, acc), target), transitionEnd);
  27252. }
  27253. return acc;
  27254. };
  27255. function isAnimated(key) {
  27256. return allAnimatedKeys[key] !== undefined;
  27257. }
  27258. /**
  27259. * This just allows us to inject mocked animation functions
  27260. * @internal
  27261. */
  27262. function setAnimateFunction(makeAnimator) {
  27263. animate = makeAnimator(visualElement);
  27264. }
  27265. /**
  27266. * When we receive new props, we need to:
  27267. * 1. Create a list of protected keys for each type. This is a directory of
  27268. * value keys that are currently being "handled" by types of a higher priority
  27269. * so that whenever an animation is played of a given type, these values are
  27270. * protected from being animated.
  27271. * 2. Determine if an animation type needs animating.
  27272. * 3. Determine if any values have been removed from a type and figure out
  27273. * what to animate those to.
  27274. */
  27275. function animateChanges(options, changedActiveType) {
  27276. var _a;
  27277. var props = visualElement.getProps();
  27278. var context = visualElement.getVariantContext(true) || {};
  27279. /**
  27280. * A list of animations that we'll build into as we iterate through the animation
  27281. * types. This will get executed at the end of the function.
  27282. */
  27283. var animations = [];
  27284. /**
  27285. * Keep track of which values have been removed. Then, as we hit lower priority
  27286. * animation types, we can check if they contain removed values and animate to that.
  27287. */
  27288. var removedKeys = new Set();
  27289. /**
  27290. * A dictionary of all encountered keys. This is an object to let us build into and
  27291. * copy it without iteration. Each time we hit an animation type we set its protected
  27292. * keys - the keys its not allowed to animate - to the latest version of this object.
  27293. */
  27294. var encounteredKeys = {};
  27295. /**
  27296. * If a variant has been removed at a given index, and this component is controlling
  27297. * variant animations, we want to ensure lower-priority variants are forced to animate.
  27298. */
  27299. var removedVariantIndex = Infinity;
  27300. var _loop_1 = function (i) {
  27301. var type = reversePriorityOrder[i];
  27302. var typeState = state[type];
  27303. var prop = (_a = props[type]) !== null && _a !== void 0 ? _a : context[type];
  27304. var propIsVariant = isVariantLabel(prop);
  27305. /**
  27306. * If this type has *just* changed isActive status, set activeDelta
  27307. * to that status. Otherwise set to null.
  27308. */
  27309. var activeDelta = type === changedActiveType ? typeState.isActive : null;
  27310. if (activeDelta === false)
  27311. removedVariantIndex = i;
  27312. /**
  27313. * If this prop is an inherited variant, rather than been set directly on the
  27314. * component itself, we want to make sure we allow the parent to trigger animations.
  27315. *
  27316. * TODO: Can probably change this to a !isControllingVariants check
  27317. */
  27318. var isInherited = prop === context[type] && prop !== props[type] && propIsVariant;
  27319. /**
  27320. *
  27321. */
  27322. if (isInherited &&
  27323. isInitialRender &&
  27324. visualElement.manuallyAnimateOnMount) {
  27325. isInherited = false;
  27326. }
  27327. /**
  27328. * Set all encountered keys so far as the protected keys for this type. This will
  27329. * be any key that has been animated or otherwise handled by active, higher-priortiy types.
  27330. */
  27331. typeState.protectedKeys = __assign({}, encounteredKeys);
  27332. // Check if we can skip analysing this prop early
  27333. if (
  27334. // If it isn't active and hasn't *just* been set as inactive
  27335. (!typeState.isActive && activeDelta === null) ||
  27336. // If we didn't and don't have any defined prop for this animation type
  27337. (!prop && !typeState.prevProp) ||
  27338. // Or if the prop doesn't define an animation
  27339. isAnimationControls(prop) ||
  27340. typeof prop === "boolean") {
  27341. return "continue";
  27342. }
  27343. /**
  27344. * As we go look through the values defined on this type, if we detect
  27345. * a changed value or a value that was removed in a higher priority, we set
  27346. * this to true and add this prop to the animation list.
  27347. */
  27348. var variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
  27349. var shouldAnimateType = variantDidChange ||
  27350. // If we're making this variant active, we want to always make it active
  27351. (type === changedActiveType &&
  27352. typeState.isActive &&
  27353. !isInherited &&
  27354. propIsVariant) ||
  27355. // If we removed a higher-priority variant (i is in reverse order)
  27356. (i > removedVariantIndex && propIsVariant);
  27357. /**
  27358. * As animations can be set as variant lists, variants or target objects, we
  27359. * coerce everything to an array if it isn't one already
  27360. */
  27361. var definitionList = Array.isArray(prop) ? prop : [prop];
  27362. /**
  27363. * Build an object of all the resolved values. We'll use this in the subsequent
  27364. * animateChanges calls to determine whether a value has changed.
  27365. */
  27366. var resolvedValues = definitionList.reduce(buildResolvedTypeValues, {});
  27367. if (activeDelta === false)
  27368. resolvedValues = {};
  27369. /**
  27370. * Now we need to loop through all the keys in the prev prop and this prop,
  27371. * and decide:
  27372. * 1. If the value has changed, and needs animating
  27373. * 2. If it has been removed, and needs adding to the removedKeys set
  27374. * 3. If it has been removed in a higher priority type and needs animating
  27375. * 4. If it hasn't been removed in a higher priority but hasn't changed, and
  27376. * needs adding to the type's protectedKeys list.
  27377. */
  27378. var _b = typeState.prevResolvedValues, prevResolvedValues = _b === void 0 ? {} : _b;
  27379. var allKeys = __assign(__assign({}, prevResolvedValues), resolvedValues);
  27380. var markToAnimate = function (key) {
  27381. shouldAnimateType = true;
  27382. removedKeys.delete(key);
  27383. typeState.needsAnimating[key] = true;
  27384. };
  27385. for (var key in allKeys) {
  27386. var next = resolvedValues[key];
  27387. var prev = prevResolvedValues[key];
  27388. // If we've already handled this we can just skip ahead
  27389. if (encounteredKeys.hasOwnProperty(key))
  27390. continue;
  27391. /**
  27392. * If the value has changed, we probably want to animate it.
  27393. */
  27394. if (next !== prev) {
  27395. /**
  27396. * If both values are keyframes, we need to shallow compare them to
  27397. * detect whether any value has changed. If it has, we animate it.
  27398. */
  27399. if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
  27400. if (!shallowCompare(next, prev) || variantDidChange) {
  27401. markToAnimate(key);
  27402. }
  27403. else {
  27404. /**
  27405. * If it hasn't changed, we want to ensure it doesn't animate by
  27406. * adding it to the list of protected keys.
  27407. */
  27408. typeState.protectedKeys[key] = true;
  27409. }
  27410. }
  27411. else if (next !== undefined) {
  27412. // If next is defined and doesn't equal prev, it needs animating
  27413. markToAnimate(key);
  27414. }
  27415. else {
  27416. // If it's undefined, it's been removed.
  27417. removedKeys.add(key);
  27418. }
  27419. }
  27420. else if (next !== undefined && removedKeys.has(key)) {
  27421. /**
  27422. * If next hasn't changed and it isn't undefined, we want to check if it's
  27423. * been removed by a higher priority
  27424. */
  27425. markToAnimate(key);
  27426. }
  27427. else {
  27428. /**
  27429. * If it hasn't changed, we add it to the list of protected values
  27430. * to ensure it doesn't get animated.
  27431. */
  27432. typeState.protectedKeys[key] = true;
  27433. }
  27434. }
  27435. /**
  27436. * Update the typeState so next time animateChanges is called we can compare the
  27437. * latest prop and resolvedValues to these.
  27438. */
  27439. typeState.prevProp = prop;
  27440. typeState.prevResolvedValues = resolvedValues;
  27441. /**
  27442. *
  27443. */
  27444. if (typeState.isActive) {
  27445. encounteredKeys = __assign(__assign({}, encounteredKeys), resolvedValues);
  27446. }
  27447. if (isInitialRender && visualElement.blockInitialAnimation) {
  27448. shouldAnimateType = false;
  27449. }
  27450. /**
  27451. * If this is an inherited prop we want to hard-block animations
  27452. * TODO: Test as this should probably still handle animations triggered
  27453. * by removed values?
  27454. */
  27455. if (shouldAnimateType && !isInherited) {
  27456. animations.push.apply(animations, tslib_es6_spreadArray([], tslib_es6_read(definitionList.map(function (animation) { return ({
  27457. animation: animation,
  27458. options: __assign({ type: type }, options),
  27459. }); })), false));
  27460. }
  27461. };
  27462. /**
  27463. * Iterate through all animation types in reverse priority order. For each, we want to
  27464. * detect which values it's handling and whether or not they've changed (and therefore
  27465. * need to be animated). If any values have been removed, we want to detect those in
  27466. * lower priority props and flag for animation.
  27467. */
  27468. for (var i = 0; i < numAnimationTypes; i++) {
  27469. _loop_1(i);
  27470. }
  27471. allAnimatedKeys = __assign({}, encounteredKeys);
  27472. /**
  27473. * If there are some removed value that haven't been dealt with,
  27474. * we need to create a new animation that falls back either to the value
  27475. * defined in the style prop, or the last read value.
  27476. */
  27477. if (removedKeys.size) {
  27478. var fallbackAnimation_1 = {};
  27479. removedKeys.forEach(function (key) {
  27480. var fallbackTarget = visualElement.getBaseTarget(key);
  27481. if (fallbackTarget !== undefined) {
  27482. fallbackAnimation_1[key] = fallbackTarget;
  27483. }
  27484. });
  27485. animations.push({ animation: fallbackAnimation_1 });
  27486. }
  27487. var shouldAnimate = Boolean(animations.length);
  27488. if (isInitialRender &&
  27489. props.initial === false &&
  27490. !visualElement.manuallyAnimateOnMount) {
  27491. shouldAnimate = false;
  27492. }
  27493. isInitialRender = false;
  27494. return shouldAnimate ? animate(animations) : Promise.resolve();
  27495. }
  27496. /**
  27497. * Change whether a certain animation type is active.
  27498. */
  27499. function setActive(type, isActive, options) {
  27500. var _a;
  27501. // If the active state hasn't changed, we can safely do nothing here
  27502. if (state[type].isActive === isActive)
  27503. return Promise.resolve();
  27504. // Propagate active change to children
  27505. (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
  27506. state[type].isActive = isActive;
  27507. var animations = animateChanges(options, type);
  27508. for (var key in state) {
  27509. state[key].protectedKeys = {};
  27510. }
  27511. return animations;
  27512. }
  27513. return {
  27514. isAnimated: isAnimated,
  27515. animateChanges: animateChanges,
  27516. setActive: setActive,
  27517. setAnimateFunction: setAnimateFunction,
  27518. getState: function () { return state; },
  27519. };
  27520. }
  27521. function checkVariantsDidChange(prev, next) {
  27522. if (typeof next === "string") {
  27523. return next !== prev;
  27524. }
  27525. else if (isVariantLabels(next)) {
  27526. return !shallowCompare(next, prev);
  27527. }
  27528. return false;
  27529. }
  27530. function createTypeState(isActive) {
  27531. if (isActive === void 0) { isActive = false; }
  27532. return {
  27533. isActive: isActive,
  27534. protectedKeys: {},
  27535. needsAnimating: {},
  27536. prevResolvedValues: {},
  27537. };
  27538. }
  27539. function createState() {
  27540. var _a;
  27541. return _a = {},
  27542. _a[AnimationType.Animate] = createTypeState(true),
  27543. _a[AnimationType.InView] = createTypeState(),
  27544. _a[AnimationType.Hover] = createTypeState(),
  27545. _a[AnimationType.Tap] = createTypeState(),
  27546. _a[AnimationType.Drag] = createTypeState(),
  27547. _a[AnimationType.Focus] = createTypeState(),
  27548. _a[AnimationType.Exit] = createTypeState(),
  27549. _a;
  27550. }
  27551. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/animations.mjs
  27552. var animations = {
  27553. animation: makeRenderlessComponent(function (_a) {
  27554. var visualElement = _a.visualElement, animate = _a.animate;
  27555. /**
  27556. * We dynamically generate the AnimationState manager as it contains a reference
  27557. * to the underlying animation library. We only want to load that if we load this,
  27558. * so people can optionally code split it out using the `m` component.
  27559. */
  27560. visualElement.animationState || (visualElement.animationState = createAnimationState(visualElement));
  27561. /**
  27562. * Subscribe any provided AnimationControls to the component's VisualElement
  27563. */
  27564. if (isAnimationControls(animate)) {
  27565. (0,external_React_.useEffect)(function () { return animate.subscribe(visualElement); }, [animate]);
  27566. }
  27567. }),
  27568. exit: makeRenderlessComponent(function (props) {
  27569. var custom = props.custom, visualElement = props.visualElement;
  27570. var _a = tslib_es6_read(usePresence(), 2), isPresent = _a[0], safeToRemove = _a[1];
  27571. var presenceContext = (0,external_React_.useContext)(PresenceContext_PresenceContext);
  27572. (0,external_React_.useEffect)(function () {
  27573. var _a, _b;
  27574. visualElement.isPresent = isPresent;
  27575. var animation = (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Exit, !isPresent, { custom: (_b = presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.custom) !== null && _b !== void 0 ? _b : custom });
  27576. !isPresent && (animation === null || animation === void 0 ? void 0 : animation.then(safeToRemove));
  27577. }, [isPresent]);
  27578. }),
  27579. };
  27580. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/PanSession.mjs
  27581. /**
  27582. * @internal
  27583. */
  27584. var PanSession = /** @class */ (function () {
  27585. function PanSession(event, handlers, _a) {
  27586. var _this = this;
  27587. var _b = _a === void 0 ? {} : _a, transformPagePoint = _b.transformPagePoint;
  27588. /**
  27589. * @internal
  27590. */
  27591. this.startEvent = null;
  27592. /**
  27593. * @internal
  27594. */
  27595. this.lastMoveEvent = null;
  27596. /**
  27597. * @internal
  27598. */
  27599. this.lastMoveEventInfo = null;
  27600. /**
  27601. * @internal
  27602. */
  27603. this.handlers = {};
  27604. this.updatePoint = function () {
  27605. if (!(_this.lastMoveEvent && _this.lastMoveEventInfo))
  27606. return;
  27607. var info = getPanInfo(_this.lastMoveEventInfo, _this.history);
  27608. var isPanStarted = _this.startEvent !== null;
  27609. // Only start panning if the offset is larger than 3 pixels. If we make it
  27610. // any larger than this we'll want to reset the pointer history
  27611. // on the first update to avoid visual snapping to the cursoe.
  27612. var isDistancePastThreshold = distance(info.offset, { x: 0, y: 0 }) >= 3;
  27613. if (!isPanStarted && !isDistancePastThreshold)
  27614. return;
  27615. var point = info.point;
  27616. var timestamp = getFrameData().timestamp;
  27617. _this.history.push(__assign(__assign({}, point), { timestamp: timestamp }));
  27618. var _a = _this.handlers, onStart = _a.onStart, onMove = _a.onMove;
  27619. if (!isPanStarted) {
  27620. onStart && onStart(_this.lastMoveEvent, info);
  27621. _this.startEvent = _this.lastMoveEvent;
  27622. }
  27623. onMove && onMove(_this.lastMoveEvent, info);
  27624. };
  27625. this.handlePointerMove = function (event, info) {
  27626. _this.lastMoveEvent = event;
  27627. _this.lastMoveEventInfo = transformPoint(info, _this.transformPagePoint);
  27628. // Because Safari doesn't trigger mouseup events when it's above a `<select>`
  27629. if (isMouseEvent(event) && event.buttons === 0) {
  27630. _this.handlePointerUp(event, info);
  27631. return;
  27632. }
  27633. // Throttle mouse move event to once per frame
  27634. es.update(_this.updatePoint, true);
  27635. };
  27636. this.handlePointerUp = function (event, info) {
  27637. _this.end();
  27638. var _a = _this.handlers, onEnd = _a.onEnd, onSessionEnd = _a.onSessionEnd;
  27639. var panInfo = getPanInfo(transformPoint(info, _this.transformPagePoint), _this.history);
  27640. if (_this.startEvent && onEnd) {
  27641. onEnd(event, panInfo);
  27642. }
  27643. onSessionEnd && onSessionEnd(event, panInfo);
  27644. };
  27645. // If we have more than one touch, don't start detecting this gesture
  27646. if (isTouchEvent(event) && event.touches.length > 1)
  27647. return;
  27648. this.handlers = handlers;
  27649. this.transformPagePoint = transformPagePoint;
  27650. var info = extractEventInfo(event);
  27651. var initialInfo = transformPoint(info, this.transformPagePoint);
  27652. var point = initialInfo.point;
  27653. var timestamp = getFrameData().timestamp;
  27654. this.history = [__assign(__assign({}, point), { timestamp: timestamp })];
  27655. var onSessionStart = handlers.onSessionStart;
  27656. onSessionStart &&
  27657. onSessionStart(event, getPanInfo(initialInfo, this.history));
  27658. this.removeListeners = pipe(addPointerEvent(window, "pointermove", this.handlePointerMove), addPointerEvent(window, "pointerup", this.handlePointerUp), addPointerEvent(window, "pointercancel", this.handlePointerUp));
  27659. }
  27660. PanSession.prototype.updateHandlers = function (handlers) {
  27661. this.handlers = handlers;
  27662. };
  27663. PanSession.prototype.end = function () {
  27664. this.removeListeners && this.removeListeners();
  27665. cancelSync.update(this.updatePoint);
  27666. };
  27667. return PanSession;
  27668. }());
  27669. function transformPoint(info, transformPagePoint) {
  27670. return transformPagePoint ? { point: transformPagePoint(info.point) } : info;
  27671. }
  27672. function subtractPoint(a, b) {
  27673. return { x: a.x - b.x, y: a.y - b.y };
  27674. }
  27675. function getPanInfo(_a, history) {
  27676. var point = _a.point;
  27677. return {
  27678. point: point,
  27679. delta: subtractPoint(point, lastDevicePoint(history)),
  27680. offset: subtractPoint(point, startDevicePoint(history)),
  27681. velocity: PanSession_getVelocity(history, 0.1),
  27682. };
  27683. }
  27684. function startDevicePoint(history) {
  27685. return history[0];
  27686. }
  27687. function lastDevicePoint(history) {
  27688. return history[history.length - 1];
  27689. }
  27690. function PanSession_getVelocity(history, timeDelta) {
  27691. if (history.length < 2) {
  27692. return { x: 0, y: 0 };
  27693. }
  27694. var i = history.length - 1;
  27695. var timestampedPoint = null;
  27696. var lastPoint = lastDevicePoint(history);
  27697. while (i >= 0) {
  27698. timestampedPoint = history[i];
  27699. if (lastPoint.timestamp - timestampedPoint.timestamp >
  27700. secondsToMilliseconds(timeDelta)) {
  27701. break;
  27702. }
  27703. i--;
  27704. }
  27705. if (!timestampedPoint) {
  27706. return { x: 0, y: 0 };
  27707. }
  27708. var time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;
  27709. if (time === 0) {
  27710. return { x: 0, y: 0 };
  27711. }
  27712. var currentVelocity = {
  27713. x: (lastPoint.x - timestampedPoint.x) / time,
  27714. y: (lastPoint.y - timestampedPoint.y) / time,
  27715. };
  27716. if (currentVelocity.x === Infinity) {
  27717. currentVelocity.x = 0;
  27718. }
  27719. if (currentVelocity.y === Infinity) {
  27720. currentVelocity.y = 0;
  27721. }
  27722. return currentVelocity;
  27723. }
  27724. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.mjs
  27725. /**
  27726. * Apply constraints to a point. These constraints are both physical along an
  27727. * axis, and an elastic factor that determines how much to constrain the point
  27728. * by if it does lie outside the defined parameters.
  27729. */
  27730. function applyConstraints(point, _a, elastic) {
  27731. var min = _a.min, max = _a.max;
  27732. if (min !== undefined && point < min) {
  27733. // If we have a min point defined, and this is outside of that, constrain
  27734. point = elastic ? mix(min, point, elastic.min) : Math.max(point, min);
  27735. }
  27736. else if (max !== undefined && point > max) {
  27737. // If we have a max point defined, and this is outside of that, constrain
  27738. point = elastic ? mix(max, point, elastic.max) : Math.min(point, max);
  27739. }
  27740. return point;
  27741. }
  27742. /**
  27743. * Calculate constraints in terms of the viewport when defined relatively to the
  27744. * measured axis. This is measured from the nearest edge, so a max constraint of 200
  27745. * on an axis with a max value of 300 would return a constraint of 500 - axis length
  27746. */
  27747. function calcRelativeAxisConstraints(axis, min, max) {
  27748. return {
  27749. min: min !== undefined ? axis.min + min : undefined,
  27750. max: max !== undefined
  27751. ? axis.max + max - (axis.max - axis.min)
  27752. : undefined,
  27753. };
  27754. }
  27755. /**
  27756. * Calculate constraints in terms of the viewport when
  27757. * defined relatively to the measured bounding box.
  27758. */
  27759. function calcRelativeConstraints(layoutBox, _a) {
  27760. var top = _a.top, left = _a.left, bottom = _a.bottom, right = _a.right;
  27761. return {
  27762. x: calcRelativeAxisConstraints(layoutBox.x, left, right),
  27763. y: calcRelativeAxisConstraints(layoutBox.y, top, bottom),
  27764. };
  27765. }
  27766. /**
  27767. * Calculate viewport constraints when defined as another viewport-relative axis
  27768. */
  27769. function calcViewportAxisConstraints(layoutAxis, constraintsAxis) {
  27770. var _a;
  27771. var min = constraintsAxis.min - layoutAxis.min;
  27772. var max = constraintsAxis.max - layoutAxis.max;
  27773. // If the constraints axis is actually smaller than the layout axis then we can
  27774. // flip the constraints
  27775. if (constraintsAxis.max - constraintsAxis.min <
  27776. layoutAxis.max - layoutAxis.min) {
  27777. _a = tslib_es6_read([max, min], 2), min = _a[0], max = _a[1];
  27778. }
  27779. return { min: min, max: max };
  27780. }
  27781. /**
  27782. * Calculate viewport constraints when defined as another viewport-relative box
  27783. */
  27784. function calcViewportConstraints(layoutBox, constraintsBox) {
  27785. return {
  27786. x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),
  27787. y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y),
  27788. };
  27789. }
  27790. /**
  27791. * Calculate a transform origin relative to the source axis, between 0-1, that results
  27792. * in an asthetically pleasing scale/transform needed to project from source to target.
  27793. */
  27794. function constraints_calcOrigin(source, target) {
  27795. var origin = 0.5;
  27796. var sourceLength = calcLength(source);
  27797. var targetLength = calcLength(target);
  27798. if (targetLength > sourceLength) {
  27799. origin = progress(target.min, target.max - sourceLength, source.min);
  27800. }
  27801. else if (sourceLength > targetLength) {
  27802. origin = progress(source.min, source.max - targetLength, target.min);
  27803. }
  27804. return clamp(0, 1, origin);
  27805. }
  27806. /**
  27807. * Rebase the calculated viewport constraints relative to the layout.min point.
  27808. */
  27809. function rebaseAxisConstraints(layout, constraints) {
  27810. var relativeConstraints = {};
  27811. if (constraints.min !== undefined) {
  27812. relativeConstraints.min = constraints.min - layout.min;
  27813. }
  27814. if (constraints.max !== undefined) {
  27815. relativeConstraints.max = constraints.max - layout.min;
  27816. }
  27817. return relativeConstraints;
  27818. }
  27819. var defaultElastic = 0.35;
  27820. /**
  27821. * Accepts a dragElastic prop and returns resolved elastic values for each axis.
  27822. */
  27823. function resolveDragElastic(dragElastic) {
  27824. if (dragElastic === void 0) { dragElastic = defaultElastic; }
  27825. if (dragElastic === false) {
  27826. dragElastic = 0;
  27827. }
  27828. else if (dragElastic === true) {
  27829. dragElastic = defaultElastic;
  27830. }
  27831. return {
  27832. x: resolveAxisElastic(dragElastic, "left", "right"),
  27833. y: resolveAxisElastic(dragElastic, "top", "bottom"),
  27834. };
  27835. }
  27836. function resolveAxisElastic(dragElastic, minLabel, maxLabel) {
  27837. return {
  27838. min: resolvePointElastic(dragElastic, minLabel),
  27839. max: resolvePointElastic(dragElastic, maxLabel),
  27840. };
  27841. }
  27842. function resolvePointElastic(dragElastic, label) {
  27843. var _a;
  27844. return typeof dragElastic === "number"
  27845. ? dragElastic
  27846. : (_a = dragElastic[label]) !== null && _a !== void 0 ? _a : 0;
  27847. }
  27848. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/conversion.mjs
  27849. /**
  27850. * Bounding boxes tend to be defined as top, left, right, bottom. For various operations
  27851. * it's easier to consider each axis individually. This function returns a bounding box
  27852. * as a map of single-axis min/max values.
  27853. */
  27854. function convertBoundingBoxToBox(_a) {
  27855. var top = _a.top, left = _a.left, right = _a.right, bottom = _a.bottom;
  27856. return {
  27857. x: { min: left, max: right },
  27858. y: { min: top, max: bottom },
  27859. };
  27860. }
  27861. function convertBoxToBoundingBox(_a) {
  27862. var x = _a.x, y = _a.y;
  27863. return { top: y.min, right: x.max, bottom: y.max, left: x.min };
  27864. }
  27865. /**
  27866. * Applies a TransformPoint function to a bounding box. TransformPoint is usually a function
  27867. * provided by Framer to allow measured points to be corrected for device scaling. This is used
  27868. * when measuring DOM elements and DOM event points.
  27869. */
  27870. function transformBoxPoints(point, transformPoint) {
  27871. if (!transformPoint)
  27872. return point;
  27873. var topLeft = transformPoint({ x: point.left, y: point.top });
  27874. var bottomRight = transformPoint({ x: point.right, y: point.bottom });
  27875. return {
  27876. top: topLeft.y,
  27877. left: topLeft.x,
  27878. bottom: bottomRight.y,
  27879. right: bottomRight.x,
  27880. };
  27881. }
  27882. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/utils/measure.mjs
  27883. function measureViewportBox(instance, transformPoint) {
  27884. return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint));
  27885. }
  27886. function measurePageBox(element, rootProjectionNode, transformPagePoint) {
  27887. var viewportBox = measureViewportBox(element, transformPagePoint);
  27888. var scroll = rootProjectionNode.scroll;
  27889. if (scroll) {
  27890. translateAxis(viewportBox.x, scroll.x);
  27891. translateAxis(viewportBox.y, scroll.y);
  27892. }
  27893. return viewportBox;
  27894. }
  27895. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs
  27896. var elementDragControls = new WeakMap();
  27897. /**
  27898. *
  27899. */
  27900. // let latestPointerEvent: AnyPointerEvent
  27901. var VisualElementDragControls = /** @class */ (function () {
  27902. function VisualElementDragControls(visualElement) {
  27903. // This is a reference to the global drag gesture lock, ensuring only one component
  27904. // can "capture" the drag of one or both axes.
  27905. // TODO: Look into moving this into pansession?
  27906. this.openGlobalLock = null;
  27907. this.isDragging = false;
  27908. this.currentDirection = null;
  27909. this.originPoint = { x: 0, y: 0 };
  27910. /**
  27911. * The permitted boundaries of travel, in pixels.
  27912. */
  27913. this.constraints = false;
  27914. this.hasMutatedConstraints = false;
  27915. /**
  27916. * The per-axis resolved elastic values.
  27917. */
  27918. this.elastic = createBox();
  27919. this.visualElement = visualElement;
  27920. }
  27921. VisualElementDragControls.prototype.start = function (originEvent, _a) {
  27922. var _this = this;
  27923. var _b = _a === void 0 ? {} : _a, _c = _b.snapToCursor, snapToCursor = _c === void 0 ? false : _c;
  27924. /**
  27925. * Don't start dragging if this component is exiting
  27926. */
  27927. if (this.visualElement.isPresent === false)
  27928. return;
  27929. var onSessionStart = function (event) {
  27930. // Stop any animations on both axis values immediately. This allows the user to throw and catch
  27931. // the component.
  27932. _this.stopAnimation();
  27933. if (snapToCursor) {
  27934. _this.snapToCursor(extractEventInfo(event, "page").point);
  27935. }
  27936. };
  27937. var onStart = function (event, info) {
  27938. var _a;
  27939. // Attempt to grab the global drag gesture lock - maybe make this part of PanSession
  27940. var _b = _this.getProps(), drag = _b.drag, dragPropagation = _b.dragPropagation, onDragStart = _b.onDragStart;
  27941. if (drag && !dragPropagation) {
  27942. if (_this.openGlobalLock)
  27943. _this.openGlobalLock();
  27944. _this.openGlobalLock = getGlobalLock(drag);
  27945. // If we don 't have the lock, don't start dragging
  27946. if (!_this.openGlobalLock)
  27947. return;
  27948. }
  27949. _this.isDragging = true;
  27950. _this.currentDirection = null;
  27951. _this.resolveConstraints();
  27952. if (_this.visualElement.projection) {
  27953. _this.visualElement.projection.isAnimationBlocked = true;
  27954. _this.visualElement.projection.target = undefined;
  27955. }
  27956. /**
  27957. * Record gesture origin
  27958. */
  27959. eachAxis(function (axis) {
  27960. var _a, _b;
  27961. var current = _this.getAxisMotionValue(axis).get() || 0;
  27962. /**
  27963. * If the MotionValue is a percentage value convert to px
  27964. */
  27965. if (percent.test(current)) {
  27966. var measuredAxis = (_b = (_a = _this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.actual[axis];
  27967. if (measuredAxis) {
  27968. var length_1 = calcLength(measuredAxis);
  27969. current = length_1 * (parseFloat(current) / 100);
  27970. }
  27971. }
  27972. _this.originPoint[axis] = current;
  27973. });
  27974. // Fire onDragStart event
  27975. onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(event, info);
  27976. (_a = _this.visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Drag, true);
  27977. };
  27978. var onMove = function (event, info) {
  27979. // latestPointerEvent = event
  27980. var _a = _this.getProps(), dragPropagation = _a.dragPropagation, dragDirectionLock = _a.dragDirectionLock, onDirectionLock = _a.onDirectionLock, onDrag = _a.onDrag;
  27981. // If we didn't successfully receive the gesture lock, early return.
  27982. if (!dragPropagation && !_this.openGlobalLock)
  27983. return;
  27984. var offset = info.offset;
  27985. // Attempt to detect drag direction if directionLock is true
  27986. if (dragDirectionLock && _this.currentDirection === null) {
  27987. _this.currentDirection = getCurrentDirection(offset);
  27988. // If we've successfully set a direction, notify listener
  27989. if (_this.currentDirection !== null) {
  27990. onDirectionLock === null || onDirectionLock === void 0 ? void 0 : onDirectionLock(_this.currentDirection);
  27991. }
  27992. return;
  27993. }
  27994. // Update each point with the latest position
  27995. _this.updateAxis("x", info.point, offset);
  27996. _this.updateAxis("y", info.point, offset);
  27997. /**
  27998. * Ideally we would leave the renderer to fire naturally at the end of
  27999. * this frame but if the element is about to change layout as the result
  28000. * of a re-render we want to ensure the browser can read the latest
  28001. * bounding box to ensure the pointer and element don't fall out of sync.
  28002. */
  28003. _this.visualElement.syncRender();
  28004. /**
  28005. * This must fire after the syncRender call as it might trigger a state
  28006. * change which itself might trigger a layout update.
  28007. */
  28008. onDrag === null || onDrag === void 0 ? void 0 : onDrag(event, info);
  28009. };
  28010. var onSessionEnd = function (event, info) {
  28011. return _this.stop(event, info);
  28012. };
  28013. this.panSession = new PanSession(originEvent, {
  28014. onSessionStart: onSessionStart,
  28015. onStart: onStart,
  28016. onMove: onMove,
  28017. onSessionEnd: onSessionEnd,
  28018. }, { transformPagePoint: this.visualElement.getTransformPagePoint() });
  28019. };
  28020. VisualElementDragControls.prototype.stop = function (event, info) {
  28021. var isDragging = this.isDragging;
  28022. this.cancel();
  28023. if (!isDragging)
  28024. return;
  28025. var velocity = info.velocity;
  28026. this.startAnimation(velocity);
  28027. var onDragEnd = this.getProps().onDragEnd;
  28028. onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd(event, info);
  28029. };
  28030. VisualElementDragControls.prototype.cancel = function () {
  28031. var _a, _b;
  28032. this.isDragging = false;
  28033. if (this.visualElement.projection) {
  28034. this.visualElement.projection.isAnimationBlocked = false;
  28035. }
  28036. (_a = this.panSession) === null || _a === void 0 ? void 0 : _a.end();
  28037. this.panSession = undefined;
  28038. var dragPropagation = this.getProps().dragPropagation;
  28039. if (!dragPropagation && this.openGlobalLock) {
  28040. this.openGlobalLock();
  28041. this.openGlobalLock = null;
  28042. }
  28043. (_b = this.visualElement.animationState) === null || _b === void 0 ? void 0 : _b.setActive(AnimationType.Drag, false);
  28044. };
  28045. VisualElementDragControls.prototype.updateAxis = function (axis, _point, offset) {
  28046. var drag = this.getProps().drag;
  28047. // If we're not dragging this axis, do an early return.
  28048. if (!offset || !shouldDrag(axis, drag, this.currentDirection))
  28049. return;
  28050. var axisValue = this.getAxisMotionValue(axis);
  28051. var next = this.originPoint[axis] + offset[axis];
  28052. // Apply constraints
  28053. if (this.constraints && this.constraints[axis]) {
  28054. next = applyConstraints(next, this.constraints[axis], this.elastic[axis]);
  28055. }
  28056. axisValue.set(next);
  28057. };
  28058. VisualElementDragControls.prototype.resolveConstraints = function () {
  28059. var _this = this;
  28060. var _a = this.getProps(), dragConstraints = _a.dragConstraints, dragElastic = _a.dragElastic;
  28061. var layout = (this.visualElement.projection || {}).layout;
  28062. var prevConstraints = this.constraints;
  28063. if (dragConstraints && is_ref_object_isRefObject(dragConstraints)) {
  28064. if (!this.constraints) {
  28065. this.constraints = this.resolveRefConstraints();
  28066. }
  28067. }
  28068. else {
  28069. if (dragConstraints && layout) {
  28070. this.constraints = calcRelativeConstraints(layout.actual, dragConstraints);
  28071. }
  28072. else {
  28073. this.constraints = false;
  28074. }
  28075. }
  28076. this.elastic = resolveDragElastic(dragElastic);
  28077. /**
  28078. * If we're outputting to external MotionValues, we want to rebase the measured constraints
  28079. * from viewport-relative to component-relative.
  28080. */
  28081. if (prevConstraints !== this.constraints &&
  28082. layout &&
  28083. this.constraints &&
  28084. !this.hasMutatedConstraints) {
  28085. eachAxis(function (axis) {
  28086. if (_this.getAxisMotionValue(axis)) {
  28087. _this.constraints[axis] = rebaseAxisConstraints(layout.actual[axis], _this.constraints[axis]);
  28088. }
  28089. });
  28090. }
  28091. };
  28092. VisualElementDragControls.prototype.resolveRefConstraints = function () {
  28093. var _a = this.getProps(), constraints = _a.dragConstraints, onMeasureDragConstraints = _a.onMeasureDragConstraints;
  28094. if (!constraints || !is_ref_object_isRefObject(constraints))
  28095. return false;
  28096. var constraintsElement = constraints.current;
  28097. invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");
  28098. var projection = this.visualElement.projection;
  28099. // TODO
  28100. if (!projection || !projection.layout)
  28101. return false;
  28102. var constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());
  28103. var measuredConstraints = calcViewportConstraints(projection.layout.actual, constraintsBox);
  28104. /**
  28105. * If there's an onMeasureDragConstraints listener we call it and
  28106. * if different constraints are returned, set constraints to that
  28107. */
  28108. if (onMeasureDragConstraints) {
  28109. var userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));
  28110. this.hasMutatedConstraints = !!userConstraints;
  28111. if (userConstraints) {
  28112. measuredConstraints = convertBoundingBoxToBox(userConstraints);
  28113. }
  28114. }
  28115. return measuredConstraints;
  28116. };
  28117. VisualElementDragControls.prototype.startAnimation = function (velocity) {
  28118. var _this = this;
  28119. var _a = this.getProps(), drag = _a.drag, dragMomentum = _a.dragMomentum, dragElastic = _a.dragElastic, dragTransition = _a.dragTransition, dragSnapToOrigin = _a.dragSnapToOrigin, onDragTransitionEnd = _a.onDragTransitionEnd;
  28120. var constraints = this.constraints || {};
  28121. var momentumAnimations = eachAxis(function (axis) {
  28122. var _a;
  28123. if (!shouldDrag(axis, drag, _this.currentDirection)) {
  28124. return;
  28125. }
  28126. var transition = (_a = constraints === null || constraints === void 0 ? void 0 : constraints[axis]) !== null && _a !== void 0 ? _a : {};
  28127. if (dragSnapToOrigin)
  28128. transition = { min: 0, max: 0 };
  28129. /**
  28130. * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame
  28131. * of spring animations so we should look into adding a disable spring option to `inertia`.
  28132. * We could do something here where we affect the `bounceStiffness` and `bounceDamping`
  28133. * using the value of `dragElastic`.
  28134. */
  28135. var bounceStiffness = dragElastic ? 200 : 1000000;
  28136. var bounceDamping = dragElastic ? 40 : 10000000;
  28137. var inertia = __assign(__assign({ type: "inertia", velocity: dragMomentum ? velocity[axis] : 0, bounceStiffness: bounceStiffness, bounceDamping: bounceDamping, timeConstant: 750, restDelta: 1, restSpeed: 10 }, dragTransition), transition);
  28138. // If we're not animating on an externally-provided `MotionValue` we can use the
  28139. // component's animation controls which will handle interactions with whileHover (etc),
  28140. // otherwise we just have to animate the `MotionValue` itself.
  28141. return _this.startAxisValueAnimation(axis, inertia);
  28142. });
  28143. // Run all animations and then resolve the new drag constraints.
  28144. return Promise.all(momentumAnimations).then(onDragTransitionEnd);
  28145. };
  28146. VisualElementDragControls.prototype.startAxisValueAnimation = function (axis, transition) {
  28147. var axisValue = this.getAxisMotionValue(axis);
  28148. return startAnimation(axis, axisValue, 0, transition);
  28149. };
  28150. VisualElementDragControls.prototype.stopAnimation = function () {
  28151. var _this = this;
  28152. eachAxis(function (axis) { return _this.getAxisMotionValue(axis).stop(); });
  28153. };
  28154. /**
  28155. * Drag works differently depending on which props are provided.
  28156. *
  28157. * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
  28158. * - Otherwise, we apply the delta to the x/y motion values.
  28159. */
  28160. VisualElementDragControls.prototype.getAxisMotionValue = function (axis) {
  28161. var _a, _b;
  28162. var dragKey = "_drag" + axis.toUpperCase();
  28163. var externalMotionValue = this.visualElement.getProps()[dragKey];
  28164. return externalMotionValue
  28165. ? externalMotionValue
  28166. : this.visualElement.getValue(axis, (_b = (_a = this.visualElement.getProps().initial) === null || _a === void 0 ? void 0 : _a[axis]) !== null && _b !== void 0 ? _b : 0);
  28167. };
  28168. VisualElementDragControls.prototype.snapToCursor = function (point) {
  28169. var _this = this;
  28170. eachAxis(function (axis) {
  28171. var drag = _this.getProps().drag;
  28172. // If we're not dragging this axis, do an early return.
  28173. if (!shouldDrag(axis, drag, _this.currentDirection))
  28174. return;
  28175. var projection = _this.visualElement.projection;
  28176. var axisValue = _this.getAxisMotionValue(axis);
  28177. if (projection && projection.layout) {
  28178. var _a = projection.layout.actual[axis], min = _a.min, max = _a.max;
  28179. axisValue.set(point[axis] - mix(min, max, 0.5));
  28180. }
  28181. });
  28182. };
  28183. /**
  28184. * When the viewport resizes we want to check if the measured constraints
  28185. * have changed and, if so, reposition the element within those new constraints
  28186. * relative to where it was before the resize.
  28187. */
  28188. VisualElementDragControls.prototype.scalePositionWithinConstraints = function () {
  28189. var _this = this;
  28190. var _a;
  28191. var _b = this.getProps(), drag = _b.drag, dragConstraints = _b.dragConstraints;
  28192. var projection = this.visualElement.projection;
  28193. if (!is_ref_object_isRefObject(dragConstraints) || !projection || !this.constraints)
  28194. return;
  28195. /**
  28196. * Stop current animations as there can be visual glitching if we try to do
  28197. * this mid-animation
  28198. */
  28199. this.stopAnimation();
  28200. /**
  28201. * Record the relative position of the dragged element relative to the
  28202. * constraints box and save as a progress value.
  28203. */
  28204. var boxProgress = { x: 0, y: 0 };
  28205. eachAxis(function (axis) {
  28206. var axisValue = _this.getAxisMotionValue(axis);
  28207. if (axisValue) {
  28208. var latest = axisValue.get();
  28209. boxProgress[axis] = constraints_calcOrigin({ min: latest, max: latest }, _this.constraints[axis]);
  28210. }
  28211. });
  28212. /**
  28213. * Update the layout of this element and resolve the latest drag constraints
  28214. */
  28215. var transformTemplate = this.visualElement.getProps().transformTemplate;
  28216. this.visualElement.getInstance().style.transform = transformTemplate
  28217. ? transformTemplate({}, "")
  28218. : "none";
  28219. (_a = projection.root) === null || _a === void 0 ? void 0 : _a.updateScroll();
  28220. projection.updateLayout();
  28221. this.resolveConstraints();
  28222. /**
  28223. * For each axis, calculate the current progress of the layout axis
  28224. * within the new constraints.
  28225. */
  28226. eachAxis(function (axis) {
  28227. if (!shouldDrag(axis, drag, null))
  28228. return;
  28229. /**
  28230. * Calculate a new transform based on the previous box progress
  28231. */
  28232. var axisValue = _this.getAxisMotionValue(axis);
  28233. var _a = _this.constraints[axis], min = _a.min, max = _a.max;
  28234. axisValue.set(mix(min, max, boxProgress[axis]));
  28235. });
  28236. };
  28237. VisualElementDragControls.prototype.addListeners = function () {
  28238. var _this = this;
  28239. var _a;
  28240. elementDragControls.set(this.visualElement, this);
  28241. var element = this.visualElement.getInstance();
  28242. /**
  28243. * Attach a pointerdown event listener on this DOM element to initiate drag tracking.
  28244. */
  28245. var stopPointerListener = addPointerEvent(element, "pointerdown", function (event) {
  28246. var _a = _this.getProps(), drag = _a.drag, _b = _a.dragListener, dragListener = _b === void 0 ? true : _b;
  28247. drag && dragListener && _this.start(event);
  28248. });
  28249. var measureDragConstraints = function () {
  28250. var dragConstraints = _this.getProps().dragConstraints;
  28251. if (is_ref_object_isRefObject(dragConstraints)) {
  28252. _this.constraints = _this.resolveRefConstraints();
  28253. }
  28254. };
  28255. var projection = this.visualElement.projection;
  28256. var stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints);
  28257. if (projection && !projection.layout) {
  28258. (_a = projection.root) === null || _a === void 0 ? void 0 : _a.updateScroll();
  28259. projection.updateLayout();
  28260. }
  28261. measureDragConstraints();
  28262. /**
  28263. * Attach a window resize listener to scale the draggable target within its defined
  28264. * constraints as the window resizes.
  28265. */
  28266. var stopResizeListener = addDomEvent(window, "resize", function () {
  28267. _this.scalePositionWithinConstraints();
  28268. });
  28269. /**
  28270. * If the element's layout changes, calculate the delta and apply that to
  28271. * the drag gesture's origin point.
  28272. */
  28273. projection.addEventListener("didUpdate", (function (_a) {
  28274. var delta = _a.delta, hasLayoutChanged = _a.hasLayoutChanged;
  28275. if (_this.isDragging && hasLayoutChanged) {
  28276. eachAxis(function (axis) {
  28277. var motionValue = _this.getAxisMotionValue(axis);
  28278. if (!motionValue)
  28279. return;
  28280. _this.originPoint[axis] += delta[axis].translate;
  28281. motionValue.set(motionValue.get() + delta[axis].translate);
  28282. });
  28283. _this.visualElement.syncRender();
  28284. }
  28285. }));
  28286. return function () {
  28287. stopResizeListener();
  28288. stopPointerListener();
  28289. stopMeasureLayoutListener();
  28290. };
  28291. };
  28292. VisualElementDragControls.prototype.getProps = function () {
  28293. var props = this.visualElement.getProps();
  28294. var _a = props.drag, drag = _a === void 0 ? false : _a, _b = props.dragDirectionLock, dragDirectionLock = _b === void 0 ? false : _b, _c = props.dragPropagation, dragPropagation = _c === void 0 ? false : _c, _d = props.dragConstraints, dragConstraints = _d === void 0 ? false : _d, _e = props.dragElastic, dragElastic = _e === void 0 ? defaultElastic : _e, _f = props.dragMomentum, dragMomentum = _f === void 0 ? true : _f;
  28295. return __assign(__assign({}, props), { drag: drag, dragDirectionLock: dragDirectionLock, dragPropagation: dragPropagation, dragConstraints: dragConstraints, dragElastic: dragElastic, dragMomentum: dragMomentum });
  28296. };
  28297. return VisualElementDragControls;
  28298. }());
  28299. function shouldDrag(direction, drag, currentDirection) {
  28300. return ((drag === true || drag === direction) &&
  28301. (currentDirection === null || currentDirection === direction));
  28302. }
  28303. /**
  28304. * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower
  28305. * than the provided threshold, return `null`.
  28306. *
  28307. * @param offset - The x/y offset from origin.
  28308. * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.
  28309. */
  28310. function getCurrentDirection(offset, lockThreshold) {
  28311. if (lockThreshold === void 0) { lockThreshold = 10; }
  28312. var direction = null;
  28313. if (Math.abs(offset.y) > lockThreshold) {
  28314. direction = "y";
  28315. }
  28316. else if (Math.abs(offset.x) > lockThreshold) {
  28317. direction = "x";
  28318. }
  28319. return direction;
  28320. }
  28321. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/use-drag.mjs
  28322. /**
  28323. * A hook that allows an element to be dragged.
  28324. *
  28325. * @internal
  28326. */
  28327. function useDrag(props) {
  28328. var groupDragControls = props.dragControls, visualElement = props.visualElement;
  28329. var dragControls = useConstant(function () { return new VisualElementDragControls(visualElement); });
  28330. // If we've been provided a DragControls for manual control over the drag gesture,
  28331. // subscribe this component to it on mount.
  28332. (0,external_React_.useEffect)(function () { return groupDragControls && groupDragControls.subscribe(dragControls); }, [dragControls, groupDragControls]);
  28333. // Apply the event listeners to the element
  28334. (0,external_React_.useEffect)(function () { return dragControls.addListeners(); }, [dragControls]);
  28335. }
  28336. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/use-pan-gesture.mjs
  28337. /**
  28338. *
  28339. * @param handlers -
  28340. * @param ref -
  28341. *
  28342. * @internalremarks
  28343. * Currently this sets new pan gesture functions every render. The memo route has been explored
  28344. * in the past but ultimately we're still creating new functions every render. An optimisation
  28345. * to explore is creating the pan gestures and loading them into a `ref`.
  28346. *
  28347. * @internal
  28348. */
  28349. function usePanGesture(_a) {
  28350. var onPan = _a.onPan, onPanStart = _a.onPanStart, onPanEnd = _a.onPanEnd, onPanSessionStart = _a.onPanSessionStart, visualElement = _a.visualElement;
  28351. var hasPanEvents = onPan || onPanStart || onPanEnd || onPanSessionStart;
  28352. var panSession = (0,external_React_.useRef)(null);
  28353. var transformPagePoint = (0,external_React_.useContext)(MotionConfigContext).transformPagePoint;
  28354. var handlers = {
  28355. onSessionStart: onPanSessionStart,
  28356. onStart: onPanStart,
  28357. onMove: onPan,
  28358. onEnd: function (event, info) {
  28359. panSession.current = null;
  28360. onPanEnd && onPanEnd(event, info);
  28361. },
  28362. };
  28363. (0,external_React_.useEffect)(function () {
  28364. if (panSession.current !== null) {
  28365. panSession.current.updateHandlers(handlers);
  28366. }
  28367. });
  28368. function onPointerDown(event) {
  28369. panSession.current = new PanSession(event, handlers, {
  28370. transformPagePoint: transformPagePoint,
  28371. });
  28372. }
  28373. usePointerEvent(visualElement, "pointerdown", hasPanEvents && onPointerDown);
  28374. useUnmountEffect(function () { return panSession.current && panSession.current.end(); });
  28375. }
  28376. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/drag.mjs
  28377. var drag = {
  28378. pan: makeRenderlessComponent(usePanGesture),
  28379. drag: makeRenderlessComponent(useDrag),
  28380. };
  28381. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/lifecycles.mjs
  28382. var lifecycles_names = [
  28383. "LayoutMeasure",
  28384. "BeforeLayoutMeasure",
  28385. "LayoutUpdate",
  28386. "ViewportBoxUpdate",
  28387. "Update",
  28388. "Render",
  28389. "AnimationComplete",
  28390. "LayoutAnimationComplete",
  28391. "AnimationStart",
  28392. "LayoutAnimationStart",
  28393. "SetAxisTarget",
  28394. "Unmount",
  28395. ];
  28396. function createLifecycles() {
  28397. var managers = lifecycles_names.map(function () { return new SubscriptionManager(); });
  28398. var propSubscriptions = {};
  28399. var lifecycles = {
  28400. clearAllListeners: function () { return managers.forEach(function (manager) { return manager.clear(); }); },
  28401. updatePropListeners: function (props) {
  28402. lifecycles_names.forEach(function (name) {
  28403. var _a;
  28404. var on = "on" + name;
  28405. var propListener = props[on];
  28406. // Unsubscribe existing subscription
  28407. (_a = propSubscriptions[name]) === null || _a === void 0 ? void 0 : _a.call(propSubscriptions);
  28408. // Add new subscription
  28409. if (propListener) {
  28410. propSubscriptions[name] = lifecycles[on](propListener);
  28411. }
  28412. });
  28413. },
  28414. };
  28415. managers.forEach(function (manager, i) {
  28416. lifecycles["on" + lifecycles_names[i]] = function (handler) { return manager.add(handler); };
  28417. lifecycles["notify" + lifecycles_names[i]] = function () {
  28418. var args = [];
  28419. for (var _i = 0; _i < arguments.length; _i++) {
  28420. args[_i] = arguments[_i];
  28421. }
  28422. return manager.notify.apply(manager, tslib_es6_spreadArray([], tslib_es6_read(args), false));
  28423. };
  28424. });
  28425. return lifecycles;
  28426. }
  28427. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/motion-values.mjs
  28428. function updateMotionValuesFromProps(element, next, prev) {
  28429. var _a;
  28430. for (var key in next) {
  28431. var nextValue = next[key];
  28432. var prevValue = prev[key];
  28433. if (isMotionValue(nextValue)) {
  28434. /**
  28435. * If this is a motion value found in props or style, we want to add it
  28436. * to our visual element's motion value map.
  28437. */
  28438. element.addValue(key, nextValue);
  28439. }
  28440. else if (isMotionValue(prevValue)) {
  28441. /**
  28442. * If we're swapping to a new motion value, create a new motion value
  28443. * from that
  28444. */
  28445. element.addValue(key, motionValue(nextValue));
  28446. }
  28447. else if (prevValue !== nextValue) {
  28448. /**
  28449. * If this is a flat value that has changed, update the motion value
  28450. * or create one if it doesn't exist. We only want to do this if we're
  28451. * not handling the value with our animation state.
  28452. */
  28453. if (element.hasValue(key)) {
  28454. var existingValue = element.getValue(key);
  28455. // TODO: Only update values that aren't being animated or even looked at
  28456. !existingValue.hasAnimated && existingValue.set(nextValue);
  28457. }
  28458. else {
  28459. element.addValue(key, motionValue((_a = element.getStaticValue(key)) !== null && _a !== void 0 ? _a : nextValue));
  28460. }
  28461. }
  28462. }
  28463. // Handle removed values
  28464. for (var key in prev) {
  28465. if (next[key] === undefined)
  28466. element.removeValue(key);
  28467. }
  28468. return next;
  28469. }
  28470. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/index.mjs
  28471. var visualElement = function (_a) {
  28472. var _b = _a.treeType, treeType = _b === void 0 ? "" : _b, build = _a.build, getBaseTarget = _a.getBaseTarget, makeTargetAnimatable = _a.makeTargetAnimatable, measureViewportBox = _a.measureViewportBox, renderInstance = _a.render, readValueFromInstance = _a.readValueFromInstance, removeValueFromRenderState = _a.removeValueFromRenderState, sortNodePosition = _a.sortNodePosition, scrapeMotionValuesFromProps = _a.scrapeMotionValuesFromProps;
  28473. return function (_a, options) {
  28474. var parent = _a.parent, props = _a.props, presenceId = _a.presenceId, blockInitialAnimation = _a.blockInitialAnimation, visualState = _a.visualState, shouldReduceMotion = _a.shouldReduceMotion;
  28475. if (options === void 0) { options = {}; }
  28476. var isMounted = false;
  28477. var latestValues = visualState.latestValues, renderState = visualState.renderState;
  28478. /**
  28479. * The instance of the render-specific node that will be hydrated by the
  28480. * exposed React ref. So for example, this visual element can host a
  28481. * HTMLElement, plain object, or Three.js object. The functions provided
  28482. * in VisualElementConfig allow us to interface with this instance.
  28483. */
  28484. var instance;
  28485. /**
  28486. * Manages the subscriptions for a visual element's lifecycle, for instance
  28487. * onRender
  28488. */
  28489. var lifecycles = createLifecycles();
  28490. /**
  28491. * A map of all motion values attached to this visual element. Motion
  28492. * values are source of truth for any given animated value. A motion
  28493. * value might be provided externally by the component via props.
  28494. */
  28495. var values = new Map();
  28496. /**
  28497. * A map of every subscription that binds the provided or generated
  28498. * motion values onChange listeners to this visual element.
  28499. */
  28500. var valueSubscriptions = new Map();
  28501. /**
  28502. * A reference to the previously-provided motion values as returned
  28503. * from scrapeMotionValuesFromProps. We use the keys in here to determine
  28504. * if any motion values need to be removed after props are updated.
  28505. */
  28506. var prevMotionValues = {};
  28507. /**
  28508. * When values are removed from all animation props we need to search
  28509. * for a fallback value to animate to. These values are tracked in baseTarget.
  28510. */
  28511. var baseTarget = __assign({}, latestValues);
  28512. // Internal methods ========================
  28513. /**
  28514. * On mount, this will be hydrated with a callback to disconnect
  28515. * this visual element from its parent on unmount.
  28516. */
  28517. var removeFromVariantTree;
  28518. /**
  28519. * Render the element with the latest styles outside of the React
  28520. * render lifecycle
  28521. */
  28522. function render() {
  28523. if (!instance || !isMounted)
  28524. return;
  28525. triggerBuild();
  28526. renderInstance(instance, renderState, props.style, element.projection);
  28527. }
  28528. function triggerBuild() {
  28529. build(element, renderState, latestValues, options, props);
  28530. }
  28531. function update() {
  28532. lifecycles.notifyUpdate(latestValues);
  28533. }
  28534. /**
  28535. *
  28536. */
  28537. function bindToMotionValue(key, value) {
  28538. var removeOnChange = value.onChange(function (latestValue) {
  28539. latestValues[key] = latestValue;
  28540. props.onUpdate && es.update(update, false, true);
  28541. });
  28542. var removeOnRenderRequest = value.onRenderRequest(element.scheduleRender);
  28543. valueSubscriptions.set(key, function () {
  28544. removeOnChange();
  28545. removeOnRenderRequest();
  28546. });
  28547. }
  28548. /**
  28549. * Any motion values that are provided to the element when created
  28550. * aren't yet bound to the element, as this would technically be impure.
  28551. * However, we iterate through the motion values and set them to the
  28552. * initial values for this component.
  28553. *
  28554. * TODO: This is impure and we should look at changing this to run on mount.
  28555. * Doing so will break some tests but this isn't neccessarily a breaking change,
  28556. * more a reflection of the test.
  28557. */
  28558. var initialMotionValues = scrapeMotionValuesFromProps(props);
  28559. for (var key in initialMotionValues) {
  28560. var value = initialMotionValues[key];
  28561. if (latestValues[key] !== undefined && isMotionValue(value)) {
  28562. value.set(latestValues[key], false);
  28563. }
  28564. }
  28565. /**
  28566. * Determine what role this visual element should take in the variant tree.
  28567. */
  28568. var isControllingVariants = checkIfControllingVariants(props);
  28569. var isVariantNode = checkIfVariantNode(props);
  28570. var element = __assign(__assign({ treeType: treeType,
  28571. /**
  28572. * This is a mirror of the internal instance prop, which keeps
  28573. * VisualElement type-compatible with React's RefObject.
  28574. */
  28575. current: null,
  28576. /**
  28577. * The depth of this visual element within the visual element tree.
  28578. */
  28579. depth: parent ? parent.depth + 1 : 0, parent: parent, children: new Set(),
  28580. /**
  28581. *
  28582. */
  28583. presenceId: presenceId, shouldReduceMotion: shouldReduceMotion,
  28584. /**
  28585. * If this component is part of the variant tree, it should track
  28586. * any children that are also part of the tree. This is essentially
  28587. * a shadow tree to simplify logic around how to stagger over children.
  28588. */
  28589. variantChildren: isVariantNode ? new Set() : undefined,
  28590. /**
  28591. * Whether this instance is visible. This can be changed imperatively
  28592. * by the projection tree, is analogous to CSS's visibility in that
  28593. * hidden elements should take up layout, and needs enacting by the configured
  28594. * render function.
  28595. */
  28596. isVisible: undefined,
  28597. /**
  28598. * Normally, if a component is controlled by a parent's variants, it can
  28599. * rely on that ancestor to trigger animations further down the tree.
  28600. * However, if a component is created after its parent is mounted, the parent
  28601. * won't trigger that mount animation so the child needs to.
  28602. *
  28603. * TODO: This might be better replaced with a method isParentMounted
  28604. */
  28605. manuallyAnimateOnMount: Boolean(parent === null || parent === void 0 ? void 0 : parent.isMounted()),
  28606. /**
  28607. * This can be set by AnimatePresence to force components that mount
  28608. * at the same time as it to mount as if they have initial={false} set.
  28609. */
  28610. blockInitialAnimation: blockInitialAnimation,
  28611. /**
  28612. * Determine whether this component has mounted yet. This is mostly used
  28613. * by variant children to determine whether they need to trigger their
  28614. * own animations on mount.
  28615. */
  28616. isMounted: function () { return Boolean(instance); }, mount: function (newInstance) {
  28617. isMounted = true;
  28618. instance = element.current = newInstance;
  28619. if (element.projection) {
  28620. element.projection.mount(newInstance);
  28621. }
  28622. if (isVariantNode && parent && !isControllingVariants) {
  28623. removeFromVariantTree = parent === null || parent === void 0 ? void 0 : parent.addVariantChild(element);
  28624. }
  28625. values.forEach(function (value, key) { return bindToMotionValue(key, value); });
  28626. parent === null || parent === void 0 ? void 0 : parent.children.add(element);
  28627. element.setProps(props);
  28628. },
  28629. /**
  28630. *
  28631. */
  28632. unmount: function () {
  28633. var _a;
  28634. (_a = element.projection) === null || _a === void 0 ? void 0 : _a.unmount();
  28635. cancelSync.update(update);
  28636. cancelSync.render(render);
  28637. valueSubscriptions.forEach(function (remove) { return remove(); });
  28638. removeFromVariantTree === null || removeFromVariantTree === void 0 ? void 0 : removeFromVariantTree();
  28639. parent === null || parent === void 0 ? void 0 : parent.children.delete(element);
  28640. lifecycles.clearAllListeners();
  28641. instance = undefined;
  28642. isMounted = false;
  28643. },
  28644. /**
  28645. * Add a child visual element to our set of children.
  28646. */
  28647. addVariantChild: function (child) {
  28648. var _a;
  28649. var closestVariantNode = element.getClosestVariantNode();
  28650. if (closestVariantNode) {
  28651. (_a = closestVariantNode.variantChildren) === null || _a === void 0 ? void 0 : _a.add(child);
  28652. return function () {
  28653. return closestVariantNode.variantChildren.delete(child);
  28654. };
  28655. }
  28656. }, sortNodePosition: function (other) {
  28657. /**
  28658. * If these nodes aren't even of the same type we can't compare their depth.
  28659. */
  28660. if (!sortNodePosition || treeType !== other.treeType)
  28661. return 0;
  28662. return sortNodePosition(element.getInstance(), other.getInstance());
  28663. },
  28664. /**
  28665. * Returns the closest variant node in the tree starting from
  28666. * this visual element.
  28667. */
  28668. getClosestVariantNode: function () {
  28669. return isVariantNode ? element : parent === null || parent === void 0 ? void 0 : parent.getClosestVariantNode();
  28670. },
  28671. /**
  28672. * Expose the latest layoutId prop.
  28673. */
  28674. getLayoutId: function () { return props.layoutId; },
  28675. /**
  28676. * Returns the current instance.
  28677. */
  28678. getInstance: function () { return instance; },
  28679. /**
  28680. * Get/set the latest static values.
  28681. */
  28682. getStaticValue: function (key) { return latestValues[key]; }, setStaticValue: function (key, value) { return (latestValues[key] = value); },
  28683. /**
  28684. * Returns the latest motion value state. Currently only used to take
  28685. * a snapshot of the visual element - perhaps this can return the whole
  28686. * visual state
  28687. */
  28688. getLatestValues: function () { return latestValues; },
  28689. /**
  28690. * Set the visiblity of the visual element. If it's changed, schedule
  28691. * a render to reflect these changes.
  28692. */
  28693. setVisibility: function (visibility) {
  28694. if (element.isVisible === visibility)
  28695. return;
  28696. element.isVisible = visibility;
  28697. element.scheduleRender();
  28698. },
  28699. /**
  28700. * Make a target animatable by Popmotion. For instance, if we're
  28701. * trying to animate width from 100px to 100vw we need to measure 100vw
  28702. * in pixels to determine what we really need to animate to. This is also
  28703. * pluggable to support Framer's custom value types like Color,
  28704. * and CSS variables.
  28705. */
  28706. makeTargetAnimatable: function (target, canMutate) {
  28707. if (canMutate === void 0) { canMutate = true; }
  28708. return makeTargetAnimatable(element, target, props, canMutate);
  28709. },
  28710. /**
  28711. * Measure the current viewport box with or without transforms.
  28712. * Only measures axis-aligned boxes, rotate and skew must be manually
  28713. * removed with a re-render to work.
  28714. */
  28715. measureViewportBox: function () {
  28716. return measureViewportBox(instance, props);
  28717. },
  28718. // Motion values ========================
  28719. /**
  28720. * Add a motion value and bind it to this visual element.
  28721. */
  28722. addValue: function (key, value) {
  28723. // Remove existing value if it exists
  28724. if (element.hasValue(key))
  28725. element.removeValue(key);
  28726. values.set(key, value);
  28727. latestValues[key] = value.get();
  28728. bindToMotionValue(key, value);
  28729. },
  28730. /**
  28731. * Remove a motion value and unbind any active subscriptions.
  28732. */
  28733. removeValue: function (key) {
  28734. var _a;
  28735. values.delete(key);
  28736. (_a = valueSubscriptions.get(key)) === null || _a === void 0 ? void 0 : _a();
  28737. valueSubscriptions.delete(key);
  28738. delete latestValues[key];
  28739. removeValueFromRenderState(key, renderState);
  28740. },
  28741. /**
  28742. * Check whether we have a motion value for this key
  28743. */
  28744. hasValue: function (key) { return values.has(key); },
  28745. /**
  28746. * Get a motion value for this key. If called with a default
  28747. * value, we'll create one if none exists.
  28748. */
  28749. getValue: function (key, defaultValue) {
  28750. var value = values.get(key);
  28751. if (value === undefined && defaultValue !== undefined) {
  28752. value = motionValue(defaultValue);
  28753. element.addValue(key, value);
  28754. }
  28755. return value;
  28756. },
  28757. /**
  28758. * Iterate over our motion values.
  28759. */
  28760. forEachValue: function (callback) { return values.forEach(callback); },
  28761. /**
  28762. * If we're trying to animate to a previously unencountered value,
  28763. * we need to check for it in our state and as a last resort read it
  28764. * directly from the instance (which might have performance implications).
  28765. */
  28766. readValue: function (key) {
  28767. var _a;
  28768. return (_a = latestValues[key]) !== null && _a !== void 0 ? _a : readValueFromInstance(instance, key, options);
  28769. },
  28770. /**
  28771. * Set the base target to later animate back to. This is currently
  28772. * only hydrated on creation and when we first read a value.
  28773. */
  28774. setBaseTarget: function (key, value) {
  28775. baseTarget[key] = value;
  28776. },
  28777. /**
  28778. * Find the base target for a value thats been removed from all animation
  28779. * props.
  28780. */
  28781. getBaseTarget: function (key) {
  28782. if (getBaseTarget) {
  28783. var target = getBaseTarget(props, key);
  28784. if (target !== undefined && !isMotionValue(target))
  28785. return target;
  28786. }
  28787. return baseTarget[key];
  28788. } }, lifecycles), {
  28789. /**
  28790. * Build the renderer state based on the latest visual state.
  28791. */
  28792. build: function () {
  28793. triggerBuild();
  28794. return renderState;
  28795. },
  28796. /**
  28797. * Schedule a render on the next animation frame.
  28798. */
  28799. scheduleRender: function () {
  28800. es.render(render, false, true);
  28801. },
  28802. /**
  28803. * Synchronously fire render. It's prefered that we batch renders but
  28804. * in many circumstances, like layout measurement, we need to run this
  28805. * synchronously. However in those instances other measures should be taken
  28806. * to batch reads/writes.
  28807. */
  28808. syncRender: render,
  28809. /**
  28810. * Update the provided props. Ensure any newly-added motion values are
  28811. * added to our map, old ones removed, and listeners updated.
  28812. */
  28813. setProps: function (newProps) {
  28814. if (newProps.transformTemplate || props.transformTemplate) {
  28815. element.scheduleRender();
  28816. }
  28817. props = newProps;
  28818. lifecycles.updatePropListeners(newProps);
  28819. prevMotionValues = updateMotionValuesFromProps(element, scrapeMotionValuesFromProps(props), prevMotionValues);
  28820. }, getProps: function () { return props; },
  28821. // Variants ==============================
  28822. /**
  28823. * Returns the variant definition with a given name.
  28824. */
  28825. getVariant: function (name) { var _a; return (_a = props.variants) === null || _a === void 0 ? void 0 : _a[name]; },
  28826. /**
  28827. * Returns the defined default transition on this component.
  28828. */
  28829. getDefaultTransition: function () { return props.transition; }, getTransformPagePoint: function () {
  28830. return props.transformPagePoint;
  28831. },
  28832. /**
  28833. * Used by child variant nodes to get the closest ancestor variant props.
  28834. */
  28835. getVariantContext: function (startAtParent) {
  28836. if (startAtParent === void 0) { startAtParent = false; }
  28837. if (startAtParent)
  28838. return parent === null || parent === void 0 ? void 0 : parent.getVariantContext();
  28839. if (!isControllingVariants) {
  28840. var context_1 = (parent === null || parent === void 0 ? void 0 : parent.getVariantContext()) || {};
  28841. if (props.initial !== undefined) {
  28842. context_1.initial = props.initial;
  28843. }
  28844. return context_1;
  28845. }
  28846. var context = {};
  28847. for (var i = 0; i < numVariantProps; i++) {
  28848. var name_1 = variantProps[i];
  28849. var prop = props[name_1];
  28850. if (isVariantLabel(prop) || prop === false) {
  28851. context[name_1] = prop;
  28852. }
  28853. }
  28854. return context;
  28855. } });
  28856. return element;
  28857. };
  28858. };
  28859. var variantProps = tslib_es6_spreadArray(["initial"], tslib_es6_read(variantPriorityOrder), false);
  28860. var numVariantProps = variantProps.length;
  28861. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs
  28862. function css_variables_conversion_isCSSVariable(value) {
  28863. return typeof value === "string" && value.startsWith("var(--");
  28864. }
  28865. /**
  28866. * Parse Framer's special CSS variable format into a CSS token and a fallback.
  28867. *
  28868. * ```
  28869. * `var(--foo, #fff)` => [`--foo`, '#fff']
  28870. * ```
  28871. *
  28872. * @param current
  28873. */
  28874. var cssVariableRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;
  28875. function parseCSSVariable(current) {
  28876. var match = cssVariableRegex.exec(current);
  28877. if (!match)
  28878. return [,];
  28879. var _a = tslib_es6_read(match, 3), token = _a[1], fallback = _a[2];
  28880. return [token, fallback];
  28881. }
  28882. var maxDepth = 4;
  28883. function getVariableValue(current, element, depth) {
  28884. if (depth === void 0) { depth = 1; }
  28885. invariant(depth <= maxDepth, "Max CSS variable fallback depth detected in property \"".concat(current, "\". This may indicate a circular fallback dependency."));
  28886. var _a = tslib_es6_read(parseCSSVariable(current), 2), token = _a[0], fallback = _a[1];
  28887. // No CSS variable detected
  28888. if (!token)
  28889. return;
  28890. // Attempt to read this CSS variable off the element
  28891. var resolved = window.getComputedStyle(element).getPropertyValue(token);
  28892. if (resolved) {
  28893. return resolved.trim();
  28894. }
  28895. else if (css_variables_conversion_isCSSVariable(fallback)) {
  28896. // The fallback might itself be a CSS variable, in which case we attempt to resolve it too.
  28897. return getVariableValue(fallback, element, depth + 1);
  28898. }
  28899. else {
  28900. return fallback;
  28901. }
  28902. }
  28903. /**
  28904. * Resolve CSS variables from
  28905. *
  28906. * @internal
  28907. */
  28908. function resolveCSSVariables(visualElement, _a, transitionEnd) {
  28909. var _b;
  28910. var target = __rest(_a, []);
  28911. var element = visualElement.getInstance();
  28912. if (!(element instanceof Element))
  28913. return { target: target, transitionEnd: transitionEnd };
  28914. // If `transitionEnd` isn't `undefined`, clone it. We could clone `target` and `transitionEnd`
  28915. // only if they change but I think this reads clearer and this isn't a performance-critical path.
  28916. if (transitionEnd) {
  28917. transitionEnd = __assign({}, transitionEnd);
  28918. }
  28919. // Go through existing `MotionValue`s and ensure any existing CSS variables are resolved
  28920. visualElement.forEachValue(function (value) {
  28921. var current = value.get();
  28922. if (!css_variables_conversion_isCSSVariable(current))
  28923. return;
  28924. var resolved = getVariableValue(current, element);
  28925. if (resolved)
  28926. value.set(resolved);
  28927. });
  28928. // Cycle through every target property and resolve CSS variables. Currently
  28929. // we only read single-var properties like `var(--foo)`, not `calc(var(--foo) + 20px)`
  28930. for (var key in target) {
  28931. var current = target[key];
  28932. if (!css_variables_conversion_isCSSVariable(current))
  28933. continue;
  28934. var resolved = getVariableValue(current, element);
  28935. if (!resolved)
  28936. continue;
  28937. // Clone target if it hasn't already been
  28938. target[key] = resolved;
  28939. // If the user hasn't already set this key on `transitionEnd`, set it to the unresolved
  28940. // CSS variable. This will ensure that after the animation the component will reflect
  28941. // changes in the value of the CSS variable.
  28942. if (transitionEnd)
  28943. (_b = transitionEnd[key]) !== null && _b !== void 0 ? _b : (transitionEnd[key] = current);
  28944. }
  28945. return { target: target, transitionEnd: transitionEnd };
  28946. }
  28947. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs
  28948. var positionalKeys = new Set([
  28949. "width",
  28950. "height",
  28951. "top",
  28952. "left",
  28953. "right",
  28954. "bottom",
  28955. "x",
  28956. "y",
  28957. ]);
  28958. var isPositionalKey = function (key) { return positionalKeys.has(key); };
  28959. var hasPositionalKey = function (target) {
  28960. return Object.keys(target).some(isPositionalKey);
  28961. };
  28962. var setAndResetVelocity = function (value, to) {
  28963. // Looks odd but setting it twice doesn't render, it'll just
  28964. // set both prev and current to the latest value
  28965. value.set(to, false);
  28966. value.set(to);
  28967. };
  28968. var isNumOrPxType = function (v) {
  28969. return v === number || v === px;
  28970. };
  28971. var BoundingBoxDimension;
  28972. (function (BoundingBoxDimension) {
  28973. BoundingBoxDimension["width"] = "width";
  28974. BoundingBoxDimension["height"] = "height";
  28975. BoundingBoxDimension["left"] = "left";
  28976. BoundingBoxDimension["right"] = "right";
  28977. BoundingBoxDimension["top"] = "top";
  28978. BoundingBoxDimension["bottom"] = "bottom";
  28979. })(BoundingBoxDimension || (BoundingBoxDimension = {}));
  28980. var getPosFromMatrix = function (matrix, pos) {
  28981. return parseFloat(matrix.split(", ")[pos]);
  28982. };
  28983. var getTranslateFromMatrix = function (pos2, pos3) {
  28984. return function (_bbox, _a) {
  28985. var transform = _a.transform;
  28986. if (transform === "none" || !transform)
  28987. return 0;
  28988. var matrix3d = transform.match(/^matrix3d\((.+)\)$/);
  28989. if (matrix3d) {
  28990. return getPosFromMatrix(matrix3d[1], pos3);
  28991. }
  28992. else {
  28993. var matrix = transform.match(/^matrix\((.+)\)$/);
  28994. if (matrix) {
  28995. return getPosFromMatrix(matrix[1], pos2);
  28996. }
  28997. else {
  28998. return 0;
  28999. }
  29000. }
  29001. };
  29002. };
  29003. var transformKeys = new Set(["x", "y", "z"]);
  29004. var nonTranslationalTransformKeys = transformProps.filter(function (key) { return !transformKeys.has(key); });
  29005. function removeNonTranslationalTransform(visualElement) {
  29006. var removedTransforms = [];
  29007. nonTranslationalTransformKeys.forEach(function (key) {
  29008. var value = visualElement.getValue(key);
  29009. if (value !== undefined) {
  29010. removedTransforms.push([key, value.get()]);
  29011. value.set(key.startsWith("scale") ? 1 : 0);
  29012. }
  29013. });
  29014. // Apply changes to element before measurement
  29015. if (removedTransforms.length)
  29016. visualElement.syncRender();
  29017. return removedTransforms;
  29018. }
  29019. var positionalValues = {
  29020. // Dimensions
  29021. width: function (_a, _b) {
  29022. var x = _a.x;
  29023. var _c = _b.paddingLeft, paddingLeft = _c === void 0 ? "0" : _c, _d = _b.paddingRight, paddingRight = _d === void 0 ? "0" : _d;
  29024. return x.max - x.min - parseFloat(paddingLeft) - parseFloat(paddingRight);
  29025. },
  29026. height: function (_a, _b) {
  29027. var y = _a.y;
  29028. var _c = _b.paddingTop, paddingTop = _c === void 0 ? "0" : _c, _d = _b.paddingBottom, paddingBottom = _d === void 0 ? "0" : _d;
  29029. return y.max - y.min - parseFloat(paddingTop) - parseFloat(paddingBottom);
  29030. },
  29031. top: function (_bbox, _a) {
  29032. var top = _a.top;
  29033. return parseFloat(top);
  29034. },
  29035. left: function (_bbox, _a) {
  29036. var left = _a.left;
  29037. return parseFloat(left);
  29038. },
  29039. bottom: function (_a, _b) {
  29040. var y = _a.y;
  29041. var top = _b.top;
  29042. return parseFloat(top) + (y.max - y.min);
  29043. },
  29044. right: function (_a, _b) {
  29045. var x = _a.x;
  29046. var left = _b.left;
  29047. return parseFloat(left) + (x.max - x.min);
  29048. },
  29049. // Transform
  29050. x: getTranslateFromMatrix(4, 13),
  29051. y: getTranslateFromMatrix(5, 14),
  29052. };
  29053. var convertChangedValueTypes = function (target, visualElement, changedKeys) {
  29054. var originBbox = visualElement.measureViewportBox();
  29055. var element = visualElement.getInstance();
  29056. var elementComputedStyle = getComputedStyle(element);
  29057. var display = elementComputedStyle.display;
  29058. var origin = {};
  29059. // If the element is currently set to display: "none", make it visible before
  29060. // measuring the target bounding box
  29061. if (display === "none") {
  29062. visualElement.setStaticValue("display", target.display || "block");
  29063. }
  29064. /**
  29065. * Record origins before we render and update styles
  29066. */
  29067. changedKeys.forEach(function (key) {
  29068. origin[key] = positionalValues[key](originBbox, elementComputedStyle);
  29069. });
  29070. // Apply the latest values (as set in checkAndConvertChangedValueTypes)
  29071. visualElement.syncRender();
  29072. var targetBbox = visualElement.measureViewportBox();
  29073. changedKeys.forEach(function (key) {
  29074. // Restore styles to their **calculated computed style**, not their actual
  29075. // originally set style. This allows us to animate between equivalent pixel units.
  29076. var value = visualElement.getValue(key);
  29077. setAndResetVelocity(value, origin[key]);
  29078. target[key] = positionalValues[key](targetBbox, elementComputedStyle);
  29079. });
  29080. return target;
  29081. };
  29082. var checkAndConvertChangedValueTypes = function (visualElement, target, origin, transitionEnd) {
  29083. if (origin === void 0) { origin = {}; }
  29084. if (transitionEnd === void 0) { transitionEnd = {}; }
  29085. target = __assign({}, target);
  29086. transitionEnd = __assign({}, transitionEnd);
  29087. var targetPositionalKeys = Object.keys(target).filter(isPositionalKey);
  29088. // We want to remove any transform values that could affect the element's bounding box before
  29089. // it's measured. We'll reapply these later.
  29090. var removedTransformValues = [];
  29091. var hasAttemptedToRemoveTransformValues = false;
  29092. var changedValueTypeKeys = [];
  29093. targetPositionalKeys.forEach(function (key) {
  29094. var value = visualElement.getValue(key);
  29095. if (!visualElement.hasValue(key))
  29096. return;
  29097. var from = origin[key];
  29098. var fromType = findDimensionValueType(from);
  29099. var to = target[key];
  29100. var toType;
  29101. // TODO: The current implementation of this basically throws an error
  29102. // if you try and do value conversion via keyframes. There's probably
  29103. // a way of doing this but the performance implications would need greater scrutiny,
  29104. // as it'd be doing multiple resize-remeasure operations.
  29105. if (isKeyframesTarget(to)) {
  29106. var numKeyframes = to.length;
  29107. var fromIndex = to[0] === null ? 1 : 0;
  29108. from = to[fromIndex];
  29109. fromType = findDimensionValueType(from);
  29110. for (var i = fromIndex; i < numKeyframes; i++) {
  29111. if (!toType) {
  29112. toType = findDimensionValueType(to[i]);
  29113. invariant(toType === fromType ||
  29114. (isNumOrPxType(fromType) && isNumOrPxType(toType)), "Keyframes must be of the same dimension as the current value");
  29115. }
  29116. else {
  29117. invariant(findDimensionValueType(to[i]) === toType, "All keyframes must be of the same type");
  29118. }
  29119. }
  29120. }
  29121. else {
  29122. toType = findDimensionValueType(to);
  29123. }
  29124. if (fromType !== toType) {
  29125. // If they're both just number or px, convert them both to numbers rather than
  29126. // relying on resize/remeasure to convert (which is wasteful in this situation)
  29127. if (isNumOrPxType(fromType) && isNumOrPxType(toType)) {
  29128. var current = value.get();
  29129. if (typeof current === "string") {
  29130. value.set(parseFloat(current));
  29131. }
  29132. if (typeof to === "string") {
  29133. target[key] = parseFloat(to);
  29134. }
  29135. else if (Array.isArray(to) && toType === px) {
  29136. target[key] = to.map(parseFloat);
  29137. }
  29138. }
  29139. else if ((fromType === null || fromType === void 0 ? void 0 : fromType.transform) &&
  29140. (toType === null || toType === void 0 ? void 0 : toType.transform) &&
  29141. (from === 0 || to === 0)) {
  29142. // If one or the other value is 0, it's safe to coerce it to the
  29143. // type of the other without measurement
  29144. if (from === 0) {
  29145. value.set(toType.transform(from));
  29146. }
  29147. else {
  29148. target[key] = fromType.transform(to);
  29149. }
  29150. }
  29151. else {
  29152. // If we're going to do value conversion via DOM measurements, we first
  29153. // need to remove non-positional transform values that could affect the bbox measurements.
  29154. if (!hasAttemptedToRemoveTransformValues) {
  29155. removedTransformValues =
  29156. removeNonTranslationalTransform(visualElement);
  29157. hasAttemptedToRemoveTransformValues = true;
  29158. }
  29159. changedValueTypeKeys.push(key);
  29160. transitionEnd[key] =
  29161. transitionEnd[key] !== undefined
  29162. ? transitionEnd[key]
  29163. : target[key];
  29164. setAndResetVelocity(value, to);
  29165. }
  29166. }
  29167. });
  29168. if (changedValueTypeKeys.length) {
  29169. var convertedTarget = convertChangedValueTypes(target, visualElement, changedValueTypeKeys);
  29170. // If we removed transform values, reapply them before the next render
  29171. if (removedTransformValues.length) {
  29172. removedTransformValues.forEach(function (_a) {
  29173. var _b = tslib_es6_read(_a, 2), key = _b[0], value = _b[1];
  29174. visualElement.getValue(key).set(value);
  29175. });
  29176. }
  29177. // Reapply original values
  29178. visualElement.syncRender();
  29179. return { target: convertedTarget, transitionEnd: transitionEnd };
  29180. }
  29181. else {
  29182. return { target: target, transitionEnd: transitionEnd };
  29183. }
  29184. };
  29185. /**
  29186. * Convert value types for x/y/width/height/top/left/bottom/right
  29187. *
  29188. * Allows animation between `'auto'` -> `'100%'` or `0` -> `'calc(50% - 10vw)'`
  29189. *
  29190. * @internal
  29191. */
  29192. function unitConversion(visualElement, target, origin, transitionEnd) {
  29193. return hasPositionalKey(target)
  29194. ? checkAndConvertChangedValueTypes(visualElement, target, origin, transitionEnd)
  29195. : { target: target, transitionEnd: transitionEnd };
  29196. }
  29197. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/parse-dom-variant.mjs
  29198. /**
  29199. * Parse a DOM variant to make it animatable. This involves resolving CSS variables
  29200. * and ensuring animations like "20%" => "calc(50vw)" are performed in pixels.
  29201. */
  29202. var parseDomVariant = function (visualElement, target, origin, transitionEnd) {
  29203. var resolved = resolveCSSVariables(visualElement, target, transitionEnd);
  29204. target = resolved.target;
  29205. transitionEnd = resolved.transitionEnd;
  29206. return unitConversion(visualElement, target, origin, transitionEnd);
  29207. };
  29208. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/visual-element.mjs
  29209. function visual_element_getComputedStyle(element) {
  29210. return window.getComputedStyle(element);
  29211. }
  29212. var htmlConfig = {
  29213. treeType: "dom",
  29214. readValueFromInstance: function (domElement, key) {
  29215. if (isTransformProp(key)) {
  29216. var defaultType = getDefaultValueType(key);
  29217. return defaultType ? defaultType.default || 0 : 0;
  29218. }
  29219. else {
  29220. var computedStyle = visual_element_getComputedStyle(domElement);
  29221. return ((isCSSVariable(key)
  29222. ? computedStyle.getPropertyValue(key)
  29223. : computedStyle[key]) || 0);
  29224. }
  29225. },
  29226. sortNodePosition: function (a, b) {
  29227. /**
  29228. * compareDocumentPosition returns a bitmask, by using the bitwise &
  29229. * we're returning true if 2 in that bitmask is set to true. 2 is set
  29230. * to true if b preceeds a.
  29231. */
  29232. return a.compareDocumentPosition(b) & 2 ? 1 : -1;
  29233. },
  29234. getBaseTarget: function (props, key) {
  29235. var _a;
  29236. return (_a = props.style) === null || _a === void 0 ? void 0 : _a[key];
  29237. },
  29238. measureViewportBox: function (element, _a) {
  29239. var transformPagePoint = _a.transformPagePoint;
  29240. return measureViewportBox(element, transformPagePoint);
  29241. },
  29242. /**
  29243. * Reset the transform on the current Element. This is called as part
  29244. * of a batched process across the entire layout tree. To remove this write
  29245. * cycle it'd be interesting to see if it's possible to "undo" all the current
  29246. * layout transforms up the tree in the same way this.getBoundingBoxWithoutTransforms
  29247. * works
  29248. */
  29249. resetTransform: function (element, domElement, props) {
  29250. var transformTemplate = props.transformTemplate;
  29251. domElement.style.transform = transformTemplate
  29252. ? transformTemplate({}, "")
  29253. : "none";
  29254. // Ensure that whatever happens next, we restore our transform on the next frame
  29255. element.scheduleRender();
  29256. },
  29257. restoreTransform: function (instance, mutableState) {
  29258. instance.style.transform = mutableState.style.transform;
  29259. },
  29260. removeValueFromRenderState: function (key, _a) {
  29261. var vars = _a.vars, style = _a.style;
  29262. delete vars[key];
  29263. delete style[key];
  29264. },
  29265. /**
  29266. * Ensure that HTML and Framer-specific value types like `px`->`%` and `Color`
  29267. * can be animated by Motion.
  29268. */
  29269. makeTargetAnimatable: function (element, _a, _b, isMounted) {
  29270. var transformValues = _b.transformValues;
  29271. if (isMounted === void 0) { isMounted = true; }
  29272. var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, ["transition", "transitionEnd"]);
  29273. var origin = getOrigin(target, transition || {}, element);
  29274. /**
  29275. * If Framer has provided a function to convert `Color` etc value types, convert them
  29276. */
  29277. if (transformValues) {
  29278. if (transitionEnd)
  29279. transitionEnd = transformValues(transitionEnd);
  29280. if (target)
  29281. target = transformValues(target);
  29282. if (origin)
  29283. origin = transformValues(origin);
  29284. }
  29285. if (isMounted) {
  29286. checkTargetForNewValues(element, target, origin);
  29287. var parsed = parseDomVariant(element, target, origin, transitionEnd);
  29288. transitionEnd = parsed.transitionEnd;
  29289. target = parsed.target;
  29290. }
  29291. return __assign({ transition: transition, transitionEnd: transitionEnd }, target);
  29292. },
  29293. scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,
  29294. build: function (element, renderState, latestValues, options, props) {
  29295. if (element.isVisible !== undefined) {
  29296. renderState.style.visibility = element.isVisible
  29297. ? "visible"
  29298. : "hidden";
  29299. }
  29300. buildHTMLStyles(renderState, latestValues, options, props.transformTemplate);
  29301. },
  29302. render: renderHTML,
  29303. };
  29304. var htmlVisualElement = visualElement(htmlConfig);
  29305. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/visual-element.mjs
  29306. var svgVisualElement = visualElement(__assign(__assign({}, htmlConfig), { getBaseTarget: function (props, key) {
  29307. return props[key];
  29308. }, readValueFromInstance: function (domElement, key) {
  29309. var _a;
  29310. if (isTransformProp(key)) {
  29311. return ((_a = getDefaultValueType(key)) === null || _a === void 0 ? void 0 : _a.default) || 0;
  29312. }
  29313. key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
  29314. return domElement.getAttribute(key);
  29315. }, scrapeMotionValuesFromProps: scrape_motion_values_scrapeMotionValuesFromProps, build: function (_element, renderState, latestValues, options, props) {
  29316. buildSVGAttrs(renderState, latestValues, options, props.transformTemplate);
  29317. }, render: renderSVG }));
  29318. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/create-visual-element.mjs
  29319. var create_visual_element_createDomVisualElement = function (Component, options) {
  29320. return isSVGComponent(Component)
  29321. ? svgVisualElement(options, { enableHardwareAcceleration: false })
  29322. : htmlVisualElement(options, { enableHardwareAcceleration: true });
  29323. };
  29324. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/styles/scale-border-radius.mjs
  29325. function pixelsToPercent(pixels, axis) {
  29326. if (axis.max === axis.min)
  29327. return 0;
  29328. return (pixels / (axis.max - axis.min)) * 100;
  29329. }
  29330. /**
  29331. * We always correct borderRadius as a percentage rather than pixels to reduce paints.
  29332. * For example, if you are projecting a box that is 100px wide with a 10px borderRadius
  29333. * into a box that is 200px wide with a 20px borderRadius, that is actually a 10%
  29334. * borderRadius in both states. If we animate between the two in pixels that will trigger
  29335. * a paint each time. If we animate between the two in percentage we'll avoid a paint.
  29336. */
  29337. var correctBorderRadius = {
  29338. correct: function (latest, node) {
  29339. if (!node.target)
  29340. return latest;
  29341. /**
  29342. * If latest is a string, if it's a percentage we can return immediately as it's
  29343. * going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number.
  29344. */
  29345. if (typeof latest === "string") {
  29346. if (px.test(latest)) {
  29347. latest = parseFloat(latest);
  29348. }
  29349. else {
  29350. return latest;
  29351. }
  29352. }
  29353. /**
  29354. * If latest is a number, it's a pixel value. We use the current viewportBox to calculate that
  29355. * pixel value as a percentage of each axis
  29356. */
  29357. var x = pixelsToPercent(latest, node.target.x);
  29358. var y = pixelsToPercent(latest, node.target.y);
  29359. return "".concat(x, "% ").concat(y, "%");
  29360. },
  29361. };
  29362. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs
  29363. var varToken = "_$css";
  29364. var correctBoxShadow = {
  29365. correct: function (latest, _a) {
  29366. var treeScale = _a.treeScale, projectionDelta = _a.projectionDelta;
  29367. var original = latest;
  29368. /**
  29369. * We need to first strip and store CSS variables from the string.
  29370. */
  29371. var containsCSSVariables = latest.includes("var(");
  29372. var cssVariables = [];
  29373. if (containsCSSVariables) {
  29374. latest = latest.replace(cssVariableRegex, function (match) {
  29375. cssVariables.push(match);
  29376. return varToken;
  29377. });
  29378. }
  29379. var shadow = complex.parse(latest);
  29380. // TODO: Doesn't support multiple shadows
  29381. if (shadow.length > 5)
  29382. return original;
  29383. var template = complex.createTransformer(latest);
  29384. var offset = typeof shadow[0] !== "number" ? 1 : 0;
  29385. // Calculate the overall context scale
  29386. var xScale = projectionDelta.x.scale * treeScale.x;
  29387. var yScale = projectionDelta.y.scale * treeScale.y;
  29388. shadow[0 + offset] /= xScale;
  29389. shadow[1 + offset] /= yScale;
  29390. /**
  29391. * Ideally we'd correct x and y scales individually, but because blur and
  29392. * spread apply to both we have to take a scale average and apply that instead.
  29393. * We could potentially improve the outcome of this by incorporating the ratio between
  29394. * the two scales.
  29395. */
  29396. var averageScale = mix(xScale, yScale, 0.5);
  29397. // Blur
  29398. if (typeof shadow[2 + offset] === "number")
  29399. shadow[2 + offset] /= averageScale;
  29400. // Spread
  29401. if (typeof shadow[3 + offset] === "number")
  29402. shadow[3 + offset] /= averageScale;
  29403. var output = template(shadow);
  29404. if (containsCSSVariables) {
  29405. var i_1 = 0;
  29406. output = output.replace(varToken, function () {
  29407. var cssVariable = cssVariables[i_1];
  29408. i_1++;
  29409. return cssVariable;
  29410. });
  29411. }
  29412. return output;
  29413. },
  29414. };
  29415. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs
  29416. var MeasureLayoutWithContext = /** @class */ (function (_super) {
  29417. __extends(MeasureLayoutWithContext, _super);
  29418. function MeasureLayoutWithContext() {
  29419. return _super !== null && _super.apply(this, arguments) || this;
  29420. }
  29421. /**
  29422. * This only mounts projection nodes for components that
  29423. * need measuring, we might want to do it for all components
  29424. * in order to incorporate transforms
  29425. */
  29426. MeasureLayoutWithContext.prototype.componentDidMount = function () {
  29427. var _this = this;
  29428. var _a = this.props, visualElement = _a.visualElement, layoutGroup = _a.layoutGroup, switchLayoutGroup = _a.switchLayoutGroup, layoutId = _a.layoutId;
  29429. var projection = visualElement.projection;
  29430. addScaleCorrector(defaultScaleCorrectors);
  29431. if (projection) {
  29432. if (layoutGroup === null || layoutGroup === void 0 ? void 0 : layoutGroup.group)
  29433. layoutGroup.group.add(projection);
  29434. if ((switchLayoutGroup === null || switchLayoutGroup === void 0 ? void 0 : switchLayoutGroup.register) && layoutId) {
  29435. switchLayoutGroup.register(projection);
  29436. }
  29437. projection.root.didUpdate();
  29438. projection.addEventListener("animationComplete", function () {
  29439. _this.safeToRemove();
  29440. });
  29441. projection.setOptions(__assign(__assign({}, projection.options), { onExitComplete: function () { return _this.safeToRemove(); } }));
  29442. }
  29443. globalProjectionState.hasEverUpdated = true;
  29444. };
  29445. MeasureLayoutWithContext.prototype.getSnapshotBeforeUpdate = function (prevProps) {
  29446. var _this = this;
  29447. var _a = this.props, layoutDependency = _a.layoutDependency, visualElement = _a.visualElement, drag = _a.drag, isPresent = _a.isPresent;
  29448. var projection = visualElement.projection;
  29449. if (!projection)
  29450. return null;
  29451. /**
  29452. * TODO: We use this data in relegate to determine whether to
  29453. * promote a previous element. There's no guarantee its presence data
  29454. * will have updated by this point - if a bug like this arises it will
  29455. * have to be that we markForRelegation and then find a new lead some other way,
  29456. * perhaps in didUpdate
  29457. */
  29458. projection.isPresent = isPresent;
  29459. if (drag ||
  29460. prevProps.layoutDependency !== layoutDependency ||
  29461. layoutDependency === undefined) {
  29462. projection.willUpdate();
  29463. }
  29464. else {
  29465. this.safeToRemove();
  29466. }
  29467. if (prevProps.isPresent !== isPresent) {
  29468. if (isPresent) {
  29469. projection.promote();
  29470. }
  29471. else if (!projection.relegate()) {
  29472. /**
  29473. * If there's another stack member taking over from this one,
  29474. * it's in charge of the exit animation and therefore should
  29475. * be in charge of the safe to remove. Otherwise we call it here.
  29476. */
  29477. es.postRender(function () {
  29478. var _a;
  29479. if (!((_a = projection.getStack()) === null || _a === void 0 ? void 0 : _a.members.length)) {
  29480. _this.safeToRemove();
  29481. }
  29482. });
  29483. }
  29484. }
  29485. return null;
  29486. };
  29487. MeasureLayoutWithContext.prototype.componentDidUpdate = function () {
  29488. var projection = this.props.visualElement.projection;
  29489. if (projection) {
  29490. projection.root.didUpdate();
  29491. if (!projection.currentAnimation && projection.isLead()) {
  29492. this.safeToRemove();
  29493. }
  29494. }
  29495. };
  29496. MeasureLayoutWithContext.prototype.componentWillUnmount = function () {
  29497. var _a = this.props, visualElement = _a.visualElement, layoutGroup = _a.layoutGroup, promoteContext = _a.switchLayoutGroup;
  29498. var projection = visualElement.projection;
  29499. if (projection) {
  29500. projection.scheduleCheckAfterUnmount();
  29501. if (layoutGroup === null || layoutGroup === void 0 ? void 0 : layoutGroup.group)
  29502. layoutGroup.group.remove(projection);
  29503. if (promoteContext === null || promoteContext === void 0 ? void 0 : promoteContext.deregister)
  29504. promoteContext.deregister(projection);
  29505. }
  29506. };
  29507. MeasureLayoutWithContext.prototype.safeToRemove = function () {
  29508. var safeToRemove = this.props.safeToRemove;
  29509. safeToRemove === null || safeToRemove === void 0 ? void 0 : safeToRemove();
  29510. };
  29511. MeasureLayoutWithContext.prototype.render = function () {
  29512. return null;
  29513. };
  29514. return MeasureLayoutWithContext;
  29515. }(external_React_.Component));
  29516. function MeasureLayout(props) {
  29517. var _a = tslib_es6_read(usePresence(), 2), isPresent = _a[0], safeToRemove = _a[1];
  29518. var layoutGroup = (0,external_React_.useContext)(LayoutGroupContext);
  29519. return (external_React_.createElement(MeasureLayoutWithContext, __assign({}, props, { layoutGroup: layoutGroup, switchLayoutGroup: (0,external_React_.useContext)(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove })));
  29520. }
  29521. var defaultScaleCorrectors = {
  29522. borderRadius: __assign(__assign({}, correctBorderRadius), { applyTo: [
  29523. "borderTopLeftRadius",
  29524. "borderTopRightRadius",
  29525. "borderBottomLeftRadius",
  29526. "borderBottomRightRadius",
  29527. ] }),
  29528. borderTopLeftRadius: correctBorderRadius,
  29529. borderTopRightRadius: correctBorderRadius,
  29530. borderBottomLeftRadius: correctBorderRadius,
  29531. borderBottomRightRadius: correctBorderRadius,
  29532. boxShadow: correctBoxShadow,
  29533. };
  29534. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/layout/index.mjs
  29535. var layoutFeatures = {
  29536. measureLayout: MeasureLayout,
  29537. };
  29538. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs
  29539. var DocumentProjectionNode = createProjectionNode({
  29540. attachResizeListener: function (ref, notify) {
  29541. ref.addEventListener("resize", notify, { passive: true });
  29542. return function () { return ref.removeEventListener("resize", notify); };
  29543. },
  29544. measureScroll: function () { return ({
  29545. x: document.documentElement.scrollLeft || document.body.scrollLeft,
  29546. y: document.documentElement.scrollTop || document.body.scrollTop,
  29547. }); },
  29548. });
  29549. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs
  29550. var rootProjectionNode = {
  29551. current: undefined,
  29552. };
  29553. var HTMLProjectionNode_HTMLProjectionNode = createProjectionNode({
  29554. measureScroll: function (instance) { return ({
  29555. x: instance.scrollLeft,
  29556. y: instance.scrollTop,
  29557. }); },
  29558. defaultParent: function () {
  29559. if (!rootProjectionNode.current) {
  29560. var documentNode = new DocumentProjectionNode(0, {});
  29561. documentNode.mount(window);
  29562. documentNode.setOptions({ layoutScroll: true });
  29563. rootProjectionNode.current = documentNode;
  29564. }
  29565. return rootProjectionNode.current;
  29566. },
  29567. resetTransform: function (instance, value) {
  29568. instance.style.transform = value !== null && value !== void 0 ? value : "none";
  29569. },
  29570. });
  29571. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/motion.mjs
  29572. var featureBundle = __assign(__assign(__assign(__assign({}, animations), gestureAnimations), drag), layoutFeatures);
  29573. /**
  29574. * HTML & SVG components, optimised for use with gestures and animation. These can be used as
  29575. * drop-in replacements for any HTML & SVG component, all CSS & SVG properties are supported.
  29576. *
  29577. * @public
  29578. */
  29579. var motion = /*@__PURE__*/ createMotionProxy(function (Component, config) {
  29580. return create_config_createDomMotionConfig(Component, config, featureBundle, create_visual_element_createDomVisualElement, HTMLProjectionNode_HTMLProjectionNode);
  29581. });
  29582. /**
  29583. * Create a DOM `motion` component with the provided string. This is primarily intended
  29584. * as a full alternative to `motion` for consumers who have to support environments that don't
  29585. * support `Proxy`.
  29586. *
  29587. * ```javascript
  29588. * import { createDomMotionComponent } from "framer-motion"
  29589. *
  29590. * const motion = {
  29591. * div: createDomMotionComponent('div')
  29592. * }
  29593. * ```
  29594. *
  29595. * @public
  29596. */
  29597. function createDomMotionComponent(key) {
  29598. return createMotionComponent(createDomMotionConfig(key, { forwardMotionProps: false }, featureBundle, createDomVisualElement, HTMLProjectionNode));
  29599. }
  29600. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/context.js
  29601. /**
  29602. * WordPress dependencies
  29603. */
  29604. const FlexContext = (0,external_wp_element_namespaceObject.createContext)({
  29605. flexItemDisplay: undefined
  29606. });
  29607. const useFlexContext = () => (0,external_wp_element_namespaceObject.useContext)(FlexContext);
  29608. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/styles.js
  29609. function styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  29610. /**
  29611. * External dependencies
  29612. */
  29613. const Flex = true ? {
  29614. name: "zjik7",
  29615. styles: "display:flex"
  29616. } : 0;
  29617. const Item = true ? {
  29618. name: "qgaee5",
  29619. styles: "display:block;max-height:100%;max-width:100%;min-height:0;min-width:0"
  29620. } : 0;
  29621. const block = true ? {
  29622. name: "82a6rk",
  29623. styles: "flex:1"
  29624. } : 0;
  29625. /**
  29626. * Workaround to optimize DOM rendering.
  29627. * We'll enhance alignment with naive parent flex assumptions.
  29628. *
  29629. * Trade-off:
  29630. * Far less DOM less. However, UI rendering is not as reliable.
  29631. */
  29632. /**
  29633. * Improves stability of width/height rendering.
  29634. * https://github.com/ItsJonQ/g2/pull/149
  29635. */
  29636. const ItemsColumn = true ? {
  29637. name: "13nosa1",
  29638. styles: ">*{min-height:0;}"
  29639. } : 0;
  29640. const ItemsRow = true ? {
  29641. name: "1pwxzk4",
  29642. styles: ">*{min-width:0;}"
  29643. } : 0;
  29644. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-item/hook.js
  29645. /**
  29646. * External dependencies
  29647. */
  29648. /**
  29649. * Internal dependencies
  29650. */
  29651. /**
  29652. * @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexItemProps, 'div'>} props
  29653. */
  29654. function useFlexItem(props) {
  29655. const {
  29656. className,
  29657. display: displayProp,
  29658. isBlock = false,
  29659. ...otherProps
  29660. } = useContextSystem(props, 'FlexItem');
  29661. const sx = {};
  29662. const contextDisplay = useFlexContext().flexItemDisplay;
  29663. sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({
  29664. display: displayProp || contextDisplay
  29665. }, true ? "" : 0, true ? "" : 0);
  29666. const cx = useCx();
  29667. const classes = cx(Item, sx.Base, isBlock && block, className);
  29668. return { ...otherProps,
  29669. className: classes
  29670. };
  29671. }
  29672. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-block/hook.js
  29673. /**
  29674. * Internal dependencies
  29675. */
  29676. /**
  29677. * @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexBlockProps, 'div'>} props
  29678. */
  29679. function useFlexBlock(props) {
  29680. const otherProps = useContextSystem(props, 'FlexBlock');
  29681. const flexItemProps = useFlexItem({
  29682. isBlock: true,
  29683. ...otherProps
  29684. });
  29685. return flexItemProps;
  29686. }
  29687. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-block/component.js
  29688. /**
  29689. * Internal dependencies
  29690. */
  29691. /**
  29692. * @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexBlockProps, 'div'>} props
  29693. * @param {import('react').ForwardedRef<any>} forwardedRef
  29694. */
  29695. function FlexBlock(props, forwardedRef) {
  29696. const flexBlockProps = useFlexBlock(props);
  29697. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, flexBlockProps, {
  29698. ref: forwardedRef
  29699. }));
  29700. }
  29701. /**
  29702. * `FlexBlock` is a primitive layout component that adaptively resizes content within layout containers like `Flex`.
  29703. *
  29704. * @example
  29705. * ```jsx
  29706. * <Flex>
  29707. * <FlexBlock>...</FlexBlock>
  29708. * </Flex>
  29709. * ```
  29710. */
  29711. const ConnectedFlexBlock = contextConnect(FlexBlock, 'FlexBlock');
  29712. /* harmony default export */ var flex_block_component = (ConnectedFlexBlock);
  29713. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-item/component.js
  29714. /**
  29715. * Internal dependencies
  29716. */
  29717. /**
  29718. * @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexItemProps, 'div'>} props
  29719. * @param {import('react').ForwardedRef<any>} forwardedRef
  29720. */
  29721. function FlexItem(props, forwardedRef) {
  29722. const flexItemProps = useFlexItem(props);
  29723. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, flexItemProps, {
  29724. ref: forwardedRef
  29725. }));
  29726. }
  29727. /**
  29728. * `FlexItem` is a primitive layout component that aligns content within layout containers like `Flex`.
  29729. *
  29730. * @example
  29731. * ```jsx
  29732. * <Flex>
  29733. * <FlexItem>...</FlexItem>
  29734. * </Flex>
  29735. * ```
  29736. */
  29737. const ConnectedFlexItem = contextConnect(FlexItem, 'FlexItem');
  29738. /* harmony default export */ var flex_item_component = (ConnectedFlexItem);
  29739. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/use-responsive-value.js
  29740. /**
  29741. * WordPress dependencies
  29742. */
  29743. const breakpoints = ['40em', '52em', '64em'];
  29744. const useBreakpointIndex = function () {
  29745. let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  29746. const {
  29747. defaultIndex = 0
  29748. } = options;
  29749. if (typeof defaultIndex !== 'number') {
  29750. throw new TypeError(`Default breakpoint index should be a number. Got: ${defaultIndex}, ${typeof defaultIndex}`);
  29751. } else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) {
  29752. throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);
  29753. }
  29754. const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(defaultIndex);
  29755. (0,external_wp_element_namespaceObject.useEffect)(() => {
  29756. const getIndex = () => breakpoints.filter(bp => {
  29757. return typeof window !== 'undefined' ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;
  29758. }).length;
  29759. const onResize = () => {
  29760. const newValue = getIndex();
  29761. if (value !== newValue) {
  29762. setValue(newValue);
  29763. }
  29764. };
  29765. onResize();
  29766. if (typeof window !== 'undefined') {
  29767. window.addEventListener('resize', onResize);
  29768. }
  29769. return () => {
  29770. if (typeof window !== 'undefined') {
  29771. window.removeEventListener('resize', onResize);
  29772. }
  29773. };
  29774. }, [value]);
  29775. return value;
  29776. };
  29777. function useResponsiveValue(values) {
  29778. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  29779. const index = useBreakpointIndex(options); // Allow calling the function with a "normal" value without having to check on the outside.
  29780. if (!Array.isArray(values) && typeof values !== 'function') return values;
  29781. const array = values || [];
  29782. /* eslint-disable jsdoc/no-undefined-types */
  29783. return (
  29784. /** @type {T[]} */
  29785. array[
  29786. /* eslint-enable jsdoc/no-undefined-types */
  29787. index >= array.length ? array.length - 1 : index]
  29788. );
  29789. }
  29790. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/space.js
  29791. /**
  29792. * A real number or something parsable as a number
  29793. */
  29794. const GRID_BASE = '4px';
  29795. /**
  29796. * A function that handles numbers, numeric strings, and unit values.
  29797. *
  29798. * When given a number or a numeric string, it will return the grid-based
  29799. * value as a factor of GRID_BASE, defined above.
  29800. *
  29801. * When given a unit value or one of the named CSS values like `auto`,
  29802. * it will simply return the value back.
  29803. *
  29804. * @param value A number, numeric string, or a unit value.
  29805. */
  29806. function space(value) {
  29807. var _window$CSS, _window$CSS$supports;
  29808. if (typeof value === 'undefined') {
  29809. return undefined;
  29810. } // Handle empty strings, if it's the number 0 this still works.
  29811. if (!value) {
  29812. return '0';
  29813. }
  29814. const asInt = typeof value === 'number' ? value : Number(value); // Test if the input has a unit, was NaN, or was one of the named CSS values (like `auto`), in which case just use that value.
  29815. if (typeof window !== 'undefined' && (_window$CSS = window.CSS) !== null && _window$CSS !== void 0 && (_window$CSS$supports = _window$CSS.supports) !== null && _window$CSS$supports !== void 0 && _window$CSS$supports.call(_window$CSS, 'margin', value.toString()) || Number.isNaN(asInt)) {
  29816. return value.toString();
  29817. }
  29818. return `calc(${GRID_BASE} * ${value})`;
  29819. }
  29820. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/rtl.js
  29821. /**
  29822. * External dependencies
  29823. */
  29824. /**
  29825. * WordPress dependencies
  29826. */
  29827. const LOWER_LEFT_REGEXP = new RegExp(/-left/g);
  29828. const LOWER_RIGHT_REGEXP = new RegExp(/-right/g);
  29829. const UPPER_LEFT_REGEXP = new RegExp(/Left/g);
  29830. const UPPER_RIGHT_REGEXP = new RegExp(/Right/g);
  29831. /**
  29832. * Flips a CSS property from left <-> right.
  29833. *
  29834. * @param {string} key The CSS property name.
  29835. *
  29836. * @return {string} The flipped CSS property name, if applicable.
  29837. */
  29838. function getConvertedKey(key) {
  29839. if (key === 'left') {
  29840. return 'right';
  29841. }
  29842. if (key === 'right') {
  29843. return 'left';
  29844. }
  29845. if (LOWER_LEFT_REGEXP.test(key)) {
  29846. return key.replace(LOWER_LEFT_REGEXP, '-right');
  29847. }
  29848. if (LOWER_RIGHT_REGEXP.test(key)) {
  29849. return key.replace(LOWER_RIGHT_REGEXP, '-left');
  29850. }
  29851. if (UPPER_LEFT_REGEXP.test(key)) {
  29852. return key.replace(UPPER_LEFT_REGEXP, 'Right');
  29853. }
  29854. if (UPPER_RIGHT_REGEXP.test(key)) {
  29855. return key.replace(UPPER_RIGHT_REGEXP, 'Left');
  29856. }
  29857. return key;
  29858. }
  29859. /**
  29860. * An incredibly basic ltr -> rtl converter for style properties
  29861. *
  29862. * @param {import('react').CSSProperties} ltrStyles
  29863. *
  29864. * @return {import('react').CSSProperties} Converted ltr -> rtl styles
  29865. */
  29866. const convertLTRToRTL = function () {
  29867. let ltrStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  29868. return (0,external_lodash_namespaceObject.mapKeys)(ltrStyles, (_value, key) => getConvertedKey(key));
  29869. };
  29870. /**
  29871. * A higher-order function that create an incredibly basic ltr -> rtl style converter for CSS objects.
  29872. *
  29873. * @param {import('react').CSSProperties} ltrStyles Ltr styles. Converts and renders from ltr -> rtl styles, if applicable.
  29874. * @param {import('react').CSSProperties} [rtlStyles] Rtl styles. Renders if provided.
  29875. *
  29876. * @return {() => import('@emotion/react').SerializedStyles} A function to output CSS styles for Emotion's renderer
  29877. */
  29878. function rtl() {
  29879. let ltrStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  29880. let rtlStyles = arguments.length > 1 ? arguments[1] : undefined;
  29881. return () => {
  29882. if (rtlStyles) {
  29883. // @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css
  29884. return (0,external_wp_i18n_namespaceObject.isRTL)() ? /*#__PURE__*/emotion_react_browser_esm_css(rtlStyles, true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css(ltrStyles, true ? "" : 0);
  29885. } // @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css
  29886. return (0,external_wp_i18n_namespaceObject.isRTL)() ? /*#__PURE__*/emotion_react_browser_esm_css(convertLTRToRTL(ltrStyles), true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css(ltrStyles, true ? "" : 0);
  29887. };
  29888. }
  29889. /**
  29890. * Call this in the `useMemo` dependency array to ensure that subsequent renders will
  29891. * cause rtl styles to update based on the `isRTL` return value even if all other dependencies
  29892. * remain the same.
  29893. *
  29894. * @example
  29895. * const styles = useMemo( () => {
  29896. * return css`
  29897. * ${ rtl( { marginRight: '10px' } ) }
  29898. * `;
  29899. * }, [ rtl.watch() ] );
  29900. */
  29901. rtl.watch = () => (0,external_wp_i18n_namespaceObject.isRTL)();
  29902. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex/hook.js
  29903. /**
  29904. * External dependencies
  29905. */
  29906. /**
  29907. * WordPress dependencies
  29908. */
  29909. /**
  29910. * Internal dependencies
  29911. */
  29912. /**
  29913. *
  29914. * @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexProps, 'div'>} props
  29915. * @return {import('../../ui/context').WordPressComponentProps<import('../types').FlexProps, 'div'>} Props with the deprecated props removed.
  29916. */
  29917. function hook_useDeprecatedProps(_ref) {
  29918. let {
  29919. isReversed,
  29920. ...otherProps
  29921. } = _ref;
  29922. if (typeof isReversed !== 'undefined') {
  29923. external_wp_deprecated_default()('Flex isReversed', {
  29924. alternative: 'Flex direction="row-reverse" or "column-reverse"',
  29925. since: '5.9'
  29926. });
  29927. return { ...otherProps,
  29928. direction: isReversed ? 'row-reverse' : 'row'
  29929. };
  29930. }
  29931. return otherProps;
  29932. }
  29933. /**
  29934. * @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexProps, 'div'>} props
  29935. */
  29936. function useFlex(props) {
  29937. const {
  29938. align = 'center',
  29939. className,
  29940. direction: directionProp = 'row',
  29941. expanded = true,
  29942. gap = 2,
  29943. justify = 'space-between',
  29944. wrap = false,
  29945. ...otherProps
  29946. } = useContextSystem(hook_useDeprecatedProps(props), 'Flex');
  29947. const directionAsArray = Array.isArray(directionProp) ? directionProp : [directionProp];
  29948. const direction = useResponsiveValue(directionAsArray);
  29949. const isColumn = typeof direction === 'string' && !!direction.includes('column');
  29950. const isReverse = typeof direction === 'string' && direction.includes('reverse');
  29951. const cx = useCx();
  29952. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  29953. const sx = {};
  29954. sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({
  29955. alignItems: isColumn ? 'normal' : align,
  29956. flexDirection: direction,
  29957. flexWrap: wrap ? 'wrap' : undefined,
  29958. justifyContent: justify,
  29959. height: isColumn && expanded ? '100%' : undefined,
  29960. width: !isColumn && expanded ? '100%' : undefined,
  29961. marginBottom: wrap ? `calc(${space(gap)} * -1)` : undefined
  29962. }, true ? "" : 0, true ? "" : 0);
  29963. /**
  29964. * Workaround to optimize DOM rendering.
  29965. * We'll enhance alignment with naive parent flex assumptions.
  29966. *
  29967. * Trade-off:
  29968. * Far less DOM less. However, UI rendering is not as reliable.
  29969. */
  29970. sx.Items = /*#__PURE__*/emotion_react_browser_esm_css(">*+*:not( marquee ){margin-top:", isColumn ? space(gap) : undefined, ";", rtl({
  29971. marginLeft: !isColumn && !isReverse ? space(gap) : undefined,
  29972. marginRight: !isColumn && isReverse ? space(gap) : undefined
  29973. })(), ";}" + ( true ? "" : 0), true ? "" : 0);
  29974. sx.WrapItems = /*#__PURE__*/emotion_react_browser_esm_css(">*:not( marquee ){margin-bottom:", space(gap), ";", rtl({
  29975. marginLeft: !isColumn && isReverse ? space(gap) : undefined,
  29976. marginRight: !isColumn && !isReverse ? space(gap) : undefined
  29977. })(), ";}>*:last-child:not( marquee ){", rtl({
  29978. marginLeft: !isColumn && isReverse ? 0 : undefined,
  29979. marginRight: !isColumn && !isReverse ? 0 : undefined
  29980. })(), ";}" + ( true ? "" : 0), true ? "" : 0);
  29981. return cx(Flex, sx.Base, wrap ? sx.WrapItems : sx.Items, isColumn ? ItemsColumn : ItemsRow, className);
  29982. }, [align, className, cx, direction, expanded, gap, isColumn, isReverse, justify, wrap, rtl.watch()]);
  29983. return { ...otherProps,
  29984. className: classes,
  29985. isColumn
  29986. };
  29987. }
  29988. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex/component.js
  29989. /**
  29990. * Internal dependencies
  29991. */
  29992. /**
  29993. * @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexProps, 'div'>} props
  29994. * @param {import('react').ForwardedRef<any>} forwardedRef
  29995. */
  29996. function component_Flex(props, forwardedRef) {
  29997. const {
  29998. children,
  29999. isColumn,
  30000. ...otherProps
  30001. } = useFlex(props);
  30002. return (0,external_wp_element_namespaceObject.createElement)(FlexContext.Provider, {
  30003. value: {
  30004. flexItemDisplay: isColumn ? 'block' : undefined
  30005. }
  30006. }, (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  30007. ref: forwardedRef
  30008. }), children));
  30009. }
  30010. /**
  30011. * `Flex` is a primitive layout component that adaptively aligns child content
  30012. * horizontally or vertically. `Flex` powers components like `HStack` and
  30013. * `VStack`.
  30014. *
  30015. * `Flex` is used with any of it's two sub-components, `FlexItem` and `FlexBlock`.
  30016. *
  30017. * @example
  30018. * ```jsx
  30019. * import {
  30020. * __experimentalFlex as Flex,
  30021. * __experimentalFlexBlock as FlexBlock,
  30022. * __experimentalFlexItem as FlexItem,
  30023. * __experimentalText as Text
  30024. * } from `@wordpress/components`;
  30025. *
  30026. * function Example() {
  30027. * return (
  30028. * <Flex>
  30029. * <FlexItem>
  30030. * <Text>Code</Text>
  30031. * </FlexItem>
  30032. * <FlexBlock>
  30033. * <Text>Poetry</Text>
  30034. * </FlexBlock>
  30035. * </Flex>
  30036. * );
  30037. * }
  30038. * ```
  30039. *
  30040. */
  30041. const ConnectedFlex = contextConnect(component_Flex, 'Flex');
  30042. /* harmony default export */ var flex_component = (ConnectedFlex);
  30043. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/styles.js
  30044. function truncate_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  30045. /**
  30046. * External dependencies
  30047. */
  30048. const Truncate = true ? {
  30049. name: "hdknak",
  30050. styles: "display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"
  30051. } : 0;
  30052. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/utils.js
  30053. /**
  30054. * External dependencies
  30055. */
  30056. const TRUNCATE_ELLIPSIS = '…';
  30057. const TRUNCATE_TYPE = {
  30058. auto: 'auto',
  30059. head: 'head',
  30060. middle: 'middle',
  30061. tail: 'tail',
  30062. none: 'none'
  30063. };
  30064. const TRUNCATE_DEFAULT_PROPS = {
  30065. ellipsis: TRUNCATE_ELLIPSIS,
  30066. ellipsizeMode: TRUNCATE_TYPE.auto,
  30067. limit: 0,
  30068. numberOfLines: 0
  30069. }; // Source
  30070. // https://github.com/kahwee/truncate-middle
  30071. /**
  30072. * @param {string} word
  30073. * @param {number} headLength
  30074. * @param {number} tailLength
  30075. * @param {string} ellipsis
  30076. */
  30077. function truncateMiddle(word, headLength, tailLength, ellipsis) {
  30078. if (typeof word !== 'string') {
  30079. return '';
  30080. }
  30081. const wordLength = word.length; // Setting default values
  30082. // eslint-disable-next-line no-bitwise
  30083. const frontLength = ~~headLength; // Will cast to integer
  30084. // eslint-disable-next-line no-bitwise
  30085. const backLength = ~~tailLength;
  30086. /* istanbul ignore next */
  30087. const truncateStr = !(0,external_lodash_namespaceObject.isNil)(ellipsis) ? ellipsis : TRUNCATE_ELLIPSIS;
  30088. if (frontLength === 0 && backLength === 0 || frontLength >= wordLength || backLength >= wordLength || frontLength + backLength >= wordLength) {
  30089. return word;
  30090. } else if (backLength === 0) {
  30091. return word.slice(0, frontLength) + truncateStr;
  30092. }
  30093. return word.slice(0, frontLength) + truncateStr + word.slice(wordLength - backLength);
  30094. }
  30095. /**
  30096. *
  30097. * @param {string} words
  30098. * @param {typeof TRUNCATE_DEFAULT_PROPS} props
  30099. */
  30100. function truncateContent() {
  30101. let words = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  30102. let props = arguments.length > 1 ? arguments[1] : undefined;
  30103. const mergedProps = { ...TRUNCATE_DEFAULT_PROPS,
  30104. ...props
  30105. };
  30106. const {
  30107. ellipsis,
  30108. ellipsizeMode,
  30109. limit
  30110. } = mergedProps;
  30111. if (ellipsizeMode === TRUNCATE_TYPE.none) {
  30112. return words;
  30113. }
  30114. let truncateHead;
  30115. let truncateTail;
  30116. switch (ellipsizeMode) {
  30117. case TRUNCATE_TYPE.head:
  30118. truncateHead = 0;
  30119. truncateTail = limit;
  30120. break;
  30121. case TRUNCATE_TYPE.middle:
  30122. truncateHead = Math.floor(limit / 2);
  30123. truncateTail = Math.floor(limit / 2);
  30124. break;
  30125. default:
  30126. truncateHead = limit;
  30127. truncateTail = 0;
  30128. }
  30129. const truncatedContent = ellipsizeMode !== TRUNCATE_TYPE.auto ? truncateMiddle(words, truncateHead, truncateTail, ellipsis) : words;
  30130. return truncatedContent;
  30131. }
  30132. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/hook.js
  30133. /**
  30134. * External dependencies
  30135. */
  30136. /**
  30137. * WordPress dependencies
  30138. */
  30139. /**
  30140. * Internal dependencies
  30141. */
  30142. /**
  30143. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props
  30144. */
  30145. function useTruncate(props) {
  30146. const {
  30147. className,
  30148. children,
  30149. ellipsis = TRUNCATE_ELLIPSIS,
  30150. ellipsizeMode = TRUNCATE_TYPE.auto,
  30151. limit = 0,
  30152. numberOfLines = 0,
  30153. ...otherProps
  30154. } = useContextSystem(props, 'Truncate');
  30155. const cx = useCx();
  30156. const truncatedContent = truncateContent(typeof children === 'string' ?
  30157. /** @type {string} */
  30158. children : '', {
  30159. ellipsis,
  30160. ellipsizeMode,
  30161. limit,
  30162. numberOfLines
  30163. });
  30164. const shouldTruncate = ellipsizeMode === TRUNCATE_TYPE.auto;
  30165. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  30166. const sx = {};
  30167. sx.numberOfLines = /*#__PURE__*/emotion_react_browser_esm_css("-webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + ( true ? "" : 0), true ? "" : 0);
  30168. return cx(shouldTruncate && !numberOfLines && Truncate, shouldTruncate && !!numberOfLines && sx.numberOfLines, className);
  30169. }, [className, cx, numberOfLines, shouldTruncate]);
  30170. return { ...otherProps,
  30171. className: classes,
  30172. children: truncatedContent
  30173. };
  30174. }
  30175. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/colors.js
  30176. /**
  30177. * External dependencies
  30178. */
  30179. /** @type {HTMLDivElement} */
  30180. let colorComputationNode;
  30181. k([names]);
  30182. /**
  30183. * @return {HTMLDivElement | undefined} The HTML element for color computation.
  30184. */
  30185. function getColorComputationNode() {
  30186. if (typeof document === 'undefined') return;
  30187. if (!colorComputationNode) {
  30188. // Create a temporary element for style computation.
  30189. const el = document.createElement('div');
  30190. el.setAttribute('data-g2-color-computation-node', ''); // Inject for window computed style.
  30191. document.body.appendChild(el);
  30192. colorComputationNode = el;
  30193. }
  30194. return colorComputationNode;
  30195. }
  30196. /**
  30197. * @param {string | unknown} value
  30198. *
  30199. * @return {boolean} Whether the value is a valid color.
  30200. */
  30201. function isColor(value) {
  30202. if (typeof value !== 'string') return false;
  30203. const test = w(value);
  30204. return test.isValid();
  30205. }
  30206. /**
  30207. * Retrieves the computed background color. This is useful for getting the
  30208. * value of a CSS variable color.
  30209. *
  30210. * @param {string | unknown} backgroundColor The background color to compute.
  30211. *
  30212. * @return {string} The computed background color.
  30213. */
  30214. function _getComputedBackgroundColor(backgroundColor) {
  30215. var _window;
  30216. if (typeof backgroundColor !== 'string') return '';
  30217. if (isColor(backgroundColor)) return backgroundColor;
  30218. if (!backgroundColor.includes('var(')) return '';
  30219. if (typeof document === 'undefined') return ''; // Attempts to gracefully handle CSS variables color values.
  30220. const el = getColorComputationNode();
  30221. if (!el) return '';
  30222. el.style.background = backgroundColor; // Grab the style.
  30223. const computedColor = (_window = window) === null || _window === void 0 ? void 0 : _window.getComputedStyle(el).background; // Reset.
  30224. el.style.background = '';
  30225. return computedColor || '';
  30226. }
  30227. const getComputedBackgroundColor = memize_default()(_getComputedBackgroundColor);
  30228. /**
  30229. * Get the text shade optimized for readability, based on a background color.
  30230. *
  30231. * @param {string | unknown} backgroundColor The background color.
  30232. *
  30233. * @return {string} The optimized text color (black or white).
  30234. */
  30235. function getOptimalTextColor(backgroundColor) {
  30236. const background = getComputedBackgroundColor(backgroundColor);
  30237. return w(background).isLight() ? '#000000' : '#ffffff';
  30238. }
  30239. /**
  30240. * Get the text shade optimized for readability, based on a background color.
  30241. *
  30242. * @param {string | unknown} backgroundColor The background color.
  30243. *
  30244. * @return {string} The optimized text shade (dark or light).
  30245. */
  30246. function getOptimalTextShade(backgroundColor) {
  30247. const result = getOptimalTextColor(backgroundColor);
  30248. return result === '#000000' ? 'dark' : 'light';
  30249. }
  30250. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/config-values.js
  30251. /**
  30252. * Internal dependencies
  30253. */
  30254. const CONTROL_HEIGHT = '36px';
  30255. const CONTROL_PADDING_X = '12px';
  30256. const CONTROL_PROPS = {
  30257. controlSurfaceColor: COLORS.white,
  30258. controlTextActiveColor: COLORS.ui.theme,
  30259. controlPaddingX: CONTROL_PADDING_X,
  30260. controlPaddingXLarge: `calc(${CONTROL_PADDING_X} * 1.3334)`,
  30261. controlPaddingXSmall: `calc(${CONTROL_PADDING_X} / 1.3334)`,
  30262. controlBackgroundColor: COLORS.white,
  30263. controlBorderRadius: '2px',
  30264. controlBorderColor: COLORS.gray[700],
  30265. controlBoxShadow: 'transparent',
  30266. controlBorderColorHover: COLORS.gray[700],
  30267. controlBoxShadowFocus: `0 0 0 0.5px ${COLORS.admin.theme}`,
  30268. controlDestructiveBorderColor: COLORS.alert.red,
  30269. controlHeight: CONTROL_HEIGHT,
  30270. controlHeightXSmall: `calc( ${CONTROL_HEIGHT} * 0.6 )`,
  30271. controlHeightSmall: `calc( ${CONTROL_HEIGHT} * 0.8 )`,
  30272. controlHeightLarge: `calc( ${CONTROL_HEIGHT} * 1.2 )`,
  30273. controlHeightXLarge: `calc( ${CONTROL_HEIGHT} * 1.4 )`
  30274. };
  30275. const TOGGLE_GROUP_CONTROL_PROPS = {
  30276. toggleGroupControlBackgroundColor: CONTROL_PROPS.controlBackgroundColor,
  30277. toggleGroupControlBorderColor: COLORS.ui.border,
  30278. toggleGroupControlBackdropBackgroundColor: CONTROL_PROPS.controlSurfaceColor,
  30279. toggleGroupControlBackdropBorderColor: COLORS.ui.border,
  30280. toggleGroupControlBackdropBoxShadow: 'transparent',
  30281. toggleGroupControlButtonColorActive: CONTROL_PROPS.controlBackgroundColor
  30282. }; // Using Object.assign to avoid creating circular references when emitting
  30283. // TypeScript type declarations.
  30284. /* harmony default export */ var config_values = (Object.assign({}, CONTROL_PROPS, TOGGLE_GROUP_CONTROL_PROPS, {
  30285. colorDivider: 'rgba(0, 0, 0, 0.1)',
  30286. colorScrollbarThumb: 'rgba(0, 0, 0, 0.2)',
  30287. colorScrollbarThumbHover: 'rgba(0, 0, 0, 0.5)',
  30288. colorScrollbarTrack: 'rgba(0, 0, 0, 0.04)',
  30289. elevationIntensity: 1,
  30290. radiusBlockUi: '2px',
  30291. borderWidth: '1px',
  30292. borderWidthFocus: '1.5px',
  30293. borderWidthTab: '4px',
  30294. spinnerSize: 16,
  30295. fontSize: '13px',
  30296. fontSizeH1: 'calc(2.44 * 13px)',
  30297. fontSizeH2: 'calc(1.95 * 13px)',
  30298. fontSizeH3: 'calc(1.56 * 13px)',
  30299. fontSizeH4: 'calc(1.25 * 13px)',
  30300. fontSizeH5: '13px',
  30301. fontSizeH6: 'calc(0.8 * 13px)',
  30302. fontSizeInputMobile: '16px',
  30303. fontSizeMobile: '15px',
  30304. fontSizeSmall: 'calc(0.92 * 13px)',
  30305. fontSizeXSmall: 'calc(0.75 * 13px)',
  30306. fontLineHeightBase: '1.2',
  30307. fontWeight: 'normal',
  30308. fontWeightHeading: '600',
  30309. gridBase: '4px',
  30310. cardBorderRadius: '2px',
  30311. cardPaddingXSmall: `${space(2)}`,
  30312. cardPaddingSmall: `${space(4)}`,
  30313. cardPaddingMedium: `${space(4)} ${space(6)}`,
  30314. cardPaddingLarge: `${space(6)} ${space(8)}`,
  30315. surfaceBackgroundColor: COLORS.white,
  30316. surfaceBackgroundSubtleColor: '#F3F3F3',
  30317. surfaceBackgroundTintColor: '#F5F5F5',
  30318. surfaceBorderColor: 'rgba(0, 0, 0, 0.1)',
  30319. surfaceBorderBoldColor: 'rgba(0, 0, 0, 0.15)',
  30320. surfaceBorderSubtleColor: 'rgba(0, 0, 0, 0.05)',
  30321. surfaceBackgroundTertiaryColor: COLORS.white,
  30322. surfaceColor: COLORS.white,
  30323. transitionDuration: '200ms',
  30324. transitionDurationFast: '160ms',
  30325. transitionDurationFaster: '120ms',
  30326. transitionDurationFastest: '100ms',
  30327. transitionTimingFunction: 'cubic-bezier(0.08, 0.52, 0.52, 1)',
  30328. transitionTimingFunctionControl: 'cubic-bezier(0.12, 0.8, 0.32, 1)'
  30329. }));
  30330. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/styles.js
  30331. function text_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  30332. /**
  30333. * External dependencies
  30334. */
  30335. /**
  30336. * Internal dependencies
  30337. */
  30338. const Text = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.darkGray.primary, ";line-height:", config_values.fontLineHeightBase, ";margin:0;" + ( true ? "" : 0), true ? "" : 0);
  30339. const styles_block = true ? {
  30340. name: "4zleql",
  30341. styles: "display:block"
  30342. } : 0;
  30343. const positive = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.alert.green, ";" + ( true ? "" : 0), true ? "" : 0);
  30344. const destructive = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.alert.red, ";" + ( true ? "" : 0), true ? "" : 0);
  30345. const muted = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.mediumGray.text, ";" + ( true ? "" : 0), true ? "" : 0);
  30346. const highlighterText = /*#__PURE__*/emotion_react_browser_esm_css("mark{background:", COLORS.alert.yellow, ";border-radius:2px;box-shadow:0 0 0 1px rgba( 0, 0, 0, 0.05 ) inset,0 -1px 0 rgba( 0, 0, 0, 0.1 ) inset;}" + ( true ? "" : 0), true ? "" : 0);
  30347. const upperCase = true ? {
  30348. name: "50zrmy",
  30349. styles: "text-transform:uppercase"
  30350. } : 0;
  30351. // EXTERNAL MODULE: ./node_modules/highlight-words-core/dist/index.js
  30352. var dist = __webpack_require__(3138);
  30353. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/utils.js
  30354. /**
  30355. * External dependencies
  30356. */
  30357. /**
  30358. * WordPress dependencies
  30359. */
  30360. /**
  30361. * Source:
  30362. * https://github.com/bvaughn/react-highlight-words/blob/HEAD/src/Highlighter.js
  30363. */
  30364. /* eslint-disable jsdoc/valid-types */
  30365. /**
  30366. * @typedef Options
  30367. * @property {string} [activeClassName=''] Classname for active highlighted areas.
  30368. * @property {number} [activeIndex=-1] The index of the active highlighted area.
  30369. * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [activeStyle] Styles to apply to the active highlighted area.
  30370. * @property {boolean} [autoEscape] Whether to automatically escape text.
  30371. * @property {boolean} [caseSensitive=false] Whether to highlight in a case-sensitive manner.
  30372. * @property {string} children Children to highlight.
  30373. * @property {import('highlight-words-core').FindAllArgs['findChunks']} [findChunks] Custom `findChunks` function to pass to `highlight-words-core`.
  30374. * @property {string | Record<string, unknown>} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).
  30375. * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text.
  30376. * @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.
  30377. * @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `santize` function to pass to `highlight-words-core`.
  30378. * @property {string[]} [searchWords=[]] Words to search for and highlight.
  30379. * @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.
  30380. * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text.
  30381. */
  30382. /**
  30383. * Maps props to lowercase names.
  30384. *
  30385. * @template {Record<string, unknown>} T
  30386. * @param {T} object Props to map.
  30387. * @return {{[K in keyof T as Lowercase<string & K>]: T[K]}} The mapped props.
  30388. */
  30389. /* eslint-enable jsdoc/valid-types */
  30390. const lowercaseProps = object => {
  30391. /** @type {any} */
  30392. const mapped = {};
  30393. for (const key in object) {
  30394. mapped[key.toLowerCase()] = object[key];
  30395. }
  30396. return mapped;
  30397. };
  30398. const memoizedLowercaseProps = memize_default()(lowercaseProps);
  30399. /**
  30400. *
  30401. * @param {Options} options
  30402. */
  30403. function createHighlighterText(_ref) {
  30404. let {
  30405. activeClassName = '',
  30406. activeIndex = -1,
  30407. activeStyle,
  30408. autoEscape,
  30409. caseSensitive = false,
  30410. children,
  30411. findChunks,
  30412. highlightClassName = '',
  30413. highlightStyle = {},
  30414. highlightTag = 'mark',
  30415. sanitize,
  30416. searchWords = [],
  30417. unhighlightClassName = '',
  30418. unhighlightStyle
  30419. } = _ref;
  30420. if (!children) return null;
  30421. if (typeof children !== 'string') return children;
  30422. const textToHighlight = children;
  30423. const chunks = (0,dist.findAll)({
  30424. autoEscape,
  30425. caseSensitive,
  30426. findChunks,
  30427. sanitize,
  30428. searchWords,
  30429. textToHighlight
  30430. });
  30431. const HighlightTag = highlightTag;
  30432. let highlightIndex = -1;
  30433. let highlightClassNames = '';
  30434. let highlightStyles;
  30435. const textContent = chunks.map((chunk, index) => {
  30436. const text = textToHighlight.substr(chunk.start, chunk.end - chunk.start);
  30437. if (chunk.highlight) {
  30438. highlightIndex++;
  30439. let highlightClass;
  30440. if (typeof highlightClassName === 'object') {
  30441. if (!caseSensitive) {
  30442. highlightClassName = memoizedLowercaseProps(highlightClassName);
  30443. highlightClass = highlightClassName[text.toLowerCase()];
  30444. } else {
  30445. highlightClass = highlightClassName[text];
  30446. }
  30447. } else {
  30448. highlightClass = highlightClassName;
  30449. }
  30450. const isActive = highlightIndex === +activeIndex;
  30451. highlightClassNames = `${highlightClass} ${isActive ? activeClassName : ''}`;
  30452. highlightStyles = isActive === true && activeStyle !== null ? Object.assign({}, highlightStyle, activeStyle) : highlightStyle;
  30453. /** @type {Record<string, any>} */
  30454. const props = {
  30455. children: text,
  30456. className: highlightClassNames,
  30457. key: index,
  30458. style: highlightStyles
  30459. }; // Don't attach arbitrary props to DOM elements; this triggers React DEV warnings (https://fb.me/react-unknown-prop)
  30460. // Only pass through the highlightIndex attribute for custom components.
  30461. if (typeof HighlightTag !== 'string') {
  30462. props.highlightIndex = highlightIndex;
  30463. }
  30464. return (0,external_wp_element_namespaceObject.createElement)(HighlightTag, props);
  30465. }
  30466. return (0,external_wp_element_namespaceObject.createElement)('span', {
  30467. children: text,
  30468. className: unhighlightClassName,
  30469. key: index,
  30470. style: unhighlightStyle
  30471. });
  30472. });
  30473. return textContent;
  30474. }
  30475. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/font-size.js
  30476. /**
  30477. * External dependencies
  30478. */
  30479. /**
  30480. * Internal dependencies
  30481. */
  30482. const BASE_FONT_SIZE = 13;
  30483. const PRESET_FONT_SIZES = {
  30484. body: BASE_FONT_SIZE,
  30485. caption: 10,
  30486. footnote: 11,
  30487. largeTitle: 28,
  30488. subheadline: 12,
  30489. title: 20
  30490. };
  30491. const HEADING_FONT_SIZES = [1, 2, 3, 4, 5, 6].flatMap(n => [n, n.toString()]);
  30492. function getFontSize() {
  30493. let size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : BASE_FONT_SIZE;
  30494. if (size in PRESET_FONT_SIZES) {
  30495. return getFontSize(PRESET_FONT_SIZES[size]);
  30496. }
  30497. if (typeof size !== 'number') {
  30498. const parsed = parseFloat(size);
  30499. if (Number.isNaN(parsed)) return size;
  30500. size = parsed;
  30501. }
  30502. const ratio = `(${size} / ${BASE_FONT_SIZE})`;
  30503. return `calc(${ratio} * ${config_values.fontSize})`;
  30504. }
  30505. function getHeadingFontSize() {
  30506. let size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 3;
  30507. if (!HEADING_FONT_SIZES.includes(size)) {
  30508. return getFontSize(size);
  30509. }
  30510. const headingSize = `fontSizeH${size}`;
  30511. return config_values[headingSize];
  30512. }
  30513. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/get-line-height.js
  30514. /**
  30515. * External dependencies
  30516. */
  30517. /**
  30518. * Internal dependencies
  30519. */
  30520. function getLineHeight(adjustLineHeightForInnerControls, lineHeight) {
  30521. if (lineHeight) return lineHeight;
  30522. if (!adjustLineHeightForInnerControls) return;
  30523. let value = `calc(${config_values.controlHeight} + ${space(2)})`;
  30524. switch (adjustLineHeightForInnerControls) {
  30525. case 'large':
  30526. value = `calc(${config_values.controlHeightLarge} + ${space(2)})`;
  30527. break;
  30528. case 'small':
  30529. value = `calc(${config_values.controlHeightSmall} + ${space(2)})`;
  30530. break;
  30531. case 'xSmall':
  30532. value = `calc(${config_values.controlHeightXSmall} + ${space(2)})`;
  30533. break;
  30534. default:
  30535. break;
  30536. }
  30537. return value;
  30538. }
  30539. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/hook.js
  30540. function hook_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  30541. /**
  30542. * External dependencies
  30543. */
  30544. /**
  30545. * WordPress dependencies
  30546. */
  30547. /**
  30548. * Internal dependencies
  30549. */
  30550. /**
  30551. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props
  30552. */
  30553. var hook_ref = true ? {
  30554. name: "50zrmy",
  30555. styles: "text-transform:uppercase"
  30556. } : 0;
  30557. function useText(props) {
  30558. const {
  30559. adjustLineHeightForInnerControls,
  30560. align,
  30561. children,
  30562. className,
  30563. color,
  30564. ellipsizeMode,
  30565. isDestructive = false,
  30566. display,
  30567. highlightEscape = false,
  30568. highlightCaseSensitive = false,
  30569. highlightWords,
  30570. highlightSanitize,
  30571. isBlock = false,
  30572. letterSpacing,
  30573. lineHeight: lineHeightProp,
  30574. optimizeReadabilityFor,
  30575. size,
  30576. truncate = false,
  30577. upperCase = false,
  30578. variant,
  30579. weight = config_values.fontWeight,
  30580. ...otherProps
  30581. } = useContextSystem(props, 'Text');
  30582. /** @type {import('react').ReactNode} */
  30583. let content = children;
  30584. const isHighlighter = Array.isArray(highlightWords);
  30585. const isCaption = size === 'caption';
  30586. if (isHighlighter) {
  30587. if (typeof children !== 'string') {
  30588. throw new TypeError('`children` of `Text` must only be `string` types when `highlightWords` is defined');
  30589. }
  30590. content = createHighlighterText({
  30591. autoEscape: highlightEscape,
  30592. // Disable reason: We need to disable this otherwise it erases the cast
  30593. // eslint-disable-next-line object-shorthand
  30594. children:
  30595. /** @type {string} */
  30596. children,
  30597. caseSensitive: highlightCaseSensitive,
  30598. searchWords: highlightWords,
  30599. sanitize: highlightSanitize
  30600. });
  30601. }
  30602. const cx = useCx();
  30603. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  30604. const sx = {};
  30605. const lineHeight = getLineHeight(adjustLineHeightForInnerControls, lineHeightProp);
  30606. sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({
  30607. color,
  30608. display,
  30609. fontSize: getFontSize(size),
  30610. /* eslint-disable jsdoc/valid-types */
  30611. fontWeight:
  30612. /** @type {import('react').CSSProperties['fontWeight']} */
  30613. weight,
  30614. /* eslint-enable jsdoc/valid-types */
  30615. lineHeight,
  30616. letterSpacing,
  30617. textAlign: align
  30618. }, true ? "" : 0, true ? "" : 0);
  30619. sx.upperCase = hook_ref;
  30620. sx.optimalTextColor = null;
  30621. if (optimizeReadabilityFor) {
  30622. const isOptimalTextColorDark = getOptimalTextShade(optimizeReadabilityFor) === 'dark';
  30623. sx.optimalTextColor = isOptimalTextColorDark ? /*#__PURE__*/emotion_react_browser_esm_css({
  30624. color: COLORS.black
  30625. }, true ? "" : 0, true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css({
  30626. color: COLORS.white
  30627. }, true ? "" : 0, true ? "" : 0);
  30628. }
  30629. return cx(Text, sx.Base, sx.optimalTextColor, isDestructive && destructive, !!isHighlighter && highlighterText, isBlock && styles_block, isCaption && muted, variant && text_styles_namespaceObject[variant], upperCase && sx.upperCase, className);
  30630. }, [adjustLineHeightForInnerControls, align, className, color, cx, display, isBlock, isCaption, isDestructive, isHighlighter, letterSpacing, lineHeightProp, optimizeReadabilityFor, size, upperCase, variant, weight]);
  30631. /** @type {undefined | 'auto' | 'none'} */
  30632. let finalEllipsizeMode;
  30633. if (truncate === true) {
  30634. finalEllipsizeMode = 'auto';
  30635. }
  30636. if (truncate === false) {
  30637. finalEllipsizeMode = 'none';
  30638. }
  30639. const finalComponentProps = { ...otherProps,
  30640. className: classes,
  30641. children,
  30642. ellipsizeMode: ellipsizeMode || finalEllipsizeMode
  30643. };
  30644. const truncateProps = useTruncate(finalComponentProps);
  30645. /**
  30646. * Enhance child `<Link />` components to inherit font size.
  30647. */
  30648. if (!truncate && Array.isArray(children)) {
  30649. content = external_wp_element_namespaceObject.Children.map(children, child => {
  30650. // @ts-ignore
  30651. if (!(0,external_lodash_namespaceObject.isPlainObject)(child) || !('props' in child)) {
  30652. return child;
  30653. }
  30654. const isLink = hasConnectNamespace(child, ['Link']);
  30655. if (isLink) {
  30656. return (0,external_wp_element_namespaceObject.cloneElement)(child, {
  30657. size: child.props.size || 'inherit'
  30658. });
  30659. }
  30660. return child;
  30661. });
  30662. }
  30663. return { ...truncateProps,
  30664. children: truncate ? truncateProps.children : content
  30665. };
  30666. }
  30667. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/component.js
  30668. /**
  30669. * Internal dependencies
  30670. */
  30671. /**
  30672. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props
  30673. * @param {import('react').ForwardedRef<any>} forwardedRef
  30674. */
  30675. function component_Text(props, forwardedRef) {
  30676. const textProps = useText(props);
  30677. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  30678. as: "span"
  30679. }, textProps, {
  30680. ref: forwardedRef
  30681. }));
  30682. }
  30683. /**
  30684. * `Text` is a core component that renders text in the library, using the
  30685. * library's typography system.
  30686. *
  30687. * `Text` can be used to render any text-content, like an HTML `p` or `span`.
  30688. *
  30689. * @example
  30690. *
  30691. * ```jsx
  30692. * import { __experimentalText as Text } from `@wordpress/components`;
  30693. *
  30694. * function Example() {
  30695. * return <Text>Code is Poetry</Text>;
  30696. * }
  30697. * ```
  30698. */
  30699. const ConnectedText = contextConnect(component_Text, 'Text');
  30700. /* harmony default export */ var text_component = (ConnectedText);
  30701. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js
  30702. function input_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  30703. /**
  30704. * External dependencies
  30705. */
  30706. var _ref6 = true ? {
  30707. name: "1739oy8",
  30708. styles: "z-index:1"
  30709. } : 0;
  30710. const rootFocusedStyles = _ref7 => {
  30711. let {
  30712. isFocused
  30713. } = _ref7;
  30714. if (!isFocused) return '';
  30715. return _ref6;
  30716. };
  30717. var _ref3 = true ? {
  30718. name: "2o6p8u",
  30719. styles: "justify-content:space-between"
  30720. } : 0;
  30721. var _ref4 = true ? {
  30722. name: "14qk3ip",
  30723. styles: "align-items:flex-start;flex-direction:column-reverse"
  30724. } : 0;
  30725. var _ref5 = true ? {
  30726. name: "hbng6e",
  30727. styles: "align-items:flex-start;flex-direction:column"
  30728. } : 0;
  30729. const rootLabelPositionStyles = _ref8 => {
  30730. let {
  30731. labelPosition
  30732. } = _ref8;
  30733. switch (labelPosition) {
  30734. case 'top':
  30735. return _ref5;
  30736. case 'bottom':
  30737. return _ref4;
  30738. case 'edge':
  30739. return _ref3;
  30740. default:
  30741. return '';
  30742. }
  30743. };
  30744. const input_control_styles_Root = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  30745. target: "em5sgkm7"
  30746. } : 0)("position:relative;border-radius:2px;padding-top:0;", rootFocusedStyles, " ", rootLabelPositionStyles, ";" + ( true ? "" : 0));
  30747. const containerDisabledStyles = _ref9 => {
  30748. let {
  30749. disabled
  30750. } = _ref9;
  30751. const backgroundColor = disabled ? COLORS.ui.backgroundDisabled : COLORS.ui.background;
  30752. return /*#__PURE__*/emotion_react_browser_esm_css({
  30753. backgroundColor
  30754. }, true ? "" : 0, true ? "" : 0);
  30755. }; // Normalizes the margins from the <Flex /> (components/ui/flex/) container.
  30756. var _ref2 = true ? {
  30757. name: "wyxldh",
  30758. styles: "margin:0 !important"
  30759. } : 0;
  30760. const containerMarginStyles = _ref10 => {
  30761. let {
  30762. hideLabel
  30763. } = _ref10;
  30764. return hideLabel ? _ref2 : null;
  30765. };
  30766. var input_control_styles_ref = true ? {
  30767. name: "1d3w5wq",
  30768. styles: "width:100%"
  30769. } : 0;
  30770. const containerWidthStyles = _ref11 => {
  30771. let {
  30772. __unstableInputWidth,
  30773. labelPosition
  30774. } = _ref11;
  30775. if (!__unstableInputWidth) return input_control_styles_ref;
  30776. if (labelPosition === 'side') return '';
  30777. if (labelPosition === 'edge') {
  30778. return /*#__PURE__*/emotion_react_browser_esm_css({
  30779. flex: `0 0 ${__unstableInputWidth}`
  30780. }, true ? "" : 0, true ? "" : 0);
  30781. }
  30782. return /*#__PURE__*/emotion_react_browser_esm_css({
  30783. width: __unstableInputWidth
  30784. }, true ? "" : 0, true ? "" : 0);
  30785. };
  30786. const Container = emotion_styled_base_browser_esm("div", true ? {
  30787. target: "em5sgkm6"
  30788. } : 0)("align-items:center;box-sizing:border-box;border-radius:inherit;display:flex;flex:1;position:relative;", containerDisabledStyles, " ", containerMarginStyles, " ", containerWidthStyles, ";" + ( true ? "" : 0));
  30789. const disabledStyles = _ref12 => {
  30790. let {
  30791. disabled
  30792. } = _ref12;
  30793. if (!disabled) return '';
  30794. return /*#__PURE__*/emotion_react_browser_esm_css({
  30795. color: COLORS.ui.textDisabled
  30796. }, true ? "" : 0, true ? "" : 0);
  30797. };
  30798. const fontSizeStyles = _ref13 => {
  30799. let {
  30800. inputSize: size
  30801. } = _ref13;
  30802. const sizes = {
  30803. default: '13px',
  30804. small: '11px',
  30805. '__unstable-large': '13px'
  30806. };
  30807. const fontSize = sizes[size] || sizes.default;
  30808. const fontSizeMobile = '16px';
  30809. if (!fontSize) return '';
  30810. return /*#__PURE__*/emotion_react_browser_esm_css("font-size:", fontSizeMobile, ";@media ( min-width: 600px ){font-size:", fontSize, ";}" + ( true ? "" : 0), true ? "" : 0);
  30811. };
  30812. const sizeStyles = _ref14 => {
  30813. let {
  30814. inputSize: size
  30815. } = _ref14;
  30816. const sizes = {
  30817. default: {
  30818. height: 30,
  30819. lineHeight: 1,
  30820. minHeight: 30,
  30821. paddingLeft: 8,
  30822. paddingRight: 8
  30823. },
  30824. small: {
  30825. height: 24,
  30826. lineHeight: 1,
  30827. minHeight: 24,
  30828. paddingLeft: 8,
  30829. paddingRight: 8
  30830. },
  30831. '__unstable-large': {
  30832. height: 40,
  30833. lineHeight: 1,
  30834. minHeight: 40,
  30835. paddingLeft: 16,
  30836. paddingRight: 16
  30837. }
  30838. };
  30839. const style = sizes[size] || sizes.default;
  30840. return /*#__PURE__*/emotion_react_browser_esm_css(style, true ? "" : 0, true ? "" : 0);
  30841. };
  30842. const dragStyles = _ref15 => {
  30843. let {
  30844. isDragging,
  30845. dragCursor
  30846. } = _ref15;
  30847. let defaultArrowStyles;
  30848. let activeDragCursorStyles;
  30849. if (isDragging) {
  30850. defaultArrowStyles = /*#__PURE__*/emotion_react_browser_esm_css("cursor:", dragCursor, ";user-select:none;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none!important;margin:0!important;}" + ( true ? "" : 0), true ? "" : 0);
  30851. }
  30852. if (isDragging && dragCursor) {
  30853. activeDragCursorStyles = /*#__PURE__*/emotion_react_browser_esm_css("&:active{cursor:", dragCursor, ";}" + ( true ? "" : 0), true ? "" : 0);
  30854. }
  30855. return /*#__PURE__*/emotion_react_browser_esm_css(defaultArrowStyles, " ", activeDragCursorStyles, ";" + ( true ? "" : 0), true ? "" : 0);
  30856. }; // TODO: Resolve need to use &&& to increase specificity
  30857. // https://github.com/WordPress/gutenberg/issues/18483
  30858. const Input = emotion_styled_base_browser_esm("input", true ? {
  30859. target: "em5sgkm5"
  30860. } : 0)("&&&{background-color:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:", COLORS.black, ";display:block;font-family:inherit;margin:0;outline:none;width:100%;", dragStyles, " ", disabledStyles, " ", fontSizeStyles, " ", sizeStyles, " &::-webkit-input-placeholder{line-height:normal;}}" + ( true ? "" : 0));
  30861. const labelMargin = _ref16 => {
  30862. let {
  30863. labelPosition
  30864. } = _ref16;
  30865. let marginBottom = 8;
  30866. if (labelPosition === 'edge' || labelPosition === 'side') {
  30867. marginBottom = 0;
  30868. }
  30869. return /*#__PURE__*/emotion_react_browser_esm_css({
  30870. marginTop: 0,
  30871. marginRight: 0,
  30872. marginBottom,
  30873. marginLeft: 0
  30874. }, true ? "" : 0, true ? "" : 0);
  30875. };
  30876. const BaseLabel = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? {
  30877. target: "em5sgkm4"
  30878. } : 0)("&&&{box-sizing:border-box;color:currentColor;display:block;padding-top:0;padding-bottom:0;max-width:100%;z-index:1;", labelMargin, " overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}" + ( true ? "" : 0));
  30879. const Label = props => (0,external_wp_element_namespaceObject.createElement)(BaseLabel, extends_extends({}, props, {
  30880. as: "label"
  30881. }));
  30882. const LabelWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_item_component, true ? {
  30883. target: "em5sgkm3"
  30884. } : 0)( true ? {
  30885. name: "1b6uupn",
  30886. styles: "max-width:calc( 100% - 10px )"
  30887. } : 0);
  30888. const backdropFocusedStyles = _ref17 => {
  30889. let {
  30890. disabled,
  30891. isFocused
  30892. } = _ref17;
  30893. let borderColor = isFocused ? COLORS.ui.borderFocus : COLORS.ui.border;
  30894. let boxShadow;
  30895. if (isFocused) {
  30896. boxShadow = `0 0 0 1px ${COLORS.ui.borderFocus} inset`;
  30897. }
  30898. if (disabled) {
  30899. borderColor = COLORS.ui.borderDisabled;
  30900. }
  30901. return /*#__PURE__*/emotion_react_browser_esm_css({
  30902. boxShadow,
  30903. borderColor,
  30904. borderStyle: 'solid',
  30905. borderWidth: 1
  30906. }, true ? "" : 0, true ? "" : 0);
  30907. };
  30908. const BackdropUI = emotion_styled_base_browser_esm("div", true ? {
  30909. target: "em5sgkm2"
  30910. } : 0)("&&&{box-sizing:border-box;border-radius:inherit;bottom:0;left:0;margin:0;padding:0;pointer-events:none;position:absolute;right:0;top:0;", backdropFocusedStyles, " ", rtl({
  30911. paddingLeft: 2
  30912. }), ";}" + ( true ? "" : 0));
  30913. const Prefix = emotion_styled_base_browser_esm("span", true ? {
  30914. target: "em5sgkm1"
  30915. } : 0)( true ? {
  30916. name: "pvvbxf",
  30917. styles: "box-sizing:border-box;display:block"
  30918. } : 0);
  30919. const Suffix = emotion_styled_base_browser_esm("span", true ? {
  30920. target: "em5sgkm0"
  30921. } : 0)( true ? {
  30922. name: "jgf79h",
  30923. styles: "align-items:center;align-self:stretch;box-sizing:border-box;display:flex"
  30924. } : 0);
  30925. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/backdrop.js
  30926. /**
  30927. * WordPress dependencies
  30928. */
  30929. /**
  30930. * Internal dependencies
  30931. */
  30932. function Backdrop(_ref) {
  30933. let {
  30934. disabled = false,
  30935. isFocused = false
  30936. } = _ref;
  30937. return (0,external_wp_element_namespaceObject.createElement)(BackdropUI, {
  30938. "aria-hidden": "true",
  30939. className: "components-input-control__backdrop",
  30940. disabled: disabled,
  30941. isFocused: isFocused
  30942. });
  30943. }
  30944. const MemoizedBackdrop = (0,external_wp_element_namespaceObject.memo)(Backdrop);
  30945. /* harmony default export */ var backdrop = (MemoizedBackdrop);
  30946. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/label.js
  30947. /**
  30948. * Internal dependencies
  30949. */
  30950. function label_Label(_ref) {
  30951. let {
  30952. children,
  30953. hideLabelFromVision,
  30954. htmlFor,
  30955. ...props
  30956. } = _ref;
  30957. if (!children) return null;
  30958. if (hideLabelFromVision) {
  30959. return (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  30960. as: "label",
  30961. htmlFor: htmlFor
  30962. }, children);
  30963. }
  30964. return (0,external_wp_element_namespaceObject.createElement)(Label, extends_extends({
  30965. htmlFor: htmlFor
  30966. }, props), children);
  30967. }
  30968. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-base.js
  30969. /**
  30970. * External dependencies
  30971. */
  30972. /**
  30973. * WordPress dependencies
  30974. */
  30975. /**
  30976. * Internal dependencies
  30977. */
  30978. function useUniqueId(idProp) {
  30979. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(InputBase);
  30980. const id = `input-base-control-${instanceId}`;
  30981. return idProp || id;
  30982. } // Adapter to map props for the new ui/flex compopnent.
  30983. function getUIFlexProps(labelPosition) {
  30984. const props = {};
  30985. switch (labelPosition) {
  30986. case 'top':
  30987. props.direction = 'column';
  30988. props.gap = 0;
  30989. break;
  30990. case 'bottom':
  30991. props.direction = 'column-reverse';
  30992. props.gap = 0;
  30993. break;
  30994. case 'edge':
  30995. props.justify = 'space-between';
  30996. break;
  30997. }
  30998. return props;
  30999. }
  31000. function InputBase(_ref, ref) {
  31001. let {
  31002. __unstableInputWidth,
  31003. children,
  31004. className,
  31005. disabled = false,
  31006. hideLabelFromVision = false,
  31007. labelPosition,
  31008. id: idProp,
  31009. isFocused = false,
  31010. label,
  31011. prefix,
  31012. size = 'default',
  31013. suffix,
  31014. ...props
  31015. } = _ref;
  31016. const id = useUniqueId(idProp);
  31017. const hideLabel = hideLabelFromVision || !label;
  31018. return (// @ts-expect-error The `direction` prop from Flex (FlexDirection) conflicts with legacy SVGAttributes `direction` (string) that come from React intrinsic prop definitions.
  31019. (0,external_wp_element_namespaceObject.createElement)(input_control_styles_Root, extends_extends({}, props, getUIFlexProps(labelPosition), {
  31020. className: className,
  31021. isFocused: isFocused,
  31022. labelPosition: labelPosition,
  31023. ref: ref
  31024. }), (0,external_wp_element_namespaceObject.createElement)(LabelWrapper, null, (0,external_wp_element_namespaceObject.createElement)(label_Label, {
  31025. className: "components-input-control__label",
  31026. hideLabelFromVision: hideLabelFromVision,
  31027. labelPosition: labelPosition,
  31028. htmlFor: id,
  31029. size: size
  31030. }, label)), (0,external_wp_element_namespaceObject.createElement)(Container, {
  31031. __unstableInputWidth: __unstableInputWidth,
  31032. className: "components-input-control__container",
  31033. disabled: disabled,
  31034. hideLabel: hideLabel,
  31035. labelPosition: labelPosition
  31036. }, prefix && (0,external_wp_element_namespaceObject.createElement)(Prefix, {
  31037. className: "components-input-control__prefix"
  31038. }, prefix), children, suffix && (0,external_wp_element_namespaceObject.createElement)(Suffix, {
  31039. className: "components-input-control__suffix"
  31040. }, suffix), (0,external_wp_element_namespaceObject.createElement)(backdrop, {
  31041. disabled: disabled,
  31042. isFocused: isFocused
  31043. })))
  31044. );
  31045. }
  31046. /* harmony default export */ var input_base = ((0,external_wp_element_namespaceObject.forwardRef)(InputBase));
  31047. ;// CONCATENATED MODULE: ./node_modules/@use-gesture/core/dist/maths-b2a210f4.esm.js
  31048. function maths_b2a210f4_esm_clamp(v, min, max) {
  31049. return Math.max(min, Math.min(v, max));
  31050. }
  31051. const V = {
  31052. toVector(v, fallback) {
  31053. if (v === undefined) v = fallback;
  31054. return Array.isArray(v) ? v : [v, v];
  31055. },
  31056. add(v1, v2) {
  31057. return [v1[0] + v2[0], v1[1] + v2[1]];
  31058. },
  31059. sub(v1, v2) {
  31060. return [v1[0] - v2[0], v1[1] - v2[1]];
  31061. },
  31062. addTo(v1, v2) {
  31063. v1[0] += v2[0];
  31064. v1[1] += v2[1];
  31065. },
  31066. subTo(v1, v2) {
  31067. v1[0] -= v2[0];
  31068. v1[1] -= v2[1];
  31069. }
  31070. };
  31071. function rubberband(distance, dimension, constant) {
  31072. if (dimension === 0 || Math.abs(dimension) === Infinity) return Math.pow(distance, constant * 5);
  31073. return distance * dimension * constant / (dimension + constant * distance);
  31074. }
  31075. function rubberbandIfOutOfBounds(position, min, max, constant = 0.15) {
  31076. if (constant === 0) return maths_b2a210f4_esm_clamp(position, min, max);
  31077. if (position < min) return -rubberband(min - position, max - min, constant) + min;
  31078. if (position > max) return +rubberband(position - max, max - min, constant) + max;
  31079. return position;
  31080. }
  31081. function computeRubberband(bounds, [Vx, Vy], [Rx, Ry]) {
  31082. const [[X0, X1], [Y0, Y1]] = bounds;
  31083. return [rubberbandIfOutOfBounds(Vx, X0, X1, Rx), rubberbandIfOutOfBounds(Vy, Y0, Y1, Ry)];
  31084. }
  31085. ;// CONCATENATED MODULE: ./node_modules/@use-gesture/core/dist/actions-e2a59bb9.esm.js
  31086. function actions_e2a59bb9_esm_defineProperty(obj, key, value) {
  31087. if (key in obj) {
  31088. Object.defineProperty(obj, key, {
  31089. value: value,
  31090. enumerable: true,
  31091. configurable: true,
  31092. writable: true
  31093. });
  31094. } else {
  31095. obj[key] = value;
  31096. }
  31097. return obj;
  31098. }
  31099. function actions_e2a59bb9_esm_ownKeys(object, enumerableOnly) {
  31100. var keys = Object.keys(object);
  31101. if (Object.getOwnPropertySymbols) {
  31102. var symbols = Object.getOwnPropertySymbols(object);
  31103. enumerableOnly && (symbols = symbols.filter(function (sym) {
  31104. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  31105. })), keys.push.apply(keys, symbols);
  31106. }
  31107. return keys;
  31108. }
  31109. function actions_e2a59bb9_esm_objectSpread2(target) {
  31110. for (var i = 1; i < arguments.length; i++) {
  31111. var source = null != arguments[i] ? arguments[i] : {};
  31112. i % 2 ? actions_e2a59bb9_esm_ownKeys(Object(source), !0).forEach(function (key) {
  31113. actions_e2a59bb9_esm_defineProperty(target, key, source[key]);
  31114. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : actions_e2a59bb9_esm_ownKeys(Object(source)).forEach(function (key) {
  31115. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  31116. });
  31117. }
  31118. return target;
  31119. }
  31120. const EVENT_TYPE_MAP = {
  31121. pointer: {
  31122. start: 'down',
  31123. change: 'move',
  31124. end: 'up'
  31125. },
  31126. mouse: {
  31127. start: 'down',
  31128. change: 'move',
  31129. end: 'up'
  31130. },
  31131. touch: {
  31132. start: 'start',
  31133. change: 'move',
  31134. end: 'end'
  31135. },
  31136. gesture: {
  31137. start: 'start',
  31138. change: 'change',
  31139. end: 'end'
  31140. }
  31141. };
  31142. function capitalize(string) {
  31143. if (!string) return '';
  31144. return string[0].toUpperCase() + string.slice(1);
  31145. }
  31146. const actionsWithoutCaptureSupported = ['enter', 'leave'];
  31147. function hasCapture(capture = false, actionKey) {
  31148. return capture && !actionsWithoutCaptureSupported.includes(actionKey);
  31149. }
  31150. function toHandlerProp(device, action = '', capture = false) {
  31151. const deviceProps = EVENT_TYPE_MAP[device];
  31152. const actionKey = deviceProps ? deviceProps[action] || action : action;
  31153. return 'on' + capitalize(device) + capitalize(actionKey) + (hasCapture(capture, actionKey) ? 'Capture' : '');
  31154. }
  31155. const pointerCaptureEvents = ['gotpointercapture', 'lostpointercapture'];
  31156. function parseProp(prop) {
  31157. let eventKey = prop.substring(2).toLowerCase();
  31158. const passive = !!~eventKey.indexOf('passive');
  31159. if (passive) eventKey = eventKey.replace('passive', '');
  31160. const captureKey = pointerCaptureEvents.includes(eventKey) ? 'capturecapture' : 'capture';
  31161. const capture = !!~eventKey.indexOf(captureKey);
  31162. if (capture) eventKey = eventKey.replace('capture', '');
  31163. return {
  31164. device: eventKey,
  31165. capture,
  31166. passive
  31167. };
  31168. }
  31169. function toDomEventType(device, action = '') {
  31170. const deviceProps = EVENT_TYPE_MAP[device];
  31171. const actionKey = deviceProps ? deviceProps[action] || action : action;
  31172. return device + actionKey;
  31173. }
  31174. function isTouch(event) {
  31175. return 'touches' in event;
  31176. }
  31177. function getPointerType(event) {
  31178. if (isTouch(event)) return 'touch';
  31179. if ('pointerType' in event) return event.pointerType;
  31180. return 'mouse';
  31181. }
  31182. function getCurrentTargetTouchList(event) {
  31183. return Array.from(event.touches).filter(e => {
  31184. var _event$currentTarget, _event$currentTarget$;
  31185. return e.target === event.currentTarget || ((_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 ? void 0 : (_event$currentTarget$ = _event$currentTarget.contains) === null || _event$currentTarget$ === void 0 ? void 0 : _event$currentTarget$.call(_event$currentTarget, e.target));
  31186. });
  31187. }
  31188. function getTouchList(event) {
  31189. return event.type === 'touchend' || event.type === 'touchcancel' ? event.changedTouches : event.targetTouches;
  31190. }
  31191. function getValueEvent(event) {
  31192. return isTouch(event) ? getTouchList(event)[0] : event;
  31193. }
  31194. function distanceAngle(P1, P2) {
  31195. const dx = P2.clientX - P1.clientX;
  31196. const dy = P2.clientY - P1.clientY;
  31197. const cx = (P2.clientX + P1.clientX) / 2;
  31198. const cy = (P2.clientY + P1.clientY) / 2;
  31199. const distance = Math.hypot(dx, dy);
  31200. const angle = -(Math.atan2(dx, dy) * 180) / Math.PI;
  31201. const origin = [cx, cy];
  31202. return {
  31203. angle,
  31204. distance,
  31205. origin
  31206. };
  31207. }
  31208. function touchIds(event) {
  31209. return getCurrentTargetTouchList(event).map(touch => touch.identifier);
  31210. }
  31211. function touchDistanceAngle(event, ids) {
  31212. const [P1, P2] = Array.from(event.touches).filter(touch => ids.includes(touch.identifier));
  31213. return distanceAngle(P1, P2);
  31214. }
  31215. function pointerId(event) {
  31216. const valueEvent = getValueEvent(event);
  31217. return isTouch(event) ? valueEvent.identifier : valueEvent.pointerId;
  31218. }
  31219. function pointerValues(event) {
  31220. const valueEvent = getValueEvent(event);
  31221. return [valueEvent.clientX, valueEvent.clientY];
  31222. }
  31223. const LINE_HEIGHT = 40;
  31224. const PAGE_HEIGHT = 800;
  31225. function wheelValues(event) {
  31226. let {
  31227. deltaX,
  31228. deltaY,
  31229. deltaMode
  31230. } = event;
  31231. if (deltaMode === 1) {
  31232. deltaX *= LINE_HEIGHT;
  31233. deltaY *= LINE_HEIGHT;
  31234. } else if (deltaMode === 2) {
  31235. deltaX *= PAGE_HEIGHT;
  31236. deltaY *= PAGE_HEIGHT;
  31237. }
  31238. return [deltaX, deltaY];
  31239. }
  31240. function scrollValues(event) {
  31241. var _ref, _ref2;
  31242. const {
  31243. scrollX,
  31244. scrollY,
  31245. scrollLeft,
  31246. scrollTop
  31247. } = event.currentTarget;
  31248. return [(_ref = scrollX !== null && scrollX !== void 0 ? scrollX : scrollLeft) !== null && _ref !== void 0 ? _ref : 0, (_ref2 = scrollY !== null && scrollY !== void 0 ? scrollY : scrollTop) !== null && _ref2 !== void 0 ? _ref2 : 0];
  31249. }
  31250. function getEventDetails(event) {
  31251. const payload = {};
  31252. if ('buttons' in event) payload.buttons = event.buttons;
  31253. if ('shiftKey' in event) {
  31254. const {
  31255. shiftKey,
  31256. altKey,
  31257. metaKey,
  31258. ctrlKey
  31259. } = event;
  31260. Object.assign(payload, {
  31261. shiftKey,
  31262. altKey,
  31263. metaKey,
  31264. ctrlKey
  31265. });
  31266. }
  31267. return payload;
  31268. }
  31269. function call(v, ...args) {
  31270. if (typeof v === 'function') {
  31271. return v(...args);
  31272. } else {
  31273. return v;
  31274. }
  31275. }
  31276. function noop() {}
  31277. function chain(...fns) {
  31278. if (fns.length === 0) return noop;
  31279. if (fns.length === 1) return fns[0];
  31280. return function () {
  31281. let result;
  31282. for (const fn of fns) {
  31283. result = fn.apply(this, arguments) || result;
  31284. }
  31285. return result;
  31286. };
  31287. }
  31288. function assignDefault(value, fallback) {
  31289. return Object.assign({}, fallback, value || {});
  31290. }
  31291. const BEFORE_LAST_KINEMATICS_DELAY = 32;
  31292. class Engine {
  31293. constructor(ctrl, args, key) {
  31294. this.ctrl = ctrl;
  31295. this.args = args;
  31296. this.key = key;
  31297. if (!this.state) {
  31298. this.state = {};
  31299. this.computeValues([0, 0]);
  31300. this.computeInitial();
  31301. if (this.init) this.init();
  31302. this.reset();
  31303. }
  31304. }
  31305. get state() {
  31306. return this.ctrl.state[this.key];
  31307. }
  31308. set state(state) {
  31309. this.ctrl.state[this.key] = state;
  31310. }
  31311. get shared() {
  31312. return this.ctrl.state.shared;
  31313. }
  31314. get eventStore() {
  31315. return this.ctrl.gestureEventStores[this.key];
  31316. }
  31317. get timeoutStore() {
  31318. return this.ctrl.gestureTimeoutStores[this.key];
  31319. }
  31320. get config() {
  31321. return this.ctrl.config[this.key];
  31322. }
  31323. get sharedConfig() {
  31324. return this.ctrl.config.shared;
  31325. }
  31326. get handler() {
  31327. return this.ctrl.handlers[this.key];
  31328. }
  31329. reset() {
  31330. const {
  31331. state,
  31332. shared,
  31333. ingKey,
  31334. args
  31335. } = this;
  31336. shared[ingKey] = state._active = state.active = state._blocked = state._force = false;
  31337. state._step = [false, false];
  31338. state.intentional = false;
  31339. state._movement = [0, 0];
  31340. state._distance = [0, 0];
  31341. state._direction = [0, 0];
  31342. state._delta = [0, 0];
  31343. state._bounds = [[-Infinity, Infinity], [-Infinity, Infinity]];
  31344. state.args = args;
  31345. state.axis = undefined;
  31346. state.memo = undefined;
  31347. state.elapsedTime = 0;
  31348. state.direction = [0, 0];
  31349. state.distance = [0, 0];
  31350. state.overflow = [0, 0];
  31351. state._movementBound = [false, false];
  31352. state.velocity = [0, 0];
  31353. state.movement = [0, 0];
  31354. state.delta = [0, 0];
  31355. state.timeStamp = 0;
  31356. }
  31357. start(event) {
  31358. const state = this.state;
  31359. const config = this.config;
  31360. if (!state._active) {
  31361. this.reset();
  31362. this.computeInitial();
  31363. state._active = true;
  31364. state.target = event.target;
  31365. state.currentTarget = event.currentTarget;
  31366. state.lastOffset = config.from ? call(config.from, state) : state.offset;
  31367. state.offset = state.lastOffset;
  31368. }
  31369. state.startTime = state.timeStamp = event.timeStamp;
  31370. }
  31371. computeValues(values) {
  31372. const state = this.state;
  31373. state._values = values;
  31374. state.values = this.config.transform(values);
  31375. }
  31376. computeInitial() {
  31377. const state = this.state;
  31378. state._initial = state._values;
  31379. state.initial = state.values;
  31380. }
  31381. compute(event) {
  31382. const {
  31383. state,
  31384. config,
  31385. shared
  31386. } = this;
  31387. state.args = this.args;
  31388. let dt = 0;
  31389. if (event) {
  31390. state.event = event;
  31391. if (config.preventDefault && event.cancelable) state.event.preventDefault();
  31392. state.type = event.type;
  31393. shared.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size;
  31394. shared.locked = !!document.pointerLockElement;
  31395. Object.assign(shared, getEventDetails(event));
  31396. shared.down = shared.pressed = shared.buttons % 2 === 1 || shared.touches > 0;
  31397. dt = event.timeStamp - state.timeStamp;
  31398. state.timeStamp = event.timeStamp;
  31399. state.elapsedTime = state.timeStamp - state.startTime;
  31400. }
  31401. if (state._active) {
  31402. const _absoluteDelta = state._delta.map(Math.abs);
  31403. V.addTo(state._distance, _absoluteDelta);
  31404. }
  31405. if (this.axisIntent) this.axisIntent(event);
  31406. const [_m0, _m1] = state._movement;
  31407. const [t0, t1] = config.threshold;
  31408. const {
  31409. _step,
  31410. values
  31411. } = state;
  31412. if (config.hasCustomTransform) {
  31413. if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && values[0];
  31414. if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && values[1];
  31415. } else {
  31416. if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && Math.sign(_m0) * t0;
  31417. if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && Math.sign(_m1) * t1;
  31418. }
  31419. state.intentional = _step[0] !== false || _step[1] !== false;
  31420. if (!state.intentional) return;
  31421. const movement = [0, 0];
  31422. if (config.hasCustomTransform) {
  31423. const [v0, v1] = values;
  31424. movement[0] = _step[0] !== false ? v0 - _step[0] : 0;
  31425. movement[1] = _step[1] !== false ? v1 - _step[1] : 0;
  31426. } else {
  31427. movement[0] = _step[0] !== false ? _m0 - _step[0] : 0;
  31428. movement[1] = _step[1] !== false ? _m1 - _step[1] : 0;
  31429. }
  31430. if (this.restrictToAxis && !state._blocked) this.restrictToAxis(movement);
  31431. const previousOffset = state.offset;
  31432. const gestureIsActive = state._active && !state._blocked || state.active;
  31433. if (gestureIsActive) {
  31434. state.first = state._active && !state.active;
  31435. state.last = !state._active && state.active;
  31436. state.active = shared[this.ingKey] = state._active;
  31437. if (event) {
  31438. if (state.first) {
  31439. if ('bounds' in config) state._bounds = call(config.bounds, state);
  31440. if (this.setup) this.setup();
  31441. }
  31442. state.movement = movement;
  31443. this.computeOffset();
  31444. }
  31445. }
  31446. const [ox, oy] = state.offset;
  31447. const [[x0, x1], [y0, y1]] = state._bounds;
  31448. state.overflow = [ox < x0 ? -1 : ox > x1 ? 1 : 0, oy < y0 ? -1 : oy > y1 ? 1 : 0];
  31449. state._movementBound[0] = state.overflow[0] ? state._movementBound[0] === false ? state._movement[0] : state._movementBound[0] : false;
  31450. state._movementBound[1] = state.overflow[1] ? state._movementBound[1] === false ? state._movement[1] : state._movementBound[1] : false;
  31451. const rubberband = state._active ? config.rubberband || [0, 0] : [0, 0];
  31452. state.offset = computeRubberband(state._bounds, state.offset, rubberband);
  31453. state.delta = V.sub(state.offset, previousOffset);
  31454. this.computeMovement();
  31455. if (gestureIsActive && (!state.last || dt > BEFORE_LAST_KINEMATICS_DELAY)) {
  31456. state.delta = V.sub(state.offset, previousOffset);
  31457. const absoluteDelta = state.delta.map(Math.abs);
  31458. V.addTo(state.distance, absoluteDelta);
  31459. state.direction = state.delta.map(Math.sign);
  31460. state._direction = state._delta.map(Math.sign);
  31461. if (!state.first && dt > 0) {
  31462. state.velocity = [absoluteDelta[0] / dt, absoluteDelta[1] / dt];
  31463. }
  31464. }
  31465. }
  31466. emit() {
  31467. const state = this.state;
  31468. const shared = this.shared;
  31469. const config = this.config;
  31470. if (!state._active) this.clean();
  31471. if ((state._blocked || !state.intentional) && !state._force && !config.triggerAllEvents) return;
  31472. const memo = this.handler(actions_e2a59bb9_esm_objectSpread2(actions_e2a59bb9_esm_objectSpread2(actions_e2a59bb9_esm_objectSpread2({}, shared), state), {}, {
  31473. [this.aliasKey]: state.values
  31474. }));
  31475. if (memo !== undefined) state.memo = memo;
  31476. }
  31477. clean() {
  31478. this.eventStore.clean();
  31479. this.timeoutStore.clean();
  31480. }
  31481. }
  31482. function selectAxis([dx, dy], threshold) {
  31483. const absDx = Math.abs(dx);
  31484. const absDy = Math.abs(dy);
  31485. if (absDx > absDy && absDx > threshold) {
  31486. return 'x';
  31487. }
  31488. if (absDy > absDx && absDy > threshold) {
  31489. return 'y';
  31490. }
  31491. return undefined;
  31492. }
  31493. class CoordinatesEngine extends Engine {
  31494. constructor(...args) {
  31495. super(...args);
  31496. actions_e2a59bb9_esm_defineProperty(this, "aliasKey", 'xy');
  31497. }
  31498. reset() {
  31499. super.reset();
  31500. this.state.axis = undefined;
  31501. }
  31502. init() {
  31503. this.state.offset = [0, 0];
  31504. this.state.lastOffset = [0, 0];
  31505. }
  31506. computeOffset() {
  31507. this.state.offset = V.add(this.state.lastOffset, this.state.movement);
  31508. }
  31509. computeMovement() {
  31510. this.state.movement = V.sub(this.state.offset, this.state.lastOffset);
  31511. }
  31512. axisIntent(event) {
  31513. const state = this.state;
  31514. const config = this.config;
  31515. if (!state.axis && event) {
  31516. const threshold = typeof config.axisThreshold === 'object' ? config.axisThreshold[getPointerType(event)] : config.axisThreshold;
  31517. state.axis = selectAxis(state._movement, threshold);
  31518. }
  31519. state._blocked = (config.lockDirection || !!config.axis) && !state.axis || !!config.axis && config.axis !== state.axis;
  31520. }
  31521. restrictToAxis(v) {
  31522. if (this.config.axis || this.config.lockDirection) {
  31523. switch (this.state.axis) {
  31524. case 'x':
  31525. v[1] = 0;
  31526. break;
  31527. case 'y':
  31528. v[0] = 0;
  31529. break;
  31530. }
  31531. }
  31532. }
  31533. }
  31534. const identity = v => v;
  31535. const DEFAULT_RUBBERBAND = 0.15;
  31536. const commonConfigResolver = {
  31537. enabled(value = true) {
  31538. return value;
  31539. },
  31540. eventOptions(value, _k, config) {
  31541. return actions_e2a59bb9_esm_objectSpread2(actions_e2a59bb9_esm_objectSpread2({}, config.shared.eventOptions), value);
  31542. },
  31543. preventDefault(value = false) {
  31544. return value;
  31545. },
  31546. triggerAllEvents(value = false) {
  31547. return value;
  31548. },
  31549. rubberband(value = 0) {
  31550. switch (value) {
  31551. case true:
  31552. return [DEFAULT_RUBBERBAND, DEFAULT_RUBBERBAND];
  31553. case false:
  31554. return [0, 0];
  31555. default:
  31556. return V.toVector(value);
  31557. }
  31558. },
  31559. from(value) {
  31560. if (typeof value === 'function') return value;
  31561. if (value != null) return V.toVector(value);
  31562. },
  31563. transform(value, _k, config) {
  31564. const transform = value || config.shared.transform;
  31565. this.hasCustomTransform = !!transform;
  31566. if (false) {}
  31567. return transform || identity;
  31568. },
  31569. threshold(value) {
  31570. return V.toVector(value, 0);
  31571. }
  31572. };
  31573. if (false) {}
  31574. const DEFAULT_AXIS_THRESHOLD = 0;
  31575. const coordinatesConfigResolver = actions_e2a59bb9_esm_objectSpread2(actions_e2a59bb9_esm_objectSpread2({}, commonConfigResolver), {}, {
  31576. axis(_v, _k, {
  31577. axis
  31578. }) {
  31579. this.lockDirection = axis === 'lock';
  31580. if (!this.lockDirection) return axis;
  31581. },
  31582. axisThreshold(value = DEFAULT_AXIS_THRESHOLD) {
  31583. return value;
  31584. },
  31585. bounds(value = {}) {
  31586. if (typeof value === 'function') {
  31587. return state => coordinatesConfigResolver.bounds(value(state));
  31588. }
  31589. if ('current' in value) {
  31590. return () => value.current;
  31591. }
  31592. if (typeof HTMLElement === 'function' && value instanceof HTMLElement) {
  31593. return value;
  31594. }
  31595. const {
  31596. left = -Infinity,
  31597. right = Infinity,
  31598. top = -Infinity,
  31599. bottom = Infinity
  31600. } = value;
  31601. return [[left, right], [top, bottom]];
  31602. }
  31603. });
  31604. const DISPLACEMENT = 10;
  31605. const KEYS_DELTA_MAP = {
  31606. ArrowRight: (factor = 1) => [DISPLACEMENT * factor, 0],
  31607. ArrowLeft: (factor = 1) => [-DISPLACEMENT * factor, 0],
  31608. ArrowUp: (factor = 1) => [0, -DISPLACEMENT * factor],
  31609. ArrowDown: (factor = 1) => [0, DISPLACEMENT * factor]
  31610. };
  31611. class DragEngine extends CoordinatesEngine {
  31612. constructor(...args) {
  31613. super(...args);
  31614. actions_e2a59bb9_esm_defineProperty(this, "ingKey", 'dragging');
  31615. }
  31616. reset() {
  31617. super.reset();
  31618. const state = this.state;
  31619. state._pointerId = undefined;
  31620. state._pointerActive = false;
  31621. state._keyboardActive = false;
  31622. state._preventScroll = false;
  31623. state._delayed = false;
  31624. state.swipe = [0, 0];
  31625. state.tap = false;
  31626. state.canceled = false;
  31627. state.cancel = this.cancel.bind(this);
  31628. }
  31629. setup() {
  31630. const state = this.state;
  31631. if (state._bounds instanceof HTMLElement) {
  31632. const boundRect = state._bounds.getBoundingClientRect();
  31633. const targetRect = state.currentTarget.getBoundingClientRect();
  31634. const _bounds = {
  31635. left: boundRect.left - targetRect.left + state.offset[0],
  31636. right: boundRect.right - targetRect.right + state.offset[0],
  31637. top: boundRect.top - targetRect.top + state.offset[1],
  31638. bottom: boundRect.bottom - targetRect.bottom + state.offset[1]
  31639. };
  31640. state._bounds = coordinatesConfigResolver.bounds(_bounds);
  31641. }
  31642. }
  31643. cancel() {
  31644. const state = this.state;
  31645. if (state.canceled) return;
  31646. state.canceled = true;
  31647. state._active = false;
  31648. setTimeout(() => {
  31649. this.compute();
  31650. this.emit();
  31651. }, 0);
  31652. }
  31653. setActive() {
  31654. this.state._active = this.state._pointerActive || this.state._keyboardActive;
  31655. }
  31656. clean() {
  31657. this.pointerClean();
  31658. this.state._pointerActive = false;
  31659. this.state._keyboardActive = false;
  31660. super.clean();
  31661. }
  31662. pointerDown(event) {
  31663. const config = this.config;
  31664. const state = this.state;
  31665. if (event.buttons != null && (Array.isArray(config.pointerButtons) ? !config.pointerButtons.includes(event.buttons) : config.pointerButtons !== -1 && config.pointerButtons !== event.buttons)) return;
  31666. const ctrlIds = this.ctrl.setEventIds(event);
  31667. if (config.pointerCapture) {
  31668. event.target.setPointerCapture(event.pointerId);
  31669. }
  31670. if (ctrlIds && ctrlIds.size > 1 && state._pointerActive) return;
  31671. this.start(event);
  31672. this.setupPointer(event);
  31673. state._pointerId = pointerId(event);
  31674. state._pointerActive = true;
  31675. this.computeValues(pointerValues(event));
  31676. this.computeInitial();
  31677. if (config.preventScrollAxis && getPointerType(event) !== 'mouse') {
  31678. state._active = false;
  31679. this.setupScrollPrevention(event);
  31680. } else if (config.delay > 0) {
  31681. this.setupDelayTrigger(event);
  31682. if (config.triggerAllEvents) {
  31683. this.compute(event);
  31684. this.emit();
  31685. }
  31686. } else {
  31687. this.startPointerDrag(event);
  31688. }
  31689. }
  31690. startPointerDrag(event) {
  31691. const state = this.state;
  31692. state._active = true;
  31693. state._preventScroll = true;
  31694. state._delayed = false;
  31695. this.compute(event);
  31696. this.emit();
  31697. }
  31698. pointerMove(event) {
  31699. const state = this.state;
  31700. const config = this.config;
  31701. if (!state._pointerActive) return;
  31702. if (state.type === event.type && event.timeStamp === state.timeStamp) return;
  31703. const id = pointerId(event);
  31704. if (state._pointerId !== undefined && id !== state._pointerId) return;
  31705. const _values = pointerValues(event);
  31706. if (document.pointerLockElement === event.target) {
  31707. state._delta = [event.movementX, event.movementY];
  31708. } else {
  31709. state._delta = V.sub(_values, state._values);
  31710. this.computeValues(_values);
  31711. }
  31712. V.addTo(state._movement, state._delta);
  31713. this.compute(event);
  31714. if (state._delayed && state.intentional) {
  31715. this.timeoutStore.remove('dragDelay');
  31716. state.active = false;
  31717. this.startPointerDrag(event);
  31718. return;
  31719. }
  31720. if (config.preventScrollAxis && !state._preventScroll) {
  31721. if (state.axis) {
  31722. if (state.axis === config.preventScrollAxis || config.preventScrollAxis === 'xy') {
  31723. state._active = false;
  31724. this.clean();
  31725. return;
  31726. } else {
  31727. this.timeoutStore.remove('startPointerDrag');
  31728. this.startPointerDrag(event);
  31729. return;
  31730. }
  31731. } else {
  31732. return;
  31733. }
  31734. }
  31735. this.emit();
  31736. }
  31737. pointerUp(event) {
  31738. this.ctrl.setEventIds(event);
  31739. try {
  31740. if (this.config.pointerCapture && event.target.hasPointerCapture(event.pointerId)) {
  31741. ;
  31742. event.target.releasePointerCapture(event.pointerId);
  31743. }
  31744. } catch (_unused) {
  31745. if (false) {}
  31746. }
  31747. const state = this.state;
  31748. const config = this.config;
  31749. if (!state._active || !state._pointerActive) return;
  31750. const id = pointerId(event);
  31751. if (state._pointerId !== undefined && id !== state._pointerId) return;
  31752. this.state._pointerActive = false;
  31753. this.setActive();
  31754. this.compute(event);
  31755. const [dx, dy] = state._distance;
  31756. state.tap = dx <= config.tapsThreshold && dy <= config.tapsThreshold;
  31757. if (state.tap && config.filterTaps) {
  31758. state._force = true;
  31759. } else {
  31760. const [dirx, diry] = state.direction;
  31761. const [vx, vy] = state.velocity;
  31762. const [mx, my] = state.movement;
  31763. const [svx, svy] = config.swipe.velocity;
  31764. const [sx, sy] = config.swipe.distance;
  31765. const sdt = config.swipe.duration;
  31766. if (state.elapsedTime < sdt) {
  31767. if (Math.abs(vx) > svx && Math.abs(mx) > sx) state.swipe[0] = dirx;
  31768. if (Math.abs(vy) > svy && Math.abs(my) > sy) state.swipe[1] = diry;
  31769. }
  31770. }
  31771. this.emit();
  31772. }
  31773. pointerClick(event) {
  31774. if (!this.state.tap) {
  31775. event.preventDefault();
  31776. event.stopPropagation();
  31777. }
  31778. }
  31779. setupPointer(event) {
  31780. const config = this.config;
  31781. const device = config.device;
  31782. if (false) {}
  31783. if (config.pointerLock) {
  31784. event.currentTarget.requestPointerLock();
  31785. }
  31786. if (!config.pointerCapture) {
  31787. this.eventStore.add(this.sharedConfig.window, device, 'change', this.pointerMove.bind(this));
  31788. this.eventStore.add(this.sharedConfig.window, device, 'end', this.pointerUp.bind(this));
  31789. this.eventStore.add(this.sharedConfig.window, device, 'cancel', this.pointerUp.bind(this));
  31790. }
  31791. }
  31792. pointerClean() {
  31793. if (this.config.pointerLock && document.pointerLockElement === this.state.currentTarget) {
  31794. document.exitPointerLock();
  31795. }
  31796. }
  31797. preventScroll(event) {
  31798. if (this.state._preventScroll && event.cancelable) {
  31799. event.preventDefault();
  31800. }
  31801. }
  31802. setupScrollPrevention(event) {
  31803. persistEvent(event);
  31804. const remove = this.eventStore.add(this.sharedConfig.window, 'touch', 'change', this.preventScroll.bind(this), {
  31805. passive: false
  31806. });
  31807. this.eventStore.add(this.sharedConfig.window, 'touch', 'end', remove);
  31808. this.eventStore.add(this.sharedConfig.window, 'touch', 'cancel', remove);
  31809. this.timeoutStore.add('startPointerDrag', this.startPointerDrag.bind(this), this.config.preventScrollDelay, event);
  31810. }
  31811. setupDelayTrigger(event) {
  31812. this.state._delayed = true;
  31813. this.timeoutStore.add('dragDelay', () => {
  31814. this.state._step = [0, 0];
  31815. this.startPointerDrag(event);
  31816. }, this.config.delay);
  31817. }
  31818. keyDown(event) {
  31819. const deltaFn = KEYS_DELTA_MAP[event.key];
  31820. if (deltaFn) {
  31821. const state = this.state;
  31822. const factor = event.shiftKey ? 10 : event.altKey ? 0.1 : 1;
  31823. this.start(event);
  31824. state._delta = deltaFn(factor);
  31825. state._keyboardActive = true;
  31826. V.addTo(state._movement, state._delta);
  31827. this.compute(event);
  31828. this.emit();
  31829. }
  31830. }
  31831. keyUp(event) {
  31832. if (!(event.key in KEYS_DELTA_MAP)) return;
  31833. this.state._keyboardActive = false;
  31834. this.setActive();
  31835. this.compute(event);
  31836. this.emit();
  31837. }
  31838. bind(bindFunction) {
  31839. const device = this.config.device;
  31840. bindFunction(device, 'start', this.pointerDown.bind(this));
  31841. if (this.config.pointerCapture) {
  31842. bindFunction(device, 'change', this.pointerMove.bind(this));
  31843. bindFunction(device, 'end', this.pointerUp.bind(this));
  31844. bindFunction(device, 'cancel', this.pointerUp.bind(this));
  31845. bindFunction('lostPointerCapture', '', this.pointerUp.bind(this));
  31846. }
  31847. bindFunction('key', 'down', this.keyDown.bind(this));
  31848. bindFunction('key', 'up', this.keyUp.bind(this));
  31849. if (this.config.filterTaps) {
  31850. bindFunction('click', '', this.pointerClick.bind(this), {
  31851. capture: true,
  31852. passive: false
  31853. });
  31854. }
  31855. }
  31856. }
  31857. function persistEvent(event) {
  31858. 'persist' in event && typeof event.persist === 'function' && event.persist();
  31859. }
  31860. const actions_e2a59bb9_esm_isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement;
  31861. function actions_e2a59bb9_esm_supportsTouchEvents() {
  31862. return actions_e2a59bb9_esm_isBrowser && 'ontouchstart' in window;
  31863. }
  31864. function isTouchScreen() {
  31865. return actions_e2a59bb9_esm_supportsTouchEvents() || actions_e2a59bb9_esm_isBrowser && window.navigator.maxTouchPoints > 1;
  31866. }
  31867. function actions_e2a59bb9_esm_supportsPointerEvents() {
  31868. return actions_e2a59bb9_esm_isBrowser && 'onpointerdown' in window;
  31869. }
  31870. function supportsPointerLock() {
  31871. return actions_e2a59bb9_esm_isBrowser && 'exitPointerLock' in window.document;
  31872. }
  31873. function supportsGestureEvents() {
  31874. try {
  31875. return 'constructor' in GestureEvent;
  31876. } catch (e) {
  31877. return false;
  31878. }
  31879. }
  31880. const SUPPORT = {
  31881. isBrowser: actions_e2a59bb9_esm_isBrowser,
  31882. gesture: supportsGestureEvents(),
  31883. touch: isTouchScreen(),
  31884. touchscreen: isTouchScreen(),
  31885. pointer: actions_e2a59bb9_esm_supportsPointerEvents(),
  31886. pointerLock: supportsPointerLock()
  31887. };
  31888. const DEFAULT_PREVENT_SCROLL_DELAY = 250;
  31889. const DEFAULT_DRAG_DELAY = 180;
  31890. const DEFAULT_SWIPE_VELOCITY = 0.5;
  31891. const DEFAULT_SWIPE_DISTANCE = 50;
  31892. const DEFAULT_SWIPE_DURATION = 250;
  31893. const DEFAULT_DRAG_AXIS_THRESHOLD = {
  31894. mouse: 0,
  31895. touch: 0,
  31896. pen: 8
  31897. };
  31898. const dragConfigResolver = actions_e2a59bb9_esm_objectSpread2(actions_e2a59bb9_esm_objectSpread2({}, coordinatesConfigResolver), {}, {
  31899. device(_v, _k, {
  31900. pointer: {
  31901. touch = false,
  31902. lock = false,
  31903. mouse = false
  31904. } = {}
  31905. }) {
  31906. this.pointerLock = lock && SUPPORT.pointerLock;
  31907. if (SUPPORT.touch && touch) return 'touch';
  31908. if (this.pointerLock) return 'mouse';
  31909. if (SUPPORT.pointer && !mouse) return 'pointer';
  31910. if (SUPPORT.touch) return 'touch';
  31911. return 'mouse';
  31912. },
  31913. preventScrollAxis(value, _k, {
  31914. preventScroll
  31915. }) {
  31916. this.preventScrollDelay = typeof preventScroll === 'number' ? preventScroll : preventScroll || preventScroll === undefined && value ? DEFAULT_PREVENT_SCROLL_DELAY : undefined;
  31917. if (!SUPPORT.touchscreen || preventScroll === false) return undefined;
  31918. return value ? value : preventScroll !== undefined ? 'y' : undefined;
  31919. },
  31920. pointerCapture(_v, _k, {
  31921. pointer: {
  31922. capture = true,
  31923. buttons = 1
  31924. } = {}
  31925. }) {
  31926. this.pointerButtons = buttons;
  31927. return !this.pointerLock && this.device === 'pointer' && capture;
  31928. },
  31929. threshold(value, _k, {
  31930. filterTaps = false,
  31931. tapsThreshold = 3,
  31932. axis = undefined
  31933. }) {
  31934. const threshold = V.toVector(value, filterTaps ? tapsThreshold : axis ? 1 : 0);
  31935. this.filterTaps = filterTaps;
  31936. this.tapsThreshold = tapsThreshold;
  31937. return threshold;
  31938. },
  31939. swipe({
  31940. velocity = DEFAULT_SWIPE_VELOCITY,
  31941. distance = DEFAULT_SWIPE_DISTANCE,
  31942. duration = DEFAULT_SWIPE_DURATION
  31943. } = {}) {
  31944. return {
  31945. velocity: this.transform(V.toVector(velocity)),
  31946. distance: this.transform(V.toVector(distance)),
  31947. duration
  31948. };
  31949. },
  31950. delay(value = 0) {
  31951. switch (value) {
  31952. case true:
  31953. return DEFAULT_DRAG_DELAY;
  31954. case false:
  31955. return 0;
  31956. default:
  31957. return value;
  31958. }
  31959. },
  31960. axisThreshold(value) {
  31961. if (!value) return DEFAULT_DRAG_AXIS_THRESHOLD;
  31962. return actions_e2a59bb9_esm_objectSpread2(actions_e2a59bb9_esm_objectSpread2({}, DEFAULT_DRAG_AXIS_THRESHOLD), value);
  31963. }
  31964. });
  31965. if (false) {}
  31966. const SCALE_ANGLE_RATIO_INTENT_DEG = 30;
  31967. const PINCH_WHEEL_RATIO = 100;
  31968. class PinchEngine extends Engine {
  31969. constructor(...args) {
  31970. super(...args);
  31971. actions_e2a59bb9_esm_defineProperty(this, "ingKey", 'pinching');
  31972. actions_e2a59bb9_esm_defineProperty(this, "aliasKey", 'da');
  31973. }
  31974. init() {
  31975. this.state.offset = [1, 0];
  31976. this.state.lastOffset = [1, 0];
  31977. this.state._pointerEvents = new Map();
  31978. }
  31979. reset() {
  31980. super.reset();
  31981. const state = this.state;
  31982. state._touchIds = [];
  31983. state.canceled = false;
  31984. state.cancel = this.cancel.bind(this);
  31985. state.turns = 0;
  31986. }
  31987. computeOffset() {
  31988. const {
  31989. type,
  31990. movement,
  31991. lastOffset
  31992. } = this.state;
  31993. if (type === 'wheel') {
  31994. this.state.offset = V.add(movement, lastOffset);
  31995. } else {
  31996. this.state.offset = [(1 + movement[0]) * lastOffset[0], movement[1] + lastOffset[1]];
  31997. }
  31998. }
  31999. computeMovement() {
  32000. const {
  32001. offset,
  32002. lastOffset
  32003. } = this.state;
  32004. this.state.movement = [offset[0] / lastOffset[0], offset[1] - lastOffset[1]];
  32005. }
  32006. axisIntent() {
  32007. const state = this.state;
  32008. const [_m0, _m1] = state._movement;
  32009. if (!state.axis) {
  32010. const axisMovementDifference = Math.abs(_m0) * SCALE_ANGLE_RATIO_INTENT_DEG - Math.abs(_m1);
  32011. if (axisMovementDifference < 0) state.axis = 'angle';else if (axisMovementDifference > 0) state.axis = 'scale';
  32012. }
  32013. }
  32014. restrictToAxis(v) {
  32015. if (this.config.lockDirection) {
  32016. if (this.state.axis === 'scale') v[1] = 0;else if (this.state.axis === 'angle') v[0] = 0;
  32017. }
  32018. }
  32019. cancel() {
  32020. const state = this.state;
  32021. if (state.canceled) return;
  32022. setTimeout(() => {
  32023. state.canceled = true;
  32024. state._active = false;
  32025. this.compute();
  32026. this.emit();
  32027. }, 0);
  32028. }
  32029. touchStart(event) {
  32030. this.ctrl.setEventIds(event);
  32031. const state = this.state;
  32032. const ctrlTouchIds = this.ctrl.touchIds;
  32033. if (state._active) {
  32034. if (state._touchIds.every(id => ctrlTouchIds.has(id))) return;
  32035. }
  32036. if (ctrlTouchIds.size < 2) return;
  32037. this.start(event);
  32038. state._touchIds = Array.from(ctrlTouchIds).slice(0, 2);
  32039. const payload = touchDistanceAngle(event, state._touchIds);
  32040. this.pinchStart(event, payload);
  32041. }
  32042. pointerStart(event) {
  32043. if (event.buttons != null && event.buttons % 2 !== 1) return;
  32044. this.ctrl.setEventIds(event);
  32045. event.target.setPointerCapture(event.pointerId);
  32046. const state = this.state;
  32047. const _pointerEvents = state._pointerEvents;
  32048. const ctrlPointerIds = this.ctrl.pointerIds;
  32049. if (state._active) {
  32050. if (Array.from(_pointerEvents.keys()).every(id => ctrlPointerIds.has(id))) return;
  32051. }
  32052. if (_pointerEvents.size < 2) {
  32053. _pointerEvents.set(event.pointerId, event);
  32054. }
  32055. if (state._pointerEvents.size < 2) return;
  32056. this.start(event);
  32057. const payload = distanceAngle(...Array.from(_pointerEvents.values()));
  32058. this.pinchStart(event, payload);
  32059. }
  32060. pinchStart(event, payload) {
  32061. const state = this.state;
  32062. state.origin = payload.origin;
  32063. this.computeValues([payload.distance, payload.angle]);
  32064. this.computeInitial();
  32065. this.compute(event);
  32066. this.emit();
  32067. }
  32068. touchMove(event) {
  32069. if (!this.state._active) return;
  32070. const payload = touchDistanceAngle(event, this.state._touchIds);
  32071. this.pinchMove(event, payload);
  32072. }
  32073. pointerMove(event) {
  32074. const _pointerEvents = this.state._pointerEvents;
  32075. if (_pointerEvents.has(event.pointerId)) {
  32076. _pointerEvents.set(event.pointerId, event);
  32077. }
  32078. if (!this.state._active) return;
  32079. const payload = distanceAngle(...Array.from(_pointerEvents.values()));
  32080. this.pinchMove(event, payload);
  32081. }
  32082. pinchMove(event, payload) {
  32083. const state = this.state;
  32084. const prev_a = state._values[1];
  32085. const delta_a = payload.angle - prev_a;
  32086. let delta_turns = 0;
  32087. if (Math.abs(delta_a) > 270) delta_turns += Math.sign(delta_a);
  32088. this.computeValues([payload.distance, payload.angle - 360 * delta_turns]);
  32089. state.origin = payload.origin;
  32090. state.turns = delta_turns;
  32091. state._movement = [state._values[0] / state._initial[0] - 1, state._values[1] - state._initial[1]];
  32092. this.compute(event);
  32093. this.emit();
  32094. }
  32095. touchEnd(event) {
  32096. this.ctrl.setEventIds(event);
  32097. if (!this.state._active) return;
  32098. if (this.state._touchIds.some(id => !this.ctrl.touchIds.has(id))) {
  32099. this.state._active = false;
  32100. this.compute(event);
  32101. this.emit();
  32102. }
  32103. }
  32104. pointerEnd(event) {
  32105. const state = this.state;
  32106. this.ctrl.setEventIds(event);
  32107. try {
  32108. event.target.releasePointerCapture(event.pointerId);
  32109. } catch (_unused) {}
  32110. if (state._pointerEvents.has(event.pointerId)) {
  32111. state._pointerEvents.delete(event.pointerId);
  32112. }
  32113. if (!state._active) return;
  32114. if (state._pointerEvents.size < 2) {
  32115. state._active = false;
  32116. this.compute(event);
  32117. this.emit();
  32118. }
  32119. }
  32120. gestureStart(event) {
  32121. if (event.cancelable) event.preventDefault();
  32122. const state = this.state;
  32123. if (state._active) return;
  32124. this.start(event);
  32125. this.computeValues([event.scale, event.rotation]);
  32126. state.origin = [event.clientX, event.clientY];
  32127. this.compute(event);
  32128. this.emit();
  32129. }
  32130. gestureMove(event) {
  32131. if (event.cancelable) event.preventDefault();
  32132. if (!this.state._active) return;
  32133. const state = this.state;
  32134. this.computeValues([event.scale, event.rotation]);
  32135. state.origin = [event.clientX, event.clientY];
  32136. const _previousMovement = state._movement;
  32137. state._movement = [event.scale - 1, event.rotation];
  32138. state._delta = V.sub(state._movement, _previousMovement);
  32139. this.compute(event);
  32140. this.emit();
  32141. }
  32142. gestureEnd(event) {
  32143. if (!this.state._active) return;
  32144. this.state._active = false;
  32145. this.compute(event);
  32146. this.emit();
  32147. }
  32148. wheel(event) {
  32149. const modifierKey = this.config.modifierKey;
  32150. if (modifierKey && !event[modifierKey]) return;
  32151. if (!this.state._active) this.wheelStart(event);else this.wheelChange(event);
  32152. this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));
  32153. }
  32154. wheelStart(event) {
  32155. this.start(event);
  32156. this.wheelChange(event);
  32157. }
  32158. wheelChange(event) {
  32159. const isR3f = ('uv' in event);
  32160. if (!isR3f) {
  32161. if (event.cancelable) {
  32162. event.preventDefault();
  32163. }
  32164. if (false) {}
  32165. }
  32166. const state = this.state;
  32167. state._delta = [-wheelValues(event)[1] / PINCH_WHEEL_RATIO * state.offset[0], 0];
  32168. V.addTo(state._movement, state._delta);
  32169. this.state.origin = [event.clientX, event.clientY];
  32170. this.compute(event);
  32171. this.emit();
  32172. }
  32173. wheelEnd() {
  32174. if (!this.state._active) return;
  32175. this.state._active = false;
  32176. this.compute();
  32177. this.emit();
  32178. }
  32179. bind(bindFunction) {
  32180. const device = this.config.device;
  32181. if (!!device) {
  32182. bindFunction(device, 'start', this[device + 'Start'].bind(this));
  32183. bindFunction(device, 'change', this[device + 'Move'].bind(this));
  32184. bindFunction(device, 'end', this[device + 'End'].bind(this));
  32185. bindFunction(device, 'cancel', this[device + 'End'].bind(this));
  32186. } else {
  32187. bindFunction('wheel', '', this.wheel.bind(this), {
  32188. passive: false
  32189. });
  32190. }
  32191. }
  32192. }
  32193. const pinchConfigResolver = actions_e2a59bb9_esm_objectSpread2(actions_e2a59bb9_esm_objectSpread2({}, commonConfigResolver), {}, {
  32194. device(_v, _k, {
  32195. shared,
  32196. pointer: {
  32197. touch = false
  32198. } = {}
  32199. }) {
  32200. const sharedConfig = shared;
  32201. if (sharedConfig.target && !SUPPORT.touch && SUPPORT.gesture) return 'gesture';
  32202. if (SUPPORT.touch && touch) return 'touch';
  32203. if (SUPPORT.touchscreen) {
  32204. if (SUPPORT.pointer) return 'pointer';
  32205. if (SUPPORT.touch) return 'touch';
  32206. }
  32207. },
  32208. bounds(_v, _k, {
  32209. scaleBounds = {},
  32210. angleBounds = {}
  32211. }) {
  32212. const _scaleBounds = state => {
  32213. const D = assignDefault(call(scaleBounds, state), {
  32214. min: -Infinity,
  32215. max: Infinity
  32216. });
  32217. return [D.min, D.max];
  32218. };
  32219. const _angleBounds = state => {
  32220. const A = assignDefault(call(angleBounds, state), {
  32221. min: -Infinity,
  32222. max: Infinity
  32223. });
  32224. return [A.min, A.max];
  32225. };
  32226. if (typeof scaleBounds !== 'function' && typeof angleBounds !== 'function') return [_scaleBounds(), _angleBounds()];
  32227. return state => [_scaleBounds(state), _angleBounds(state)];
  32228. },
  32229. threshold(value, _k, config) {
  32230. this.lockDirection = config.axis === 'lock';
  32231. const threshold = V.toVector(value, this.lockDirection ? [0.1, 3] : 0);
  32232. return threshold;
  32233. },
  32234. modifierKey(value) {
  32235. if (value === undefined) return 'ctrlKey';
  32236. return value;
  32237. }
  32238. });
  32239. class MoveEngine extends CoordinatesEngine {
  32240. constructor(...args) {
  32241. super(...args);
  32242. actions_e2a59bb9_esm_defineProperty(this, "ingKey", 'moving');
  32243. }
  32244. move(event) {
  32245. if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
  32246. if (!this.state._active) this.moveStart(event);else this.moveChange(event);
  32247. this.timeoutStore.add('moveEnd', this.moveEnd.bind(this));
  32248. }
  32249. moveStart(event) {
  32250. this.start(event);
  32251. this.computeValues(pointerValues(event));
  32252. this.compute(event);
  32253. this.computeInitial();
  32254. this.emit();
  32255. }
  32256. moveChange(event) {
  32257. if (!this.state._active) return;
  32258. const values = pointerValues(event);
  32259. const state = this.state;
  32260. state._delta = V.sub(values, state._values);
  32261. V.addTo(state._movement, state._delta);
  32262. this.computeValues(values);
  32263. this.compute(event);
  32264. this.emit();
  32265. }
  32266. moveEnd(event) {
  32267. if (!this.state._active) return;
  32268. this.state._active = false;
  32269. this.compute(event);
  32270. this.emit();
  32271. }
  32272. bind(bindFunction) {
  32273. bindFunction('pointer', 'change', this.move.bind(this));
  32274. bindFunction('pointer', 'leave', this.moveEnd.bind(this));
  32275. }
  32276. }
  32277. const moveConfigResolver = actions_e2a59bb9_esm_objectSpread2(actions_e2a59bb9_esm_objectSpread2({}, coordinatesConfigResolver), {}, {
  32278. mouseOnly: (value = true) => value
  32279. });
  32280. class ScrollEngine extends CoordinatesEngine {
  32281. constructor(...args) {
  32282. super(...args);
  32283. actions_e2a59bb9_esm_defineProperty(this, "ingKey", 'scrolling');
  32284. }
  32285. scroll(event) {
  32286. if (!this.state._active) this.start(event);
  32287. this.scrollChange(event);
  32288. this.timeoutStore.add('scrollEnd', this.scrollEnd.bind(this));
  32289. }
  32290. scrollChange(event) {
  32291. if (event.cancelable) event.preventDefault();
  32292. const state = this.state;
  32293. const values = scrollValues(event);
  32294. state._delta = V.sub(values, state._values);
  32295. V.addTo(state._movement, state._delta);
  32296. this.computeValues(values);
  32297. this.compute(event);
  32298. this.emit();
  32299. }
  32300. scrollEnd() {
  32301. if (!this.state._active) return;
  32302. this.state._active = false;
  32303. this.compute();
  32304. this.emit();
  32305. }
  32306. bind(bindFunction) {
  32307. bindFunction('scroll', '', this.scroll.bind(this));
  32308. }
  32309. }
  32310. const scrollConfigResolver = coordinatesConfigResolver;
  32311. class WheelEngine extends CoordinatesEngine {
  32312. constructor(...args) {
  32313. super(...args);
  32314. actions_e2a59bb9_esm_defineProperty(this, "ingKey", 'wheeling');
  32315. }
  32316. wheel(event) {
  32317. if (!this.state._active) this.start(event);
  32318. this.wheelChange(event);
  32319. this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));
  32320. }
  32321. wheelChange(event) {
  32322. const state = this.state;
  32323. state._delta = wheelValues(event);
  32324. V.addTo(state._movement, state._delta);
  32325. const [ox, oy] = state.overflow;
  32326. const [dx, dy] = state._delta;
  32327. const [dirx, diry] = state._direction;
  32328. if (ox < 0 && dx > 0 && dirx < 0 || ox > 0 && dx < 0 && dirx > 0) {
  32329. state._movement[0] = state._movementBound[0];
  32330. }
  32331. if (oy < 0 && dy > 0 && diry < 0 || oy > 0 && dy < 0 && diry > 0) {
  32332. state._movement[1] = state._movementBound[1];
  32333. }
  32334. this.compute(event);
  32335. this.emit();
  32336. }
  32337. wheelEnd() {
  32338. if (!this.state._active) return;
  32339. this.state._active = false;
  32340. this.compute();
  32341. this.emit();
  32342. }
  32343. bind(bindFunction) {
  32344. bindFunction('wheel', '', this.wheel.bind(this));
  32345. }
  32346. }
  32347. const wheelConfigResolver = coordinatesConfigResolver;
  32348. class HoverEngine extends CoordinatesEngine {
  32349. constructor(...args) {
  32350. super(...args);
  32351. actions_e2a59bb9_esm_defineProperty(this, "ingKey", 'hovering');
  32352. }
  32353. enter(event) {
  32354. if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
  32355. this.start(event);
  32356. this.computeValues(pointerValues(event));
  32357. this.compute(event);
  32358. this.emit();
  32359. }
  32360. leave(event) {
  32361. if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
  32362. const state = this.state;
  32363. if (!state._active) return;
  32364. state._active = false;
  32365. const values = pointerValues(event);
  32366. state._movement = state._delta = V.sub(values, state._values);
  32367. this.computeValues(values);
  32368. this.compute(event);
  32369. state.delta = state.movement;
  32370. this.emit();
  32371. }
  32372. bind(bindFunction) {
  32373. bindFunction('pointer', 'enter', this.enter.bind(this));
  32374. bindFunction('pointer', 'leave', this.leave.bind(this));
  32375. }
  32376. }
  32377. const hoverConfigResolver = actions_e2a59bb9_esm_objectSpread2(actions_e2a59bb9_esm_objectSpread2({}, coordinatesConfigResolver), {}, {
  32378. mouseOnly: (value = true) => value
  32379. });
  32380. const actions_e2a59bb9_esm_EngineMap = new Map();
  32381. const ConfigResolverMap = new Map();
  32382. function actions_e2a59bb9_esm_registerAction(action) {
  32383. actions_e2a59bb9_esm_EngineMap.set(action.key, action.engine);
  32384. ConfigResolverMap.set(action.key, action.resolver);
  32385. }
  32386. const actions_e2a59bb9_esm_dragAction = {
  32387. key: 'drag',
  32388. engine: DragEngine,
  32389. resolver: dragConfigResolver
  32390. };
  32391. const actions_e2a59bb9_esm_hoverAction = {
  32392. key: 'hover',
  32393. engine: HoverEngine,
  32394. resolver: hoverConfigResolver
  32395. };
  32396. const actions_e2a59bb9_esm_moveAction = {
  32397. key: 'move',
  32398. engine: MoveEngine,
  32399. resolver: moveConfigResolver
  32400. };
  32401. const actions_e2a59bb9_esm_pinchAction = {
  32402. key: 'pinch',
  32403. engine: PinchEngine,
  32404. resolver: pinchConfigResolver
  32405. };
  32406. const actions_e2a59bb9_esm_scrollAction = {
  32407. key: 'scroll',
  32408. engine: ScrollEngine,
  32409. resolver: scrollConfigResolver
  32410. };
  32411. const actions_e2a59bb9_esm_wheelAction = {
  32412. key: 'wheel',
  32413. engine: WheelEngine,
  32414. resolver: wheelConfigResolver
  32415. };
  32416. ;// CONCATENATED MODULE: ./node_modules/@use-gesture/core/dist/use-gesture-core.esm.js
  32417. function use_gesture_core_esm_objectWithoutPropertiesLoose(source, excluded) {
  32418. if (source == null) return {};
  32419. var target = {};
  32420. var sourceKeys = Object.keys(source);
  32421. var key, i;
  32422. for (i = 0; i < sourceKeys.length; i++) {
  32423. key = sourceKeys[i];
  32424. if (excluded.indexOf(key) >= 0) continue;
  32425. target[key] = source[key];
  32426. }
  32427. return target;
  32428. }
  32429. function _objectWithoutProperties(source, excluded) {
  32430. if (source == null) return {};
  32431. var target = use_gesture_core_esm_objectWithoutPropertiesLoose(source, excluded);
  32432. var key, i;
  32433. if (Object.getOwnPropertySymbols) {
  32434. var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
  32435. for (i = 0; i < sourceSymbolKeys.length; i++) {
  32436. key = sourceSymbolKeys[i];
  32437. if (excluded.indexOf(key) >= 0) continue;
  32438. if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
  32439. target[key] = source[key];
  32440. }
  32441. }
  32442. return target;
  32443. }
  32444. const sharedConfigResolver = {
  32445. target(value) {
  32446. if (value) {
  32447. return () => 'current' in value ? value.current : value;
  32448. }
  32449. return undefined;
  32450. },
  32451. enabled(value = true) {
  32452. return value;
  32453. },
  32454. window(value = SUPPORT.isBrowser ? window : undefined) {
  32455. return value;
  32456. },
  32457. eventOptions({
  32458. passive = true,
  32459. capture = false
  32460. } = {}) {
  32461. return {
  32462. passive,
  32463. capture
  32464. };
  32465. },
  32466. transform(value) {
  32467. return value;
  32468. }
  32469. };
  32470. const _excluded = ["target", "eventOptions", "window", "enabled", "transform"];
  32471. function resolveWith(config = {}, resolvers) {
  32472. const result = {};
  32473. for (const [key, resolver] of Object.entries(resolvers)) {
  32474. switch (typeof resolver) {
  32475. case 'function':
  32476. if (false) {} else {
  32477. result[key] = resolver.call(result, config[key], key, config);
  32478. }
  32479. break;
  32480. case 'object':
  32481. result[key] = resolveWith(config[key], resolver);
  32482. break;
  32483. case 'boolean':
  32484. if (resolver) result[key] = config[key];
  32485. break;
  32486. }
  32487. }
  32488. return result;
  32489. }
  32490. function use_gesture_core_esm_parse(config, gestureKey) {
  32491. const _ref = config,
  32492. {
  32493. target,
  32494. eventOptions,
  32495. window,
  32496. enabled,
  32497. transform
  32498. } = _ref,
  32499. rest = _objectWithoutProperties(_ref, _excluded);
  32500. const _config = {
  32501. shared: resolveWith({
  32502. target,
  32503. eventOptions,
  32504. window,
  32505. enabled,
  32506. transform
  32507. }, sharedConfigResolver)
  32508. };
  32509. if (gestureKey) {
  32510. const resolver = ConfigResolverMap.get(gestureKey);
  32511. _config[gestureKey] = resolveWith(actions_e2a59bb9_esm_objectSpread2({
  32512. shared: _config.shared
  32513. }, rest), resolver);
  32514. } else {
  32515. for (const key in rest) {
  32516. const resolver = ConfigResolverMap.get(key);
  32517. if (resolver) {
  32518. _config[key] = resolveWith(actions_e2a59bb9_esm_objectSpread2({
  32519. shared: _config.shared
  32520. }, rest[key]), resolver);
  32521. } else if (false) {}
  32522. }
  32523. }
  32524. return _config;
  32525. }
  32526. class EventStore {
  32527. constructor(ctrl, gestureKey) {
  32528. actions_e2a59bb9_esm_defineProperty(this, "_listeners", new Set());
  32529. this._ctrl = ctrl;
  32530. this._gestureKey = gestureKey;
  32531. }
  32532. add(element, device, action, handler, options) {
  32533. const listeners = this._listeners;
  32534. const type = toDomEventType(device, action);
  32535. const _options = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {};
  32536. const eventOptions = actions_e2a59bb9_esm_objectSpread2(actions_e2a59bb9_esm_objectSpread2({}, _options), options);
  32537. element.addEventListener(type, handler, eventOptions);
  32538. const remove = () => {
  32539. element.removeEventListener(type, handler, eventOptions);
  32540. listeners.delete(remove);
  32541. };
  32542. listeners.add(remove);
  32543. return remove;
  32544. }
  32545. clean() {
  32546. this._listeners.forEach(remove => remove());
  32547. this._listeners.clear();
  32548. }
  32549. }
  32550. class TimeoutStore {
  32551. constructor() {
  32552. actions_e2a59bb9_esm_defineProperty(this, "_timeouts", new Map());
  32553. }
  32554. add(key, callback, ms = 140, ...args) {
  32555. this.remove(key);
  32556. this._timeouts.set(key, window.setTimeout(callback, ms, ...args));
  32557. }
  32558. remove(key) {
  32559. const timeout = this._timeouts.get(key);
  32560. if (timeout) window.clearTimeout(timeout);
  32561. }
  32562. clean() {
  32563. this._timeouts.forEach(timeout => void window.clearTimeout(timeout));
  32564. this._timeouts.clear();
  32565. }
  32566. }
  32567. class Controller {
  32568. constructor(handlers) {
  32569. actions_e2a59bb9_esm_defineProperty(this, "gestures", new Set());
  32570. actions_e2a59bb9_esm_defineProperty(this, "_targetEventStore", new EventStore(this));
  32571. actions_e2a59bb9_esm_defineProperty(this, "gestureEventStores", {});
  32572. actions_e2a59bb9_esm_defineProperty(this, "gestureTimeoutStores", {});
  32573. actions_e2a59bb9_esm_defineProperty(this, "handlers", {});
  32574. actions_e2a59bb9_esm_defineProperty(this, "config", {});
  32575. actions_e2a59bb9_esm_defineProperty(this, "pointerIds", new Set());
  32576. actions_e2a59bb9_esm_defineProperty(this, "touchIds", new Set());
  32577. actions_e2a59bb9_esm_defineProperty(this, "state", {
  32578. shared: {
  32579. shiftKey: false,
  32580. metaKey: false,
  32581. ctrlKey: false,
  32582. altKey: false
  32583. }
  32584. });
  32585. resolveGestures(this, handlers);
  32586. }
  32587. setEventIds(event) {
  32588. if (isTouch(event)) {
  32589. this.touchIds = new Set(touchIds(event));
  32590. return this.touchIds;
  32591. } else if ('pointerId' in event) {
  32592. if (event.type === 'pointerup' || event.type === 'pointercancel') this.pointerIds.delete(event.pointerId);else if (event.type === 'pointerdown') this.pointerIds.add(event.pointerId);
  32593. return this.pointerIds;
  32594. }
  32595. }
  32596. applyHandlers(handlers, nativeHandlers) {
  32597. this.handlers = handlers;
  32598. this.nativeHandlers = nativeHandlers;
  32599. }
  32600. applyConfig(config, gestureKey) {
  32601. this.config = use_gesture_core_esm_parse(config, gestureKey);
  32602. }
  32603. clean() {
  32604. this._targetEventStore.clean();
  32605. for (const key of this.gestures) {
  32606. this.gestureEventStores[key].clean();
  32607. this.gestureTimeoutStores[key].clean();
  32608. }
  32609. }
  32610. effect() {
  32611. if (this.config.shared.target) this.bind();
  32612. return () => this._targetEventStore.clean();
  32613. }
  32614. bind(...args) {
  32615. const sharedConfig = this.config.shared;
  32616. const props = {};
  32617. let target;
  32618. if (sharedConfig.target) {
  32619. target = sharedConfig.target();
  32620. if (!target) return;
  32621. }
  32622. if (sharedConfig.enabled) {
  32623. for (const gestureKey of this.gestures) {
  32624. const gestureConfig = this.config[gestureKey];
  32625. const bindFunction = bindToProps(props, gestureConfig.eventOptions, !!target);
  32626. if (gestureConfig.enabled) {
  32627. const Engine = actions_e2a59bb9_esm_EngineMap.get(gestureKey);
  32628. new Engine(this, args, gestureKey).bind(bindFunction);
  32629. }
  32630. }
  32631. const nativeBindFunction = bindToProps(props, sharedConfig.eventOptions, !!target);
  32632. for (const eventKey in this.nativeHandlers) {
  32633. nativeBindFunction(eventKey, '', event => this.nativeHandlers[eventKey](actions_e2a59bb9_esm_objectSpread2(actions_e2a59bb9_esm_objectSpread2({}, this.state.shared), {}, {
  32634. event,
  32635. args
  32636. })), undefined, true);
  32637. }
  32638. }
  32639. for (const handlerProp in props) {
  32640. props[handlerProp] = chain(...props[handlerProp]);
  32641. }
  32642. if (!target) return props;
  32643. for (const handlerProp in props) {
  32644. const {
  32645. device,
  32646. capture,
  32647. passive
  32648. } = parseProp(handlerProp);
  32649. this._targetEventStore.add(target, device, '', props[handlerProp], {
  32650. capture,
  32651. passive
  32652. });
  32653. }
  32654. }
  32655. }
  32656. function setupGesture(ctrl, gestureKey) {
  32657. ctrl.gestures.add(gestureKey);
  32658. ctrl.gestureEventStores[gestureKey] = new EventStore(ctrl, gestureKey);
  32659. ctrl.gestureTimeoutStores[gestureKey] = new TimeoutStore();
  32660. }
  32661. function resolveGestures(ctrl, internalHandlers) {
  32662. if (internalHandlers.drag) setupGesture(ctrl, 'drag');
  32663. if (internalHandlers.wheel) setupGesture(ctrl, 'wheel');
  32664. if (internalHandlers.scroll) setupGesture(ctrl, 'scroll');
  32665. if (internalHandlers.move) setupGesture(ctrl, 'move');
  32666. if (internalHandlers.pinch) setupGesture(ctrl, 'pinch');
  32667. if (internalHandlers.hover) setupGesture(ctrl, 'hover');
  32668. }
  32669. const bindToProps = (props, eventOptions, withPassiveOption) => (device, action, handler, options = {}, isNative = false) => {
  32670. var _options$capture, _options$passive;
  32671. const capture = (_options$capture = options.capture) !== null && _options$capture !== void 0 ? _options$capture : eventOptions.capture;
  32672. const passive = (_options$passive = options.passive) !== null && _options$passive !== void 0 ? _options$passive : eventOptions.passive;
  32673. let handlerProp = isNative ? device : toHandlerProp(device, action, capture);
  32674. if (withPassiveOption && passive) handlerProp += 'Passive';
  32675. props[handlerProp] = props[handlerProp] || [];
  32676. props[handlerProp].push(handler);
  32677. };
  32678. const RE_NOT_NATIVE = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;
  32679. function sortHandlers(_handlers) {
  32680. const native = {};
  32681. const handlers = {};
  32682. const actions = new Set();
  32683. for (let key in _handlers) {
  32684. if (RE_NOT_NATIVE.test(key)) {
  32685. actions.add(RegExp.lastMatch);
  32686. handlers[key] = _handlers[key];
  32687. } else {
  32688. native[key] = _handlers[key];
  32689. }
  32690. }
  32691. return [handlers, native, actions];
  32692. }
  32693. function registerGesture(actions, handlers, handlerKey, key, internalHandlers, config) {
  32694. if (!actions.has(handlerKey)) return;
  32695. if (!EngineMap.has(key)) {
  32696. if (false) {}
  32697. return;
  32698. }
  32699. const startKey = handlerKey + 'Start';
  32700. const endKey = handlerKey + 'End';
  32701. const fn = state => {
  32702. let memo = undefined;
  32703. if (state.first && startKey in handlers) handlers[startKey](state);
  32704. if (handlerKey in handlers) memo = handlers[handlerKey](state);
  32705. if (state.last && endKey in handlers) handlers[endKey](state);
  32706. return memo;
  32707. };
  32708. internalHandlers[key] = fn;
  32709. config[key] = config[key] || {};
  32710. }
  32711. function use_gesture_core_esm_parseMergedHandlers(mergedHandlers, mergedConfig) {
  32712. const [handlers, nativeHandlers, actions] = sortHandlers(mergedHandlers);
  32713. const internalHandlers = {};
  32714. registerGesture(actions, handlers, 'onDrag', 'drag', internalHandlers, mergedConfig);
  32715. registerGesture(actions, handlers, 'onWheel', 'wheel', internalHandlers, mergedConfig);
  32716. registerGesture(actions, handlers, 'onScroll', 'scroll', internalHandlers, mergedConfig);
  32717. registerGesture(actions, handlers, 'onPinch', 'pinch', internalHandlers, mergedConfig);
  32718. registerGesture(actions, handlers, 'onMove', 'move', internalHandlers, mergedConfig);
  32719. registerGesture(actions, handlers, 'onHover', 'hover', internalHandlers, mergedConfig);
  32720. return {
  32721. handlers: internalHandlers,
  32722. config: mergedConfig,
  32723. nativeHandlers
  32724. };
  32725. }
  32726. ;// CONCATENATED MODULE: ./node_modules/@use-gesture/react/dist/use-gesture-react.esm.js
  32727. function useRecognizers(handlers, config = {}, gestureKey, nativeHandlers) {
  32728. const ctrl = external_React_default().useMemo(() => new Controller(handlers), []);
  32729. ctrl.applyHandlers(handlers, nativeHandlers);
  32730. ctrl.applyConfig(config, gestureKey);
  32731. external_React_default().useEffect(ctrl.effect.bind(ctrl));
  32732. external_React_default().useEffect(() => {
  32733. return ctrl.clean.bind(ctrl);
  32734. }, []);
  32735. if (config.target === undefined) {
  32736. return ctrl.bind.bind(ctrl);
  32737. }
  32738. return undefined;
  32739. }
  32740. function use_gesture_react_esm_useDrag(handler, config) {
  32741. actions_e2a59bb9_esm_registerAction(actions_e2a59bb9_esm_dragAction);
  32742. return useRecognizers({
  32743. drag: handler
  32744. }, config || {}, 'drag');
  32745. }
  32746. function usePinch(handler, config) {
  32747. registerAction(pinchAction);
  32748. return useRecognizers({
  32749. pinch: handler
  32750. }, config || {}, 'pinch');
  32751. }
  32752. function useWheel(handler, config) {
  32753. registerAction(wheelAction);
  32754. return useRecognizers({
  32755. wheel: handler
  32756. }, config || {}, 'wheel');
  32757. }
  32758. function useScroll(handler, config) {
  32759. registerAction(scrollAction);
  32760. return useRecognizers({
  32761. scroll: handler
  32762. }, config || {}, 'scroll');
  32763. }
  32764. function useMove(handler, config) {
  32765. registerAction(moveAction);
  32766. return useRecognizers({
  32767. move: handler
  32768. }, config || {}, 'move');
  32769. }
  32770. function useHover(handler, config) {
  32771. actions_e2a59bb9_esm_registerAction(actions_e2a59bb9_esm_hoverAction);
  32772. return useRecognizers({
  32773. hover: handler
  32774. }, config || {}, 'hover');
  32775. }
  32776. function createUseGesture(actions) {
  32777. actions.forEach(registerAction);
  32778. return function useGesture(_handlers, _config) {
  32779. const {
  32780. handlers,
  32781. nativeHandlers,
  32782. config
  32783. } = parseMergedHandlers(_handlers, _config || {});
  32784. return useRecognizers(handlers, config, undefined, nativeHandlers);
  32785. };
  32786. }
  32787. function useGesture(handlers, config) {
  32788. const hook = createUseGesture([dragAction, pinchAction, scrollAction, wheelAction, moveAction, hoverAction]);
  32789. return hook(handlers, config || {});
  32790. }
  32791. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/utils.js
  32792. /**
  32793. * WordPress dependencies
  32794. */
  32795. /**
  32796. * Gets a CSS cursor value based on a drag direction.
  32797. *
  32798. * @param dragDirection The drag direction.
  32799. * @return The CSS cursor value.
  32800. */
  32801. function getDragCursor(dragDirection) {
  32802. let dragCursor = 'ns-resize';
  32803. switch (dragDirection) {
  32804. case 'n':
  32805. case 's':
  32806. dragCursor = 'ns-resize';
  32807. break;
  32808. case 'e':
  32809. case 'w':
  32810. dragCursor = 'ew-resize';
  32811. break;
  32812. }
  32813. return dragCursor;
  32814. }
  32815. /**
  32816. * Custom hook that renders a drag cursor when dragging.
  32817. *
  32818. * @param {boolean} isDragging The dragging state.
  32819. * @param {string} dragDirection The drag direction.
  32820. *
  32821. * @return {string} The CSS cursor value.
  32822. */
  32823. function useDragCursor(isDragging, dragDirection) {
  32824. const dragCursor = getDragCursor(dragDirection);
  32825. (0,external_wp_element_namespaceObject.useEffect)(() => {
  32826. if (isDragging) {
  32827. document.documentElement.style.cursor = dragCursor;
  32828. } else {
  32829. // @ts-expect-error
  32830. document.documentElement.style.cursor = null;
  32831. }
  32832. }, [isDragging]);
  32833. return dragCursor;
  32834. }
  32835. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/reducer/state.js
  32836. /**
  32837. * External dependencies
  32838. */
  32839. /**
  32840. * Internal dependencies
  32841. */
  32842. const initialStateReducer = state => state;
  32843. const initialInputControlState = {
  32844. _event: {},
  32845. error: null,
  32846. initialValue: '',
  32847. isDirty: false,
  32848. isDragEnabled: false,
  32849. isDragging: false,
  32850. isPressEnterToChange: false,
  32851. value: ''
  32852. };
  32853. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/reducer/actions.js
  32854. /**
  32855. * External dependencies
  32856. */
  32857. /**
  32858. * Internal dependencies
  32859. */
  32860. const CHANGE = 'CHANGE';
  32861. const COMMIT = 'COMMIT';
  32862. const DRAG_END = 'DRAG_END';
  32863. const DRAG_START = 'DRAG_START';
  32864. const DRAG = 'DRAG';
  32865. const INVALIDATE = 'INVALIDATE';
  32866. const PRESS_DOWN = 'PRESS_DOWN';
  32867. const PRESS_ENTER = 'PRESS_ENTER';
  32868. const PRESS_UP = 'PRESS_UP';
  32869. const RESET = 'RESET';
  32870. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/reducer/reducer.js
  32871. /**
  32872. * External dependencies
  32873. */
  32874. /**
  32875. * WordPress dependencies
  32876. */
  32877. /**
  32878. * Internal dependencies
  32879. */
  32880. /**
  32881. * Prepares initialState for the reducer.
  32882. *
  32883. * @param initialState The initial state.
  32884. * @return Prepared initialState for the reducer
  32885. */
  32886. function mergeInitialState() {
  32887. let initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialInputControlState;
  32888. const {
  32889. value
  32890. } = initialState;
  32891. return { ...initialInputControlState,
  32892. ...initialState,
  32893. initialValue: value
  32894. };
  32895. }
  32896. /**
  32897. * Creates a reducer that opens the channel for external state subscription
  32898. * and modification.
  32899. *
  32900. * This technique uses the "stateReducer" design pattern:
  32901. * https://kentcdodds.com/blog/the-state-reducer-pattern/
  32902. *
  32903. * @param composedStateReducers A custom reducer that can subscribe and modify state.
  32904. * @return The reducer.
  32905. */
  32906. function inputControlStateReducer(composedStateReducers) {
  32907. return (state, action) => {
  32908. const nextState = { ...state
  32909. };
  32910. switch (action.type) {
  32911. /**
  32912. * Keyboard events
  32913. */
  32914. case PRESS_UP:
  32915. nextState.isDirty = false;
  32916. break;
  32917. case PRESS_DOWN:
  32918. nextState.isDirty = false;
  32919. break;
  32920. /**
  32921. * Drag events
  32922. */
  32923. case DRAG_START:
  32924. nextState.isDragging = true;
  32925. break;
  32926. case DRAG_END:
  32927. nextState.isDragging = false;
  32928. break;
  32929. /**
  32930. * Input events
  32931. */
  32932. case CHANGE:
  32933. nextState.error = null;
  32934. nextState.value = action.payload.value;
  32935. if (state.isPressEnterToChange) {
  32936. nextState.isDirty = true;
  32937. }
  32938. break;
  32939. case COMMIT:
  32940. nextState.value = action.payload.value;
  32941. nextState.isDirty = false;
  32942. break;
  32943. case RESET:
  32944. nextState.error = null;
  32945. nextState.isDirty = false;
  32946. nextState.value = action.payload.value || state.initialValue;
  32947. break;
  32948. /**
  32949. * Validation
  32950. */
  32951. case INVALIDATE:
  32952. nextState.error = action.payload.error;
  32953. break;
  32954. }
  32955. if (action.payload.event) {
  32956. nextState._event = action.payload.event;
  32957. }
  32958. /**
  32959. * Send the nextState + action to the composedReducers via
  32960. * this "bridge" mechanism. This allows external stateReducers
  32961. * to hook into actions, and modify state if needed.
  32962. */
  32963. return composedStateReducers(nextState, action);
  32964. };
  32965. }
  32966. /**
  32967. * A custom hook that connects and external stateReducer with an internal
  32968. * reducer. This hook manages the internal state of InputControl.
  32969. * However, by connecting an external stateReducer function, other
  32970. * components can react to actions as well as modify state before it is
  32971. * applied.
  32972. *
  32973. * This technique uses the "stateReducer" design pattern:
  32974. * https://kentcdodds.com/blog/the-state-reducer-pattern/
  32975. *
  32976. * @param stateReducer An external state reducer.
  32977. * @param initialState The initial state for the reducer.
  32978. * @return State, dispatch, and a collection of actions.
  32979. */
  32980. function useInputControlStateReducer() {
  32981. let stateReducer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialStateReducer;
  32982. let initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : initialInputControlState;
  32983. const [state, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(inputControlStateReducer(stateReducer), mergeInitialState(initialState));
  32984. const createChangeEvent = type => (nextValue, event) => {
  32985. /**
  32986. * Persist allows for the (Synthetic) event to be used outside of
  32987. * this function call.
  32988. * https://reactjs.org/docs/events.html#event-pooling
  32989. */
  32990. if (event && event.persist) {
  32991. event.persist();
  32992. }
  32993. dispatch({
  32994. type,
  32995. payload: {
  32996. value: nextValue,
  32997. event
  32998. }
  32999. });
  33000. };
  33001. const createKeyEvent = type => event => {
  33002. /**
  33003. * Persist allows for the (Synthetic) event to be used outside of
  33004. * this function call.
  33005. * https://reactjs.org/docs/events.html#event-pooling
  33006. */
  33007. if (event && event.persist) {
  33008. event.persist();
  33009. }
  33010. dispatch({
  33011. type,
  33012. payload: {
  33013. event
  33014. }
  33015. });
  33016. };
  33017. const createDragEvent = type => payload => {
  33018. dispatch({
  33019. type,
  33020. payload
  33021. });
  33022. };
  33023. /**
  33024. * Actions for the reducer
  33025. */
  33026. const change = createChangeEvent(CHANGE);
  33027. const invalidate = (error, event) => dispatch({
  33028. type: INVALIDATE,
  33029. payload: {
  33030. error,
  33031. event
  33032. }
  33033. });
  33034. const reset = createChangeEvent(RESET);
  33035. const commit = createChangeEvent(COMMIT);
  33036. const dragStart = createDragEvent(DRAG_START);
  33037. const drag = createDragEvent(DRAG);
  33038. const dragEnd = createDragEvent(DRAG_END);
  33039. const pressUp = createKeyEvent(PRESS_UP);
  33040. const pressDown = createKeyEvent(PRESS_DOWN);
  33041. const pressEnter = createKeyEvent(PRESS_ENTER);
  33042. return {
  33043. change,
  33044. commit,
  33045. dispatch,
  33046. drag,
  33047. dragEnd,
  33048. dragStart,
  33049. invalidate,
  33050. pressDown,
  33051. pressEnter,
  33052. pressUp,
  33053. reset,
  33054. state
  33055. };
  33056. }
  33057. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.js
  33058. /**
  33059. * WordPress dependencies
  33060. */
  33061. /**
  33062. * A `React.useEffect` that will not run on the first render.
  33063. * Source:
  33064. * https://github.com/reakit/reakit/blob/HEAD/packages/reakit-utils/src/useUpdateEffect.ts
  33065. *
  33066. * @param {import('react').EffectCallback} effect
  33067. * @param {import('react').DependencyList} deps
  33068. */
  33069. function use_update_effect_useUpdateEffect(effect, deps) {
  33070. const mounted = (0,external_wp_element_namespaceObject.useRef)(false);
  33071. (0,external_wp_element_namespaceObject.useEffect)(() => {
  33072. if (mounted.current) {
  33073. return effect();
  33074. }
  33075. mounted.current = true;
  33076. return undefined;
  33077. }, deps);
  33078. }
  33079. /* harmony default export */ var use_update_effect = (use_update_effect_useUpdateEffect);
  33080. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-field.js
  33081. /**
  33082. * External dependencies
  33083. */
  33084. /**
  33085. * WordPress dependencies
  33086. */
  33087. /**
  33088. * Internal dependencies
  33089. */
  33090. function InputField(_ref, ref) {
  33091. let {
  33092. disabled = false,
  33093. dragDirection = 'n',
  33094. dragThreshold = 10,
  33095. id,
  33096. isDragEnabled = false,
  33097. isFocused,
  33098. isPressEnterToChange = false,
  33099. onBlur = external_lodash_namespaceObject.noop,
  33100. onChange = external_lodash_namespaceObject.noop,
  33101. onDrag = external_lodash_namespaceObject.noop,
  33102. onDragEnd = external_lodash_namespaceObject.noop,
  33103. onDragStart = external_lodash_namespaceObject.noop,
  33104. onFocus = external_lodash_namespaceObject.noop,
  33105. onKeyDown = external_lodash_namespaceObject.noop,
  33106. onValidate = external_lodash_namespaceObject.noop,
  33107. size = 'default',
  33108. setIsFocused,
  33109. stateReducer = state => state,
  33110. value: valueProp,
  33111. type,
  33112. ...props
  33113. } = _ref;
  33114. const {
  33115. // State.
  33116. state,
  33117. // Actions.
  33118. change,
  33119. commit,
  33120. drag,
  33121. dragEnd,
  33122. dragStart,
  33123. invalidate,
  33124. pressDown,
  33125. pressEnter,
  33126. pressUp,
  33127. reset
  33128. } = useInputControlStateReducer(stateReducer, {
  33129. isDragEnabled,
  33130. value: valueProp,
  33131. isPressEnterToChange
  33132. });
  33133. const {
  33134. _event,
  33135. value,
  33136. isDragging,
  33137. isDirty
  33138. } = state;
  33139. const wasDirtyOnBlur = (0,external_wp_element_namespaceObject.useRef)(false);
  33140. const dragCursor = useDragCursor(isDragging, dragDirection);
  33141. /*
  33142. * Handles synchronization of external and internal value state.
  33143. * If not focused and did not hold a dirty value[1] on blur
  33144. * updates the value from the props. Otherwise if not holding
  33145. * a dirty value[1] propagates the value and event through onChange.
  33146. * [1] value is only made dirty if isPressEnterToChange is true
  33147. */
  33148. use_update_effect(() => {
  33149. if (valueProp === value) {
  33150. return;
  33151. }
  33152. if (!isFocused && !wasDirtyOnBlur.current) {
  33153. commit(valueProp, _event);
  33154. } else if (!isDirty) {
  33155. onChange(value, {
  33156. event: _event
  33157. });
  33158. wasDirtyOnBlur.current = false;
  33159. }
  33160. }, [value, isDirty, isFocused, valueProp]);
  33161. const handleOnBlur = event => {
  33162. onBlur(event);
  33163. setIsFocused === null || setIsFocused === void 0 ? void 0 : setIsFocused(false);
  33164. /**
  33165. * If isPressEnterToChange is set, this commits the value to
  33166. * the onChange callback.
  33167. */
  33168. if (isDirty || !event.target.validity.valid) {
  33169. wasDirtyOnBlur.current = true;
  33170. handleOnCommit(event);
  33171. }
  33172. };
  33173. const handleOnFocus = event => {
  33174. onFocus(event);
  33175. setIsFocused === null || setIsFocused === void 0 ? void 0 : setIsFocused(true);
  33176. };
  33177. const handleOnChange = event => {
  33178. const nextValue = event.target.value;
  33179. change(nextValue, event);
  33180. };
  33181. const handleOnCommit = event => {
  33182. const nextValue = event.currentTarget.value;
  33183. try {
  33184. onValidate(nextValue);
  33185. commit(nextValue, event);
  33186. } catch (err) {
  33187. invalidate(err, event);
  33188. }
  33189. };
  33190. const handleOnKeyDown = event => {
  33191. const {
  33192. key
  33193. } = event;
  33194. onKeyDown(event);
  33195. switch (key) {
  33196. case 'ArrowUp':
  33197. pressUp(event);
  33198. break;
  33199. case 'ArrowDown':
  33200. pressDown(event);
  33201. break;
  33202. case 'Enter':
  33203. pressEnter(event);
  33204. if (isPressEnterToChange) {
  33205. event.preventDefault();
  33206. handleOnCommit(event);
  33207. }
  33208. break;
  33209. case 'Escape':
  33210. if (isPressEnterToChange && isDirty) {
  33211. event.preventDefault();
  33212. reset(valueProp, event);
  33213. }
  33214. break;
  33215. }
  33216. };
  33217. const dragGestureProps = use_gesture_react_esm_useDrag(dragProps => {
  33218. const {
  33219. distance,
  33220. dragging,
  33221. event,
  33222. target
  33223. } = dragProps; // The `target` prop always references the `input` element while, by
  33224. // default, the `dragProps.event.target` property would reference the real
  33225. // event target (i.e. any DOM element that the pointer is hovering while
  33226. // dragging). Ensuring that the `target` is always the `input` element
  33227. // allows consumers of `InputControl` (or any higher-level control) to
  33228. // check the input's validity by accessing `event.target.validity.valid`.
  33229. dragProps.event = { ...dragProps.event,
  33230. target
  33231. };
  33232. if (!distance) return;
  33233. event.stopPropagation();
  33234. /**
  33235. * Quick return if no longer dragging.
  33236. * This prevents unnecessary value calculations.
  33237. */
  33238. if (!dragging) {
  33239. onDragEnd(dragProps);
  33240. dragEnd(dragProps);
  33241. return;
  33242. }
  33243. onDrag(dragProps);
  33244. drag(dragProps);
  33245. if (!isDragging) {
  33246. onDragStart(dragProps);
  33247. dragStart(dragProps);
  33248. }
  33249. }, {
  33250. axis: dragDirection === 'e' || dragDirection === 'w' ? 'x' : 'y',
  33251. threshold: dragThreshold,
  33252. enabled: isDragEnabled,
  33253. pointer: {
  33254. capture: false
  33255. }
  33256. });
  33257. const dragProps = isDragEnabled ? dragGestureProps() : {};
  33258. /*
  33259. * Works around the odd UA (e.g. Firefox) that does not focus inputs of
  33260. * type=number when their spinner arrows are pressed.
  33261. */
  33262. let handleOnMouseDown;
  33263. if (type === 'number') {
  33264. handleOnMouseDown = event => {
  33265. var _props$onMouseDown;
  33266. (_props$onMouseDown = props.onMouseDown) === null || _props$onMouseDown === void 0 ? void 0 : _props$onMouseDown.call(props, event);
  33267. if (event.currentTarget !== event.currentTarget.ownerDocument.activeElement) {
  33268. event.currentTarget.focus();
  33269. }
  33270. };
  33271. }
  33272. return (0,external_wp_element_namespaceObject.createElement)(Input, extends_extends({}, props, dragProps, {
  33273. className: "components-input-control__input",
  33274. disabled: disabled,
  33275. dragCursor: dragCursor,
  33276. isDragging: isDragging,
  33277. id: id,
  33278. onBlur: handleOnBlur,
  33279. onChange: handleOnChange,
  33280. onFocus: handleOnFocus,
  33281. onKeyDown: handleOnKeyDown,
  33282. onMouseDown: handleOnMouseDown,
  33283. ref: ref,
  33284. inputSize: size,
  33285. value: value,
  33286. type: type
  33287. }));
  33288. }
  33289. const ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(InputField);
  33290. /* harmony default export */ var input_field = (ForwardedComponent);
  33291. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/index.js
  33292. /**
  33293. * External dependencies
  33294. */
  33295. /**
  33296. * WordPress dependencies
  33297. */
  33298. /**
  33299. * Internal dependencies
  33300. */
  33301. function input_control_useUniqueId(idProp) {
  33302. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(InputControl);
  33303. const id = `inspector-input-control-${instanceId}`;
  33304. return idProp || id;
  33305. }
  33306. function InputControl(_ref, ref) {
  33307. let {
  33308. __unstableStateReducer: stateReducer = state => state,
  33309. __unstableInputWidth,
  33310. className,
  33311. disabled = false,
  33312. hideLabelFromVision = false,
  33313. id: idProp,
  33314. isPressEnterToChange = false,
  33315. label,
  33316. labelPosition = 'top',
  33317. onChange = external_lodash_namespaceObject.noop,
  33318. onValidate = external_lodash_namespaceObject.noop,
  33319. onKeyDown = external_lodash_namespaceObject.noop,
  33320. prefix,
  33321. size = 'default',
  33322. suffix,
  33323. value,
  33324. ...props
  33325. } = _ref;
  33326. const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
  33327. const id = input_control_useUniqueId(idProp);
  33328. const classes = classnames_default()('components-input-control', className);
  33329. return (0,external_wp_element_namespaceObject.createElement)(input_base, {
  33330. __unstableInputWidth: __unstableInputWidth,
  33331. className: classes,
  33332. disabled: disabled,
  33333. gap: 3,
  33334. hideLabelFromVision: hideLabelFromVision,
  33335. id: id,
  33336. isFocused: isFocused,
  33337. justify: "left",
  33338. label: label,
  33339. labelPosition: labelPosition,
  33340. prefix: prefix,
  33341. size: size,
  33342. suffix: suffix
  33343. }, (0,external_wp_element_namespaceObject.createElement)(input_field, extends_extends({}, props, {
  33344. className: "components-input-control__input",
  33345. disabled: disabled,
  33346. id: id,
  33347. isFocused: isFocused,
  33348. isPressEnterToChange: isPressEnterToChange,
  33349. onChange: onChange,
  33350. onKeyDown: onKeyDown,
  33351. onValidate: onValidate,
  33352. ref: ref,
  33353. setIsFocused: setIsFocused,
  33354. size: size,
  33355. stateReducer: stateReducer,
  33356. value: value
  33357. })));
  33358. }
  33359. const input_control_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(InputControl);
  33360. /* harmony default export */ var input_control = (input_control_ForwardedComponent);
  33361. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/styles/angle-picker-control-styles.js
  33362. function angle_picker_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  33363. /**
  33364. * External dependencies
  33365. */
  33366. /**
  33367. * Internal dependencies
  33368. */
  33369. const CIRCLE_SIZE = 32;
  33370. const INNER_CIRCLE_SIZE = 3;
  33371. const angle_picker_control_styles_Root = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  33372. target: "e65ony43"
  33373. } : 0)("margin-bottom:", space(2), ";" + ( true ? "" : 0));
  33374. const CircleRoot = emotion_styled_base_browser_esm("div", true ? {
  33375. target: "e65ony42"
  33376. } : 0)("border-radius:50%;border:", config_values.borderWidth, " solid ", COLORS.ui.border, ";box-sizing:border-box;cursor:grab;height:", CIRCLE_SIZE, "px;overflow:hidden;width:", CIRCLE_SIZE, "px;" + ( true ? "" : 0));
  33377. const CircleIndicatorWrapper = emotion_styled_base_browser_esm("div", true ? {
  33378. target: "e65ony41"
  33379. } : 0)( true ? {
  33380. name: "1bhd2sw",
  33381. styles: "box-sizing:border-box;position:relative;width:100%;height:100%"
  33382. } : 0);
  33383. const CircleIndicator = emotion_styled_base_browser_esm("div", true ? {
  33384. target: "e65ony40"
  33385. } : 0)("background:", COLORS.admin.theme, ";border-radius:50%;border:", INNER_CIRCLE_SIZE, "px solid ", COLORS.admin.theme, ";bottom:0;box-sizing:border-box;display:block;height:0px;left:0;margin:auto;position:absolute;right:0;top:-", CIRCLE_SIZE / 2, "px;width:0px;" + ( true ? "" : 0));
  33386. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/angle-circle.js
  33387. /**
  33388. * WordPress dependencies
  33389. */
  33390. /**
  33391. * Internal dependencies
  33392. */
  33393. function AngleCircle(_ref) {
  33394. let {
  33395. value,
  33396. onChange,
  33397. ...props
  33398. } = _ref;
  33399. const angleCircleRef = (0,external_wp_element_namespaceObject.useRef)();
  33400. const angleCircleCenter = (0,external_wp_element_namespaceObject.useRef)();
  33401. const previousCursorValue = (0,external_wp_element_namespaceObject.useRef)();
  33402. const setAngleCircleCenter = () => {
  33403. const rect = angleCircleRef.current.getBoundingClientRect();
  33404. angleCircleCenter.current = {
  33405. x: rect.x + rect.width / 2,
  33406. y: rect.y + rect.height / 2
  33407. };
  33408. };
  33409. const changeAngleToPosition = event => {
  33410. const {
  33411. x: centerX,
  33412. y: centerY
  33413. } = angleCircleCenter.current; // Prevent (drag) mouse events from selecting and accidentally
  33414. // triggering actions from other elements.
  33415. event.preventDefault(); // Input control needs to lose focus and by preventDefault above, it doesn't.
  33416. event.target.focus();
  33417. onChange(getAngle(centerX, centerY, event.clientX, event.clientY));
  33418. };
  33419. const {
  33420. startDrag,
  33421. isDragging
  33422. } = (0,external_wp_compose_namespaceObject.__experimentalUseDragging)({
  33423. onDragStart: event => {
  33424. setAngleCircleCenter();
  33425. changeAngleToPosition(event);
  33426. },
  33427. onDragMove: changeAngleToPosition,
  33428. onDragEnd: changeAngleToPosition
  33429. });
  33430. (0,external_wp_element_namespaceObject.useEffect)(() => {
  33431. if (isDragging) {
  33432. if (previousCursorValue.current === undefined) {
  33433. previousCursorValue.current = document.body.style.cursor;
  33434. }
  33435. document.body.style.cursor = 'grabbing';
  33436. } else {
  33437. document.body.style.cursor = previousCursorValue.current || null;
  33438. previousCursorValue.current = undefined;
  33439. }
  33440. }, [isDragging]);
  33441. return (
  33442. /* eslint-disable jsx-a11y/no-static-element-interactions */
  33443. (0,external_wp_element_namespaceObject.createElement)(CircleRoot, extends_extends({
  33444. ref: angleCircleRef,
  33445. onMouseDown: startDrag,
  33446. className: "components-angle-picker-control__angle-circle",
  33447. style: isDragging ? {
  33448. cursor: 'grabbing'
  33449. } : undefined
  33450. }, props), (0,external_wp_element_namespaceObject.createElement)(CircleIndicatorWrapper, {
  33451. style: value ? {
  33452. transform: `rotate(${value}deg)`
  33453. } : undefined,
  33454. className: "components-angle-picker-control__angle-circle-indicator-wrapper",
  33455. tabIndex: -1
  33456. }, (0,external_wp_element_namespaceObject.createElement)(CircleIndicator, {
  33457. className: "components-angle-picker-control__angle-circle-indicator"
  33458. })))
  33459. /* eslint-enable jsx-a11y/no-static-element-interactions */
  33460. );
  33461. }
  33462. function getAngle(centerX, centerY, pointX, pointY) {
  33463. const y = pointY - centerY;
  33464. const x = pointX - centerX;
  33465. const angleInRadians = Math.atan2(y, x);
  33466. const angleInDeg = Math.round(angleInRadians * (180 / Math.PI)) + 90;
  33467. if (angleInDeg < 0) {
  33468. return 360 + angleInDeg;
  33469. }
  33470. return angleInDeg;
  33471. }
  33472. /* harmony default export */ var angle_circle = (AngleCircle);
  33473. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spacer/hook.js
  33474. /**
  33475. * External dependencies
  33476. */
  33477. /**
  33478. * Internal dependencies
  33479. */
  33480. const isDefined = o => typeof o !== 'undefined' && o !== null;
  33481. function useSpacer(props) {
  33482. const {
  33483. className,
  33484. margin,
  33485. marginBottom = 2,
  33486. marginLeft,
  33487. marginRight,
  33488. marginTop,
  33489. marginX,
  33490. marginY,
  33491. padding,
  33492. paddingBottom,
  33493. paddingLeft,
  33494. paddingRight,
  33495. paddingTop,
  33496. paddingX,
  33497. paddingY,
  33498. ...otherProps
  33499. } = useContextSystem(props, 'Spacer');
  33500. const cx = useCx();
  33501. const classes = cx(isDefined(margin) && /*#__PURE__*/emotion_react_browser_esm_css("margin:", space(margin), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginY) && /*#__PURE__*/emotion_react_browser_esm_css("margin-bottom:", space(marginY), ";margin-top:", space(marginY), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginX) && /*#__PURE__*/emotion_react_browser_esm_css("margin-left:", space(marginX), ";margin-right:", space(marginX), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginTop) && /*#__PURE__*/emotion_react_browser_esm_css("margin-top:", space(marginTop), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginBottom) && /*#__PURE__*/emotion_react_browser_esm_css("margin-bottom:", space(marginBottom), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginLeft) && /*#__PURE__*/emotion_react_browser_esm_css("margin-left:", space(marginLeft), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginRight) && /*#__PURE__*/emotion_react_browser_esm_css("margin-right:", space(marginRight), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(padding) && /*#__PURE__*/emotion_react_browser_esm_css("padding:", space(padding), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingY) && /*#__PURE__*/emotion_react_browser_esm_css("padding-bottom:", space(paddingY), ";padding-top:", space(paddingY), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingX) && /*#__PURE__*/emotion_react_browser_esm_css("padding-left:", space(paddingX), ";padding-right:", space(paddingX), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingTop) && /*#__PURE__*/emotion_react_browser_esm_css("padding-top:", space(paddingTop), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingBottom) && /*#__PURE__*/emotion_react_browser_esm_css("padding-bottom:", space(paddingBottom), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingLeft) && /*#__PURE__*/emotion_react_browser_esm_css("padding-left:", space(paddingLeft), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingRight) && /*#__PURE__*/emotion_react_browser_esm_css("padding-right:", space(paddingRight), ";" + ( true ? "" : 0), true ? "" : 0), className);
  33502. return { ...otherProps,
  33503. className: classes
  33504. };
  33505. }
  33506. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spacer/component.js
  33507. /**
  33508. * External dependencies
  33509. */
  33510. /**
  33511. * Internal dependencies
  33512. */
  33513. function Spacer(props, forwardedRef) {
  33514. const spacerProps = useSpacer(props);
  33515. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, spacerProps, {
  33516. ref: forwardedRef
  33517. }));
  33518. }
  33519. /**
  33520. * `Spacer` is a primitive layout component that providers inner (`padding`) or outer (`margin`) space in-between components. It can also be used to adaptively provide space within an `HStack` or `VStack`.
  33521. *
  33522. * `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props work as a multiplier to the library's grid system (base of `4px`).
  33523. *
  33524. * @example
  33525. * ```jsx
  33526. * import { Spacer } from `@wordpress/components`
  33527. *
  33528. * function Example() {
  33529. * return (
  33530. * <View>
  33531. * <Spacer>
  33532. * <Heading>WordPress.org</Heading>
  33533. * </Spacer>
  33534. * <Text>
  33535. * Code is Poetry
  33536. * </Text>
  33537. * </View>
  33538. * );
  33539. * }
  33540. * ```
  33541. */
  33542. const ConnectedSpacer = contextConnect(Spacer, 'Spacer');
  33543. /* harmony default export */ var spacer_component = (ConnectedSpacer);
  33544. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/index.js
  33545. /**
  33546. * External dependencies
  33547. */
  33548. /**
  33549. * WordPress dependencies
  33550. */
  33551. /**
  33552. * Internal dependencies
  33553. */
  33554. function AnglePickerControl(_ref) {
  33555. let {
  33556. className,
  33557. label = (0,external_wp_i18n_namespaceObject.__)('Angle'),
  33558. onChange,
  33559. value
  33560. } = _ref;
  33561. const handleOnNumberChange = unprocessedValue => {
  33562. const inputValue = unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : 0;
  33563. onChange(inputValue);
  33564. };
  33565. const classes = classnames_default()('components-angle-picker-control', className);
  33566. return (0,external_wp_element_namespaceObject.createElement)(angle_picker_control_styles_Root, {
  33567. className: classes
  33568. }, (0,external_wp_element_namespaceObject.createElement)(flex_block_component, null, (0,external_wp_element_namespaceObject.createElement)(input_control, {
  33569. label: label,
  33570. className: "components-angle-picker-control__input-field",
  33571. max: 360,
  33572. min: 0,
  33573. onChange: handleOnNumberChange,
  33574. size: "__unstable-large",
  33575. step: "1",
  33576. value: value,
  33577. hideHTMLArrows: true,
  33578. suffix: (0,external_wp_element_namespaceObject.createElement)(spacer_component, {
  33579. as: text_component,
  33580. marginBottom: 0,
  33581. marginRight: space(3),
  33582. style: {
  33583. color: 'var( --wp-admin-theme-color )'
  33584. }
  33585. }, "\xB0")
  33586. })), (0,external_wp_element_namespaceObject.createElement)(flex_item_component, {
  33587. style: {
  33588. marginLeft: space(4),
  33589. marginBottom: space(1),
  33590. marginTop: 'auto'
  33591. }
  33592. }, (0,external_wp_element_namespaceObject.createElement)(angle_circle, {
  33593. "aria-hidden": "true",
  33594. value: value,
  33595. onChange: onChange
  33596. })));
  33597. }
  33598. ;// CONCATENATED MODULE: external ["wp","keycodes"]
  33599. var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
  33600. ;// CONCATENATED MODULE: external ["wp","richText"]
  33601. var external_wp_richText_namespaceObject = window["wp"]["richText"];
  33602. ;// CONCATENATED MODULE: external ["wp","a11y"]
  33603. var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
  33604. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/autocomplete/get-default-use-items.js
  33605. /**
  33606. * External dependencies
  33607. */
  33608. /**
  33609. * WordPress dependencies
  33610. */
  33611. function filterOptions(search) {
  33612. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  33613. let maxResults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
  33614. const filtered = [];
  33615. for (let i = 0; i < options.length; i++) {
  33616. const option = options[i]; // Merge label into keywords.
  33617. let {
  33618. keywords = []
  33619. } = option;
  33620. if ('string' === typeof option.label) {
  33621. keywords = [...keywords, option.label];
  33622. }
  33623. const isMatch = keywords.some(keyword => search.test((0,external_lodash_namespaceObject.deburr)(keyword)));
  33624. if (!isMatch) {
  33625. continue;
  33626. }
  33627. filtered.push(option); // Abort early if max reached.
  33628. if (filtered.length === maxResults) {
  33629. break;
  33630. }
  33631. }
  33632. return filtered;
  33633. }
  33634. function getDefaultUseItems(autocompleter) {
  33635. return filterValue => {
  33636. const [items, setItems] = (0,external_wp_element_namespaceObject.useState)([]);
  33637. /*
  33638. * We support both synchronous and asynchronous retrieval of completer options
  33639. * but internally treat all as async so we maintain a single, consistent code path.
  33640. *
  33641. * Because networks can be slow, and the internet is wonderfully unpredictable,
  33642. * we don't want two promises updating the state at once. This ensures that only
  33643. * the most recent promise will act on `optionsData`. This doesn't use the state
  33644. * because `setState` is batched, and so there's no guarantee that setting
  33645. * `activePromise` in the state would result in it actually being in `this.state`
  33646. * before the promise resolves and we check to see if this is the active promise or not.
  33647. */
  33648. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  33649. const {
  33650. options,
  33651. isDebounced
  33652. } = autocompleter;
  33653. const loadOptions = (0,external_lodash_namespaceObject.debounce)(() => {
  33654. const promise = Promise.resolve(typeof options === 'function' ? options(filterValue) : options).then(optionsData => {
  33655. if (promise.canceled) {
  33656. return;
  33657. }
  33658. const keyedOptions = optionsData.map((optionData, optionIndex) => ({
  33659. key: `${autocompleter.name}-${optionIndex}`,
  33660. value: optionData,
  33661. label: autocompleter.getOptionLabel(optionData),
  33662. keywords: autocompleter.getOptionKeywords ? autocompleter.getOptionKeywords(optionData) : [],
  33663. isDisabled: autocompleter.isOptionDisabled ? autocompleter.isOptionDisabled(optionData) : false
  33664. })); // Create a regular expression to filter the options.
  33665. const search = new RegExp('(?:\\b|\\s|^)' + (0,external_lodash_namespaceObject.escapeRegExp)(filterValue), 'i');
  33666. setItems(filterOptions(search, keyedOptions));
  33667. });
  33668. return promise;
  33669. }, isDebounced ? 250 : 0);
  33670. const promise = loadOptions();
  33671. return () => {
  33672. loadOptions.cancel();
  33673. if (promise) {
  33674. promise.canceled = true;
  33675. }
  33676. };
  33677. }, [filterValue]);
  33678. return [items];
  33679. };
  33680. }
  33681. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/autocomplete/autocompleter-ui.js
  33682. /**
  33683. * External dependencies
  33684. */
  33685. /**
  33686. * WordPress dependencies
  33687. */
  33688. /**
  33689. * Internal dependencies
  33690. */
  33691. function getAutoCompleterUI(autocompleter) {
  33692. const useItems = autocompleter.useItems ? autocompleter.useItems : getDefaultUseItems(autocompleter);
  33693. function AutocompleterUI(_ref) {
  33694. let {
  33695. filterValue,
  33696. instanceId,
  33697. listBoxId,
  33698. className,
  33699. selectedIndex,
  33700. onChangeOptions,
  33701. onSelect,
  33702. onReset,
  33703. value,
  33704. contentRef
  33705. } = _ref;
  33706. const [items] = useItems(filterValue);
  33707. const anchorRef = (0,external_wp_richText_namespaceObject.useAnchorRef)({
  33708. ref: contentRef,
  33709. value
  33710. });
  33711. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  33712. onChangeOptions(items);
  33713. }, [items]);
  33714. if (!items.length > 0) {
  33715. return null;
  33716. }
  33717. return (0,external_wp_element_namespaceObject.createElement)(popover, {
  33718. focusOnMount: false,
  33719. onClose: onReset,
  33720. position: "top right",
  33721. className: "components-autocomplete__popover",
  33722. anchorRef: anchorRef
  33723. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  33724. id: listBoxId,
  33725. role: "listbox",
  33726. className: "components-autocomplete__results"
  33727. }, (0,external_lodash_namespaceObject.map)(items, (option, index) => (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  33728. key: option.key,
  33729. id: `components-autocomplete-item-${instanceId}-${option.key}`,
  33730. role: "option",
  33731. "aria-selected": index === selectedIndex,
  33732. disabled: option.isDisabled,
  33733. className: classnames_default()('components-autocomplete__result', className, {
  33734. 'is-selected': index === selectedIndex
  33735. }),
  33736. onClick: () => onSelect(option)
  33737. }, option.label))));
  33738. }
  33739. return AutocompleterUI;
  33740. }
  33741. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/autocomplete/index.js
  33742. /**
  33743. * External dependencies
  33744. */
  33745. /**
  33746. * WordPress dependencies
  33747. */
  33748. /**
  33749. * Internal dependencies
  33750. */
  33751. /**
  33752. * A raw completer option.
  33753. *
  33754. * @typedef {*} CompleterOption
  33755. */
  33756. /**
  33757. * @callback FnGetOptions
  33758. *
  33759. * @return {(CompleterOption[]|Promise.<CompleterOption[]>)} The completer options or a promise for them.
  33760. */
  33761. /**
  33762. * @callback FnGetOptionKeywords
  33763. * @param {CompleterOption} option a completer option.
  33764. *
  33765. * @return {string[]} list of key words to search.
  33766. */
  33767. /**
  33768. * @callback FnIsOptionDisabled
  33769. * @param {CompleterOption} option a completer option.
  33770. *
  33771. * @return {string[]} whether or not the given option is disabled.
  33772. */
  33773. /**
  33774. * @callback FnGetOptionLabel
  33775. * @param {CompleterOption} option a completer option.
  33776. *
  33777. * @return {(string|Array.<(string|WPElement)>)} list of react components to render.
  33778. */
  33779. /**
  33780. * @callback FnAllowContext
  33781. * @param {string} before the string before the auto complete trigger and query.
  33782. * @param {string} after the string after the autocomplete trigger and query.
  33783. *
  33784. * @return {boolean} true if the completer can handle.
  33785. */
  33786. /**
  33787. * @typedef {Object} OptionCompletion
  33788. * @property {'insert-at-caret'|'replace'} action the intended placement of the completion.
  33789. * @property {OptionCompletionValue} value the completion value.
  33790. */
  33791. /**
  33792. * A completion value.
  33793. *
  33794. * @typedef {(string|WPElement|Object)} OptionCompletionValue
  33795. */
  33796. /**
  33797. * @callback FnGetOptionCompletion
  33798. * @param {CompleterOption} value the value of the completer option.
  33799. * @param {string} query the text value of the autocomplete query.
  33800. *
  33801. * @return {(OptionCompletion|OptionCompletionValue)} the completion for the given option. If an
  33802. * OptionCompletionValue is returned, the
  33803. * completion action defaults to `insert-at-caret`.
  33804. */
  33805. /**
  33806. * @typedef {Object} WPCompleter
  33807. * @property {string} name a way to identify a completer, useful for selective overriding.
  33808. * @property {?string} className A class to apply to the popup menu.
  33809. * @property {string} triggerPrefix the prefix that will display the menu.
  33810. * @property {(CompleterOption[]|FnGetOptions)} options the completer options or a function to get them.
  33811. * @property {?FnGetOptionKeywords} getOptionKeywords get the keywords for a given option.
  33812. * @property {?FnIsOptionDisabled} isOptionDisabled get whether or not the given option is disabled.
  33813. * @property {FnGetOptionLabel} getOptionLabel get the label for a given option.
  33814. * @property {?FnAllowContext} allowContext filter the context under which the autocomplete activates.
  33815. * @property {FnGetOptionCompletion} getOptionCompletion get the completion associated with a given option.
  33816. */
  33817. function useAutocomplete(_ref) {
  33818. let {
  33819. record,
  33820. onChange,
  33821. onReplace,
  33822. completers,
  33823. contentRef
  33824. } = _ref;
  33825. const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
  33826. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(useAutocomplete);
  33827. const [selectedIndex, setSelectedIndex] = (0,external_wp_element_namespaceObject.useState)(0);
  33828. const [filteredOptions, setFilteredOptions] = (0,external_wp_element_namespaceObject.useState)([]);
  33829. const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
  33830. const [autocompleter, setAutocompleter] = (0,external_wp_element_namespaceObject.useState)(null);
  33831. const [AutocompleterUI, setAutocompleterUI] = (0,external_wp_element_namespaceObject.useState)(null);
  33832. const [backspacing, setBackspacing] = (0,external_wp_element_namespaceObject.useState)(false);
  33833. function insertCompletion(replacement) {
  33834. const end = record.start;
  33835. const start = end - autocompleter.triggerPrefix.length - filterValue.length;
  33836. const toInsert = (0,external_wp_richText_namespaceObject.create)({
  33837. html: (0,external_wp_element_namespaceObject.renderToString)(replacement)
  33838. });
  33839. onChange((0,external_wp_richText_namespaceObject.insert)(record, toInsert, start, end));
  33840. }
  33841. function select(option) {
  33842. const {
  33843. getOptionCompletion
  33844. } = autocompleter || {};
  33845. if (option.isDisabled) {
  33846. return;
  33847. }
  33848. if (getOptionCompletion) {
  33849. const completion = getOptionCompletion(option.value, filterValue);
  33850. const {
  33851. action,
  33852. value
  33853. } = undefined === completion.action || undefined === completion.value ? {
  33854. action: 'insert-at-caret',
  33855. value: completion
  33856. } : completion;
  33857. if ('replace' === action) {
  33858. onReplace([value]); // When replacing, the component will unmount, so don't reset
  33859. // state (below) on an unmounted component.
  33860. return;
  33861. } else if ('insert-at-caret' === action) {
  33862. insertCompletion(value);
  33863. }
  33864. } // Reset autocomplete state after insertion rather than before
  33865. // so insertion events don't cause the completion menu to redisplay.
  33866. reset();
  33867. }
  33868. function reset() {
  33869. setSelectedIndex(0);
  33870. setFilteredOptions([]);
  33871. setFilterValue('');
  33872. setAutocompleter(null);
  33873. setAutocompleterUI(null);
  33874. }
  33875. function announce(options) {
  33876. if (!debouncedSpeak) {
  33877. return;
  33878. }
  33879. if (!!options.length) {
  33880. debouncedSpeak((0,external_wp_i18n_namespaceObject.sprintf)(
  33881. /* translators: %d: number of results. */
  33882. (0,external_wp_i18n_namespaceObject._n)('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', options.length), options.length), 'assertive');
  33883. } else {
  33884. debouncedSpeak((0,external_wp_i18n_namespaceObject.__)('No results.'), 'assertive');
  33885. }
  33886. }
  33887. /**
  33888. * Load options for an autocompleter.
  33889. *
  33890. * @param {Array} options
  33891. */
  33892. function onChangeOptions(options) {
  33893. setSelectedIndex(options.length === filteredOptions.length ? selectedIndex : 0);
  33894. setFilteredOptions(options);
  33895. announce(options);
  33896. }
  33897. function handleKeyDown(event) {
  33898. setBackspacing(event.keyCode === external_wp_keycodes_namespaceObject.BACKSPACE);
  33899. if (!autocompleter) {
  33900. return;
  33901. }
  33902. if (filteredOptions.length === 0) {
  33903. return;
  33904. }
  33905. if (event.defaultPrevented) {
  33906. return;
  33907. }
  33908. switch (event.keyCode) {
  33909. case external_wp_keycodes_namespaceObject.UP:
  33910. setSelectedIndex((selectedIndex === 0 ? filteredOptions.length : selectedIndex) - 1);
  33911. break;
  33912. case external_wp_keycodes_namespaceObject.DOWN:
  33913. setSelectedIndex((selectedIndex + 1) % filteredOptions.length);
  33914. break;
  33915. case external_wp_keycodes_namespaceObject.ESCAPE:
  33916. setAutocompleter(null);
  33917. setAutocompleterUI(null);
  33918. event.preventDefault();
  33919. break;
  33920. case external_wp_keycodes_namespaceObject.ENTER:
  33921. select(filteredOptions[selectedIndex]);
  33922. break;
  33923. case external_wp_keycodes_namespaceObject.LEFT:
  33924. case external_wp_keycodes_namespaceObject.RIGHT:
  33925. reset();
  33926. return;
  33927. default:
  33928. return;
  33929. } // Any handled keycode should prevent original behavior. This relies on
  33930. // the early return in the default case.
  33931. event.preventDefault();
  33932. }
  33933. let textContent;
  33934. if ((0,external_wp_richText_namespaceObject.isCollapsed)(record)) {
  33935. textContent = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(record, 0));
  33936. }
  33937. (0,external_wp_element_namespaceObject.useEffect)(() => {
  33938. if (!textContent) {
  33939. reset();
  33940. return;
  33941. }
  33942. const text = (0,external_lodash_namespaceObject.deburr)(textContent);
  33943. const textAfterSelection = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(record, undefined, (0,external_wp_richText_namespaceObject.getTextContent)(record).length));
  33944. const completer = (0,external_lodash_namespaceObject.find)(completers, _ref2 => {
  33945. let {
  33946. triggerPrefix,
  33947. allowContext
  33948. } = _ref2;
  33949. const index = text.lastIndexOf(triggerPrefix);
  33950. if (index === -1) {
  33951. return false;
  33952. }
  33953. const textWithoutTrigger = text.slice(index + triggerPrefix.length);
  33954. const tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.
  33955. // This is a final barrier to prevent the effect from completing with
  33956. // an extremely long string, which causes the editor to slow-down
  33957. // significantly. This could happen, for example, if `matchingWhileBackspacing`
  33958. // is true and one of the "words" end up being too long. If that's the case,
  33959. // it will be caught by this guard.
  33960. if (tooDistantFromTrigger) return false;
  33961. const mismatch = filteredOptions.length === 0;
  33962. const wordsFromTrigger = textWithoutTrigger.split(/\s/); // We need to allow the effect to run when not backspacing and if there
  33963. // was a mismatch. i.e when typing a trigger + the match string or when
  33964. // clicking in an existing trigger word on the page. We do that if we
  33965. // detect that we have one word from trigger in the current textual context.
  33966. //
  33967. // Ex.: "Some text @a" <-- "@a" will be detected as the trigger word and
  33968. // allow the effect to run. It will run until there's a mismatch.
  33969. const hasOneTriggerWord = wordsFromTrigger.length === 1; // This is used to allow the effect to run when backspacing and if
  33970. // "touching" a word that "belongs" to a trigger. We consider a "trigger
  33971. // word" any word up to the limit of 3 from the trigger character.
  33972. // Anything beyond that is ignored if there's a mismatch. This allows
  33973. // us to "escape" a mismatch when backspacing, but still imposing some
  33974. // sane limits.
  33975. //
  33976. // Ex: "Some text @marcelo sekkkk" <--- "kkkk" caused a mismatch, but
  33977. // if the user presses backspace here, it will show the completion popup again.
  33978. const matchingWhileBackspacing = backspacing && textWithoutTrigger.split(/\s/).length <= 3;
  33979. if (mismatch && !(matchingWhileBackspacing || hasOneTriggerWord)) {
  33980. return false;
  33981. }
  33982. if (allowContext && !allowContext(text.slice(0, index), textAfterSelection)) {
  33983. return false;
  33984. }
  33985. if (/^\s/.test(textWithoutTrigger) || /\s\s+$/.test(textWithoutTrigger)) {
  33986. return false;
  33987. }
  33988. return /[\u0000-\uFFFF]*$/.test(textWithoutTrigger);
  33989. });
  33990. if (!completer) {
  33991. reset();
  33992. return;
  33993. }
  33994. const safeTrigger = (0,external_lodash_namespaceObject.escapeRegExp)(completer.triggerPrefix);
  33995. const match = text.slice(text.lastIndexOf(completer.triggerPrefix)).match(new RegExp(`${safeTrigger}([\u0000-\uFFFF]*)$`));
  33996. const query = match && match[1];
  33997. setAutocompleter(completer);
  33998. setAutocompleterUI(() => completer !== autocompleter ? getAutoCompleterUI(completer) : AutocompleterUI);
  33999. setFilterValue(query);
  34000. }, [textContent]);
  34001. const {
  34002. key: selectedKey = ''
  34003. } = filteredOptions[selectedIndex] || {};
  34004. const {
  34005. className
  34006. } = autocompleter || {};
  34007. const isExpanded = !!autocompleter && filteredOptions.length > 0;
  34008. const listBoxId = isExpanded ? `components-autocomplete-listbox-${instanceId}` : null;
  34009. const activeId = isExpanded ? `components-autocomplete-item-${instanceId}-${selectedKey}` : null;
  34010. const hasSelection = record.start !== undefined;
  34011. return {
  34012. listBoxId,
  34013. activeId,
  34014. onKeyDown: handleKeyDown,
  34015. popover: hasSelection && AutocompleterUI && (0,external_wp_element_namespaceObject.createElement)(AutocompleterUI, {
  34016. className: className,
  34017. filterValue: filterValue,
  34018. instanceId: instanceId,
  34019. listBoxId: listBoxId,
  34020. selectedIndex: selectedIndex,
  34021. onChangeOptions: onChangeOptions,
  34022. onSelect: select,
  34023. value: record,
  34024. contentRef: contentRef,
  34025. reset: reset
  34026. })
  34027. };
  34028. }
  34029. function useAutocompleteProps(options) {
  34030. const ref = (0,external_wp_element_namespaceObject.useRef)();
  34031. const onKeyDownRef = (0,external_wp_element_namespaceObject.useRef)();
  34032. const {
  34033. popover,
  34034. listBoxId,
  34035. activeId,
  34036. onKeyDown
  34037. } = useAutocomplete({ ...options,
  34038. contentRef: ref
  34039. });
  34040. onKeyDownRef.current = onKeyDown;
  34041. return {
  34042. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
  34043. function _onKeyDown(event) {
  34044. onKeyDownRef.current(event);
  34045. }
  34046. element.addEventListener('keydown', _onKeyDown);
  34047. return () => {
  34048. element.removeEventListener('keydown', _onKeyDown);
  34049. };
  34050. }, [])]),
  34051. children: popover,
  34052. 'aria-autocomplete': listBoxId ? 'list' : undefined,
  34053. 'aria-owns': listBoxId,
  34054. 'aria-activedescendant': activeId
  34055. };
  34056. }
  34057. function Autocomplete(_ref3) {
  34058. let {
  34059. children,
  34060. isSelected,
  34061. ...options
  34062. } = _ref3;
  34063. const {
  34064. popover,
  34065. ...props
  34066. } = useAutocomplete(options);
  34067. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, children(props), isSelected && popover);
  34068. }
  34069. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/font-values.js
  34070. /* harmony default export */ var font_values = ({
  34071. 'default.fontFamily': "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif",
  34072. 'default.fontSize': '13px',
  34073. 'helpText.fontSize': '12px',
  34074. mobileTextMinFontSize: '16px'
  34075. });
  34076. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/font.js
  34077. /**
  34078. * External dependencies
  34079. */
  34080. /**
  34081. * Internal dependencies
  34082. */
  34083. /**
  34084. *
  34085. * @param {keyof FONT} value Path of value from `FONT`
  34086. * @return {string} Font rule value
  34087. */
  34088. function font(value) {
  34089. return (0,external_lodash_namespaceObject.get)(font_values, value, '');
  34090. }
  34091. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/base-control/styles/base-control-styles.js
  34092. function base_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  34093. /**
  34094. * External dependencies
  34095. */
  34096. /**
  34097. * Internal dependencies
  34098. */
  34099. const base_control_styles_Wrapper = emotion_styled_base_browser_esm("div", true ? {
  34100. target: "ej5x27r4"
  34101. } : 0)("font-family:", font('default.fontFamily'), ";font-size:", font('default.fontSize'), ";" + ( true ? "" : 0));
  34102. const deprecatedMarginField = _ref2 => {
  34103. let {
  34104. __nextHasNoMarginBottom = false
  34105. } = _ref2;
  34106. return !__nextHasNoMarginBottom && /*#__PURE__*/emotion_react_browser_esm_css("margin-bottom:", space(2), ";" + ( true ? "" : 0), true ? "" : 0);
  34107. };
  34108. const StyledField = emotion_styled_base_browser_esm("div", true ? {
  34109. target: "ej5x27r3"
  34110. } : 0)(deprecatedMarginField, " .components-panel__row &{margin-bottom:inherit;}" + ( true ? "" : 0));
  34111. const labelStyles = /*#__PURE__*/emotion_react_browser_esm_css("display:inline-block;margin-bottom:", space(2), ";" + ( true ? "" : 0), true ? "" : 0);
  34112. const StyledLabel = emotion_styled_base_browser_esm("label", true ? {
  34113. target: "ej5x27r2"
  34114. } : 0)(labelStyles, ";" + ( true ? "" : 0));
  34115. var base_control_styles_ref = true ? {
  34116. name: "11yad0w",
  34117. styles: "margin-bottom:revert"
  34118. } : 0;
  34119. const deprecatedMarginHelp = _ref3 => {
  34120. let {
  34121. __nextHasNoMarginBottom = false
  34122. } = _ref3;
  34123. return !__nextHasNoMarginBottom && base_control_styles_ref;
  34124. };
  34125. const StyledHelp = emotion_styled_base_browser_esm("p", true ? {
  34126. target: "ej5x27r1"
  34127. } : 0)("margin-top:", space(2), ";margin-bottom:0;font-size:", font('helpText.fontSize'), ";font-style:normal;color:", COLORS.mediumGray.text, ";", deprecatedMarginHelp, ";" + ( true ? "" : 0));
  34128. const StyledVisualLabel = emotion_styled_base_browser_esm("span", true ? {
  34129. target: "ej5x27r0"
  34130. } : 0)(labelStyles, ";" + ( true ? "" : 0));
  34131. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/base-control/index.js
  34132. /**
  34133. * External dependencies
  34134. */
  34135. /**
  34136. * Internal dependencies
  34137. */
  34138. /**
  34139. * `BaseControl` is a component used to generate labels and help text for components handling user inputs.
  34140. *
  34141. * @example
  34142. * // Render a `BaseControl` for a textarea input
  34143. * import { BaseControl } from '@wordpress/components';
  34144. *
  34145. * // The `id` prop is necessary to accessibly associate the label with the textarea
  34146. * const MyBaseControl = () => (
  34147. * <BaseControl id="textarea-1" label="Text" help="Enter some text" __nextHasNoMarginBottom={ true }>
  34148. * <textarea id="textarea-1" />
  34149. * </BaseControl>
  34150. * );
  34151. */
  34152. const BaseControl = _ref => {
  34153. let {
  34154. __nextHasNoMarginBottom = false,
  34155. id,
  34156. label,
  34157. hideLabelFromVision = false,
  34158. help,
  34159. className,
  34160. children
  34161. } = _ref;
  34162. return (0,external_wp_element_namespaceObject.createElement)(base_control_styles_Wrapper, {
  34163. className: classnames_default()('components-base-control', className)
  34164. }, (0,external_wp_element_namespaceObject.createElement)(StyledField, {
  34165. className: "components-base-control__field" // TODO: Official deprecation for this should start after all internal usages have been migrated
  34166. ,
  34167. __nextHasNoMarginBottom: __nextHasNoMarginBottom
  34168. }, label && id && (hideLabelFromVision ? (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  34169. as: "label",
  34170. htmlFor: id
  34171. }, label) : (0,external_wp_element_namespaceObject.createElement)(StyledLabel, {
  34172. className: "components-base-control__label",
  34173. htmlFor: id
  34174. }, label)), label && !id && (hideLabelFromVision ? (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  34175. as: "label"
  34176. }, label) : (0,external_wp_element_namespaceObject.createElement)(BaseControl.VisualLabel, null, label)), children), !!help && (0,external_wp_element_namespaceObject.createElement)(StyledHelp, {
  34177. id: id ? id + '__help' : undefined,
  34178. className: "components-base-control__help",
  34179. __nextHasNoMarginBottom: __nextHasNoMarginBottom
  34180. }, help));
  34181. };
  34182. /**
  34183. * `BaseControl.VisualLabel` is used to render a purely visual label inside a `BaseControl` component.
  34184. *
  34185. * It should only be used in cases where the children being rendered inside `BaseControl` are already accessibly labeled,
  34186. * e.g., a button, but we want an additional visual label for that section equivalent to the labels `BaseControl` would
  34187. * otherwise use if the `label` prop was passed.
  34188. *
  34189. * @example
  34190. * import { BaseControl } from '@wordpress/components';
  34191. *
  34192. * const MyBaseControl = () => (
  34193. * <BaseControl help="This button is already accessibly labeled.">
  34194. * <BaseControl.VisualLabel>Author</BaseControl.VisualLabel>
  34195. * <Button>Select an author</Button>
  34196. * </BaseControl>
  34197. * );
  34198. */
  34199. const VisualLabel = _ref2 => {
  34200. let {
  34201. className,
  34202. children
  34203. } = _ref2;
  34204. return (0,external_wp_element_namespaceObject.createElement)(StyledVisualLabel, {
  34205. className: classnames_default()('components-base-control__label', className)
  34206. }, children);
  34207. };
  34208. BaseControl.VisualLabel = VisualLabel;
  34209. /* harmony default export */ var base_control = (BaseControl);
  34210. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js
  34211. /**
  34212. * WordPress dependencies
  34213. */
  34214. const link_link = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  34215. xmlns: "http://www.w3.org/2000/svg",
  34216. viewBox: "0 0 24 24"
  34217. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  34218. d: "M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z"
  34219. }));
  34220. /* harmony default export */ var library_link = (link_link);
  34221. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link-off.js
  34222. /**
  34223. * WordPress dependencies
  34224. */
  34225. const linkOff = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  34226. xmlns: "http://www.w3.org/2000/svg",
  34227. viewBox: "0 0 24 24"
  34228. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  34229. d: "M15.6 7.3h-.7l1.6-3.5-.9-.4-3.9 8.5H9v1.5h2l-1.3 2.8H8.4c-2 0-3.7-1.7-3.7-3.7s1.7-3.7 3.7-3.7H10V7.3H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H9l-1.4 3.2.9.4 5.7-12.5h1.4c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.9 0 5.2-2.3 5.2-5.2 0-2.9-2.4-5.2-5.2-5.2z"
  34230. }));
  34231. /* harmony default export */ var link_off = (linkOff);
  34232. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/styles.js
  34233. function border_box_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  34234. /**
  34235. * External dependencies
  34236. */
  34237. /**
  34238. * Internal dependencies
  34239. */
  34240. const BorderBoxControl = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
  34241. const LinkedBorderControl = true ? {
  34242. name: "82a6rk",
  34243. styles: "flex:1"
  34244. } : 0;
  34245. const BorderBoxControlLinkedButton = true ? {
  34246. name: "3gg0za",
  34247. styles: "flex:0;flex-basis:36px;margin-top:7px"
  34248. } : 0;
  34249. const BorderBoxStyleWithFallback = border => {
  34250. const {
  34251. color = COLORS.gray[200],
  34252. style = 'solid',
  34253. width = config_values.borderWidth
  34254. } = border || {};
  34255. const clampedWidth = width !== config_values.borderWidth ? `clamp(1px, ${width}, 10px)` : width;
  34256. const hasVisibleBorder = !!width && width !== '0' || !!color;
  34257. const borderStyle = hasVisibleBorder ? style || 'solid' : style;
  34258. return `${color} ${borderStyle} ${clampedWidth}`;
  34259. };
  34260. const BorderBoxControlVisualizer = borders => {
  34261. return /*#__PURE__*/emotion_react_browser_esm_css("position:absolute;top:20px;right:30px;bottom:20px;left:30px;border-top:", BorderBoxStyleWithFallback(borders === null || borders === void 0 ? void 0 : borders.top), ";border-bottom:", BorderBoxStyleWithFallback(borders === null || borders === void 0 ? void 0 : borders.bottom), ";", rtl({
  34262. borderLeft: BorderBoxStyleWithFallback(borders === null || borders === void 0 ? void 0 : borders.left)
  34263. })(), " ", rtl({
  34264. borderRight: BorderBoxStyleWithFallback(borders === null || borders === void 0 ? void 0 : borders.right)
  34265. })(), ";" + ( true ? "" : 0), true ? "" : 0);
  34266. };
  34267. const BorderBoxControlSplitControls = /*#__PURE__*/emotion_react_browser_esm_css("position:relative;flex:1;", rtl({
  34268. marginRight: space(3)
  34269. }, {
  34270. marginLeft: space(3)
  34271. })(), ";" + ( true ? "" : 0), true ? "" : 0);
  34272. const CenteredBorderControl = true ? {
  34273. name: "1nwbfnf",
  34274. styles: "grid-column:span 2;margin:0 auto"
  34275. } : 0;
  34276. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-linked-button/hook.js
  34277. /**
  34278. * WordPress dependencies
  34279. */
  34280. /**
  34281. * Internal dependencies
  34282. */
  34283. function useBorderBoxControlLinkedButton(props) {
  34284. const {
  34285. className,
  34286. ...otherProps
  34287. } = useContextSystem(props, 'BorderBoxControlLinkedButton'); // Generate class names.
  34288. const cx = useCx();
  34289. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  34290. return cx(BorderBoxControlLinkedButton, className);
  34291. }, [className]);
  34292. return { ...otherProps,
  34293. className: classes
  34294. };
  34295. }
  34296. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-linked-button/component.js
  34297. /**
  34298. * WordPress dependencies
  34299. */
  34300. /**
  34301. * Internal dependencies
  34302. */
  34303. const component_BorderBoxControlLinkedButton = (props, forwardedRef) => {
  34304. const {
  34305. className,
  34306. isLinked,
  34307. ...buttonProps
  34308. } = useBorderBoxControlLinkedButton(props);
  34309. const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink sides') : (0,external_wp_i18n_namespaceObject.__)('Link sides');
  34310. return (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  34311. text: label
  34312. }, (0,external_wp_element_namespaceObject.createElement)(component, {
  34313. className: className
  34314. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({}, buttonProps, {
  34315. variant: isLinked ? 'primary' : 'secondary',
  34316. isSmall: true,
  34317. icon: isLinked ? library_link : link_off,
  34318. iconSize: 16,
  34319. "aria-label": label,
  34320. ref: forwardedRef
  34321. }))));
  34322. };
  34323. const ConnectedBorderBoxControlLinkedButton = contextConnect(component_BorderBoxControlLinkedButton, 'BorderBoxControlLinkedButton');
  34324. /* harmony default export */ var border_box_control_linked_button_component = (ConnectedBorderBoxControlLinkedButton);
  34325. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-visualizer/hook.js
  34326. /**
  34327. * WordPress dependencies
  34328. */
  34329. /**
  34330. * Internal dependencies
  34331. */
  34332. function useBorderBoxControlVisualizer(props) {
  34333. const {
  34334. className,
  34335. value,
  34336. ...otherProps
  34337. } = useContextSystem(props, 'BorderBoxControlVisualizer'); // Generate class names.
  34338. const cx = useCx();
  34339. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  34340. return cx(BorderBoxControlVisualizer(value), className);
  34341. }, [className, value, rtl.watch()]);
  34342. return { ...otherProps,
  34343. className: classes,
  34344. value
  34345. };
  34346. }
  34347. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-visualizer/component.js
  34348. /**
  34349. * WordPress dependencies
  34350. */
  34351. /**
  34352. * Internal dependencies
  34353. */
  34354. const component_BorderBoxControlVisualizer = (props, forwardedRef) => {
  34355. const {
  34356. value,
  34357. ...otherProps
  34358. } = useBorderBoxControlVisualizer(props);
  34359. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  34360. ref: forwardedRef
  34361. }));
  34362. };
  34363. const ConnectedBorderBoxControlVisualizer = contextConnect(component_BorderBoxControlVisualizer, 'BorderBoxControlVisualizer');
  34364. /* harmony default export */ var border_box_control_visualizer_component = (ConnectedBorderBoxControlVisualizer);
  34365. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
  34366. /**
  34367. * WordPress dependencies
  34368. */
  34369. const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  34370. xmlns: "http://www.w3.org/2000/svg",
  34371. viewBox: "0 0 24 24"
  34372. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  34373. d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
  34374. }));
  34375. /* harmony default export */ var close_small = (closeSmall);
  34376. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/line-solid.js
  34377. /**
  34378. * WordPress dependencies
  34379. */
  34380. const lineSolid = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  34381. xmlns: "http://www.w3.org/2000/svg",
  34382. width: "24",
  34383. height: "24",
  34384. fill: "none"
  34385. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  34386. d: "M5 11.25h14v1.5H5z"
  34387. }));
  34388. /* harmony default export */ var line_solid = (lineSolid);
  34389. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/line-dashed.js
  34390. /**
  34391. * WordPress dependencies
  34392. */
  34393. const lineDashed = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  34394. xmlns: "http://www.w3.org/2000/svg",
  34395. width: "24",
  34396. height: "24",
  34397. fill: "none"
  34398. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  34399. fillRule: "evenodd",
  34400. d: "M5 11.25h3v1.5H5v-1.5zm5.5 0h3v1.5h-3v-1.5zm8.5 0h-3v1.5h3v-1.5z",
  34401. clipRule: "evenodd"
  34402. }));
  34403. /* harmony default export */ var line_dashed = (lineDashed);
  34404. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/line-dotted.js
  34405. /**
  34406. * WordPress dependencies
  34407. */
  34408. const lineDotted = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  34409. xmlns: "http://www.w3.org/2000/svg",
  34410. width: "24",
  34411. height: "24",
  34412. fill: "none"
  34413. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  34414. fillRule: "evenodd",
  34415. d: "M5.25 11.25h1.5v1.5h-1.5v-1.5zm3 0h1.5v1.5h-1.5v-1.5zm4.5 0h-1.5v1.5h1.5v-1.5zm1.5 0h1.5v1.5h-1.5v-1.5zm4.5 0h-1.5v1.5h1.5v-1.5z",
  34416. clipRule: "evenodd"
  34417. }));
  34418. /* harmony default export */ var line_dotted = (lineDotted);
  34419. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/number-control/styles/number-control-styles.js
  34420. function number_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  34421. // @ts-nocheck
  34422. /**
  34423. * External dependencies
  34424. */
  34425. /**
  34426. * Internal dependencies
  34427. */
  34428. var number_control_styles_ref = true ? {
  34429. name: "euqsgg",
  34430. styles: "input[type='number']::-webkit-outer-spin-button,input[type='number']::-webkit-inner-spin-button{-webkit-appearance:none!important;margin:0!important;}input[type='number']{-moz-appearance:textfield;}"
  34431. } : 0;
  34432. const htmlArrowStyles = _ref2 => {
  34433. let {
  34434. hideHTMLArrows
  34435. } = _ref2;
  34436. if (!hideHTMLArrows) return ``;
  34437. return number_control_styles_ref;
  34438. };
  34439. const number_control_styles_Input = /*#__PURE__*/emotion_styled_base_browser_esm(input_control, true ? {
  34440. target: "ep48uk90"
  34441. } : 0)(htmlArrowStyles, ";" + ( true ? "" : 0));
  34442. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/math.js
  34443. /**
  34444. * External dependencies
  34445. */
  34446. /**
  34447. * Parses and retrieves a number value.
  34448. *
  34449. * @param {unknown} value The incoming value.
  34450. *
  34451. * @return {number} The parsed number value.
  34452. */
  34453. function getNumber(value) {
  34454. const number = Number(value);
  34455. return isNaN(number) ? 0 : number;
  34456. }
  34457. /**
  34458. * Safely adds 2 values.
  34459. *
  34460. * @param {Array<number|string>} args Values to add together.
  34461. *
  34462. * @return {number} The sum of values.
  34463. */
  34464. function add() {
  34465. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  34466. args[_key] = arguments[_key];
  34467. }
  34468. return args.reduce(
  34469. /** @type {(sum:number, arg: number|string) => number} */
  34470. (sum, arg) => sum + getNumber(arg), 0);
  34471. }
  34472. /**
  34473. * Safely subtracts 2 values.
  34474. *
  34475. * @param {Array<number|string>} args Values to subtract together.
  34476. *
  34477. * @return {number} The difference of the values.
  34478. */
  34479. function subtract() {
  34480. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  34481. args[_key2] = arguments[_key2];
  34482. }
  34483. return args.reduce(
  34484. /** @type {(diff:number, arg: number|string, index:number) => number} */
  34485. (diff, arg, index) => {
  34486. const value = getNumber(arg);
  34487. return index === 0 ? value : diff - value;
  34488. }, 0);
  34489. }
  34490. /**
  34491. * Determines the decimal position of a number value.
  34492. *
  34493. * @param {number} value The number to evaluate.
  34494. *
  34495. * @return {number} The number of decimal places.
  34496. */
  34497. function getPrecision(value) {
  34498. const split = (value + '').split('.');
  34499. return split[1] !== undefined ? split[1].length : 0;
  34500. }
  34501. /**
  34502. * Clamps a value based on a min/max range with rounding
  34503. *
  34504. * @param {number} value The value.
  34505. * @param {number} min The minimum range.
  34506. * @param {number} max The maximum range.
  34507. * @param {number} step A multiplier for the value.
  34508. *
  34509. * @return {number} The rounded and clamped value.
  34510. */
  34511. function roundClamp() {
  34512. let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  34513. let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
  34514. let max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Infinity;
  34515. let step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
  34516. const baseValue = getNumber(value);
  34517. const stepValue = getNumber(step);
  34518. const precision = getPrecision(step);
  34519. const rounded = Math.round(baseValue / stepValue) * stepValue;
  34520. const clampedValue = (0,external_lodash_namespaceObject.clamp)(rounded, min, max);
  34521. return precision ? getNumber(clampedValue.toFixed(precision)) : clampedValue;
  34522. }
  34523. /**
  34524. * Clamps a value based on a min/max range with rounding.
  34525. * Returns a string.
  34526. *
  34527. * @param {Parameters<typeof roundClamp>} args Arguments for roundClamp().
  34528. * @return {string} The rounded and clamped value.
  34529. */
  34530. function roundClampString() {
  34531. return roundClamp(...arguments).toString();
  34532. }
  34533. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/values.js
  34534. /* eslint-disable jsdoc/valid-types */
  34535. /**
  34536. * Determines if a value is null or undefined.
  34537. *
  34538. * @template T
  34539. *
  34540. * @param {T | null | undefined} value The value to check.
  34541. * @return {value is T} Whether value is not null or undefined.
  34542. */
  34543. function isValueDefined(value) {
  34544. return value !== undefined && value !== null;
  34545. }
  34546. /* eslint-enable jsdoc/valid-types */
  34547. /* eslint-disable jsdoc/valid-types */
  34548. /**
  34549. * Determines if a value is empty, null, or undefined.
  34550. *
  34551. * @template T
  34552. *
  34553. * @param {T | "" | null | undefined} value The value to check.
  34554. * @return {value is T} Whether value is empty.
  34555. */
  34556. function isValueEmpty(value) {
  34557. const isEmptyString = value === '';
  34558. return !isValueDefined(value) || isEmptyString;
  34559. }
  34560. /* eslint-enable jsdoc/valid-types */
  34561. /**
  34562. * Get the first defined/non-null value from an array.
  34563. *
  34564. * @template T
  34565. *
  34566. * @param {Array<T | null | undefined>} values Values to derive from.
  34567. * @param {T} fallbackValue Fallback value if there are no defined values.
  34568. * @return {T} A defined value or the fallback value.
  34569. */
  34570. function getDefinedValue() {
  34571. var _values$find;
  34572. let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  34573. let fallbackValue = arguments.length > 1 ? arguments[1] : undefined;
  34574. return (_values$find = values.find(isValueDefined)) !== null && _values$find !== void 0 ? _values$find : fallbackValue;
  34575. }
  34576. /**
  34577. * @param {string} [locale]
  34578. * @return {[RegExp, RegExp]} The delimiter and decimal regexp
  34579. */
  34580. const getDelimiterAndDecimalRegex = locale => {
  34581. const formatted = Intl.NumberFormat(locale).format(1000.1);
  34582. const delimiter = formatted[1];
  34583. const decimal = formatted[formatted.length - 2];
  34584. return [new RegExp(`\\${delimiter}`, 'g'), new RegExp(`\\${decimal}`, 'g')];
  34585. }; // https://en.wikipedia.org/wiki/Decimal_separator#Current_standards
  34586. const INTERNATIONAL_THOUSANDS_DELIMITER = / /g;
  34587. const ARABIC_NUMERAL_LOCALES = (/* unused pure expression or super */ null && (['ar', 'fa', 'ur', 'ckb', 'ps']));
  34588. const EASTERN_ARABIC_NUMBERS = /([۰-۹]|[٠-٩])/g;
  34589. /**
  34590. * Checks to see if a value is a numeric value (`number` or `string`).
  34591. *
  34592. * Intentionally ignores whether the thousands delimiters are only
  34593. * in the thousands marks.
  34594. *
  34595. * @param {any} value
  34596. * @param {string} [locale]
  34597. * @return {boolean} Whether value is numeric.
  34598. */
  34599. function isValueNumeric(value) {
  34600. let locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.navigator.language;
  34601. if (ARABIC_NUMERAL_LOCALES.some(l => locale.startsWith(l))) {
  34602. locale = 'en-GB';
  34603. if (EASTERN_ARABIC_NUMBERS.test(value)) {
  34604. value = value.replace(/[٠-٩]/g, (
  34605. /** @type {string} */
  34606. d) => '٠١٢٣٤٥٦٧٨٩'.indexOf(d)).replace(/[۰-۹]/g, (
  34607. /** @type {string} */
  34608. d) => '۰۱۲۳۴۵۶۷۸۹'.indexOf(d)).replace(/٬/g, ',').replace(/٫/g, '.');
  34609. }
  34610. }
  34611. const [delimiterRegexp, decimalRegexp] = getDelimiterAndDecimalRegex(locale);
  34612. const valueToCheck = typeof value === 'string' ? value.replace(delimiterRegexp, '').replace(decimalRegexp, '.').replace(INTERNATIONAL_THOUSANDS_DELIMITER, '') : value;
  34613. return !isNaN(parseFloat(valueToCheck)) && isFinite(valueToCheck);
  34614. }
  34615. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/number-control/index.js
  34616. // @ts-nocheck
  34617. /**
  34618. * External dependencies
  34619. */
  34620. /**
  34621. * WordPress dependencies
  34622. */
  34623. /**
  34624. * Internal dependencies
  34625. */
  34626. function NumberControl(_ref, ref) {
  34627. let {
  34628. __unstableStateReducer: stateReducerProp,
  34629. className,
  34630. dragDirection = 'n',
  34631. hideHTMLArrows = false,
  34632. isDragEnabled = true,
  34633. isShiftStepEnabled = true,
  34634. label,
  34635. max = Infinity,
  34636. min = -Infinity,
  34637. required = false,
  34638. shiftStep = 10,
  34639. step = 1,
  34640. type: typeProp = 'number',
  34641. value: valueProp,
  34642. ...props
  34643. } = _ref;
  34644. const isStepAny = step === 'any';
  34645. const baseStep = isStepAny ? 1 : parseFloat(step);
  34646. const baseValue = roundClamp(0, min, max, baseStep);
  34647. const constrainValue = (value, stepOverride) => {
  34648. // When step is "any" clamp the value, otherwise round and clamp it.
  34649. return isStepAny ? Math.min(max, Math.max(min, value)) : roundClamp(value, min, max, stepOverride !== null && stepOverride !== void 0 ? stepOverride : baseStep);
  34650. };
  34651. const autoComplete = typeProp === 'number' ? 'off' : null;
  34652. const classes = classnames_default()('components-number-control', className);
  34653. /**
  34654. * "Middleware" function that intercepts updates from InputControl.
  34655. * This allows us to tap into actions to transform the (next) state for
  34656. * InputControl.
  34657. *
  34658. * @param {Object} state State from InputControl
  34659. * @param {Object} action Action triggering state change
  34660. * @return {Object} The updated state to apply to InputControl
  34661. */
  34662. const numberControlStateReducer = (state, action) => {
  34663. const nextState = { ...state
  34664. };
  34665. const {
  34666. type,
  34667. payload
  34668. } = action;
  34669. const event = payload === null || payload === void 0 ? void 0 : payload.event;
  34670. const currentValue = nextState.value;
  34671. /**
  34672. * Handles custom UP and DOWN Keyboard events
  34673. */
  34674. if (type === PRESS_UP || type === PRESS_DOWN) {
  34675. const enableShift = event.shiftKey && isShiftStepEnabled;
  34676. const incrementalValue = enableShift ? parseFloat(shiftStep) * baseStep : baseStep;
  34677. let nextValue = isValueEmpty(currentValue) ? baseValue : currentValue;
  34678. if (event !== null && event !== void 0 && event.preventDefault) {
  34679. event.preventDefault();
  34680. }
  34681. if (type === PRESS_UP) {
  34682. nextValue = add(nextValue, incrementalValue);
  34683. }
  34684. if (type === PRESS_DOWN) {
  34685. nextValue = subtract(nextValue, incrementalValue);
  34686. }
  34687. nextState.value = constrainValue(nextValue, enableShift ? incrementalValue : null);
  34688. }
  34689. /**
  34690. * Handles drag to update events
  34691. */
  34692. if (type === DRAG && isDragEnabled) {
  34693. const [x, y] = payload.delta;
  34694. const enableShift = payload.shiftKey && isShiftStepEnabled;
  34695. const modifier = enableShift ? parseFloat(shiftStep) * baseStep : baseStep;
  34696. let directionModifier;
  34697. let delta;
  34698. switch (dragDirection) {
  34699. case 'n':
  34700. delta = y;
  34701. directionModifier = -1;
  34702. break;
  34703. case 'e':
  34704. delta = x;
  34705. directionModifier = (0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1;
  34706. break;
  34707. case 's':
  34708. delta = y;
  34709. directionModifier = 1;
  34710. break;
  34711. case 'w':
  34712. delta = x;
  34713. directionModifier = (0,external_wp_i18n_namespaceObject.isRTL)() ? 1 : -1;
  34714. break;
  34715. }
  34716. if (delta !== 0) {
  34717. delta = Math.ceil(Math.abs(delta)) * Math.sign(delta);
  34718. const distance = delta * modifier * directionModifier;
  34719. nextState.value = constrainValue(add(currentValue, distance), enableShift ? modifier : null);
  34720. }
  34721. }
  34722. /**
  34723. * Handles commit (ENTER key press or blur)
  34724. */
  34725. if (type === PRESS_ENTER || type === COMMIT) {
  34726. const applyEmptyValue = required === false && currentValue === '';
  34727. nextState.value = applyEmptyValue ? currentValue : constrainValue(currentValue);
  34728. }
  34729. return nextState;
  34730. };
  34731. return (0,external_wp_element_namespaceObject.createElement)(number_control_styles_Input, extends_extends({
  34732. autoComplete: autoComplete,
  34733. inputMode: "numeric"
  34734. }, props, {
  34735. className: classes,
  34736. dragDirection: dragDirection,
  34737. hideHTMLArrows: hideHTMLArrows,
  34738. isDragEnabled: isDragEnabled,
  34739. label: label,
  34740. max: max,
  34741. min: min,
  34742. ref: ref,
  34743. required: required,
  34744. step: step,
  34745. type: typeProp,
  34746. value: valueProp,
  34747. __unstableStateReducer: (state, action) => {
  34748. var _stateReducerProp;
  34749. const baseState = numberControlStateReducer(state, action);
  34750. return (_stateReducerProp = stateReducerProp === null || stateReducerProp === void 0 ? void 0 : stateReducerProp(baseState, action)) !== null && _stateReducerProp !== void 0 ? _stateReducerProp : baseState;
  34751. }
  34752. }));
  34753. }
  34754. /* harmony default export */ var number_control = ((0,external_wp_element_namespaceObject.forwardRef)(NumberControl));
  34755. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/styles/unit-control-styles.js
  34756. function unit_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  34757. /**
  34758. * External dependencies
  34759. */
  34760. /**
  34761. * Internal dependencies
  34762. */
  34763. const unit_control_styles_Root = emotion_styled_base_browser_esm("div", true ? {
  34764. target: "e1bagdl33"
  34765. } : 0)( true ? {
  34766. name: "100d0a9",
  34767. styles: "box-sizing:border-box;position:relative"
  34768. } : 0);
  34769. const paddingStyles = _ref2 => {
  34770. let {
  34771. disableUnits,
  34772. size
  34773. } = _ref2;
  34774. const paddings = {
  34775. default: {
  34776. paddingRight: 8
  34777. },
  34778. small: {
  34779. paddingRight: 8
  34780. },
  34781. '__unstable-large': {
  34782. paddingRight: disableUnits ? 16 : 8
  34783. }
  34784. };
  34785. return /*#__PURE__*/emotion_react_browser_esm_css(rtl(paddings[size])(), ";" + ( true ? "" : 0), true ? "" : 0);
  34786. };
  34787. var unit_control_styles_ref = true ? {
  34788. name: "1y65o8",
  34789. styles: "&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}"
  34790. } : 0;
  34791. const arrowStyles = _ref3 => {
  34792. let {
  34793. disableUnits
  34794. } = _ref3;
  34795. if (disableUnits) return '';
  34796. return unit_control_styles_ref;
  34797. }; // TODO: Resolve need to use &&& to increase specificity
  34798. // https://github.com/WordPress/gutenberg/issues/18483
  34799. const ValueInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
  34800. target: "e1bagdl32"
  34801. } : 0)("&&&{input{appearance:none;-moz-appearance:textfield;display:block;width:100%;", arrowStyles, ";", paddingStyles, ";}}" + ( true ? "" : 0));
  34802. const baseUnitLabelStyles = /*#__PURE__*/emotion_react_browser_esm_css("appearance:none;background:transparent;border-radius:2px;border:none;box-sizing:border-box;color:", COLORS.darkGray[500], ";display:block;font-size:8px;letter-spacing:-0.5px;outline:none;padding:2px 1px;text-align-last:center;text-transform:uppercase;width:20px;", rtl({
  34803. borderTopLeftRadius: 0,
  34804. borderBottomLeftRadius: 0
  34805. })(), ";" + ( true ? "" : 0), true ? "" : 0);
  34806. const UnitLabel = emotion_styled_base_browser_esm("div", true ? {
  34807. target: "e1bagdl31"
  34808. } : 0)("&&&{pointer-events:none;", baseUnitLabelStyles, ";}" + ( true ? "" : 0));
  34809. const UnitSelect = emotion_styled_base_browser_esm("select", true ? {
  34810. target: "e1bagdl30"
  34811. } : 0)("&&&{", baseUnitLabelStyles, ";cursor:pointer;border:1px solid transparent;height:100%;&:hover{background-color:", COLORS.lightGray[300], ";}&:focus{border-color:", COLORS.ui.borderFocus, ";outline:2px solid transparent;outline-offset:0;}&:disabled{cursor:initial;&:hover{background-color:transparent;}}}" + ( true ? "" : 0));
  34812. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/styles.js
  34813. function border_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  34814. /**
  34815. * External dependencies
  34816. */
  34817. /**
  34818. * Internal dependencies
  34819. */
  34820. const styles_labelStyles = true ? {
  34821. name: "f3vz0n",
  34822. styles: "font-weight:500"
  34823. } : 0;
  34824. const borderControl = true ? {
  34825. name: "bjn8wh",
  34826. styles: "position:relative"
  34827. } : 0;
  34828. const innerWrapper = () => /*#__PURE__*/emotion_react_browser_esm_css("border:", config_values.borderWidth, " solid ", COLORS.gray[200], ";border-radius:2px;flex:1 0 40%;background:#fff;", unit_control_styles_Root, "{flex:1;", rtl({
  34829. marginLeft: 0
  34830. })(), ";}" + ( true ? "" : 0), true ? "" : 0);
  34831. const styles_wrapperWidth = width => {
  34832. return /*#__PURE__*/emotion_react_browser_esm_css("width:", width, ";flex:0 0 auto;" + ( true ? "" : 0), true ? "" : 0);
  34833. };
  34834. const borderControlDropdown = () => /*#__PURE__*/emotion_react_browser_esm_css("background:#fff;", rtl({
  34835. borderRadius: `1px 0 0 1px`,
  34836. borderRight: `${config_values.borderWidth} solid ${COLORS.gray[200]}`
  34837. }, {
  34838. borderRadius: `0 1px 1px 0`,
  34839. borderLeft: `${config_values.borderWidth} solid ${COLORS.gray[200]}`
  34840. })(), " &&>button{padding:", space(1), ";border-radius:inherit;}" + ( true ? "" : 0), true ? "" : 0);
  34841. const colorIndicatorBorder = border => {
  34842. const {
  34843. color,
  34844. style
  34845. } = border || {};
  34846. const fallbackColor = !!style && style !== 'none' ? COLORS.gray[300] : undefined;
  34847. return /*#__PURE__*/emotion_react_browser_esm_css("border-style:", style === 'none' ? 'solid' : style, ";border-color:", color || fallbackColor, ";" + ( true ? "" : 0), true ? "" : 0);
  34848. };
  34849. const colorIndicatorWrapper = border => {
  34850. const {
  34851. style
  34852. } = border || {};
  34853. return /*#__PURE__*/emotion_react_browser_esm_css("border-radius:9999px;border:2px solid transparent;", style ? colorIndicatorBorder(border) : undefined, " width:28px;height:28px;padding:2px;&>span{background:linear-gradient(\n\t\t\t\t-45deg,\n\t\t\t\ttransparent 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 52%,\n\t\t\t\ttransparent 52%\n\t\t\t);}" + ( true ? "" : 0), true ? "" : 0);
  34854. };
  34855. const borderControlPopover = true ? {
  34856. name: "1phacrs",
  34857. styles: "&&>div>div{padding:0;}"
  34858. } : 0;
  34859. const borderControlPopoverControls = /*#__PURE__*/emotion_react_browser_esm_css("padding:", space(2), ";>div:first-of-type>", StyledLabel, "{margin-bottom:0;", styles_labelStyles, ";}&& ", StyledLabel, "+button:not( .has-text ){min-width:24px;padding:0;}" + ( true ? "" : 0), true ? "" : 0);
  34860. const borderControlPopoverContent = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
  34861. const borderColorIndicator = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
  34862. const resetButton = /*#__PURE__*/emotion_react_browser_esm_css("justify-content:center;width:100%;&&{border-top:", config_values.borderWidth, " solid ", COLORS.gray[200], ";height:46px;}" + ( true ? "" : 0), true ? "" : 0);
  34863. const borderWidthControl = () => /*#__PURE__*/emotion_react_browser_esm_css("&&& ", BackdropUI, "{border:none;}&&& input{", rtl({
  34864. paddingRight: 0
  34865. })(), ";}" + ( true ? "" : 0), true ? "" : 0);
  34866. const borderControlStylePicker = /*#__PURE__*/emotion_react_browser_esm_css(StyledLabel, "{", styles_labelStyles, ";}" + ( true ? "" : 0), true ? "" : 0);
  34867. const borderStyleButton = true ? {
  34868. name: "1486260",
  34869. styles: "&&&&&{min-width:30px;width:30px;height:30px;padding:3px;}"
  34870. } : 0;
  34871. const borderSlider = () => /*#__PURE__*/emotion_react_browser_esm_css("flex:1 1 60%;", rtl({
  34872. marginRight: space(3)
  34873. })(), " ", StyledField, "{margin-bottom:0;font-size:0;display:flex;}" + ( true ? "" : 0), true ? "" : 0);
  34874. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-style-picker/hook.js
  34875. /**
  34876. * WordPress dependencies
  34877. */
  34878. /**
  34879. * Internal dependencies
  34880. */
  34881. function useBorderControlStylePicker(props) {
  34882. const {
  34883. className,
  34884. ...otherProps
  34885. } = useContextSystem(props, 'BorderControlStylePicker'); // Generate class names.
  34886. const cx = useCx();
  34887. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  34888. return cx(borderControlStylePicker, className);
  34889. }, [className, cx]);
  34890. const buttonClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  34891. return cx(borderStyleButton);
  34892. }, [cx]);
  34893. return { ...otherProps,
  34894. className: classes,
  34895. buttonClassName
  34896. };
  34897. }
  34898. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-style-picker/component.js
  34899. /**
  34900. * WordPress dependencies
  34901. */
  34902. /**
  34903. * Internal dependencies
  34904. */
  34905. const BORDER_STYLES = [{
  34906. label: (0,external_wp_i18n_namespaceObject.__)('Solid'),
  34907. icon: line_solid,
  34908. value: 'solid'
  34909. }, {
  34910. label: (0,external_wp_i18n_namespaceObject.__)('Dashed'),
  34911. icon: line_dashed,
  34912. value: 'dashed'
  34913. }, {
  34914. label: (0,external_wp_i18n_namespaceObject.__)('Dotted'),
  34915. icon: line_dotted,
  34916. value: 'dotted'
  34917. }];
  34918. const component_Label = props => {
  34919. const {
  34920. label,
  34921. hideLabelFromVision
  34922. } = props;
  34923. if (!label) {
  34924. return null;
  34925. }
  34926. return hideLabelFromVision ? (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  34927. as: "label"
  34928. }, label) : (0,external_wp_element_namespaceObject.createElement)(StyledLabel, null, label);
  34929. };
  34930. const BorderControlStylePicker = (props, forwardedRef) => {
  34931. const {
  34932. buttonClassName,
  34933. hideLabelFromVision,
  34934. label,
  34935. onChange,
  34936. value,
  34937. ...otherProps
  34938. } = useBorderControlStylePicker(props);
  34939. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  34940. ref: forwardedRef
  34941. }), (0,external_wp_element_namespaceObject.createElement)(component_Label, {
  34942. label: label,
  34943. hideLabelFromVision: hideLabelFromVision
  34944. }), (0,external_wp_element_namespaceObject.createElement)(flex_component, {
  34945. justify: "flex-start",
  34946. gap: 1
  34947. }, BORDER_STYLES.map(borderStyle => (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  34948. key: borderStyle.value,
  34949. className: buttonClassName,
  34950. icon: borderStyle.icon,
  34951. isSmall: true,
  34952. isPressed: borderStyle.value === value,
  34953. onClick: () => onChange(borderStyle.value === value ? undefined : borderStyle.value),
  34954. "aria-label": borderStyle.label,
  34955. label: borderStyle.label,
  34956. showTooltip: true
  34957. }))));
  34958. };
  34959. const ConnectedBorderControlStylePicker = contextConnect(BorderControlStylePicker, 'BorderControlStylePicker');
  34960. /* harmony default export */ var border_control_style_picker_component = (ConnectedBorderControlStylePicker);
  34961. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-indicator/index.js
  34962. // @ts-nocheck
  34963. /**
  34964. * External dependencies
  34965. */
  34966. const ColorIndicator = _ref => {
  34967. let {
  34968. className,
  34969. colorValue,
  34970. ...props
  34971. } = _ref;
  34972. return (0,external_wp_element_namespaceObject.createElement)("span", extends_extends({
  34973. className: classnames_default()('component-color-indicator', className),
  34974. style: {
  34975. background: colorValue
  34976. }
  34977. }, props));
  34978. };
  34979. /* harmony default export */ var color_indicator = (ColorIndicator);
  34980. ;// CONCATENATED MODULE: ./node_modules/colord/plugins/a11y.mjs
  34981. var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}}
  34982. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown/index.js
  34983. // @ts-nocheck
  34984. /**
  34985. * External dependencies
  34986. */
  34987. /**
  34988. * WordPress dependencies
  34989. */
  34990. /**
  34991. * Internal dependencies
  34992. */
  34993. function useObservableState(initialState, onStateChange) {
  34994. const [state, setState] = (0,external_wp_element_namespaceObject.useState)(initialState);
  34995. return [state, value => {
  34996. setState(value);
  34997. if (onStateChange) {
  34998. onStateChange(value);
  34999. }
  35000. }];
  35001. }
  35002. function Dropdown(props) {
  35003. var _popoverProps$anchorR;
  35004. const {
  35005. renderContent,
  35006. renderToggle,
  35007. position = 'bottom right',
  35008. className,
  35009. contentClassName,
  35010. expandOnMobile,
  35011. headerTitle,
  35012. focusOnMount,
  35013. popoverProps,
  35014. onClose,
  35015. onToggle
  35016. } = props;
  35017. const containerRef = (0,external_wp_element_namespaceObject.useRef)();
  35018. const [isOpen, setIsOpen] = useObservableState(false, onToggle);
  35019. (0,external_wp_element_namespaceObject.useEffect)(() => () => {
  35020. if (onToggle) {
  35021. onToggle(false);
  35022. }
  35023. }, []);
  35024. function toggle() {
  35025. setIsOpen(!isOpen);
  35026. }
  35027. /**
  35028. * Closes the popover when focus leaves it unless the toggle was pressed or
  35029. * focus has moved to a separate dialog. The former is to let the toggle
  35030. * handle closing the popover and the latter is to preserve presence in
  35031. * case a dialog has opened, allowing focus to return when it's dismissed.
  35032. */
  35033. function closeIfFocusOutside() {
  35034. const {
  35035. ownerDocument
  35036. } = containerRef.current;
  35037. const dialog = ownerDocument.activeElement.closest('[role="dialog"]');
  35038. if (!containerRef.current.contains(ownerDocument.activeElement) && (!dialog || dialog.contains(containerRef.current))) {
  35039. close();
  35040. }
  35041. }
  35042. function close() {
  35043. if (onClose) {
  35044. onClose();
  35045. }
  35046. setIsOpen(false);
  35047. }
  35048. const args = {
  35049. isOpen,
  35050. onToggle: toggle,
  35051. onClose: close
  35052. };
  35053. return (0,external_wp_element_namespaceObject.createElement)("div", {
  35054. className: classnames_default()('components-dropdown', className),
  35055. ref: containerRef // Some UAs focus the closest focusable parent when the toggle is
  35056. // clicked. Making this div focusable ensures such UAs will focus
  35057. // it and `closeIfFocusOutside` can tell if the toggle was clicked.
  35058. ,
  35059. tabIndex: "-1"
  35060. }, renderToggle(args), isOpen && (0,external_wp_element_namespaceObject.createElement)(popover, extends_extends({
  35061. position: position,
  35062. onClose: close,
  35063. onFocusOutside: closeIfFocusOutside,
  35064. expandOnMobile: expandOnMobile,
  35065. headerTitle: headerTitle,
  35066. focusOnMount: focusOnMount
  35067. }, popoverProps, {
  35068. anchorRef: (_popoverProps$anchorR = popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.anchorRef) !== null && _popoverProps$anchorR !== void 0 ? _popoverProps$anchorR : containerRef.current,
  35069. className: classnames_default()('components-dropdown__content', popoverProps ? popoverProps.className : undefined, contentClassName)
  35070. }), renderContent(args)));
  35071. }
  35072. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/settings.js
  35073. /**
  35074. * WordPress dependencies
  35075. */
  35076. const settings = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  35077. xmlns: "http://www.w3.org/2000/svg",
  35078. viewBox: "0 0 24 24"
  35079. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  35080. d: "M14.5 13.8c-1.1 0-2.1.7-2.4 1.8H4V17h8.1c.3 1 1.3 1.8 2.4 1.8s2.1-.7 2.4-1.8H20v-1.5h-3.1c-.3-1-1.3-1.7-2.4-1.7zM11.9 7c-.3-1-1.3-1.8-2.4-1.8S7.4 6 7.1 7H4v1.5h3.1c.3 1 1.3 1.8 2.4 1.8s2.1-.7 2.4-1.8H20V7h-8.1z"
  35081. }));
  35082. /* harmony default export */ var library_settings = (settings);
  35083. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/h-stack/utils.js
  35084. /**
  35085. * External dependencies
  35086. */
  35087. /** @type {import('./types').Alignments} */
  35088. const utils_ALIGNMENTS = {
  35089. bottom: {
  35090. align: 'flex-end',
  35091. justify: 'center'
  35092. },
  35093. bottomLeft: {
  35094. align: 'flex-start',
  35095. justify: 'flex-end'
  35096. },
  35097. bottomRight: {
  35098. align: 'flex-end',
  35099. justify: 'flex-end'
  35100. },
  35101. center: {
  35102. align: 'center',
  35103. justify: 'center'
  35104. },
  35105. edge: {
  35106. align: 'center',
  35107. justify: 'space-between'
  35108. },
  35109. left: {
  35110. align: 'center',
  35111. justify: 'flex-start'
  35112. },
  35113. right: {
  35114. align: 'center',
  35115. justify: 'flex-end'
  35116. },
  35117. stretch: {
  35118. align: 'stretch'
  35119. },
  35120. top: {
  35121. align: 'flex-start',
  35122. justify: 'center'
  35123. },
  35124. topLeft: {
  35125. align: 'flex-start',
  35126. justify: 'flex-start'
  35127. },
  35128. topRight: {
  35129. align: 'flex-start',
  35130. justify: 'flex-end'
  35131. }
  35132. };
  35133. /** @type {import('./types').Alignments} */
  35134. const V_ALIGNMENTS = {
  35135. bottom: {
  35136. justify: 'flex-end',
  35137. align: 'center'
  35138. },
  35139. bottomLeft: {
  35140. justify: 'flex-start',
  35141. align: 'flex-end'
  35142. },
  35143. bottomRight: {
  35144. justify: 'flex-end',
  35145. align: 'flex-end'
  35146. },
  35147. center: {
  35148. justify: 'center',
  35149. align: 'center'
  35150. },
  35151. edge: {
  35152. justify: 'space-between',
  35153. align: 'center'
  35154. },
  35155. left: {
  35156. justify: 'center',
  35157. align: 'flex-start'
  35158. },
  35159. right: {
  35160. justify: 'center',
  35161. align: 'flex-end'
  35162. },
  35163. stretch: {
  35164. justify: 'stretch'
  35165. },
  35166. top: {
  35167. justify: 'flex-start',
  35168. align: 'center'
  35169. },
  35170. topLeft: {
  35171. justify: 'flex-start',
  35172. align: 'flex-start'
  35173. },
  35174. topRight: {
  35175. justify: 'flex-start',
  35176. align: 'flex-end'
  35177. }
  35178. };
  35179. /* eslint-disable jsdoc/valid-types */
  35180. /**
  35181. * @param {import('./types').HStackAlignment | import('react').CSSProperties[ 'alignItems' ]} alignment Where to align.
  35182. * @param {import('../flex/types').FlexDirection} [direction='row'] Direction to align.
  35183. * @return {import('./types').AlignmentProps} Alignment props.
  35184. */
  35185. /* eslint-enable jsdoc/valid-types */
  35186. function getAlignmentProps(alignment) {
  35187. let direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'row';
  35188. if ((0,external_lodash_namespaceObject.isNil)(alignment)) {
  35189. return {};
  35190. }
  35191. const isVertical = direction === 'column';
  35192. const props = isVertical ? V_ALIGNMENTS : utils_ALIGNMENTS;
  35193. const alignmentProps = alignment in props ? props[
  35194. /** @type {keyof typeof ALIGNMENTS} */
  35195. alignment] : {
  35196. align: alignment
  35197. };
  35198. return alignmentProps;
  35199. }
  35200. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/get-valid-children.js
  35201. /**
  35202. * External dependencies
  35203. */
  35204. /**
  35205. * WordPress dependencies
  35206. */
  35207. /**
  35208. * Gets a collection of available children elements from a React component's children prop.
  35209. *
  35210. * @param children
  35211. *
  35212. * @return An array of available children.
  35213. */
  35214. function getValidChildren(children) {
  35215. if (typeof children === 'string') return [children];
  35216. return external_wp_element_namespaceObject.Children.toArray(children).filter(child => (0,external_wp_element_namespaceObject.isValidElement)(child));
  35217. }
  35218. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/h-stack/hook.js
  35219. /**
  35220. * Internal dependencies
  35221. */
  35222. /**
  35223. *
  35224. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
  35225. */
  35226. function useHStack(props) {
  35227. const {
  35228. alignment = 'edge',
  35229. children,
  35230. direction,
  35231. spacing = 2,
  35232. ...otherProps
  35233. } = useContextSystem(props, 'HStack');
  35234. const align = getAlignmentProps(alignment, direction);
  35235. const validChildren = getValidChildren(children);
  35236. const clonedChildren = validChildren.map( // @ts-ignore
  35237. (
  35238. /** @type {import('react').ReactElement} */
  35239. child, index) => {
  35240. const _key = child.key || `hstack-${index}`;
  35241. const _isSpacer = hasConnectNamespace(child, ['Spacer']);
  35242. if (_isSpacer) {
  35243. return (0,external_wp_element_namespaceObject.createElement)(flex_item_component, extends_extends({
  35244. isBlock: true,
  35245. key: _key
  35246. }, child.props));
  35247. }
  35248. return child;
  35249. });
  35250. const propsForFlex = {
  35251. children: clonedChildren,
  35252. direction,
  35253. justify: 'center',
  35254. ...align,
  35255. ...otherProps,
  35256. gap: spacing
  35257. };
  35258. const flexProps = useFlex(propsForFlex);
  35259. return flexProps;
  35260. }
  35261. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/h-stack/component.js
  35262. /**
  35263. * Internal dependencies
  35264. */
  35265. /**
  35266. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
  35267. * @param {import('react').ForwardedRef<any>} forwardedRef
  35268. */
  35269. function HStack(props, forwardedRef) {
  35270. const hStackProps = useHStack(props);
  35271. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, hStackProps, {
  35272. ref: forwardedRef
  35273. }));
  35274. }
  35275. /**
  35276. * `HStack` (Horizontal Stack) arranges child elements in a horizontal line.
  35277. *
  35278. * `HStack` can render anything inside.
  35279. *
  35280. * @example
  35281. * ```jsx
  35282. * import {
  35283. * __experimentalHStack as HStack,
  35284. * __experimentalText as Text,
  35285. * } from `@wordpress/components`;
  35286. *
  35287. * function Example() {
  35288. * return (
  35289. * <HStack>
  35290. * <Text>Code</Text>
  35291. * <Text>is</Text>
  35292. * <Text>Poetry</Text>
  35293. * </HStack>
  35294. * );
  35295. * }
  35296. * ```
  35297. */
  35298. const ConnectedHStack = contextConnect(HStack, 'HStack');
  35299. /* harmony default export */ var h_stack_component = (ConnectedHStack);
  35300. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
  35301. /**
  35302. * WordPress dependencies
  35303. */
  35304. /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
  35305. /**
  35306. * Return an SVG icon.
  35307. *
  35308. * @param {IconProps} props icon is the SVG component to render
  35309. * size is a number specifiying the icon size in pixels
  35310. * Other props will be passed to wrapped SVG component
  35311. *
  35312. * @return {JSX.Element} Icon component
  35313. */
  35314. function icon_Icon(_ref) {
  35315. let {
  35316. icon,
  35317. size = 24,
  35318. ...props
  35319. } = _ref;
  35320. return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
  35321. width: size,
  35322. height: size,
  35323. ...props
  35324. });
  35325. }
  35326. /* harmony default export */ var icons_build_module_icon = (icon_Icon);
  35327. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
  35328. /**
  35329. * WordPress dependencies
  35330. */
  35331. const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  35332. viewBox: "0 0 24 24",
  35333. xmlns: "http://www.w3.org/2000/svg"
  35334. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  35335. d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
  35336. }));
  35337. /* harmony default export */ var chevron_down = (chevronDown);
  35338. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/select-control/styles/select-control-styles.js
  35339. /**
  35340. * External dependencies
  35341. */
  35342. /**
  35343. * Internal dependencies
  35344. */
  35345. const select_control_styles_disabledStyles = _ref => {
  35346. let {
  35347. disabled
  35348. } = _ref;
  35349. if (!disabled) return '';
  35350. return /*#__PURE__*/emotion_react_browser_esm_css({
  35351. color: COLORS.ui.textDisabled
  35352. }, true ? "" : 0, true ? "" : 0);
  35353. };
  35354. const select_control_styles_fontSizeStyles = _ref2 => {
  35355. let {
  35356. selectSize
  35357. } = _ref2;
  35358. const sizes = {
  35359. default: '13px',
  35360. small: '11px',
  35361. '__unstable-large': '13px'
  35362. };
  35363. const fontSize = sizes[selectSize];
  35364. const fontSizeMobile = '16px';
  35365. if (!fontSize) return '';
  35366. return /*#__PURE__*/emotion_react_browser_esm_css("font-size:", fontSizeMobile, ";@media ( min-width: 600px ){font-size:", fontSize, ";}" + ( true ? "" : 0), true ? "" : 0);
  35367. };
  35368. const select_control_styles_sizeStyles = _ref3 => {
  35369. let {
  35370. selectSize
  35371. } = _ref3;
  35372. const sizes = {
  35373. default: {
  35374. height: 30,
  35375. lineHeight: 1,
  35376. minHeight: 30
  35377. },
  35378. small: {
  35379. height: 24,
  35380. lineHeight: 1,
  35381. minHeight: 24
  35382. },
  35383. '__unstable-large': {
  35384. height: 40,
  35385. lineHeight: 1,
  35386. minHeight: 40
  35387. }
  35388. };
  35389. const style = sizes[selectSize] || sizes.default;
  35390. return /*#__PURE__*/emotion_react_browser_esm_css(style, true ? "" : 0, true ? "" : 0);
  35391. };
  35392. const sizePaddings = _ref4 => {
  35393. let {
  35394. selectSize = 'default'
  35395. } = _ref4;
  35396. const sizes = {
  35397. default: {
  35398. paddingLeft: 8,
  35399. paddingRight: 24
  35400. },
  35401. small: {
  35402. paddingLeft: 8,
  35403. paddingRight: 24
  35404. },
  35405. '__unstable-large': {
  35406. paddingLeft: 16,
  35407. paddingRight: 32
  35408. }
  35409. };
  35410. return rtl(sizes[selectSize]);
  35411. }; // TODO: Resolve need to use &&& to increase specificity
  35412. // https://github.com/WordPress/gutenberg/issues/18483
  35413. const Select = emotion_styled_base_browser_esm("select", true ? {
  35414. target: "e1mv6sxx1"
  35415. } : 0)("&&&{appearance:none;background:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:", COLORS.black, ";display:block;font-family:inherit;margin:0;width:100%;", select_control_styles_disabledStyles, ";", select_control_styles_fontSizeStyles, ";", select_control_styles_sizeStyles, ";", sizePaddings, ";}" + ( true ? "" : 0));
  35416. const DownArrowWrapper = emotion_styled_base_browser_esm("div", true ? {
  35417. target: "e1mv6sxx0"
  35418. } : 0)("align-items:center;bottom:0;box-sizing:border-box;display:flex;padding:0 4px;pointer-events:none;position:absolute;top:0;", rtl({
  35419. right: 0
  35420. }), " svg{display:block;}" + ( true ? "" : 0));
  35421. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/select-control/index.js
  35422. /**
  35423. * External dependencies
  35424. */
  35425. /**
  35426. * WordPress dependencies
  35427. */
  35428. /**
  35429. * Internal dependencies
  35430. */
  35431. function select_control_useUniqueId(idProp) {
  35432. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(SelectControl);
  35433. const id = `inspector-select-control-${instanceId}`;
  35434. return idProp || id;
  35435. }
  35436. function SelectControl(_ref, ref) {
  35437. let {
  35438. className,
  35439. disabled = false,
  35440. help,
  35441. hideLabelFromVision,
  35442. id: idProp,
  35443. label,
  35444. multiple = false,
  35445. onBlur = external_lodash_namespaceObject.noop,
  35446. onChange = external_lodash_namespaceObject.noop,
  35447. onFocus = external_lodash_namespaceObject.noop,
  35448. options = [],
  35449. size = 'default',
  35450. value: valueProp,
  35451. labelPosition = 'top',
  35452. children,
  35453. prefix,
  35454. suffix,
  35455. ...props
  35456. } = _ref;
  35457. const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
  35458. const id = select_control_useUniqueId(idProp);
  35459. const helpId = help ? `${id}__help` : undefined; // Disable reason: A select with an onchange throws a warning.
  35460. if ((0,external_lodash_namespaceObject.isEmpty)(options) && !children) return null;
  35461. const handleOnBlur = event => {
  35462. onBlur(event);
  35463. setIsFocused(false);
  35464. };
  35465. const handleOnFocus = event => {
  35466. onFocus(event);
  35467. setIsFocused(true);
  35468. };
  35469. const handleOnChange = event => {
  35470. if (multiple) {
  35471. const selectedOptions = Array.from(event.target.options).filter(_ref2 => {
  35472. let {
  35473. selected
  35474. } = _ref2;
  35475. return selected;
  35476. });
  35477. const newValues = selectedOptions.map(_ref3 => {
  35478. let {
  35479. value
  35480. } = _ref3;
  35481. return value;
  35482. });
  35483. onChange(newValues);
  35484. return;
  35485. }
  35486. onChange(event.target.value, {
  35487. event
  35488. });
  35489. };
  35490. const classes = classnames_default()('components-select-control', className);
  35491. /* eslint-disable jsx-a11y/no-onchange */
  35492. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  35493. help: help,
  35494. id: id
  35495. }, (0,external_wp_element_namespaceObject.createElement)(input_base, {
  35496. className: classes,
  35497. disabled: disabled,
  35498. hideLabelFromVision: hideLabelFromVision,
  35499. id: id,
  35500. isFocused: isFocused,
  35501. label: label,
  35502. size: size,
  35503. suffix: suffix || (0,external_wp_element_namespaceObject.createElement)(DownArrowWrapper, null, (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  35504. icon: chevron_down,
  35505. size: 18
  35506. })),
  35507. prefix: prefix,
  35508. labelPosition: labelPosition
  35509. }, (0,external_wp_element_namespaceObject.createElement)(Select, extends_extends({}, props, {
  35510. "aria-describedby": helpId,
  35511. className: "components-select-control__input",
  35512. disabled: disabled,
  35513. id: id,
  35514. multiple: multiple,
  35515. onBlur: handleOnBlur,
  35516. onChange: handleOnChange,
  35517. onFocus: handleOnFocus,
  35518. ref: ref,
  35519. selectSize: size,
  35520. value: valueProp
  35521. }), children || options.map((option, index) => {
  35522. const key = option.id || `${option.label}-${option.value}-${index}`;
  35523. return (0,external_wp_element_namespaceObject.createElement)("option", {
  35524. key: key,
  35525. value: option.value,
  35526. disabled: option.disabled
  35527. }, option.label);
  35528. }))));
  35529. /* eslint-enable jsx-a11y/no-onchange */
  35530. }
  35531. const select_control_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(SelectControl);
  35532. /* harmony default export */ var select_control = (select_control_ForwardedComponent);
  35533. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-state.js
  35534. /**
  35535. * WordPress dependencies
  35536. */
  35537. /**
  35538. * Internal dependencies
  35539. */
  35540. /**
  35541. * @template T
  35542. * @typedef Options
  35543. * @property {T | undefined} initial Initial value
  35544. * @property {T | ""} fallback Fallback value
  35545. */
  35546. /** @type {Readonly<{ initial: undefined, fallback: '' }>} */
  35547. const defaultOptions = {
  35548. initial: undefined,
  35549. /**
  35550. * Defaults to empty string, as that is preferred for usage with
  35551. * <input />, <textarea />, and <select /> form elements.
  35552. */
  35553. fallback: ''
  35554. };
  35555. /**
  35556. * Custom hooks for "controlled" components to track and consolidate internal
  35557. * state and incoming values. This is useful for components that render
  35558. * `input`, `textarea`, or `select` HTML elements.
  35559. *
  35560. * https://reactjs.org/docs/forms.html#controlled-components
  35561. *
  35562. * At first, a component using useControlledState receives an initial prop
  35563. * value, which is used as initial internal state.
  35564. *
  35565. * This internal state can be maintained and updated without
  35566. * relying on new incoming prop values.
  35567. *
  35568. * Unlike the basic useState hook, useControlledState's state can
  35569. * be updated if a new incoming prop value is changed.
  35570. *
  35571. * @template T
  35572. *
  35573. * @param {T | undefined} currentState The current value.
  35574. * @param {Options<T>} [options=defaultOptions] Additional options for the hook.
  35575. *
  35576. * @return {[T | "", (nextState: T) => void]} The controlled value and the value setter.
  35577. */
  35578. function useControlledState(currentState) {
  35579. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
  35580. const {
  35581. initial,
  35582. fallback
  35583. } = { ...defaultOptions,
  35584. ...options
  35585. };
  35586. const [internalState, setInternalState] = (0,external_wp_element_namespaceObject.useState)(currentState);
  35587. const hasCurrentState = isValueDefined(currentState);
  35588. /*
  35589. * Resets internal state if value every changes from uncontrolled <-> controlled.
  35590. */
  35591. (0,external_wp_element_namespaceObject.useEffect)(() => {
  35592. if (hasCurrentState && internalState) {
  35593. setInternalState(undefined);
  35594. }
  35595. }, [hasCurrentState, internalState]);
  35596. const state = getDefinedValue([currentState, internalState, initial], fallback);
  35597. /* eslint-disable jsdoc/no-undefined-types */
  35598. /** @type {(nextState: T) => void} */
  35599. const setState = nextState => {
  35600. if (!hasCurrentState) {
  35601. setInternalState(nextState);
  35602. }
  35603. };
  35604. /* eslint-enable jsdoc/no-undefined-types */
  35605. return [state, setState];
  35606. }
  35607. /* harmony default export */ var use_controlled_state = (useControlledState);
  35608. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/utils.js
  35609. // @ts-nocheck
  35610. /**
  35611. * External dependencies
  35612. */
  35613. /**
  35614. * WordPress dependencies
  35615. */
  35616. /**
  35617. * Internal dependencies
  35618. */
  35619. /**
  35620. * A float supported clamp function for a specific value.
  35621. *
  35622. * @param {number|null} value The value to clamp.
  35623. * @param {number} min The minimum value.
  35624. * @param {number} max The maximum value.
  35625. *
  35626. * @return {number} A (float) number
  35627. */
  35628. function floatClamp(value, min, max) {
  35629. if (typeof value !== 'number') {
  35630. return null;
  35631. }
  35632. return parseFloat((0,external_lodash_namespaceObject.clamp)(value, min, max));
  35633. }
  35634. /**
  35635. * Hook to store a clamped value, derived from props.
  35636. *
  35637. * @param {Object} settings Hook settings.
  35638. * @param {number} settings.min The minimum value.
  35639. * @param {number} settings.max The maximum value.
  35640. * @param {number} settings.value The current value.
  35641. * @param {any} settings.initial The initial value.
  35642. *
  35643. * @return {[*, Function]} The controlled value and the value setter.
  35644. */
  35645. function useControlledRangeValue(_ref) {
  35646. let {
  35647. min,
  35648. max,
  35649. value: valueProp,
  35650. initial
  35651. } = _ref;
  35652. const [state, setInternalState] = use_controlled_state(floatClamp(valueProp, min, max), {
  35653. initial,
  35654. fallback: null
  35655. });
  35656. const setState = (0,external_wp_element_namespaceObject.useCallback)(nextValue => {
  35657. if (nextValue === null) {
  35658. setInternalState(null);
  35659. } else {
  35660. setInternalState(floatClamp(nextValue, min, max));
  35661. }
  35662. }, [min, max]);
  35663. return [state, setState];
  35664. }
  35665. /**
  35666. * Hook to encapsulate the debouncing "hover" to better handle the showing
  35667. * and hiding of the Tooltip.
  35668. *
  35669. * @param {Object} settings Hook settings.
  35670. * @param {Function} [settings.onShow=noop] A callback function invoked when the element is shown.
  35671. * @param {Function} [settings.onHide=noop] A callback function invoked when the element is hidden.
  35672. * @param {Function} [settings.onMouseMove=noop] A callback function invoked when the mouse is moved.
  35673. * @param {Function} [settings.onMouseLeave=noop] A callback function invoked when the mouse is moved out of the element.
  35674. * @param {number} [settings.timeout=300] Timeout before the element is shown or hidden.
  35675. *
  35676. * @return {Object} Bound properties for use on a React.Node.
  35677. */
  35678. function useDebouncedHoverInteraction(_ref2) {
  35679. let {
  35680. onHide = external_lodash_namespaceObject.noop,
  35681. onMouseLeave = external_lodash_namespaceObject.noop,
  35682. onMouseMove = external_lodash_namespaceObject.noop,
  35683. onShow = external_lodash_namespaceObject.noop,
  35684. timeout = 300
  35685. } = _ref2;
  35686. const [show, setShow] = (0,external_wp_element_namespaceObject.useState)(false);
  35687. const timeoutRef = (0,external_wp_element_namespaceObject.useRef)();
  35688. const setDebouncedTimeout = (0,external_wp_element_namespaceObject.useCallback)(callback => {
  35689. window.clearTimeout(timeoutRef.current);
  35690. timeoutRef.current = setTimeout(callback, timeout);
  35691. }, [timeout]);
  35692. const handleOnMouseMove = (0,external_wp_element_namespaceObject.useCallback)(event => {
  35693. onMouseMove(event);
  35694. setDebouncedTimeout(() => {
  35695. if (!show) {
  35696. setShow(true);
  35697. onShow();
  35698. }
  35699. });
  35700. }, []);
  35701. const handleOnMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(event => {
  35702. onMouseLeave(event);
  35703. setDebouncedTimeout(() => {
  35704. setShow(false);
  35705. onHide();
  35706. });
  35707. }, []);
  35708. (0,external_wp_element_namespaceObject.useEffect)(() => {
  35709. return () => {
  35710. window.clearTimeout(timeoutRef.current);
  35711. };
  35712. });
  35713. return {
  35714. onMouseMove: handleOnMouseMove,
  35715. onMouseLeave: handleOnMouseLeave
  35716. };
  35717. }
  35718. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/styles/range-control-styles.js
  35719. function range_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  35720. // @ts-nocheck
  35721. /**
  35722. * External dependencies
  35723. */
  35724. /**
  35725. * Internal dependencies
  35726. */
  35727. const rangeHeightValue = 30;
  35728. const railHeight = 4;
  35729. const rangeHeight = () => /*#__PURE__*/emotion_react_browser_esm_css({
  35730. height: rangeHeightValue,
  35731. minHeight: rangeHeightValue
  35732. }, true ? "" : 0, true ? "" : 0);
  35733. const thumbSize = 12;
  35734. const range_control_styles_Root = emotion_styled_base_browser_esm("div", true ? {
  35735. target: "exqw8y214"
  35736. } : 0)( true ? {
  35737. name: "17z6zai",
  35738. styles: "-webkit-tap-highlight-color:transparent;box-sizing:border-box;align-items:flex-start;display:inline-flex;justify-content:flex-start;padding:0;position:relative;touch-action:none;width:100%"
  35739. } : 0);
  35740. const wrapperColor = _ref4 => {
  35741. let {
  35742. color: colorProp = COLORS.ui.borderFocus
  35743. } = _ref4;
  35744. return /*#__PURE__*/emotion_react_browser_esm_css({
  35745. color: colorProp
  35746. }, true ? "" : 0, true ? "" : 0);
  35747. };
  35748. const wrapperMargin = _ref5 => {
  35749. let {
  35750. marks
  35751. } = _ref5;
  35752. return /*#__PURE__*/emotion_react_browser_esm_css({
  35753. marginBottom: marks ? 16 : null
  35754. }, true ? "" : 0, true ? "" : 0);
  35755. };
  35756. const range_control_styles_Wrapper = emotion_styled_base_browser_esm("div", true ? {
  35757. target: "exqw8y213"
  35758. } : 0)("box-sizing:border-box;color:", COLORS.blue.medium.focus, ";display:block;flex:1;position:relative;width:100%;", wrapperColor, ";", rangeHeight, ";", wrapperMargin, ";" + ( true ? "" : 0));
  35759. const BeforeIconWrapper = emotion_styled_base_browser_esm("span", true ? {
  35760. target: "exqw8y212"
  35761. } : 0)("margin-top:", railHeight, "px;", rtl({
  35762. marginRight: 6
  35763. }), ";" + ( true ? "" : 0));
  35764. const AfterIconWrapper = emotion_styled_base_browser_esm("span", true ? {
  35765. target: "exqw8y211"
  35766. } : 0)("margin-top:", railHeight, "px;", rtl({
  35767. marginLeft: 6
  35768. }), ";" + ( true ? "" : 0));
  35769. const railBackgroundColor = _ref6 => {
  35770. let {
  35771. disabled,
  35772. railColor
  35773. } = _ref6;
  35774. let background = railColor || null;
  35775. if (disabled) {
  35776. background = COLORS.lightGray[400];
  35777. }
  35778. return /*#__PURE__*/emotion_react_browser_esm_css({
  35779. background
  35780. }, true ? "" : 0, true ? "" : 0);
  35781. };
  35782. const Rail = emotion_styled_base_browser_esm("span", true ? {
  35783. target: "exqw8y210"
  35784. } : 0)("background-color:", COLORS.lightGray[600], ";box-sizing:border-box;left:0;pointer-events:none;right:0;display:block;height:", railHeight, "px;position:absolute;margin-top:", (rangeHeightValue - railHeight) / 2, "px;top:0;border-radius:", railHeight, "px;", railBackgroundColor, ";" + ( true ? "" : 0));
  35785. const trackBackgroundColor = _ref7 => {
  35786. let {
  35787. disabled,
  35788. trackColor
  35789. } = _ref7;
  35790. let background = trackColor || 'currentColor';
  35791. if (disabled) {
  35792. background = COLORS.lightGray[800];
  35793. }
  35794. return /*#__PURE__*/emotion_react_browser_esm_css({
  35795. background
  35796. }, true ? "" : 0, true ? "" : 0);
  35797. };
  35798. const Track = emotion_styled_base_browser_esm("span", true ? {
  35799. target: "exqw8y29"
  35800. } : 0)("background-color:currentColor;border-radius:", railHeight, "px;box-sizing:border-box;height:", railHeight, "px;pointer-events:none;display:block;position:absolute;margin-top:", (rangeHeightValue - railHeight) / 2, "px;top:0;", trackBackgroundColor, ";" + ( true ? "" : 0));
  35801. const MarksWrapper = emotion_styled_base_browser_esm("span", true ? {
  35802. target: "exqw8y28"
  35803. } : 0)( true ? {
  35804. name: "1xuuvmv",
  35805. styles: "box-sizing:border-box;display:block;pointer-events:none;position:relative;width:100%;user-select:none"
  35806. } : 0);
  35807. const markFill = _ref8 => {
  35808. let {
  35809. disabled,
  35810. isFilled
  35811. } = _ref8;
  35812. let backgroundColor = isFilled ? 'currentColor' : COLORS.lightGray[600];
  35813. if (disabled) {
  35814. backgroundColor = COLORS.lightGray[800];
  35815. }
  35816. return /*#__PURE__*/emotion_react_browser_esm_css({
  35817. backgroundColor
  35818. }, true ? "" : 0, true ? "" : 0);
  35819. };
  35820. const Mark = emotion_styled_base_browser_esm("span", true ? {
  35821. target: "exqw8y27"
  35822. } : 0)("box-sizing:border-box;height:", thumbSize, "px;left:0;position:absolute;top:-4px;width:1px;", markFill, ";" + ( true ? "" : 0));
  35823. const markLabelFill = _ref9 => {
  35824. let {
  35825. isFilled
  35826. } = _ref9;
  35827. return /*#__PURE__*/emotion_react_browser_esm_css({
  35828. color: isFilled ? COLORS.darkGray[300] : COLORS.lightGray[600]
  35829. }, true ? "" : 0, true ? "" : 0);
  35830. };
  35831. const MarkLabel = emotion_styled_base_browser_esm("span", true ? {
  35832. target: "exqw8y26"
  35833. } : 0)("box-sizing:border-box;color:", COLORS.lightGray[600], ";left:0;font-size:11px;position:absolute;top:12px;transform:translateX( -50% );white-space:nowrap;", markLabelFill, ";" + ( true ? "" : 0));
  35834. var range_control_styles_ref3 = true ? {
  35835. name: "1sb75b3",
  35836. styles: "background-color:var( --wp-admin-theme-color )"
  35837. } : 0;
  35838. const thumbColor = _ref10 => {
  35839. let {
  35840. disabled
  35841. } = _ref10;
  35842. return disabled ? /*#__PURE__*/emotion_react_browser_esm_css("background-color:", COLORS.lightGray[800], ";" + ( true ? "" : 0), true ? "" : 0) : range_control_styles_ref3;
  35843. };
  35844. const ThumbWrapper = emotion_styled_base_browser_esm("span", true ? {
  35845. target: "exqw8y25"
  35846. } : 0)("align-items:center;box-sizing:border-box;display:flex;height:", thumbSize, "px;justify-content:center;margin-top:", (rangeHeightValue - thumbSize) / 2, "px;outline:0;pointer-events:none;position:absolute;top:0;user-select:none;width:", thumbSize, "px;border-radius:50%;", thumbColor, ";", rtl({
  35847. marginLeft: -10
  35848. }), ";", rtl({
  35849. transform: 'translateX( 4.5px )'
  35850. }, {
  35851. transform: 'translateX( -4.5px )'
  35852. }), ";" + ( true ? "" : 0));
  35853. const thumbFocus = _ref11 => {
  35854. let {
  35855. isFocused
  35856. } = _ref11;
  35857. return isFocused ? /*#__PURE__*/emotion_react_browser_esm_css("&::before{content:' ';position:absolute;background-color:var( --wp-admin-theme-color );opacity:0.4;border-radius:50%;height:", thumbSize + 8, "px;width:", thumbSize + 8, "px;top:-4px;left:-4px;}" + ( true ? "" : 0), true ? "" : 0) : '';
  35858. };
  35859. const Thumb = emotion_styled_base_browser_esm("span", true ? {
  35860. target: "exqw8y24"
  35861. } : 0)("align-items:center;border-radius:50%;box-sizing:border-box;height:100%;outline:0;position:absolute;user-select:none;width:100%;", thumbColor, ";", thumbFocus, ";" + ( true ? "" : 0));
  35862. const InputRange = emotion_styled_base_browser_esm("input", true ? {
  35863. target: "exqw8y23"
  35864. } : 0)("box-sizing:border-box;cursor:pointer;display:block;height:100%;left:0;margin:0 -", thumbSize / 2, "px;opacity:0;outline:none;position:absolute;right:0;top:0;width:calc( 100% + ", thumbSize, "px );" + ( true ? "" : 0));
  35865. const tooltipShow = _ref12 => {
  35866. let {
  35867. show
  35868. } = _ref12;
  35869. return /*#__PURE__*/emotion_react_browser_esm_css({
  35870. opacity: show ? 1 : 0
  35871. }, true ? "" : 0, true ? "" : 0);
  35872. };
  35873. var range_control_styles_ref = true ? {
  35874. name: "1cypxip",
  35875. styles: "top:-80%"
  35876. } : 0;
  35877. var range_control_styles_ref2 = true ? {
  35878. name: "1lr98c4",
  35879. styles: "bottom:-80%"
  35880. } : 0;
  35881. const tooltipPosition = _ref13 => {
  35882. let {
  35883. position
  35884. } = _ref13;
  35885. const isBottom = position === 'bottom';
  35886. if (isBottom) {
  35887. return range_control_styles_ref2;
  35888. }
  35889. return range_control_styles_ref;
  35890. };
  35891. const range_control_styles_Tooltip = emotion_styled_base_browser_esm("span", true ? {
  35892. target: "exqw8y22"
  35893. } : 0)("background:rgba( 0, 0, 0, 0.8 );border-radius:2px;box-sizing:border-box;color:white;display:inline-block;font-size:12px;min-width:32px;opacity:0;padding:4px 8px;pointer-events:none;position:absolute;text-align:center;transition:opacity 120ms ease;user-select:none;line-height:1.4;", tooltipShow, ";", tooltipPosition, ";", reduceMotion('transition'), ";", rtl({
  35894. transform: 'translateX(-50%)'
  35895. }, {
  35896. transform: 'translateX(50%)'
  35897. }), ";" + ( true ? "" : 0)); // @todo: Refactor RangeControl with latest HStack configuration
  35898. // @wordpress/components/ui/hstack.
  35899. const InputNumber = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
  35900. target: "exqw8y21"
  35901. } : 0)("box-sizing:border-box;display:inline-block;font-size:13px;margin-top:0;width:", space(16), "!important;input[type='number']&{", rangeHeight, ";}", rtl({
  35902. marginLeft: `${space(4)} !important`
  35903. }), ";" + ( true ? "" : 0));
  35904. const ActionRightWrapper = emotion_styled_base_browser_esm("span", true ? {
  35905. target: "exqw8y20"
  35906. } : 0)("box-sizing:border-box;display:block;margin-top:0;button,button.is-small{margin-left:0;", rangeHeight, ";}", rtl({
  35907. marginLeft: 8
  35908. }), ";" + ( true ? "" : 0));
  35909. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/input-range.js
  35910. // @ts-nocheck
  35911. /**
  35912. * External dependencies
  35913. */
  35914. /**
  35915. * WordPress dependencies
  35916. */
  35917. /**
  35918. * Internal dependencies
  35919. */
  35920. function input_range_InputRange(_ref, ref) {
  35921. let {
  35922. describedBy,
  35923. label,
  35924. onHideTooltip = external_lodash_namespaceObject.noop,
  35925. onMouseLeave = external_lodash_namespaceObject.noop,
  35926. onMouseMove = external_lodash_namespaceObject.noop,
  35927. onShowTooltip = external_lodash_namespaceObject.noop,
  35928. value,
  35929. ...props
  35930. } = _ref;
  35931. const hoverInteractions = useDebouncedHoverInteraction({
  35932. onHide: onHideTooltip,
  35933. onMouseLeave,
  35934. onMouseMove,
  35935. onShow: onShowTooltip
  35936. });
  35937. return (0,external_wp_element_namespaceObject.createElement)(InputRange, extends_extends({}, props, hoverInteractions, {
  35938. "aria-describedby": describedBy,
  35939. "aria-label": label,
  35940. "aria-hidden": false,
  35941. ref: ref,
  35942. tabIndex: 0,
  35943. type: "range",
  35944. value: value
  35945. }));
  35946. }
  35947. const input_range_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(input_range_InputRange);
  35948. /* harmony default export */ var input_range = (input_range_ForwardedComponent);
  35949. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/mark.js
  35950. // @ts-nocheck
  35951. /**
  35952. * External dependencies
  35953. */
  35954. /**
  35955. * Internal dependencies
  35956. */
  35957. function RangeMark(_ref) {
  35958. let {
  35959. className,
  35960. isFilled = false,
  35961. label,
  35962. style = {},
  35963. ...props
  35964. } = _ref;
  35965. const classes = classnames_default()('components-range-control__mark', isFilled && 'is-filled', className);
  35966. const labelClasses = classnames_default()('components-range-control__mark-label', isFilled && 'is-filled');
  35967. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(Mark, extends_extends({}, props, {
  35968. "aria-hidden": "true",
  35969. className: classes,
  35970. isFilled: isFilled,
  35971. style: style
  35972. })), label && (0,external_wp_element_namespaceObject.createElement)(MarkLabel, {
  35973. "aria-hidden": "true",
  35974. className: labelClasses,
  35975. isFilled: isFilled,
  35976. style: style
  35977. }, label));
  35978. }
  35979. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/rail.js
  35980. // @ts-nocheck
  35981. /**
  35982. * WordPress dependencies
  35983. */
  35984. /**
  35985. * Internal dependencies
  35986. */
  35987. function RangeRail(_ref) {
  35988. let {
  35989. disabled = false,
  35990. marks = false,
  35991. min = 0,
  35992. max = 100,
  35993. step = 1,
  35994. value = 0,
  35995. ...restProps
  35996. } = _ref;
  35997. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(Rail, extends_extends({
  35998. disabled: disabled
  35999. }, restProps)), marks && (0,external_wp_element_namespaceObject.createElement)(Marks, {
  36000. disabled: disabled,
  36001. marks: marks,
  36002. min: min,
  36003. max: max,
  36004. step: step,
  36005. value: value
  36006. }));
  36007. }
  36008. function Marks(_ref2) {
  36009. let {
  36010. disabled = false,
  36011. marks = false,
  36012. min = 0,
  36013. max = 100,
  36014. step = 1,
  36015. value = 0
  36016. } = _ref2;
  36017. if (step === 'any') {
  36018. step = 1;
  36019. }
  36020. const marksData = useMarks({
  36021. marks,
  36022. min,
  36023. max,
  36024. step,
  36025. value
  36026. });
  36027. return (0,external_wp_element_namespaceObject.createElement)(MarksWrapper, {
  36028. "aria-hidden": "true",
  36029. className: "components-range-control__marks"
  36030. }, marksData.map(mark => (0,external_wp_element_namespaceObject.createElement)(RangeMark, extends_extends({}, mark, {
  36031. key: mark.key,
  36032. "aria-hidden": "true",
  36033. disabled: disabled
  36034. }))));
  36035. }
  36036. function useMarks(_ref3) {
  36037. let {
  36038. marks,
  36039. min = 0,
  36040. max = 100,
  36041. step = 1,
  36042. value = 0
  36043. } = _ref3;
  36044. if (!marks) {
  36045. return [];
  36046. }
  36047. const range = max - min;
  36048. if (!Array.isArray(marks)) {
  36049. marks = [];
  36050. const count = 1 + Math.round(range / step);
  36051. while (count > marks.push({
  36052. value: step * marks.length + min
  36053. }));
  36054. }
  36055. const placedMarks = [];
  36056. marks.forEach((mark, index) => {
  36057. if (mark.value < min || mark.value > max) {
  36058. return;
  36059. }
  36060. const key = `mark-${index}`;
  36061. const isFilled = mark.value <= value;
  36062. const offset = `${(mark.value - min) / range * 100}%`;
  36063. const offsetStyle = {
  36064. [(0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left']: offset
  36065. };
  36066. placedMarks.push({ ...mark,
  36067. isFilled,
  36068. key,
  36069. style: offsetStyle
  36070. });
  36071. });
  36072. return placedMarks;
  36073. }
  36074. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/tooltip.js
  36075. // @ts-nocheck
  36076. /**
  36077. * External dependencies
  36078. */
  36079. /**
  36080. * WordPress dependencies
  36081. */
  36082. /**
  36083. * Internal dependencies
  36084. */
  36085. function SimpleTooltip(_ref) {
  36086. let {
  36087. className,
  36088. inputRef,
  36089. tooltipPosition,
  36090. show = false,
  36091. style = {},
  36092. value = 0,
  36093. renderTooltipContent = v => v,
  36094. zIndex = 100,
  36095. ...restProps
  36096. } = _ref;
  36097. const position = useTooltipPosition({
  36098. inputRef,
  36099. tooltipPosition
  36100. });
  36101. const classes = classnames_default()('components-simple-tooltip', className);
  36102. const styles = { ...style,
  36103. zIndex
  36104. };
  36105. return (0,external_wp_element_namespaceObject.createElement)(range_control_styles_Tooltip, extends_extends({}, restProps, {
  36106. "aria-hidden": show,
  36107. className: classes,
  36108. position: position,
  36109. show: show,
  36110. role: "tooltip",
  36111. style: styles
  36112. }), renderTooltipContent(value));
  36113. }
  36114. function useTooltipPosition(_ref2) {
  36115. let {
  36116. inputRef,
  36117. tooltipPosition
  36118. } = _ref2;
  36119. const [position, setPosition] = (0,external_wp_element_namespaceObject.useState)();
  36120. const setTooltipPosition = (0,external_wp_element_namespaceObject.useCallback)(() => {
  36121. if (inputRef && inputRef.current) {
  36122. setPosition(tooltipPosition);
  36123. }
  36124. }, [tooltipPosition]);
  36125. (0,external_wp_element_namespaceObject.useEffect)(() => {
  36126. setTooltipPosition();
  36127. }, [setTooltipPosition]);
  36128. (0,external_wp_element_namespaceObject.useEffect)(() => {
  36129. window.addEventListener('resize', setTooltipPosition);
  36130. return () => {
  36131. window.removeEventListener('resize', setTooltipPosition);
  36132. };
  36133. });
  36134. return position;
  36135. }
  36136. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/index.js
  36137. // @ts-nocheck
  36138. /**
  36139. * External dependencies
  36140. */
  36141. /**
  36142. * WordPress dependencies
  36143. */
  36144. /**
  36145. * Internal dependencies
  36146. */
  36147. function RangeControl(_ref, ref) {
  36148. var _inputRef$current;
  36149. let {
  36150. afterIcon,
  36151. allowReset = false,
  36152. beforeIcon,
  36153. className,
  36154. currentInput,
  36155. color: colorProp = COLORS.ui.theme,
  36156. disabled = false,
  36157. help,
  36158. initialPosition,
  36159. isShiftStepEnabled = true,
  36160. label,
  36161. hideLabelFromVision = false,
  36162. marks = false,
  36163. max = 100,
  36164. min = 0,
  36165. onBlur = external_lodash_namespaceObject.noop,
  36166. onChange = external_lodash_namespaceObject.noop,
  36167. onFocus = external_lodash_namespaceObject.noop,
  36168. onMouseMove = external_lodash_namespaceObject.noop,
  36169. onMouseLeave = external_lodash_namespaceObject.noop,
  36170. railColor,
  36171. resetFallbackValue,
  36172. renderTooltipContent = v => v,
  36173. showTooltip: showTooltipProp,
  36174. shiftStep = 10,
  36175. step = 1,
  36176. trackColor,
  36177. value: valueProp,
  36178. withInputField = true,
  36179. ...props
  36180. } = _ref;
  36181. const [value, setValue] = useControlledRangeValue({
  36182. min,
  36183. max,
  36184. value: valueProp,
  36185. initial: initialPosition
  36186. });
  36187. const isResetPendent = (0,external_wp_element_namespaceObject.useRef)(false);
  36188. if (step === 'any') {
  36189. // The tooltip and number input field are hidden when the step is "any"
  36190. // because the decimals get too lengthy to fit well.
  36191. showTooltipProp = false;
  36192. withInputField = false;
  36193. }
  36194. const [showTooltip, setShowTooltip] = (0,external_wp_element_namespaceObject.useState)(showTooltipProp);
  36195. const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
  36196. const inputRef = (0,external_wp_element_namespaceObject.useRef)();
  36197. const setRef = nodeRef => {
  36198. inputRef.current = nodeRef;
  36199. if (ref) {
  36200. ref(nodeRef);
  36201. }
  36202. };
  36203. const isCurrentlyFocused = (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.matches(':focus');
  36204. const isThumbFocused = !disabled && isFocused;
  36205. const isValueReset = value === null;
  36206. const currentValue = value !== undefined ? value : currentInput;
  36207. const inputSliderValue = isValueReset ? '' : currentValue;
  36208. const rangeFillValue = isValueReset ? (max - min) / 2 + min : value;
  36209. const calculatedFillValue = (value - min) / (max - min) * 100;
  36210. const fillValue = isValueReset ? 50 : calculatedFillValue;
  36211. const fillValueOffset = `${(0,external_lodash_namespaceObject.clamp)(fillValue, 0, 100)}%`;
  36212. const classes = classnames_default()('components-range-control', className);
  36213. const wrapperClasses = classnames_default()('components-range-control__wrapper', !!marks && 'is-marked');
  36214. const id = (0,external_wp_compose_namespaceObject.useInstanceId)(RangeControl, 'inspector-range-control');
  36215. const describedBy = !!help ? `${id}__help` : undefined;
  36216. const enableTooltip = showTooltipProp !== false && (0,external_lodash_namespaceObject.isFinite)(value);
  36217. const handleOnRangeChange = event => {
  36218. const nextValue = parseFloat(event.target.value);
  36219. setValue(nextValue);
  36220. onChange(nextValue);
  36221. };
  36222. const handleOnChange = nextValue => {
  36223. nextValue = parseFloat(nextValue);
  36224. setValue(nextValue);
  36225. /*
  36226. * Calls onChange only when nextValue is numeric
  36227. * otherwise may queue a reset for the blur event.
  36228. */
  36229. if (!isNaN(nextValue)) {
  36230. if (nextValue < min || nextValue > max) {
  36231. nextValue = floatClamp(nextValue, min, max);
  36232. }
  36233. onChange(nextValue);
  36234. isResetPendent.current = false;
  36235. } else if (allowReset) {
  36236. isResetPendent.current = true;
  36237. }
  36238. };
  36239. const handleOnInputNumberBlur = () => {
  36240. if (isResetPendent.current) {
  36241. handleOnReset();
  36242. isResetPendent.current = false;
  36243. }
  36244. };
  36245. const handleOnReset = () => {
  36246. let resetValue = parseFloat(resetFallbackValue);
  36247. let onChangeResetValue = resetValue;
  36248. if (isNaN(resetValue)) {
  36249. resetValue = null;
  36250. onChangeResetValue = undefined;
  36251. }
  36252. setValue(resetValue);
  36253. /**
  36254. * Previously, this callback would always receive undefined as
  36255. * an argument. This behavior is unexpected, specifically
  36256. * when resetFallbackValue is defined.
  36257. *
  36258. * The value of undefined is not ideal. Passing it through
  36259. * to internal <input /> elements would change it from a
  36260. * controlled component to an uncontrolled component.
  36261. *
  36262. * For now, to minimize unexpected regressions, we're going to
  36263. * preserve the undefined callback argument, except when a
  36264. * resetFallbackValue is defined.
  36265. */
  36266. onChange(onChangeResetValue);
  36267. };
  36268. const handleShowTooltip = () => setShowTooltip(true);
  36269. const handleHideTooltip = () => setShowTooltip(false);
  36270. const handleOnBlur = event => {
  36271. onBlur(event);
  36272. setIsFocused(false);
  36273. handleHideTooltip();
  36274. };
  36275. const handleOnFocus = event => {
  36276. onFocus(event);
  36277. setIsFocused(true);
  36278. handleShowTooltip();
  36279. };
  36280. const offsetStyle = {
  36281. [(0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left']: fillValueOffset
  36282. };
  36283. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  36284. className: classes,
  36285. label: label,
  36286. hideLabelFromVision: hideLabelFromVision,
  36287. id: id,
  36288. help: help
  36289. }, (0,external_wp_element_namespaceObject.createElement)(range_control_styles_Root, {
  36290. className: "components-range-control__root"
  36291. }, beforeIcon && (0,external_wp_element_namespaceObject.createElement)(BeforeIconWrapper, null, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  36292. icon: beforeIcon
  36293. })), (0,external_wp_element_namespaceObject.createElement)(range_control_styles_Wrapper, {
  36294. className: wrapperClasses,
  36295. color: colorProp,
  36296. marks: !!marks
  36297. }, (0,external_wp_element_namespaceObject.createElement)(input_range, extends_extends({}, props, {
  36298. className: "components-range-control__slider",
  36299. describedBy: describedBy,
  36300. disabled: disabled,
  36301. id: id,
  36302. label: label,
  36303. max: max,
  36304. min: min,
  36305. onBlur: handleOnBlur,
  36306. onChange: handleOnRangeChange,
  36307. onFocus: handleOnFocus,
  36308. onMouseMove: onMouseMove,
  36309. onMouseLeave: onMouseLeave,
  36310. ref: setRef,
  36311. step: step,
  36312. value: inputSliderValue
  36313. })), (0,external_wp_element_namespaceObject.createElement)(RangeRail, {
  36314. "aria-hidden": true,
  36315. disabled: disabled,
  36316. marks: marks,
  36317. max: max,
  36318. min: min,
  36319. railColor: railColor,
  36320. step: step,
  36321. value: rangeFillValue
  36322. }), (0,external_wp_element_namespaceObject.createElement)(Track, {
  36323. "aria-hidden": true,
  36324. className: "components-range-control__track",
  36325. disabled: disabled,
  36326. style: {
  36327. width: fillValueOffset
  36328. },
  36329. trackColor: trackColor
  36330. }), (0,external_wp_element_namespaceObject.createElement)(ThumbWrapper, {
  36331. style: offsetStyle,
  36332. disabled: disabled
  36333. }, (0,external_wp_element_namespaceObject.createElement)(Thumb, {
  36334. "aria-hidden": true,
  36335. isFocused: isThumbFocused,
  36336. disabled: disabled
  36337. })), enableTooltip && (0,external_wp_element_namespaceObject.createElement)(SimpleTooltip, {
  36338. className: "components-range-control__tooltip",
  36339. inputRef: inputRef,
  36340. tooltipPosition: "bottom",
  36341. renderTooltipContent: renderTooltipContent,
  36342. show: isCurrentlyFocused || showTooltip,
  36343. style: offsetStyle,
  36344. value: value
  36345. })), afterIcon && (0,external_wp_element_namespaceObject.createElement)(AfterIconWrapper, null, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  36346. icon: afterIcon
  36347. })), withInputField && (0,external_wp_element_namespaceObject.createElement)(InputNumber, {
  36348. "aria-label": label,
  36349. className: "components-range-control__number",
  36350. disabled: disabled,
  36351. inputMode: "decimal",
  36352. isShiftStepEnabled: isShiftStepEnabled,
  36353. max: max,
  36354. min: min,
  36355. onBlur: handleOnInputNumberBlur,
  36356. onChange: handleOnChange,
  36357. shiftStep: shiftStep,
  36358. step: step,
  36359. value: inputSliderValue
  36360. }), allowReset && (0,external_wp_element_namespaceObject.createElement)(ActionRightWrapper, null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  36361. className: "components-range-control__reset",
  36362. disabled: disabled || value === undefined,
  36363. variant: "secondary",
  36364. isSmall: true,
  36365. onClick: handleOnReset
  36366. }, (0,external_wp_i18n_namespaceObject.__)('Reset')))));
  36367. }
  36368. const range_control_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(RangeControl);
  36369. /* harmony default export */ var range_control = (range_control_ForwardedComponent);
  36370. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/styles.js
  36371. function color_picker_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  36372. /**
  36373. * External dependencies
  36374. */
  36375. /**
  36376. * Internal dependencies
  36377. */
  36378. const NumberControlWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
  36379. target: "ez9hsf46"
  36380. } : 0)(Container, "{width:", space(24), ";}" + ( true ? "" : 0));
  36381. const styles_SelectControl = /*#__PURE__*/emotion_styled_base_browser_esm(select_control, true ? {
  36382. target: "ez9hsf45"
  36383. } : 0)("margin-left:", space(-2), ";width:5em;", BackdropUI, "{display:none;}" + ( true ? "" : 0));
  36384. const styles_RangeControl = /*#__PURE__*/emotion_styled_base_browser_esm(range_control, true ? {
  36385. target: "ez9hsf44"
  36386. } : 0)("flex:1;", StyledField, "{margin-bottom:0;}" + ( true ? "" : 0)); // All inputs should be the same height so this should be changed at the component level.
  36387. // That involves changing heights of multiple input types probably buttons too etc.
  36388. // So until that is done we are already using the new height on the color picker so it matches the mockups.
  36389. const inputHeightStyle = `
  36390. &&& ${Input} {
  36391. height: 40px;
  36392. }`; // Make the Hue circle picker not go out of the bar.
  36393. const interactiveHueStyles = `
  36394. .react-colorful__interactive {
  36395. width: calc( 100% - ${space(2)} );
  36396. margin-left: ${space(1)};
  36397. }`;
  36398. const AuxiliaryColorArtefactWrapper = emotion_styled_base_browser_esm("div", true ? {
  36399. target: "ez9hsf43"
  36400. } : 0)("padding:", space(2), " ", space(4), ";" + ( true ? "" : 0));
  36401. const ColorfulWrapper = emotion_styled_base_browser_esm("div", true ? {
  36402. target: "ez9hsf42"
  36403. } : 0)("width:216px;.react-colorful{display:flex;flex-direction:column;align-items:center;width:216px;height:auto;}.react-colorful__saturation{width:100%;border-radius:0;height:216px;margin-bottom:", space(4), ";border-bottom:none;}.react-colorful__hue,.react-colorful__alpha{width:184px;height:16px;border-radius:16px;margin-bottom:", space(2), ";}.react-colorful__pointer{height:16px;width:16px;border:none;box-shadow:0 0 2px 0 rgba( 0, 0, 0, 0.25 );outline:2px solid transparent;}.react-colorful__pointer-fill{box-shadow:inset 0 0 0 ", config_values.borderWidthFocus, " #fff;}", interactiveHueStyles, " ", StyledField, "{margin-bottom:0;}", inputHeightStyle, ";" + ( true ? "" : 0));
  36404. const DetailsControlButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
  36405. target: "ez9hsf41"
  36406. } : 0)("&&&&&{min-width:", space(6), ";padding:0;}" + ( true ? "" : 0));
  36407. const ColorHexInputControl = /*#__PURE__*/emotion_styled_base_browser_esm(input_control, true ? {
  36408. target: "ez9hsf40"
  36409. } : 0)( true ? {
  36410. name: "1287a6j",
  36411. styles: "width:8em"
  36412. } : 0);
  36413. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getWindow.js
  36414. function getWindow_getWindow(node) {
  36415. if (node == null) {
  36416. return window;
  36417. }
  36418. if (node.toString() !== '[object Window]') {
  36419. var ownerDocument = node.ownerDocument;
  36420. return ownerDocument ? ownerDocument.defaultView || window : window;
  36421. }
  36422. return node;
  36423. }
  36424. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/instanceOf.js
  36425. function isElement(node) {
  36426. var OwnElement = getWindow_getWindow(node).Element;
  36427. return node instanceof OwnElement || node instanceof Element;
  36428. }
  36429. function isHTMLElement(node) {
  36430. var OwnElement = getWindow_getWindow(node).HTMLElement;
  36431. return node instanceof OwnElement || node instanceof HTMLElement;
  36432. }
  36433. function isShadowRoot(node) {
  36434. // IE 11 has no ShadowRoot
  36435. if (typeof ShadowRoot === 'undefined') {
  36436. return false;
  36437. }
  36438. var OwnElement = getWindow_getWindow(node).ShadowRoot;
  36439. return node instanceof OwnElement || node instanceof ShadowRoot;
  36440. }
  36441. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/math.js
  36442. var math_max = Math.max;
  36443. var math_min = Math.min;
  36444. var round = Math.round;
  36445. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js
  36446. function getBoundingClientRect(element, includeScale) {
  36447. if (includeScale === void 0) {
  36448. includeScale = false;
  36449. }
  36450. var rect = element.getBoundingClientRect();
  36451. var scaleX = 1;
  36452. var scaleY = 1;
  36453. if (isHTMLElement(element) && includeScale) {
  36454. var offsetHeight = element.offsetHeight;
  36455. var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
  36456. // Fallback to 1 in case both values are `0`
  36457. if (offsetWidth > 0) {
  36458. scaleX = round(rect.width) / offsetWidth || 1;
  36459. }
  36460. if (offsetHeight > 0) {
  36461. scaleY = round(rect.height) / offsetHeight || 1;
  36462. }
  36463. }
  36464. return {
  36465. width: rect.width / scaleX,
  36466. height: rect.height / scaleY,
  36467. top: rect.top / scaleY,
  36468. right: rect.right / scaleX,
  36469. bottom: rect.bottom / scaleY,
  36470. left: rect.left / scaleX,
  36471. x: rect.left / scaleX,
  36472. y: rect.top / scaleY
  36473. };
  36474. }
  36475. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js
  36476. function getWindowScroll(node) {
  36477. var win = getWindow_getWindow(node);
  36478. var scrollLeft = win.pageXOffset;
  36479. var scrollTop = win.pageYOffset;
  36480. return {
  36481. scrollLeft: scrollLeft,
  36482. scrollTop: scrollTop
  36483. };
  36484. }
  36485. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js
  36486. function getHTMLElementScroll(element) {
  36487. return {
  36488. scrollLeft: element.scrollLeft,
  36489. scrollTop: element.scrollTop
  36490. };
  36491. }
  36492. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js
  36493. function getNodeScroll(node) {
  36494. if (node === getWindow_getWindow(node) || !isHTMLElement(node)) {
  36495. return getWindowScroll(node);
  36496. } else {
  36497. return getHTMLElementScroll(node);
  36498. }
  36499. }
  36500. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getNodeName.js
  36501. function getNodeName(element) {
  36502. return element ? (element.nodeName || '').toLowerCase() : null;
  36503. }
  36504. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
  36505. function getDocumentElement(element) {
  36506. // $FlowFixMe[incompatible-return]: assume body is always available
  36507. return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
  36508. element.document) || window.document).documentElement;
  36509. }
  36510. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js
  36511. function getWindowScrollBarX(element) {
  36512. // If <html> has a CSS width greater than the viewport, then this will be
  36513. // incorrect for RTL.
  36514. // Popper 1 is broken in this case and never had a bug report so let's assume
  36515. // it's not an issue. I don't think anyone ever specifies width on <html>
  36516. // anyway.
  36517. // Browsers where the left scrollbar doesn't cause an issue report `0` for
  36518. // this (e.g. Edge 2019, IE11, Safari)
  36519. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  36520. }
  36521. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js
  36522. function getComputedStyle_getComputedStyle(element) {
  36523. return getWindow_getWindow(element).getComputedStyle(element);
  36524. }
  36525. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js
  36526. function isScrollParent(element) {
  36527. // Firefox wants us to check `-x` and `-y` variations as well
  36528. var _getComputedStyle = getComputedStyle_getComputedStyle(element),
  36529. overflow = _getComputedStyle.overflow,
  36530. overflowX = _getComputedStyle.overflowX,
  36531. overflowY = _getComputedStyle.overflowY;
  36532. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  36533. }
  36534. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js
  36535. function isElementScaled(element) {
  36536. var rect = element.getBoundingClientRect();
  36537. var scaleX = round(rect.width) / element.offsetWidth || 1;
  36538. var scaleY = round(rect.height) / element.offsetHeight || 1;
  36539. return scaleX !== 1 || scaleY !== 1;
  36540. } // Returns the composite rect of an element relative to its offsetParent.
  36541. // Composite means it takes into account transforms as well as layout.
  36542. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  36543. if (isFixed === void 0) {
  36544. isFixed = false;
  36545. }
  36546. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  36547. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  36548. var documentElement = getDocumentElement(offsetParent);
  36549. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
  36550. var scroll = {
  36551. scrollLeft: 0,
  36552. scrollTop: 0
  36553. };
  36554. var offsets = {
  36555. x: 0,
  36556. y: 0
  36557. };
  36558. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  36559. if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
  36560. isScrollParent(documentElement)) {
  36561. scroll = getNodeScroll(offsetParent);
  36562. }
  36563. if (isHTMLElement(offsetParent)) {
  36564. offsets = getBoundingClientRect(offsetParent, true);
  36565. offsets.x += offsetParent.clientLeft;
  36566. offsets.y += offsetParent.clientTop;
  36567. } else if (documentElement) {
  36568. offsets.x = getWindowScrollBarX(documentElement);
  36569. }
  36570. }
  36571. return {
  36572. x: rect.left + scroll.scrollLeft - offsets.x,
  36573. y: rect.top + scroll.scrollTop - offsets.y,
  36574. width: rect.width,
  36575. height: rect.height
  36576. };
  36577. }
  36578. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js
  36579. // Returns the layout rect of an element relative to its offsetParent. Layout
  36580. // means it doesn't take into account transforms.
  36581. function getLayoutRect(element) {
  36582. var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
  36583. // Fixes https://github.com/popperjs/popper-core/issues/1223
  36584. var width = element.offsetWidth;
  36585. var height = element.offsetHeight;
  36586. if (Math.abs(clientRect.width - width) <= 1) {
  36587. width = clientRect.width;
  36588. }
  36589. if (Math.abs(clientRect.height - height) <= 1) {
  36590. height = clientRect.height;
  36591. }
  36592. return {
  36593. x: element.offsetLeft,
  36594. y: element.offsetTop,
  36595. width: width,
  36596. height: height
  36597. };
  36598. }
  36599. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getParentNode.js
  36600. function getParentNode(element) {
  36601. if (getNodeName(element) === 'html') {
  36602. return element;
  36603. }
  36604. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  36605. // $FlowFixMe[incompatible-return]
  36606. // $FlowFixMe[prop-missing]
  36607. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  36608. element.parentNode || ( // DOM Element detected
  36609. isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  36610. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  36611. getDocumentElement(element) // fallback
  36612. );
  36613. }
  36614. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js
  36615. function getScrollParent(node) {
  36616. if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
  36617. // $FlowFixMe[incompatible-return]: assume body is always available
  36618. return node.ownerDocument.body;
  36619. }
  36620. if (isHTMLElement(node) && isScrollParent(node)) {
  36621. return node;
  36622. }
  36623. return getScrollParent(getParentNode(node));
  36624. }
  36625. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js
  36626. /*
  36627. given a DOM element, return the list of all scroll parents, up the list of ancesors
  36628. until we get to the top window object. This list is what we attach scroll listeners
  36629. to, because if any of these parent elements scroll, we'll need to re-calculate the
  36630. reference element's position.
  36631. */
  36632. function listScrollParents(element, list) {
  36633. var _element$ownerDocumen;
  36634. if (list === void 0) {
  36635. list = [];
  36636. }
  36637. var scrollParent = getScrollParent(element);
  36638. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  36639. var win = getWindow_getWindow(scrollParent);
  36640. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  36641. var updatedList = list.concat(target);
  36642. return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  36643. updatedList.concat(listScrollParents(getParentNode(target)));
  36644. }
  36645. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/isTableElement.js
  36646. function isTableElement(element) {
  36647. return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
  36648. }
  36649. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
  36650. function getTrueOffsetParent(element) {
  36651. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  36652. getComputedStyle_getComputedStyle(element).position === 'fixed') {
  36653. return null;
  36654. }
  36655. return element.offsetParent;
  36656. } // `.offsetParent` reports `null` for fixed elements, while absolute elements
  36657. // return the containing block
  36658. function getContainingBlock(element) {
  36659. var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
  36660. var isIE = navigator.userAgent.indexOf('Trident') !== -1;
  36661. if (isIE && isHTMLElement(element)) {
  36662. // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
  36663. var elementCss = getComputedStyle_getComputedStyle(element);
  36664. if (elementCss.position === 'fixed') {
  36665. return null;
  36666. }
  36667. }
  36668. var currentNode = getParentNode(element);
  36669. if (isShadowRoot(currentNode)) {
  36670. currentNode = currentNode.host;
  36671. }
  36672. while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
  36673. var css = getComputedStyle_getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
  36674. // create a containing block.
  36675. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  36676. if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
  36677. return currentNode;
  36678. } else {
  36679. currentNode = currentNode.parentNode;
  36680. }
  36681. }
  36682. return null;
  36683. } // Gets the closest ancestor positioned element. Handles some edge cases,
  36684. // such as table ancestors and cross browser bugs.
  36685. function getOffsetParent(element) {
  36686. var window = getWindow_getWindow(element);
  36687. var offsetParent = getTrueOffsetParent(element);
  36688. while (offsetParent && isTableElement(offsetParent) && getComputedStyle_getComputedStyle(offsetParent).position === 'static') {
  36689. offsetParent = getTrueOffsetParent(offsetParent);
  36690. }
  36691. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle_getComputedStyle(offsetParent).position === 'static')) {
  36692. return window;
  36693. }
  36694. return offsetParent || getContainingBlock(element) || window;
  36695. }
  36696. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/enums.js
  36697. var enums_top = 'top';
  36698. var bottom = 'bottom';
  36699. var right = 'right';
  36700. var left = 'left';
  36701. var enums_auto = 'auto';
  36702. var basePlacements = [enums_top, bottom, right, left];
  36703. var start = 'start';
  36704. var end = 'end';
  36705. var clippingParents = 'clippingParents';
  36706. var viewport = 'viewport';
  36707. var popper = 'popper';
  36708. var reference = 'reference';
  36709. var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
  36710. return acc.concat([placement + "-" + start, placement + "-" + end]);
  36711. }, []);
  36712. var enums_placements = /*#__PURE__*/[].concat(basePlacements, [enums_auto]).reduce(function (acc, placement) {
  36713. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  36714. }, []); // modifiers that need to read the DOM
  36715. var beforeRead = 'beforeRead';
  36716. var read = 'read';
  36717. var afterRead = 'afterRead'; // pure-logic modifiers
  36718. var beforeMain = 'beforeMain';
  36719. var main = 'main';
  36720. var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
  36721. var beforeWrite = 'beforeWrite';
  36722. var write = 'write';
  36723. var afterWrite = 'afterWrite';
  36724. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  36725. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/orderModifiers.js
  36726. // source: https://stackoverflow.com/questions/49875255
  36727. function orderModifiers_order(modifiers) {
  36728. var map = new Map();
  36729. var visited = new Set();
  36730. var result = [];
  36731. modifiers.forEach(function (modifier) {
  36732. map.set(modifier.name, modifier);
  36733. }); // On visiting object, check for its dependencies and visit them recursively
  36734. function sort(modifier) {
  36735. visited.add(modifier.name);
  36736. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  36737. requires.forEach(function (dep) {
  36738. if (!visited.has(dep)) {
  36739. var depModifier = map.get(dep);
  36740. if (depModifier) {
  36741. sort(depModifier);
  36742. }
  36743. }
  36744. });
  36745. result.push(modifier);
  36746. }
  36747. modifiers.forEach(function (modifier) {
  36748. if (!visited.has(modifier.name)) {
  36749. // check for visited object
  36750. sort(modifier);
  36751. }
  36752. });
  36753. return result;
  36754. }
  36755. function orderModifiers(modifiers) {
  36756. // order based on dependencies
  36757. var orderedModifiers = orderModifiers_order(modifiers); // order based on phase
  36758. return modifierPhases.reduce(function (acc, phase) {
  36759. return acc.concat(orderedModifiers.filter(function (modifier) {
  36760. return modifier.phase === phase;
  36761. }));
  36762. }, []);
  36763. }
  36764. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/debounce.js
  36765. function debounce(fn) {
  36766. var pending;
  36767. return function () {
  36768. if (!pending) {
  36769. pending = new Promise(function (resolve) {
  36770. Promise.resolve().then(function () {
  36771. pending = undefined;
  36772. resolve(fn());
  36773. });
  36774. });
  36775. }
  36776. return pending;
  36777. };
  36778. }
  36779. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/mergeByName.js
  36780. function mergeByName(modifiers) {
  36781. var merged = modifiers.reduce(function (merged, current) {
  36782. var existing = merged[current.name];
  36783. merged[current.name] = existing ? Object.assign({}, existing, current, {
  36784. options: Object.assign({}, existing.options, current.options),
  36785. data: Object.assign({}, existing.data, current.data)
  36786. }) : current;
  36787. return merged;
  36788. }, {}); // IE11 does not support Object.values
  36789. return Object.keys(merged).map(function (key) {
  36790. return merged[key];
  36791. });
  36792. }
  36793. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/createPopper.js
  36794. var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
  36795. var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
  36796. var DEFAULT_OPTIONS = {
  36797. placement: 'bottom',
  36798. modifiers: [],
  36799. strategy: 'absolute'
  36800. };
  36801. function areValidElements() {
  36802. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  36803. args[_key] = arguments[_key];
  36804. }
  36805. return !args.some(function (element) {
  36806. return !(element && typeof element.getBoundingClientRect === 'function');
  36807. });
  36808. }
  36809. function popperGenerator(generatorOptions) {
  36810. if (generatorOptions === void 0) {
  36811. generatorOptions = {};
  36812. }
  36813. var _generatorOptions = generatorOptions,
  36814. _generatorOptions$def = _generatorOptions.defaultModifiers,
  36815. defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
  36816. _generatorOptions$def2 = _generatorOptions.defaultOptions,
  36817. defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  36818. return function createPopper(reference, popper, options) {
  36819. if (options === void 0) {
  36820. options = defaultOptions;
  36821. }
  36822. var state = {
  36823. placement: 'bottom',
  36824. orderedModifiers: [],
  36825. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  36826. modifiersData: {},
  36827. elements: {
  36828. reference: reference,
  36829. popper: popper
  36830. },
  36831. attributes: {},
  36832. styles: {}
  36833. };
  36834. var effectCleanupFns = [];
  36835. var isDestroyed = false;
  36836. var instance = {
  36837. state: state,
  36838. setOptions: function setOptions(setOptionsAction) {
  36839. var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
  36840. cleanupModifierEffects();
  36841. state.options = Object.assign({}, defaultOptions, state.options, options);
  36842. state.scrollParents = {
  36843. reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
  36844. popper: listScrollParents(popper)
  36845. }; // Orders the modifiers based on their dependencies and `phase`
  36846. // properties
  36847. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
  36848. state.orderedModifiers = orderedModifiers.filter(function (m) {
  36849. return m.enabled;
  36850. }); // Validate the provided modifiers so that the consumer will get warned
  36851. // if one of the modifiers is invalid for any reason
  36852. if (false) { var _getComputedStyle, marginTop, marginRight, marginBottom, marginLeft, flipModifier, modifiers; }
  36853. runModifierEffects();
  36854. return instance.update();
  36855. },
  36856. // Sync update – it will always be executed, even if not necessary. This
  36857. // is useful for low frequency updates where sync behavior simplifies the
  36858. // logic.
  36859. // For high frequency updates (e.g. `resize` and `scroll` events), always
  36860. // prefer the async Popper#update method
  36861. forceUpdate: function forceUpdate() {
  36862. if (isDestroyed) {
  36863. return;
  36864. }
  36865. var _state$elements = state.elements,
  36866. reference = _state$elements.reference,
  36867. popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
  36868. // anymore
  36869. if (!areValidElements(reference, popper)) {
  36870. if (false) {}
  36871. return;
  36872. } // Store the reference and popper rects to be read by modifiers
  36873. state.rects = {
  36874. reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
  36875. popper: getLayoutRect(popper)
  36876. }; // Modifiers have the ability to reset the current update cycle. The
  36877. // most common use case for this is the `flip` modifier changing the
  36878. // placement, which then needs to re-run all the modifiers, because the
  36879. // logic was previously ran for the previous placement and is therefore
  36880. // stale/incorrect
  36881. state.reset = false;
  36882. state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
  36883. // is filled with the initial data specified by the modifier. This means
  36884. // it doesn't persist and is fresh on each update.
  36885. // To ensure persistent data, use `${name}#persistent`
  36886. state.orderedModifiers.forEach(function (modifier) {
  36887. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  36888. });
  36889. var __debug_loops__ = 0;
  36890. for (var index = 0; index < state.orderedModifiers.length; index++) {
  36891. if (false) {}
  36892. if (state.reset === true) {
  36893. state.reset = false;
  36894. index = -1;
  36895. continue;
  36896. }
  36897. var _state$orderedModifie = state.orderedModifiers[index],
  36898. fn = _state$orderedModifie.fn,
  36899. _state$orderedModifie2 = _state$orderedModifie.options,
  36900. _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
  36901. name = _state$orderedModifie.name;
  36902. if (typeof fn === 'function') {
  36903. state = fn({
  36904. state: state,
  36905. options: _options,
  36906. name: name,
  36907. instance: instance
  36908. }) || state;
  36909. }
  36910. }
  36911. },
  36912. // Async and optimistically optimized update – it will not be executed if
  36913. // not necessary (debounced to run at most once-per-tick)
  36914. update: debounce(function () {
  36915. return new Promise(function (resolve) {
  36916. instance.forceUpdate();
  36917. resolve(state);
  36918. });
  36919. }),
  36920. destroy: function destroy() {
  36921. cleanupModifierEffects();
  36922. isDestroyed = true;
  36923. }
  36924. };
  36925. if (!areValidElements(reference, popper)) {
  36926. if (false) {}
  36927. return instance;
  36928. }
  36929. instance.setOptions(options).then(function (state) {
  36930. if (!isDestroyed && options.onFirstUpdate) {
  36931. options.onFirstUpdate(state);
  36932. }
  36933. }); // Modifiers have the ability to execute arbitrary code before the first
  36934. // update cycle runs. They will be executed in the same order as the update
  36935. // cycle. This is useful when a modifier adds some persistent data that
  36936. // other modifiers need to use, but the modifier is run after the dependent
  36937. // one.
  36938. function runModifierEffects() {
  36939. state.orderedModifiers.forEach(function (_ref3) {
  36940. var name = _ref3.name,
  36941. _ref3$options = _ref3.options,
  36942. options = _ref3$options === void 0 ? {} : _ref3$options,
  36943. effect = _ref3.effect;
  36944. if (typeof effect === 'function') {
  36945. var cleanupFn = effect({
  36946. state: state,
  36947. name: name,
  36948. instance: instance,
  36949. options: options
  36950. });
  36951. var noopFn = function noopFn() {};
  36952. effectCleanupFns.push(cleanupFn || noopFn);
  36953. }
  36954. });
  36955. }
  36956. function cleanupModifierEffects() {
  36957. effectCleanupFns.forEach(function (fn) {
  36958. return fn();
  36959. });
  36960. effectCleanupFns = [];
  36961. }
  36962. return instance;
  36963. };
  36964. }
  36965. var createPopper = /*#__PURE__*/(/* unused pure expression or super */ null && (popperGenerator())); // eslint-disable-next-line import/no-unused-modules
  36966. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/eventListeners.js
  36967. // eslint-disable-next-line import/no-unused-modules
  36968. var passive = {
  36969. passive: true
  36970. };
  36971. function effect(_ref) {
  36972. var state = _ref.state,
  36973. instance = _ref.instance,
  36974. options = _ref.options;
  36975. var _options$scroll = options.scroll,
  36976. scroll = _options$scroll === void 0 ? true : _options$scroll,
  36977. _options$resize = options.resize,
  36978. resize = _options$resize === void 0 ? true : _options$resize;
  36979. var window = getWindow_getWindow(state.elements.popper);
  36980. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  36981. if (scroll) {
  36982. scrollParents.forEach(function (scrollParent) {
  36983. scrollParent.addEventListener('scroll', instance.update, passive);
  36984. });
  36985. }
  36986. if (resize) {
  36987. window.addEventListener('resize', instance.update, passive);
  36988. }
  36989. return function () {
  36990. if (scroll) {
  36991. scrollParents.forEach(function (scrollParent) {
  36992. scrollParent.removeEventListener('scroll', instance.update, passive);
  36993. });
  36994. }
  36995. if (resize) {
  36996. window.removeEventListener('resize', instance.update, passive);
  36997. }
  36998. };
  36999. } // eslint-disable-next-line import/no-unused-modules
  37000. /* harmony default export */ var eventListeners = ({
  37001. name: 'eventListeners',
  37002. enabled: true,
  37003. phase: 'write',
  37004. fn: function fn() {},
  37005. effect: effect,
  37006. data: {}
  37007. });
  37008. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getBasePlacement.js
  37009. function getBasePlacement(placement) {
  37010. return placement.split('-')[0];
  37011. }
  37012. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getVariation.js
  37013. function getVariation(placement) {
  37014. return placement.split('-')[1];
  37015. }
  37016. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js
  37017. function getMainAxisFromPlacement(placement) {
  37018. return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
  37019. }
  37020. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/computeOffsets.js
  37021. function computeOffsets(_ref) {
  37022. var reference = _ref.reference,
  37023. element = _ref.element,
  37024. placement = _ref.placement;
  37025. var basePlacement = placement ? getBasePlacement(placement) : null;
  37026. var variation = placement ? getVariation(placement) : null;
  37027. var commonX = reference.x + reference.width / 2 - element.width / 2;
  37028. var commonY = reference.y + reference.height / 2 - element.height / 2;
  37029. var offsets;
  37030. switch (basePlacement) {
  37031. case enums_top:
  37032. offsets = {
  37033. x: commonX,
  37034. y: reference.y - element.height
  37035. };
  37036. break;
  37037. case bottom:
  37038. offsets = {
  37039. x: commonX,
  37040. y: reference.y + reference.height
  37041. };
  37042. break;
  37043. case right:
  37044. offsets = {
  37045. x: reference.x + reference.width,
  37046. y: commonY
  37047. };
  37048. break;
  37049. case left:
  37050. offsets = {
  37051. x: reference.x - element.width,
  37052. y: commonY
  37053. };
  37054. break;
  37055. default:
  37056. offsets = {
  37057. x: reference.x,
  37058. y: reference.y
  37059. };
  37060. }
  37061. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  37062. if (mainAxis != null) {
  37063. var len = mainAxis === 'y' ? 'height' : 'width';
  37064. switch (variation) {
  37065. case start:
  37066. offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
  37067. break;
  37068. case end:
  37069. offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
  37070. break;
  37071. default:
  37072. }
  37073. }
  37074. return offsets;
  37075. }
  37076. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/popperOffsets.js
  37077. function popperOffsets(_ref) {
  37078. var state = _ref.state,
  37079. name = _ref.name;
  37080. // Offsets are the actual position the popper needs to have to be
  37081. // properly positioned near its reference element
  37082. // This is the most basic placement, and will be adjusted by
  37083. // the modifiers in the next step
  37084. state.modifiersData[name] = computeOffsets({
  37085. reference: state.rects.reference,
  37086. element: state.rects.popper,
  37087. strategy: 'absolute',
  37088. placement: state.placement
  37089. });
  37090. } // eslint-disable-next-line import/no-unused-modules
  37091. /* harmony default export */ var modifiers_popperOffsets = ({
  37092. name: 'popperOffsets',
  37093. enabled: true,
  37094. phase: 'read',
  37095. fn: popperOffsets,
  37096. data: {}
  37097. });
  37098. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/computeStyles.js
  37099. // eslint-disable-next-line import/no-unused-modules
  37100. var unsetSides = {
  37101. top: 'auto',
  37102. right: 'auto',
  37103. bottom: 'auto',
  37104. left: 'auto'
  37105. }; // Round the offsets to the nearest suitable subpixel based on the DPR.
  37106. // Zooming can change the DPR, but it seems to report a value that will
  37107. // cleanly divide the values into the appropriate subpixels.
  37108. function roundOffsetsByDPR(_ref) {
  37109. var x = _ref.x,
  37110. y = _ref.y;
  37111. var win = window;
  37112. var dpr = win.devicePixelRatio || 1;
  37113. return {
  37114. x: round(x * dpr) / dpr || 0,
  37115. y: round(y * dpr) / dpr || 0
  37116. };
  37117. }
  37118. function mapToStyles(_ref2) {
  37119. var _Object$assign2;
  37120. var popper = _ref2.popper,
  37121. popperRect = _ref2.popperRect,
  37122. placement = _ref2.placement,
  37123. variation = _ref2.variation,
  37124. offsets = _ref2.offsets,
  37125. position = _ref2.position,
  37126. gpuAcceleration = _ref2.gpuAcceleration,
  37127. adaptive = _ref2.adaptive,
  37128. roundOffsets = _ref2.roundOffsets,
  37129. isFixed = _ref2.isFixed;
  37130. var _offsets$x = offsets.x,
  37131. x = _offsets$x === void 0 ? 0 : _offsets$x,
  37132. _offsets$y = offsets.y,
  37133. y = _offsets$y === void 0 ? 0 : _offsets$y;
  37134. var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
  37135. x: x,
  37136. y: y
  37137. }) : {
  37138. x: x,
  37139. y: y
  37140. };
  37141. x = _ref3.x;
  37142. y = _ref3.y;
  37143. var hasX = offsets.hasOwnProperty('x');
  37144. var hasY = offsets.hasOwnProperty('y');
  37145. var sideX = left;
  37146. var sideY = enums_top;
  37147. var win = window;
  37148. if (adaptive) {
  37149. var offsetParent = getOffsetParent(popper);
  37150. var heightProp = 'clientHeight';
  37151. var widthProp = 'clientWidth';
  37152. if (offsetParent === getWindow_getWindow(popper)) {
  37153. offsetParent = getDocumentElement(popper);
  37154. if (getComputedStyle_getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
  37155. heightProp = 'scrollHeight';
  37156. widthProp = 'scrollWidth';
  37157. }
  37158. } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
  37159. offsetParent = offsetParent;
  37160. if (placement === enums_top || (placement === left || placement === right) && variation === end) {
  37161. sideY = bottom;
  37162. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
  37163. offsetParent[heightProp];
  37164. y -= offsetY - popperRect.height;
  37165. y *= gpuAcceleration ? 1 : -1;
  37166. }
  37167. if (placement === left || (placement === enums_top || placement === bottom) && variation === end) {
  37168. sideX = right;
  37169. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
  37170. offsetParent[widthProp];
  37171. x -= offsetX - popperRect.width;
  37172. x *= gpuAcceleration ? 1 : -1;
  37173. }
  37174. }
  37175. var commonStyles = Object.assign({
  37176. position: position
  37177. }, adaptive && unsetSides);
  37178. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  37179. x: x,
  37180. y: y
  37181. }) : {
  37182. x: x,
  37183. y: y
  37184. };
  37185. x = _ref4.x;
  37186. y = _ref4.y;
  37187. if (gpuAcceleration) {
  37188. var _Object$assign;
  37189. return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  37190. }
  37191. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
  37192. }
  37193. function computeStyles(_ref5) {
  37194. var state = _ref5.state,
  37195. options = _ref5.options;
  37196. var _options$gpuAccelerat = options.gpuAcceleration,
  37197. gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
  37198. _options$adaptive = options.adaptive,
  37199. adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
  37200. _options$roundOffsets = options.roundOffsets,
  37201. roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  37202. if (false) { var transitionProperty; }
  37203. var commonStyles = {
  37204. placement: getBasePlacement(state.placement),
  37205. variation: getVariation(state.placement),
  37206. popper: state.elements.popper,
  37207. popperRect: state.rects.popper,
  37208. gpuAcceleration: gpuAcceleration,
  37209. isFixed: state.options.strategy === 'fixed'
  37210. };
  37211. if (state.modifiersData.popperOffsets != null) {
  37212. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  37213. offsets: state.modifiersData.popperOffsets,
  37214. position: state.options.strategy,
  37215. adaptive: adaptive,
  37216. roundOffsets: roundOffsets
  37217. })));
  37218. }
  37219. if (state.modifiersData.arrow != null) {
  37220. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  37221. offsets: state.modifiersData.arrow,
  37222. position: 'absolute',
  37223. adaptive: false,
  37224. roundOffsets: roundOffsets
  37225. })));
  37226. }
  37227. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  37228. 'data-popper-placement': state.placement
  37229. });
  37230. } // eslint-disable-next-line import/no-unused-modules
  37231. /* harmony default export */ var modifiers_computeStyles = ({
  37232. name: 'computeStyles',
  37233. enabled: true,
  37234. phase: 'beforeWrite',
  37235. fn: computeStyles,
  37236. data: {}
  37237. });
  37238. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/applyStyles.js
  37239. // This modifier takes the styles prepared by the `computeStyles` modifier
  37240. // and applies them to the HTMLElements such as popper and arrow
  37241. function applyStyles(_ref) {
  37242. var state = _ref.state;
  37243. Object.keys(state.elements).forEach(function (name) {
  37244. var style = state.styles[name] || {};
  37245. var attributes = state.attributes[name] || {};
  37246. var element = state.elements[name]; // arrow is optional + virtual elements
  37247. if (!isHTMLElement(element) || !getNodeName(element)) {
  37248. return;
  37249. } // Flow doesn't support to extend this property, but it's the most
  37250. // effective way to apply styles to an HTMLElement
  37251. // $FlowFixMe[cannot-write]
  37252. Object.assign(element.style, style);
  37253. Object.keys(attributes).forEach(function (name) {
  37254. var value = attributes[name];
  37255. if (value === false) {
  37256. element.removeAttribute(name);
  37257. } else {
  37258. element.setAttribute(name, value === true ? '' : value);
  37259. }
  37260. });
  37261. });
  37262. }
  37263. function applyStyles_effect(_ref2) {
  37264. var state = _ref2.state;
  37265. var initialStyles = {
  37266. popper: {
  37267. position: state.options.strategy,
  37268. left: '0',
  37269. top: '0',
  37270. margin: '0'
  37271. },
  37272. arrow: {
  37273. position: 'absolute'
  37274. },
  37275. reference: {}
  37276. };
  37277. Object.assign(state.elements.popper.style, initialStyles.popper);
  37278. state.styles = initialStyles;
  37279. if (state.elements.arrow) {
  37280. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  37281. }
  37282. return function () {
  37283. Object.keys(state.elements).forEach(function (name) {
  37284. var element = state.elements[name];
  37285. var attributes = state.attributes[name] || {};
  37286. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
  37287. var style = styleProperties.reduce(function (style, property) {
  37288. style[property] = '';
  37289. return style;
  37290. }, {}); // arrow is optional + virtual elements
  37291. if (!isHTMLElement(element) || !getNodeName(element)) {
  37292. return;
  37293. }
  37294. Object.assign(element.style, style);
  37295. Object.keys(attributes).forEach(function (attribute) {
  37296. element.removeAttribute(attribute);
  37297. });
  37298. });
  37299. };
  37300. } // eslint-disable-next-line import/no-unused-modules
  37301. /* harmony default export */ var modifiers_applyStyles = ({
  37302. name: 'applyStyles',
  37303. enabled: true,
  37304. phase: 'write',
  37305. fn: applyStyles,
  37306. effect: applyStyles_effect,
  37307. requires: ['computeStyles']
  37308. });
  37309. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/offset.js
  37310. // eslint-disable-next-line import/no-unused-modules
  37311. function distanceAndSkiddingToXY(placement, rects, offset) {
  37312. var basePlacement = getBasePlacement(placement);
  37313. var invertDistance = [left, enums_top].indexOf(basePlacement) >= 0 ? -1 : 1;
  37314. var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
  37315. placement: placement
  37316. })) : offset,
  37317. skidding = _ref[0],
  37318. distance = _ref[1];
  37319. skidding = skidding || 0;
  37320. distance = (distance || 0) * invertDistance;
  37321. return [left, right].indexOf(basePlacement) >= 0 ? {
  37322. x: distance,
  37323. y: skidding
  37324. } : {
  37325. x: skidding,
  37326. y: distance
  37327. };
  37328. }
  37329. function offset(_ref2) {
  37330. var state = _ref2.state,
  37331. options = _ref2.options,
  37332. name = _ref2.name;
  37333. var _options$offset = options.offset,
  37334. offset = _options$offset === void 0 ? [0, 0] : _options$offset;
  37335. var data = enums_placements.reduce(function (acc, placement) {
  37336. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
  37337. return acc;
  37338. }, {});
  37339. var _data$state$placement = data[state.placement],
  37340. x = _data$state$placement.x,
  37341. y = _data$state$placement.y;
  37342. if (state.modifiersData.popperOffsets != null) {
  37343. state.modifiersData.popperOffsets.x += x;
  37344. state.modifiersData.popperOffsets.y += y;
  37345. }
  37346. state.modifiersData[name] = data;
  37347. } // eslint-disable-next-line import/no-unused-modules
  37348. /* harmony default export */ var modifiers_offset = ({
  37349. name: 'offset',
  37350. enabled: true,
  37351. phase: 'main',
  37352. requires: ['popperOffsets'],
  37353. fn: offset
  37354. });
  37355. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getOppositePlacement.js
  37356. var getOppositePlacement_hash = {
  37357. left: 'right',
  37358. right: 'left',
  37359. bottom: 'top',
  37360. top: 'bottom'
  37361. };
  37362. function getOppositePlacement(placement) {
  37363. return placement.replace(/left|right|bottom|top/g, function (matched) {
  37364. return getOppositePlacement_hash[matched];
  37365. });
  37366. }
  37367. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js
  37368. var getOppositeVariationPlacement_hash = {
  37369. start: 'end',
  37370. end: 'start'
  37371. };
  37372. function getOppositeVariationPlacement(placement) {
  37373. return placement.replace(/start|end/g, function (matched) {
  37374. return getOppositeVariationPlacement_hash[matched];
  37375. });
  37376. }
  37377. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js
  37378. function getViewportRect(element) {
  37379. var win = getWindow_getWindow(element);
  37380. var html = getDocumentElement(element);
  37381. var visualViewport = win.visualViewport;
  37382. var width = html.clientWidth;
  37383. var height = html.clientHeight;
  37384. var x = 0;
  37385. var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
  37386. // can be obscured underneath it.
  37387. // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
  37388. // if it isn't open, so if this isn't available, the popper will be detected
  37389. // to overflow the bottom of the screen too early.
  37390. if (visualViewport) {
  37391. width = visualViewport.width;
  37392. height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
  37393. // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
  37394. // errors due to floating point numbers, so we need to check precision.
  37395. // Safari returns a number <= 0, usually < -1 when pinch-zoomed
  37396. // Feature detection fails in mobile emulation mode in Chrome.
  37397. // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
  37398. // 0.001
  37399. // Fallback here: "Not Safari" userAgent
  37400. if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
  37401. x = visualViewport.offsetLeft;
  37402. y = visualViewport.offsetTop;
  37403. }
  37404. }
  37405. return {
  37406. width: width,
  37407. height: height,
  37408. x: x + getWindowScrollBarX(element),
  37409. y: y
  37410. };
  37411. }
  37412. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js
  37413. // Gets the entire size of the scrollable document area, even extending outside
  37414. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  37415. function getDocumentRect(element) {
  37416. var _element$ownerDocumen;
  37417. var html = getDocumentElement(element);
  37418. var winScroll = getWindowScroll(element);
  37419. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  37420. var width = math_max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  37421. var height = math_max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  37422. var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  37423. var y = -winScroll.scrollTop;
  37424. if (getComputedStyle_getComputedStyle(body || html).direction === 'rtl') {
  37425. x += math_max(html.clientWidth, body ? body.clientWidth : 0) - width;
  37426. }
  37427. return {
  37428. width: width,
  37429. height: height,
  37430. x: x,
  37431. y: y
  37432. };
  37433. }
  37434. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/contains.js
  37435. function contains_contains(parent, child) {
  37436. var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
  37437. if (parent.contains(child)) {
  37438. return true;
  37439. } // then fallback to custom implementation with Shadow DOM support
  37440. else if (rootNode && isShadowRoot(rootNode)) {
  37441. var next = child;
  37442. do {
  37443. if (next && parent.isSameNode(next)) {
  37444. return true;
  37445. } // $FlowFixMe[prop-missing]: need a better way to handle this...
  37446. next = next.parentNode || next.host;
  37447. } while (next);
  37448. } // Give up, the result is false
  37449. return false;
  37450. }
  37451. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/rectToClientRect.js
  37452. function rectToClientRect(rect) {
  37453. return Object.assign({}, rect, {
  37454. left: rect.x,
  37455. top: rect.y,
  37456. right: rect.x + rect.width,
  37457. bottom: rect.y + rect.height
  37458. });
  37459. }
  37460. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js
  37461. function getInnerBoundingClientRect(element) {
  37462. var rect = getBoundingClientRect(element);
  37463. rect.top = rect.top + element.clientTop;
  37464. rect.left = rect.left + element.clientLeft;
  37465. rect.bottom = rect.top + element.clientHeight;
  37466. rect.right = rect.left + element.clientWidth;
  37467. rect.width = element.clientWidth;
  37468. rect.height = element.clientHeight;
  37469. rect.x = rect.left;
  37470. rect.y = rect.top;
  37471. return rect;
  37472. }
  37473. function getClientRectFromMixedType(element, clippingParent) {
  37474. return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  37475. } // A "clipping parent" is an overflowable container with the characteristic of
  37476. // clipping (or hiding) overflowing elements with a position different from
  37477. // `initial`
  37478. function getClippingParents(element) {
  37479. var clippingParents = listScrollParents(getParentNode(element));
  37480. var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle_getComputedStyle(element).position) >= 0;
  37481. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  37482. if (!isElement(clipperElement)) {
  37483. return [];
  37484. } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
  37485. return clippingParents.filter(function (clippingParent) {
  37486. return isElement(clippingParent) && contains_contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
  37487. });
  37488. } // Gets the maximum area that the element is visible in due to any number of
  37489. // clipping parents
  37490. function getClippingRect(element, boundary, rootBoundary) {
  37491. var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
  37492. var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
  37493. var firstClippingParent = clippingParents[0];
  37494. var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
  37495. var rect = getClientRectFromMixedType(element, clippingParent);
  37496. accRect.top = math_max(rect.top, accRect.top);
  37497. accRect.right = math_min(rect.right, accRect.right);
  37498. accRect.bottom = math_min(rect.bottom, accRect.bottom);
  37499. accRect.left = math_max(rect.left, accRect.left);
  37500. return accRect;
  37501. }, getClientRectFromMixedType(element, firstClippingParent));
  37502. clippingRect.width = clippingRect.right - clippingRect.left;
  37503. clippingRect.height = clippingRect.bottom - clippingRect.top;
  37504. clippingRect.x = clippingRect.left;
  37505. clippingRect.y = clippingRect.top;
  37506. return clippingRect;
  37507. }
  37508. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getFreshSideObject.js
  37509. function getFreshSideObject() {
  37510. return {
  37511. top: 0,
  37512. right: 0,
  37513. bottom: 0,
  37514. left: 0
  37515. };
  37516. }
  37517. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/mergePaddingObject.js
  37518. function mergePaddingObject(paddingObject) {
  37519. return Object.assign({}, getFreshSideObject(), paddingObject);
  37520. }
  37521. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/expandToHashMap.js
  37522. function expandToHashMap(value, keys) {
  37523. return keys.reduce(function (hashMap, key) {
  37524. hashMap[key] = value;
  37525. return hashMap;
  37526. }, {});
  37527. }
  37528. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/detectOverflow.js
  37529. // eslint-disable-next-line import/no-unused-modules
  37530. function detectOverflow(state, options) {
  37531. if (options === void 0) {
  37532. options = {};
  37533. }
  37534. var _options = options,
  37535. _options$placement = _options.placement,
  37536. placement = _options$placement === void 0 ? state.placement : _options$placement,
  37537. _options$boundary = _options.boundary,
  37538. boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
  37539. _options$rootBoundary = _options.rootBoundary,
  37540. rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
  37541. _options$elementConte = _options.elementContext,
  37542. elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
  37543. _options$altBoundary = _options.altBoundary,
  37544. altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
  37545. _options$padding = _options.padding,
  37546. padding = _options$padding === void 0 ? 0 : _options$padding;
  37547. var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
  37548. var altContext = elementContext === popper ? reference : popper;
  37549. var popperRect = state.rects.popper;
  37550. var element = state.elements[altBoundary ? altContext : elementContext];
  37551. var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
  37552. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  37553. var popperOffsets = computeOffsets({
  37554. reference: referenceClientRect,
  37555. element: popperRect,
  37556. strategy: 'absolute',
  37557. placement: placement
  37558. });
  37559. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
  37560. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
  37561. // 0 or negative = within the clipping rect
  37562. var overflowOffsets = {
  37563. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  37564. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  37565. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  37566. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  37567. };
  37568. var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
  37569. if (elementContext === popper && offsetData) {
  37570. var offset = offsetData[placement];
  37571. Object.keys(overflowOffsets).forEach(function (key) {
  37572. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  37573. var axis = [enums_top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
  37574. overflowOffsets[key] += offset[axis] * multiply;
  37575. });
  37576. }
  37577. return overflowOffsets;
  37578. }
  37579. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js
  37580. function computeAutoPlacement(state, options) {
  37581. if (options === void 0) {
  37582. options = {};
  37583. }
  37584. var _options = options,
  37585. placement = _options.placement,
  37586. boundary = _options.boundary,
  37587. rootBoundary = _options.rootBoundary,
  37588. padding = _options.padding,
  37589. flipVariations = _options.flipVariations,
  37590. _options$allowedAutoP = _options.allowedAutoPlacements,
  37591. allowedAutoPlacements = _options$allowedAutoP === void 0 ? enums_placements : _options$allowedAutoP;
  37592. var variation = getVariation(placement);
  37593. var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
  37594. return getVariation(placement) === variation;
  37595. }) : basePlacements;
  37596. var allowedPlacements = placements.filter(function (placement) {
  37597. return allowedAutoPlacements.indexOf(placement) >= 0;
  37598. });
  37599. if (allowedPlacements.length === 0) {
  37600. allowedPlacements = placements;
  37601. if (false) {}
  37602. } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
  37603. var overflows = allowedPlacements.reduce(function (acc, placement) {
  37604. acc[placement] = detectOverflow(state, {
  37605. placement: placement,
  37606. boundary: boundary,
  37607. rootBoundary: rootBoundary,
  37608. padding: padding
  37609. })[getBasePlacement(placement)];
  37610. return acc;
  37611. }, {});
  37612. return Object.keys(overflows).sort(function (a, b) {
  37613. return overflows[a] - overflows[b];
  37614. });
  37615. }
  37616. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/flip.js
  37617. // eslint-disable-next-line import/no-unused-modules
  37618. function getExpandedFallbackPlacements(placement) {
  37619. if (getBasePlacement(placement) === enums_auto) {
  37620. return [];
  37621. }
  37622. var oppositePlacement = getOppositePlacement(placement);
  37623. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  37624. }
  37625. function flip(_ref) {
  37626. var state = _ref.state,
  37627. options = _ref.options,
  37628. name = _ref.name;
  37629. if (state.modifiersData[name]._skip) {
  37630. return;
  37631. }
  37632. var _options$mainAxis = options.mainAxis,
  37633. checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
  37634. _options$altAxis = options.altAxis,
  37635. checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
  37636. specifiedFallbackPlacements = options.fallbackPlacements,
  37637. padding = options.padding,
  37638. boundary = options.boundary,
  37639. rootBoundary = options.rootBoundary,
  37640. altBoundary = options.altBoundary,
  37641. _options$flipVariatio = options.flipVariations,
  37642. flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
  37643. allowedAutoPlacements = options.allowedAutoPlacements;
  37644. var preferredPlacement = state.options.placement;
  37645. var basePlacement = getBasePlacement(preferredPlacement);
  37646. var isBasePlacement = basePlacement === preferredPlacement;
  37647. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  37648. var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
  37649. return acc.concat(getBasePlacement(placement) === enums_auto ? computeAutoPlacement(state, {
  37650. placement: placement,
  37651. boundary: boundary,
  37652. rootBoundary: rootBoundary,
  37653. padding: padding,
  37654. flipVariations: flipVariations,
  37655. allowedAutoPlacements: allowedAutoPlacements
  37656. }) : placement);
  37657. }, []);
  37658. var referenceRect = state.rects.reference;
  37659. var popperRect = state.rects.popper;
  37660. var checksMap = new Map();
  37661. var makeFallbackChecks = true;
  37662. var firstFittingPlacement = placements[0];
  37663. for (var i = 0; i < placements.length; i++) {
  37664. var placement = placements[i];
  37665. var _basePlacement = getBasePlacement(placement);
  37666. var isStartVariation = getVariation(placement) === start;
  37667. var isVertical = [enums_top, bottom].indexOf(_basePlacement) >= 0;
  37668. var len = isVertical ? 'width' : 'height';
  37669. var overflow = detectOverflow(state, {
  37670. placement: placement,
  37671. boundary: boundary,
  37672. rootBoundary: rootBoundary,
  37673. altBoundary: altBoundary,
  37674. padding: padding
  37675. });
  37676. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : enums_top;
  37677. if (referenceRect[len] > popperRect[len]) {
  37678. mainVariationSide = getOppositePlacement(mainVariationSide);
  37679. }
  37680. var altVariationSide = getOppositePlacement(mainVariationSide);
  37681. var checks = [];
  37682. if (checkMainAxis) {
  37683. checks.push(overflow[_basePlacement] <= 0);
  37684. }
  37685. if (checkAltAxis) {
  37686. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  37687. }
  37688. if (checks.every(function (check) {
  37689. return check;
  37690. })) {
  37691. firstFittingPlacement = placement;
  37692. makeFallbackChecks = false;
  37693. break;
  37694. }
  37695. checksMap.set(placement, checks);
  37696. }
  37697. if (makeFallbackChecks) {
  37698. // `2` may be desired in some cases – research later
  37699. var numberOfChecks = flipVariations ? 3 : 1;
  37700. var _loop = function _loop(_i) {
  37701. var fittingPlacement = placements.find(function (placement) {
  37702. var checks = checksMap.get(placement);
  37703. if (checks) {
  37704. return checks.slice(0, _i).every(function (check) {
  37705. return check;
  37706. });
  37707. }
  37708. });
  37709. if (fittingPlacement) {
  37710. firstFittingPlacement = fittingPlacement;
  37711. return "break";
  37712. }
  37713. };
  37714. for (var _i = numberOfChecks; _i > 0; _i--) {
  37715. var _ret = _loop(_i);
  37716. if (_ret === "break") break;
  37717. }
  37718. }
  37719. if (state.placement !== firstFittingPlacement) {
  37720. state.modifiersData[name]._skip = true;
  37721. state.placement = firstFittingPlacement;
  37722. state.reset = true;
  37723. }
  37724. } // eslint-disable-next-line import/no-unused-modules
  37725. /* harmony default export */ var modifiers_flip = ({
  37726. name: 'flip',
  37727. enabled: true,
  37728. phase: 'main',
  37729. fn: flip,
  37730. requiresIfExists: ['offset'],
  37731. data: {
  37732. _skip: false
  37733. }
  37734. });
  37735. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getAltAxis.js
  37736. function getAltAxis(axis) {
  37737. return axis === 'x' ? 'y' : 'x';
  37738. }
  37739. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/within.js
  37740. function within(min, value, max) {
  37741. return math_max(min, math_min(value, max));
  37742. }
  37743. function withinMaxClamp(min, value, max) {
  37744. var v = within(min, value, max);
  37745. return v > max ? max : v;
  37746. }
  37747. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/preventOverflow.js
  37748. function preventOverflow(_ref) {
  37749. var state = _ref.state,
  37750. options = _ref.options,
  37751. name = _ref.name;
  37752. var _options$mainAxis = options.mainAxis,
  37753. checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
  37754. _options$altAxis = options.altAxis,
  37755. checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
  37756. boundary = options.boundary,
  37757. rootBoundary = options.rootBoundary,
  37758. altBoundary = options.altBoundary,
  37759. padding = options.padding,
  37760. _options$tether = options.tether,
  37761. tether = _options$tether === void 0 ? true : _options$tether,
  37762. _options$tetherOffset = options.tetherOffset,
  37763. tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
  37764. var overflow = detectOverflow(state, {
  37765. boundary: boundary,
  37766. rootBoundary: rootBoundary,
  37767. padding: padding,
  37768. altBoundary: altBoundary
  37769. });
  37770. var basePlacement = getBasePlacement(state.placement);
  37771. var variation = getVariation(state.placement);
  37772. var isBasePlacement = !variation;
  37773. var mainAxis = getMainAxisFromPlacement(basePlacement);
  37774. var altAxis = getAltAxis(mainAxis);
  37775. var popperOffsets = state.modifiersData.popperOffsets;
  37776. var referenceRect = state.rects.reference;
  37777. var popperRect = state.rects.popper;
  37778. var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
  37779. placement: state.placement
  37780. })) : tetherOffset;
  37781. var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
  37782. mainAxis: tetherOffsetValue,
  37783. altAxis: tetherOffsetValue
  37784. } : Object.assign({
  37785. mainAxis: 0,
  37786. altAxis: 0
  37787. }, tetherOffsetValue);
  37788. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  37789. var data = {
  37790. x: 0,
  37791. y: 0
  37792. };
  37793. if (!popperOffsets) {
  37794. return;
  37795. }
  37796. if (checkMainAxis) {
  37797. var _offsetModifierState$;
  37798. var mainSide = mainAxis === 'y' ? enums_top : left;
  37799. var altSide = mainAxis === 'y' ? bottom : right;
  37800. var len = mainAxis === 'y' ? 'height' : 'width';
  37801. var offset = popperOffsets[mainAxis];
  37802. var min = offset + overflow[mainSide];
  37803. var max = offset - overflow[altSide];
  37804. var additive = tether ? -popperRect[len] / 2 : 0;
  37805. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  37806. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
  37807. // outside the reference bounds
  37808. var arrowElement = state.elements.arrow;
  37809. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  37810. width: 0,
  37811. height: 0
  37812. };
  37813. var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
  37814. var arrowPaddingMin = arrowPaddingObject[mainSide];
  37815. var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
  37816. // to include its full size in the calculation. If the reference is small
  37817. // and near the edge of a boundary, the popper can overflow even if the
  37818. // reference is not overflowing as well (e.g. virtual elements with no
  37819. // width or height)
  37820. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  37821. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  37822. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  37823. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  37824. var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  37825. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  37826. var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
  37827. var tetherMax = offset + maxOffset - offsetModifierValue;
  37828. var preventedOffset = within(tether ? math_min(min, tetherMin) : min, offset, tether ? math_max(max, tetherMax) : max);
  37829. popperOffsets[mainAxis] = preventedOffset;
  37830. data[mainAxis] = preventedOffset - offset;
  37831. }
  37832. if (checkAltAxis) {
  37833. var _offsetModifierState$2;
  37834. var _mainSide = mainAxis === 'x' ? enums_top : left;
  37835. var _altSide = mainAxis === 'x' ? bottom : right;
  37836. var _offset = popperOffsets[altAxis];
  37837. var _len = altAxis === 'y' ? 'height' : 'width';
  37838. var _min = _offset + overflow[_mainSide];
  37839. var _max = _offset - overflow[_altSide];
  37840. var isOriginSide = [enums_top, left].indexOf(basePlacement) !== -1;
  37841. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  37842. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  37843. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  37844. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  37845. popperOffsets[altAxis] = _preventedOffset;
  37846. data[altAxis] = _preventedOffset - _offset;
  37847. }
  37848. state.modifiersData[name] = data;
  37849. } // eslint-disable-next-line import/no-unused-modules
  37850. /* harmony default export */ var modifiers_preventOverflow = ({
  37851. name: 'preventOverflow',
  37852. enabled: true,
  37853. phase: 'main',
  37854. fn: preventOverflow,
  37855. requiresIfExists: ['offset']
  37856. });
  37857. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/arrow.js
  37858. // eslint-disable-next-line import/no-unused-modules
  37859. var toPaddingObject = function toPaddingObject(padding, state) {
  37860. padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
  37861. placement: state.placement
  37862. })) : padding;
  37863. return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
  37864. };
  37865. function arrow(_ref) {
  37866. var _state$modifiersData$;
  37867. var state = _ref.state,
  37868. name = _ref.name,
  37869. options = _ref.options;
  37870. var arrowElement = state.elements.arrow;
  37871. var popperOffsets = state.modifiersData.popperOffsets;
  37872. var basePlacement = getBasePlacement(state.placement);
  37873. var axis = getMainAxisFromPlacement(basePlacement);
  37874. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  37875. var len = isVertical ? 'height' : 'width';
  37876. if (!arrowElement || !popperOffsets) {
  37877. return;
  37878. }
  37879. var paddingObject = toPaddingObject(options.padding, state);
  37880. var arrowRect = getLayoutRect(arrowElement);
  37881. var minProp = axis === 'y' ? enums_top : left;
  37882. var maxProp = axis === 'y' ? bottom : right;
  37883. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
  37884. var startDiff = popperOffsets[axis] - state.rects.reference[axis];
  37885. var arrowOffsetParent = getOffsetParent(arrowElement);
  37886. var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  37887. var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
  37888. // outside of the popper bounds
  37889. var min = paddingObject[minProp];
  37890. var max = clientSize - arrowRect[len] - paddingObject[maxProp];
  37891. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  37892. var offset = within(min, center, max); // Prevents breaking syntax highlighting...
  37893. var axisProp = axis;
  37894. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
  37895. }
  37896. function arrow_effect(_ref2) {
  37897. var state = _ref2.state,
  37898. options = _ref2.options;
  37899. var _options$element = options.element,
  37900. arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
  37901. if (arrowElement == null) {
  37902. return;
  37903. } // CSS selector
  37904. if (typeof arrowElement === 'string') {
  37905. arrowElement = state.elements.popper.querySelector(arrowElement);
  37906. if (!arrowElement) {
  37907. return;
  37908. }
  37909. }
  37910. if (false) {}
  37911. if (!contains_contains(state.elements.popper, arrowElement)) {
  37912. if (false) {}
  37913. return;
  37914. }
  37915. state.elements.arrow = arrowElement;
  37916. } // eslint-disable-next-line import/no-unused-modules
  37917. /* harmony default export */ var modifiers_arrow = ({
  37918. name: 'arrow',
  37919. enabled: true,
  37920. phase: 'main',
  37921. fn: arrow,
  37922. effect: arrow_effect,
  37923. requires: ['popperOffsets'],
  37924. requiresIfExists: ['preventOverflow']
  37925. });
  37926. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/hide.js
  37927. function getSideOffsets(overflow, rect, preventedOffsets) {
  37928. if (preventedOffsets === void 0) {
  37929. preventedOffsets = {
  37930. x: 0,
  37931. y: 0
  37932. };
  37933. }
  37934. return {
  37935. top: overflow.top - rect.height - preventedOffsets.y,
  37936. right: overflow.right - rect.width + preventedOffsets.x,
  37937. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  37938. left: overflow.left - rect.width - preventedOffsets.x
  37939. };
  37940. }
  37941. function isAnySideFullyClipped(overflow) {
  37942. return [enums_top, right, bottom, left].some(function (side) {
  37943. return overflow[side] >= 0;
  37944. });
  37945. }
  37946. function hide(_ref) {
  37947. var state = _ref.state,
  37948. name = _ref.name;
  37949. var referenceRect = state.rects.reference;
  37950. var popperRect = state.rects.popper;
  37951. var preventedOffsets = state.modifiersData.preventOverflow;
  37952. var referenceOverflow = detectOverflow(state, {
  37953. elementContext: 'reference'
  37954. });
  37955. var popperAltOverflow = detectOverflow(state, {
  37956. altBoundary: true
  37957. });
  37958. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  37959. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  37960. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  37961. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  37962. state.modifiersData[name] = {
  37963. referenceClippingOffsets: referenceClippingOffsets,
  37964. popperEscapeOffsets: popperEscapeOffsets,
  37965. isReferenceHidden: isReferenceHidden,
  37966. hasPopperEscaped: hasPopperEscaped
  37967. };
  37968. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  37969. 'data-popper-reference-hidden': isReferenceHidden,
  37970. 'data-popper-escaped': hasPopperEscaped
  37971. });
  37972. } // eslint-disable-next-line import/no-unused-modules
  37973. /* harmony default export */ var modifiers_hide = ({
  37974. name: 'hide',
  37975. enabled: true,
  37976. phase: 'main',
  37977. requiresIfExists: ['preventOverflow'],
  37978. fn: hide
  37979. });
  37980. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/popper.js
  37981. var defaultModifiers = [eventListeners, modifiers_popperOffsets, modifiers_computeStyles, modifiers_applyStyles, modifiers_offset, modifiers_flip, modifiers_preventOverflow, modifiers_arrow, modifiers_hide];
  37982. var popper_createPopper = /*#__PURE__*/popperGenerator({
  37983. defaultModifiers: defaultModifiers
  37984. }); // eslint-disable-next-line import/no-unused-modules
  37985. // eslint-disable-next-line import/no-unused-modules
  37986. // eslint-disable-next-line import/no-unused-modules
  37987. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Disclosure/DisclosureState.js
  37988. function useLastValue(value) {
  37989. var lastValue = (0,external_React_.useRef)(null);
  37990. useIsomorphicEffect(function () {
  37991. lastValue.current = value;
  37992. }, [value]);
  37993. return lastValue;
  37994. }
  37995. function useDisclosureState(initialState) {
  37996. if (initialState === void 0) {
  37997. initialState = {};
  37998. }
  37999. var _useSealedState = useSealedState(initialState),
  38000. _useSealedState$visib = _useSealedState.visible,
  38001. initialVisible = _useSealedState$visib === void 0 ? false : _useSealedState$visib,
  38002. _useSealedState$anima = _useSealedState.animated,
  38003. initialAnimated = _useSealedState$anima === void 0 ? false : _useSealedState$anima,
  38004. sealed = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_useSealedState, ["visible", "animated"]);
  38005. var id = unstable_useIdState(sealed);
  38006. var _React$useState = (0,external_React_.useState)(initialVisible),
  38007. visible = _React$useState[0],
  38008. setVisible = _React$useState[1];
  38009. var _React$useState2 = (0,external_React_.useState)(initialAnimated),
  38010. animated = _React$useState2[0],
  38011. setAnimated = _React$useState2[1];
  38012. var _React$useState3 = (0,external_React_.useState)(false),
  38013. animating = _React$useState3[0],
  38014. setAnimating = _React$useState3[1];
  38015. var lastVisible = useLastValue(visible);
  38016. var visibleHasChanged = lastVisible.current != null && lastVisible.current !== visible;
  38017. if (animated && !animating && visibleHasChanged) {
  38018. // Sets animating to true when when visible is updated
  38019. setAnimating(true);
  38020. }
  38021. (0,external_React_.useEffect)(function () {
  38022. if (typeof animated === "number" && animating) {
  38023. var timeout = setTimeout(function () {
  38024. return setAnimating(false);
  38025. }, animated);
  38026. return function () {
  38027. clearTimeout(timeout);
  38028. };
  38029. }
  38030. if (animated && animating && "production" === "development") { var _timeout; }
  38031. return function () {};
  38032. }, [animated, animating]);
  38033. var show = (0,external_React_.useCallback)(function () {
  38034. return setVisible(true);
  38035. }, []);
  38036. var hide = (0,external_React_.useCallback)(function () {
  38037. return setVisible(false);
  38038. }, []);
  38039. var toggle = (0,external_React_.useCallback)(function () {
  38040. return setVisible(function (v) {
  38041. return !v;
  38042. });
  38043. }, []);
  38044. var stopAnimation = (0,external_React_.useCallback)(function () {
  38045. return setAnimating(false);
  38046. }, []);
  38047. return _objectSpread2(_objectSpread2({}, id), {}, {
  38048. visible: visible,
  38049. animated: animated,
  38050. animating: animating,
  38051. show: show,
  38052. hide: hide,
  38053. toggle: toggle,
  38054. setVisible: setVisible,
  38055. setAnimated: setAnimated,
  38056. stopAnimation: stopAnimation
  38057. });
  38058. }
  38059. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Dialog/DialogState.js
  38060. function useDialogState(initialState) {
  38061. if (initialState === void 0) {
  38062. initialState = {};
  38063. }
  38064. var _useSealedState = useSealedState(initialState),
  38065. _useSealedState$modal = _useSealedState.modal,
  38066. initialModal = _useSealedState$modal === void 0 ? true : _useSealedState$modal,
  38067. sealed = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_useSealedState, ["modal"]);
  38068. var disclosure = useDisclosureState(sealed);
  38069. var _React$useState = (0,external_React_.useState)(initialModal),
  38070. modal = _React$useState[0],
  38071. setModal = _React$useState[1];
  38072. var disclosureRef = (0,external_React_.useRef)(null);
  38073. return _objectSpread2(_objectSpread2({}, disclosure), {}, {
  38074. modal: modal,
  38075. setModal: setModal,
  38076. unstable_disclosureRef: disclosureRef
  38077. });
  38078. }
  38079. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Popover/PopoverState.js
  38080. var isSafari = isUA("Mac") && !isUA("Chrome") && isUA("Safari");
  38081. function PopoverState_applyStyles(styles) {
  38082. return function (prevStyles) {
  38083. if (styles && !shallowEqual(prevStyles, styles)) {
  38084. return styles;
  38085. }
  38086. return prevStyles;
  38087. };
  38088. }
  38089. function usePopoverState(initialState) {
  38090. if (initialState === void 0) {
  38091. initialState = {};
  38092. }
  38093. var _useSealedState = useSealedState(initialState),
  38094. _useSealedState$gutte = _useSealedState.gutter,
  38095. gutter = _useSealedState$gutte === void 0 ? 12 : _useSealedState$gutte,
  38096. _useSealedState$place = _useSealedState.placement,
  38097. sealedPlacement = _useSealedState$place === void 0 ? "bottom" : _useSealedState$place,
  38098. _useSealedState$unsta = _useSealedState.unstable_flip,
  38099. flip = _useSealedState$unsta === void 0 ? true : _useSealedState$unsta,
  38100. sealedOffset = _useSealedState.unstable_offset,
  38101. _useSealedState$unsta2 = _useSealedState.unstable_preventOverflow,
  38102. preventOverflow = _useSealedState$unsta2 === void 0 ? true : _useSealedState$unsta2,
  38103. _useSealedState$unsta3 = _useSealedState.unstable_fixed,
  38104. fixed = _useSealedState$unsta3 === void 0 ? false : _useSealedState$unsta3,
  38105. _useSealedState$modal = _useSealedState.modal,
  38106. modal = _useSealedState$modal === void 0 ? false : _useSealedState$modal,
  38107. sealed = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_useSealedState, ["gutter", "placement", "unstable_flip", "unstable_offset", "unstable_preventOverflow", "unstable_fixed", "modal"]);
  38108. var popper = (0,external_React_.useRef)(null);
  38109. var referenceRef = (0,external_React_.useRef)(null);
  38110. var popoverRef = (0,external_React_.useRef)(null);
  38111. var arrowRef = (0,external_React_.useRef)(null);
  38112. var _React$useState = (0,external_React_.useState)(sealedPlacement),
  38113. originalPlacement = _React$useState[0],
  38114. place = _React$useState[1];
  38115. var _React$useState2 = (0,external_React_.useState)(sealedPlacement),
  38116. placement = _React$useState2[0],
  38117. setPlacement = _React$useState2[1];
  38118. var _React$useState3 = (0,external_React_.useState)(sealedOffset || [0, gutter]),
  38119. offset = _React$useState3[0];
  38120. var _React$useState4 = (0,external_React_.useState)({
  38121. position: "fixed",
  38122. left: "100%",
  38123. top: "100%"
  38124. }),
  38125. popoverStyles = _React$useState4[0],
  38126. setPopoverStyles = _React$useState4[1];
  38127. var _React$useState5 = (0,external_React_.useState)({}),
  38128. arrowStyles = _React$useState5[0],
  38129. setArrowStyles = _React$useState5[1];
  38130. var dialog = useDialogState(_objectSpread2({
  38131. modal: modal
  38132. }, sealed));
  38133. var update = (0,external_React_.useCallback)(function () {
  38134. if (popper.current) {
  38135. popper.current.forceUpdate();
  38136. return true;
  38137. }
  38138. return false;
  38139. }, []);
  38140. var updateState = (0,external_React_.useCallback)(function (state) {
  38141. if (state.placement) {
  38142. setPlacement(state.placement);
  38143. }
  38144. if (state.styles) {
  38145. setPopoverStyles(PopoverState_applyStyles(state.styles.popper));
  38146. if (arrowRef.current) {
  38147. setArrowStyles(PopoverState_applyStyles(state.styles.arrow));
  38148. }
  38149. }
  38150. }, []);
  38151. useIsomorphicEffect(function () {
  38152. if (referenceRef.current && popoverRef.current) {
  38153. popper.current = popper_createPopper(referenceRef.current, popoverRef.current, {
  38154. // https://popper.js.org/docs/v2/constructors/#options
  38155. placement: originalPlacement,
  38156. strategy: fixed ? "fixed" : "absolute",
  38157. // Safari needs styles to be applied in the first render, otherwise
  38158. // hovering over the popover when it gets visible for the first time
  38159. // will change its dimensions unexpectedly.
  38160. onFirstUpdate: isSafari ? updateState : undefined,
  38161. modifiers: [{
  38162. // https://popper.js.org/docs/v2/modifiers/event-listeners/
  38163. name: "eventListeners",
  38164. enabled: dialog.visible
  38165. }, {
  38166. // https://popper.js.org/docs/v2/modifiers/apply-styles/
  38167. name: "applyStyles",
  38168. enabled: false
  38169. }, {
  38170. // https://popper.js.org/docs/v2/modifiers/flip/
  38171. name: "flip",
  38172. enabled: flip,
  38173. options: {
  38174. padding: 8
  38175. }
  38176. }, {
  38177. // https://popper.js.org/docs/v2/modifiers/offset/
  38178. name: "offset",
  38179. options: {
  38180. offset: offset
  38181. }
  38182. }, {
  38183. // https://popper.js.org/docs/v2/modifiers/prevent-overflow/
  38184. name: "preventOverflow",
  38185. enabled: preventOverflow,
  38186. options: {
  38187. tetherOffset: function tetherOffset() {
  38188. var _arrowRef$current;
  38189. return ((_arrowRef$current = arrowRef.current) === null || _arrowRef$current === void 0 ? void 0 : _arrowRef$current.clientWidth) || 0;
  38190. }
  38191. }
  38192. }, {
  38193. // https://popper.js.org/docs/v2/modifiers/arrow/
  38194. name: "arrow",
  38195. enabled: !!arrowRef.current,
  38196. options: {
  38197. element: arrowRef.current
  38198. }
  38199. }, {
  38200. // https://popper.js.org/docs/v2/modifiers/#custom-modifiers
  38201. name: "updateState",
  38202. phase: "write",
  38203. requires: ["computeStyles"],
  38204. enabled: dialog.visible && "production" !== "test",
  38205. fn: function fn(_ref) {
  38206. var state = _ref.state;
  38207. return updateState(state);
  38208. }
  38209. }]
  38210. });
  38211. }
  38212. return function () {
  38213. if (popper.current) {
  38214. popper.current.destroy();
  38215. popper.current = null;
  38216. }
  38217. };
  38218. }, [originalPlacement, fixed, dialog.visible, flip, offset, preventOverflow]); // Ensure that the popover will be correctly positioned with an additional
  38219. // update.
  38220. (0,external_React_.useEffect)(function () {
  38221. if (!dialog.visible) return undefined;
  38222. var id = window.requestAnimationFrame(function () {
  38223. var _popper$current;
  38224. (_popper$current = popper.current) === null || _popper$current === void 0 ? void 0 : _popper$current.forceUpdate();
  38225. });
  38226. return function () {
  38227. window.cancelAnimationFrame(id);
  38228. };
  38229. }, [dialog.visible]);
  38230. return _objectSpread2(_objectSpread2({}, dialog), {}, {
  38231. unstable_referenceRef: referenceRef,
  38232. unstable_popoverRef: popoverRef,
  38233. unstable_arrowRef: arrowRef,
  38234. unstable_popoverStyles: popoverStyles,
  38235. unstable_arrowStyles: arrowStyles,
  38236. unstable_update: update,
  38237. unstable_originalPlacement: originalPlacement,
  38238. placement: placement,
  38239. place: place
  38240. });
  38241. }
  38242. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__globalState-300469f0.js
  38243. var globalState = {
  38244. currentTooltipId: null,
  38245. listeners: new Set(),
  38246. subscribe: function subscribe(listener) {
  38247. var _this = this;
  38248. this.listeners.add(listener);
  38249. return function () {
  38250. _this.listeners.delete(listener);
  38251. };
  38252. },
  38253. show: function show(id) {
  38254. this.currentTooltipId = id;
  38255. this.listeners.forEach(function (listener) {
  38256. return listener(id);
  38257. });
  38258. },
  38259. hide: function hide(id) {
  38260. if (this.currentTooltipId === id) {
  38261. this.currentTooltipId = null;
  38262. this.listeners.forEach(function (listener) {
  38263. return listener(null);
  38264. });
  38265. }
  38266. }
  38267. };
  38268. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Tooltip/TooltipState.js
  38269. function useTooltipState(initialState) {
  38270. if (initialState === void 0) {
  38271. initialState = {};
  38272. }
  38273. var _useSealedState = useSealedState(initialState),
  38274. _useSealedState$place = _useSealedState.placement,
  38275. placement = _useSealedState$place === void 0 ? "top" : _useSealedState$place,
  38276. _useSealedState$unsta = _useSealedState.unstable_timeout,
  38277. initialTimeout = _useSealedState$unsta === void 0 ? 0 : _useSealedState$unsta,
  38278. sealed = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_useSealedState, ["placement", "unstable_timeout"]);
  38279. var _React$useState = (0,external_React_.useState)(initialTimeout),
  38280. timeout = _React$useState[0],
  38281. setTimeout = _React$useState[1];
  38282. var showTimeout = (0,external_React_.useRef)(null);
  38283. var hideTimeout = (0,external_React_.useRef)(null);
  38284. var _usePopoverState = usePopoverState(_objectSpread2(_objectSpread2({}, sealed), {}, {
  38285. placement: placement
  38286. })),
  38287. modal = _usePopoverState.modal,
  38288. setModal = _usePopoverState.setModal,
  38289. popover = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_usePopoverState, ["modal", "setModal"]);
  38290. var clearTimeouts = (0,external_React_.useCallback)(function () {
  38291. if (showTimeout.current !== null) {
  38292. window.clearTimeout(showTimeout.current);
  38293. }
  38294. if (hideTimeout.current !== null) {
  38295. window.clearTimeout(hideTimeout.current);
  38296. }
  38297. }, []);
  38298. var hide = (0,external_React_.useCallback)(function () {
  38299. clearTimeouts();
  38300. popover.hide(); // Let's give some time so people can move from a reference to another
  38301. // and still show tooltips immediately
  38302. hideTimeout.current = window.setTimeout(function () {
  38303. globalState.hide(popover.baseId);
  38304. }, timeout);
  38305. }, [clearTimeouts, popover.hide, timeout, popover.baseId]);
  38306. var show = (0,external_React_.useCallback)(function () {
  38307. clearTimeouts();
  38308. if (!timeout || globalState.currentTooltipId) {
  38309. // If there's no timeout or a tooltip visible already, we can show this
  38310. // immediately
  38311. globalState.show(popover.baseId);
  38312. popover.show();
  38313. } else {
  38314. // There may be a reference with focus whose tooltip is still not visible
  38315. // In this case, we want to update it before it gets shown.
  38316. globalState.show(null); // Otherwise, wait a little bit to show the tooltip
  38317. showTimeout.current = window.setTimeout(function () {
  38318. globalState.show(popover.baseId);
  38319. popover.show();
  38320. }, timeout);
  38321. }
  38322. }, [clearTimeouts, timeout, popover.show, popover.baseId]);
  38323. (0,external_React_.useEffect)(function () {
  38324. return globalState.subscribe(function (id) {
  38325. if (id !== popover.baseId) {
  38326. clearTimeouts();
  38327. if (popover.visible) {
  38328. // Make sure there will be only one tooltip visible
  38329. popover.hide();
  38330. }
  38331. }
  38332. });
  38333. }, [popover.baseId, clearTimeouts, popover.visible, popover.hide]);
  38334. (0,external_React_.useEffect)(function () {
  38335. return function () {
  38336. clearTimeouts();
  38337. globalState.hide(popover.baseId);
  38338. };
  38339. }, [clearTimeouts, popover.baseId]);
  38340. return _objectSpread2(_objectSpread2({}, popover), {}, {
  38341. hide: hide,
  38342. show: show,
  38343. unstable_timeout: timeout,
  38344. unstable_setTimeout: setTimeout
  38345. });
  38346. }
  38347. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-d101cb3b.js
  38348. // Automatically generated
  38349. var TOOLTIP_STATE_KEYS = ["baseId", "unstable_idCountRef", "visible", "animated", "animating", "setBaseId", "show", "hide", "toggle", "setVisible", "setAnimated", "stopAnimation", "unstable_disclosureRef", "unstable_referenceRef", "unstable_popoverRef", "unstable_arrowRef", "unstable_popoverStyles", "unstable_arrowStyles", "unstable_originalPlacement", "unstable_update", "placement", "place", "unstable_timeout", "unstable_setTimeout"];
  38350. var TOOLTIP_KEYS = [].concat(TOOLTIP_STATE_KEYS, ["unstable_portal"]);
  38351. var TOOLTIP_ARROW_KEYS = TOOLTIP_STATE_KEYS;
  38352. var TOOLTIP_REFERENCE_KEYS = TOOLTIP_ARROW_KEYS;
  38353. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Tooltip/TooltipReference.js
  38354. var useTooltipReference = createHook({
  38355. name: "TooltipReference",
  38356. compose: useRole,
  38357. keys: TOOLTIP_REFERENCE_KEYS,
  38358. useProps: function useProps(options, _ref) {
  38359. var htmlRef = _ref.ref,
  38360. htmlOnFocus = _ref.onFocus,
  38361. htmlOnBlur = _ref.onBlur,
  38362. htmlOnMouseEnter = _ref.onMouseEnter,
  38363. htmlOnMouseLeave = _ref.onMouseLeave,
  38364. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["ref", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave"]);
  38365. var onFocusRef = useLiveRef(htmlOnFocus);
  38366. var onBlurRef = useLiveRef(htmlOnBlur);
  38367. var onMouseEnterRef = useLiveRef(htmlOnMouseEnter);
  38368. var onMouseLeaveRef = useLiveRef(htmlOnMouseLeave);
  38369. var onFocus = (0,external_React_.useCallback)(function (event) {
  38370. var _onFocusRef$current, _options$show;
  38371. (_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
  38372. if (event.defaultPrevented) return;
  38373. (_options$show = options.show) === null || _options$show === void 0 ? void 0 : _options$show.call(options);
  38374. }, [options.show]);
  38375. var onBlur = (0,external_React_.useCallback)(function (event) {
  38376. var _onBlurRef$current, _options$hide;
  38377. (_onBlurRef$current = onBlurRef.current) === null || _onBlurRef$current === void 0 ? void 0 : _onBlurRef$current.call(onBlurRef, event);
  38378. if (event.defaultPrevented) return;
  38379. (_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);
  38380. }, [options.hide]);
  38381. var onMouseEnter = (0,external_React_.useCallback)(function (event) {
  38382. var _onMouseEnterRef$curr, _options$show2;
  38383. (_onMouseEnterRef$curr = onMouseEnterRef.current) === null || _onMouseEnterRef$curr === void 0 ? void 0 : _onMouseEnterRef$curr.call(onMouseEnterRef, event);
  38384. if (event.defaultPrevented) return;
  38385. (_options$show2 = options.show) === null || _options$show2 === void 0 ? void 0 : _options$show2.call(options);
  38386. }, [options.show]);
  38387. var onMouseLeave = (0,external_React_.useCallback)(function (event) {
  38388. var _onMouseLeaveRef$curr, _options$hide2;
  38389. (_onMouseLeaveRef$curr = onMouseLeaveRef.current) === null || _onMouseLeaveRef$curr === void 0 ? void 0 : _onMouseLeaveRef$curr.call(onMouseLeaveRef, event);
  38390. if (event.defaultPrevented) return;
  38391. (_options$hide2 = options.hide) === null || _options$hide2 === void 0 ? void 0 : _options$hide2.call(options);
  38392. }, [options.hide]);
  38393. return _objectSpread2({
  38394. ref: useForkRef(options.unstable_referenceRef, htmlRef),
  38395. tabIndex: 0,
  38396. onFocus: onFocus,
  38397. onBlur: onBlur,
  38398. onMouseEnter: onMouseEnter,
  38399. onMouseLeave: onMouseLeave,
  38400. "aria-describedby": options.baseId
  38401. }, htmlProps);
  38402. }
  38403. });
  38404. var TooltipReference = createComponent({
  38405. as: "div",
  38406. useHook: useTooltipReference
  38407. });
  38408. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/tooltip/context.js
  38409. /**
  38410. * WordPress dependencies
  38411. */
  38412. /**
  38413. * @type {import('react').Context<{ tooltip?: import('reakit').TooltipState }>}
  38414. */
  38415. const TooltipContext = (0,external_wp_element_namespaceObject.createContext)({});
  38416. const useTooltipContext = () => (0,external_wp_element_namespaceObject.useContext)(TooltipContext);
  38417. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-e6a5cfbe.js
  38418. // Automatically generated
  38419. var DISCLOSURE_STATE_KEYS = ["baseId", "unstable_idCountRef", "visible", "animated", "animating", "setBaseId", "show", "hide", "toggle", "setVisible", "setAnimated", "stopAnimation"];
  38420. var DISCLOSURE_KEYS = DISCLOSURE_STATE_KEYS;
  38421. var DISCLOSURE_CONTENT_KEYS = DISCLOSURE_KEYS;
  38422. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Disclosure/DisclosureContent.js
  38423. var useDisclosureContent = createHook({
  38424. name: "DisclosureContent",
  38425. compose: useRole,
  38426. keys: DISCLOSURE_CONTENT_KEYS,
  38427. useProps: function useProps(options, _ref) {
  38428. var htmlOnTransitionEnd = _ref.onTransitionEnd,
  38429. htmlOnAnimationEnd = _ref.onAnimationEnd,
  38430. htmlStyle = _ref.style,
  38431. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["onTransitionEnd", "onAnimationEnd", "style"]);
  38432. var animating = options.animated && options.animating;
  38433. var _React$useState = (0,external_React_.useState)(null),
  38434. transition = _React$useState[0],
  38435. setTransition = _React$useState[1];
  38436. var hidden = !options.visible && !animating;
  38437. var style = hidden ? _objectSpread2({
  38438. display: "none"
  38439. }, htmlStyle) : htmlStyle;
  38440. var onTransitionEndRef = useLiveRef(htmlOnTransitionEnd);
  38441. var onAnimationEndRef = useLiveRef(htmlOnAnimationEnd);
  38442. var raf = (0,external_React_.useRef)(0);
  38443. (0,external_React_.useEffect)(function () {
  38444. if (!options.animated) return undefined; // Double RAF is needed so the browser has enough time to paint the
  38445. // default styles before processing the `data-enter` attribute. Otherwise
  38446. // it wouldn't be considered a transition.
  38447. // See https://github.com/reakit/reakit/issues/643
  38448. raf.current = window.requestAnimationFrame(function () {
  38449. raf.current = window.requestAnimationFrame(function () {
  38450. if (options.visible) {
  38451. setTransition("enter");
  38452. } else if (animating) {
  38453. setTransition("leave");
  38454. } else {
  38455. setTransition(null);
  38456. }
  38457. });
  38458. });
  38459. return function () {
  38460. return window.cancelAnimationFrame(raf.current);
  38461. };
  38462. }, [options.animated, options.visible, animating]);
  38463. var onEnd = (0,external_React_.useCallback)(function (event) {
  38464. if (!isSelfTarget(event)) return;
  38465. if (!animating) return; // Ignores number animated
  38466. if (options.animated === true) {
  38467. var _options$stopAnimatio;
  38468. (_options$stopAnimatio = options.stopAnimation) === null || _options$stopAnimatio === void 0 ? void 0 : _options$stopAnimatio.call(options);
  38469. }
  38470. }, [options.animated, animating, options.stopAnimation]);
  38471. var onTransitionEnd = (0,external_React_.useCallback)(function (event) {
  38472. var _onTransitionEndRef$c;
  38473. (_onTransitionEndRef$c = onTransitionEndRef.current) === null || _onTransitionEndRef$c === void 0 ? void 0 : _onTransitionEndRef$c.call(onTransitionEndRef, event);
  38474. onEnd(event);
  38475. }, [onEnd]);
  38476. var onAnimationEnd = (0,external_React_.useCallback)(function (event) {
  38477. var _onAnimationEndRef$cu;
  38478. (_onAnimationEndRef$cu = onAnimationEndRef.current) === null || _onAnimationEndRef$cu === void 0 ? void 0 : _onAnimationEndRef$cu.call(onAnimationEndRef, event);
  38479. onEnd(event);
  38480. }, [onEnd]);
  38481. return _objectSpread2({
  38482. id: options.baseId,
  38483. "data-enter": transition === "enter" ? "" : undefined,
  38484. "data-leave": transition === "leave" ? "" : undefined,
  38485. onTransitionEnd: onTransitionEnd,
  38486. onAnimationEnd: onAnimationEnd,
  38487. hidden: hidden,
  38488. style: style
  38489. }, htmlProps);
  38490. }
  38491. });
  38492. var DisclosureContent = createComponent({
  38493. as: "div",
  38494. useHook: useDisclosureContent
  38495. });
  38496. ;// CONCATENATED MODULE: external "ReactDOM"
  38497. var external_ReactDOM_namespaceObject = window["ReactDOM"];
  38498. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Portal/Portal.js
  38499. function getBodyElement() {
  38500. return canUseDOM ? document.body : null;
  38501. }
  38502. var PortalContext = /*#__PURE__*/(0,external_React_.createContext)(getBodyElement());
  38503. function Portal(_ref) {
  38504. var children = _ref.children;
  38505. // if it's a nested portal, context is the parent portal
  38506. // otherwise it's document.body
  38507. // https://github.com/reakit/reakit/issues/513
  38508. var context = (0,external_React_.useContext)(PortalContext) || getBodyElement();
  38509. var _React$useState = (0,external_React_.useState)(function () {
  38510. if (canUseDOM) {
  38511. var element = document.createElement("div");
  38512. element.className = Portal.__className;
  38513. return element;
  38514. } // ssr
  38515. return null;
  38516. }),
  38517. hostNode = _React$useState[0];
  38518. useIsomorphicEffect(function () {
  38519. if (!hostNode || !context) return undefined;
  38520. context.appendChild(hostNode);
  38521. return function () {
  38522. context.removeChild(hostNode);
  38523. };
  38524. }, [hostNode, context]);
  38525. if (hostNode) {
  38526. return /*#__PURE__*/(0,external_ReactDOM_namespaceObject.createPortal)( /*#__PURE__*/(0,external_React_.createElement)(PortalContext.Provider, {
  38527. value: hostNode
  38528. }, children), hostNode);
  38529. } // ssr
  38530. return null;
  38531. }
  38532. Portal.__className = "__reakit-portal";
  38533. Portal.__selector = "." + Portal.__className;
  38534. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Tooltip/Tooltip.js
  38535. function globallyHideTooltipOnEscape(event) {
  38536. if (event.defaultPrevented) return;
  38537. if (event.key === "Escape") {
  38538. globalState.show(null);
  38539. }
  38540. }
  38541. var useTooltip = createHook({
  38542. name: "Tooltip",
  38543. compose: useDisclosureContent,
  38544. keys: TOOLTIP_KEYS,
  38545. useOptions: function useOptions(_ref) {
  38546. var _ref$unstable_portal = _ref.unstable_portal,
  38547. unstable_portal = _ref$unstable_portal === void 0 ? true : _ref$unstable_portal,
  38548. options = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["unstable_portal"]);
  38549. return _objectSpread2({
  38550. unstable_portal: unstable_portal
  38551. }, options);
  38552. },
  38553. useProps: function useProps(options, _ref2) {
  38554. var htmlRef = _ref2.ref,
  38555. htmlStyle = _ref2.style,
  38556. htmlWrapElement = _ref2.wrapElement,
  38557. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref2, ["ref", "style", "wrapElement"]);
  38558. (0,external_React_.useEffect)(function () {
  38559. var _options$unstable_pop;
  38560. var document = getDocument((_options$unstable_pop = options.unstable_popoverRef) === null || _options$unstable_pop === void 0 ? void 0 : _options$unstable_pop.current);
  38561. document.addEventListener("keydown", globallyHideTooltipOnEscape);
  38562. }, []);
  38563. var wrapElement = (0,external_React_.useCallback)(function (element) {
  38564. if (options.unstable_portal) {
  38565. element = /*#__PURE__*/(0,external_React_.createElement)(Portal, null, element);
  38566. }
  38567. if (htmlWrapElement) {
  38568. return htmlWrapElement(element);
  38569. }
  38570. return element;
  38571. }, [options.unstable_portal, htmlWrapElement]);
  38572. return _objectSpread2({
  38573. ref: useForkRef(options.unstable_popoverRef, htmlRef),
  38574. role: "tooltip",
  38575. style: _objectSpread2(_objectSpread2({}, options.unstable_popoverStyles), {}, {
  38576. pointerEvents: "none"
  38577. }, htmlStyle),
  38578. wrapElement: wrapElement
  38579. }, htmlProps);
  38580. }
  38581. });
  38582. var Tooltip_Tooltip = createComponent({
  38583. as: "div",
  38584. memo: true,
  38585. useHook: useTooltip
  38586. });
  38587. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/shortcut/component.js
  38588. /**
  38589. * External dependencies
  38590. */
  38591. /**
  38592. * Internal dependencies
  38593. */
  38594. function component_Shortcut(props, forwardedRef) {
  38595. const {
  38596. as: asProp = 'span',
  38597. shortcut,
  38598. className,
  38599. ...otherProps
  38600. } = useContextSystem(props, 'Shortcut');
  38601. if (!shortcut) {
  38602. return null;
  38603. }
  38604. let displayText;
  38605. let ariaLabel;
  38606. if (typeof shortcut === 'string') {
  38607. displayText = shortcut;
  38608. } else {
  38609. displayText = shortcut.display;
  38610. ariaLabel = shortcut.ariaLabel;
  38611. }
  38612. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  38613. as: asProp,
  38614. className: className,
  38615. "aria-label": ariaLabel,
  38616. ref: forwardedRef
  38617. }, otherProps), displayText);
  38618. }
  38619. const ConnectedShortcut = contextConnect(component_Shortcut, 'Shortcut');
  38620. /* harmony default export */ var shortcut_component = (ConnectedShortcut);
  38621. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/z-index.js
  38622. const Flyout = 10000;
  38623. const z_index_Tooltip = 1000002;
  38624. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/tooltip/styles.js
  38625. function tooltip_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  38626. /**
  38627. * External dependencies
  38628. */
  38629. /**
  38630. * Internal dependencies
  38631. */
  38632. const TooltipContent = /*#__PURE__*/emotion_react_browser_esm_css("z-index:", z_index_Tooltip, ";box-sizing:border-box;opacity:0;outline:none;transform-origin:top center;transition:opacity ", config_values.transitionDurationFastest, " ease;&[data-enter]{opacity:1;}" + ( true ? "" : 0), true ? "" : 0);
  38633. const TooltipPopoverView = emotion_styled_base_browser_esm("div", true ? {
  38634. target: "e7tfjmw1"
  38635. } : 0)("background:rgba( 0, 0, 0, 0.8 );border-radius:2px;box-shadow:0 0 0 1px rgba( 255, 255, 255, 0.04 );color:", COLORS.white, ";padding:4px 8px;" + ( true ? "" : 0));
  38636. const noOutline = true ? {
  38637. name: "12mkfdx",
  38638. styles: "outline:none"
  38639. } : 0;
  38640. const TooltipShortcut = /*#__PURE__*/emotion_styled_base_browser_esm(shortcut_component, true ? {
  38641. target: "e7tfjmw0"
  38642. } : 0)("display:inline-block;margin-left:", space(1), ";" + ( true ? "" : 0));
  38643. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/tooltip/content.js
  38644. /**
  38645. * External dependencies
  38646. */
  38647. // eslint-disable-next-line no-restricted-imports
  38648. /**
  38649. * Internal dependencies
  38650. */
  38651. const {
  38652. TooltipPopoverView: content_TooltipPopoverView
  38653. } = tooltip_styles_namespaceObject;
  38654. /**
  38655. *
  38656. * @param {import('../context').WordPressComponentProps<import('./types').ContentProps, 'div'>} props
  38657. * @param {import('react').ForwardedRef<any>} forwardedRef
  38658. */
  38659. function content_TooltipContent(props, forwardedRef) {
  38660. const {
  38661. children,
  38662. className,
  38663. ...otherProps
  38664. } = useContextSystem(props, 'TooltipContent');
  38665. const {
  38666. tooltip
  38667. } = useTooltipContext();
  38668. const cx = useCx();
  38669. const classes = cx(TooltipContent, className);
  38670. return (0,external_wp_element_namespaceObject.createElement)(Tooltip_Tooltip, extends_extends({
  38671. as: component
  38672. }, otherProps, tooltip, {
  38673. className: classes,
  38674. ref: forwardedRef
  38675. }), (0,external_wp_element_namespaceObject.createElement)(content_TooltipPopoverView, null, children));
  38676. }
  38677. /* harmony default export */ var tooltip_content = (contextConnect(content_TooltipContent, 'TooltipContent'));
  38678. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/tooltip/component.js
  38679. /**
  38680. * External dependencies
  38681. */
  38682. // eslint-disable-next-line no-restricted-imports
  38683. /**
  38684. * WordPress dependencies
  38685. */
  38686. /**
  38687. * Internal dependencies
  38688. */
  38689. /**
  38690. * @param {import('../context').WordPressComponentProps<import('./types').Props, 'div'>} props
  38691. * @param {import('react').ForwardedRef<any>} forwardedRef
  38692. */
  38693. function component_Tooltip(props, forwardedRef) {
  38694. const {
  38695. animated = true,
  38696. animationDuration = 160,
  38697. baseId,
  38698. children,
  38699. content,
  38700. focusable = true,
  38701. gutter = 4,
  38702. id,
  38703. modal = true,
  38704. placement,
  38705. visible = false,
  38706. shortcut,
  38707. ...otherProps
  38708. } = useContextSystem(props, 'Tooltip');
  38709. const tooltip = useTooltipState({
  38710. animated: animated ? animationDuration : undefined,
  38711. baseId: baseId || id,
  38712. gutter,
  38713. placement,
  38714. visible,
  38715. ...otherProps
  38716. });
  38717. const contextProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  38718. tooltip
  38719. }), [tooltip]);
  38720. return (0,external_wp_element_namespaceObject.createElement)(TooltipContext.Provider, {
  38721. value: contextProps
  38722. }, content && (0,external_wp_element_namespaceObject.createElement)(tooltip_content, {
  38723. unstable_portal: modal,
  38724. ref: forwardedRef
  38725. }, content, shortcut && (0,external_wp_element_namespaceObject.createElement)(TooltipShortcut, {
  38726. shortcut: shortcut
  38727. })), children && (0,external_wp_element_namespaceObject.createElement)(TooltipReference, extends_extends({}, tooltip, children.props, {
  38728. // @ts-ignore If ref doesn't exist that's fine with us, it'll just be undefined, but it can exist on ReactElement and there's no reason to try to scope this (it'll just overcomplicate things)
  38729. ref: children === null || children === void 0 ? void 0 : children.ref
  38730. }), referenceProps => {
  38731. if (!focusable) {
  38732. referenceProps.tabIndex = undefined;
  38733. }
  38734. return (0,external_wp_element_namespaceObject.cloneElement)(children, referenceProps);
  38735. }));
  38736. }
  38737. /**
  38738. * `Tooltip` is a component that provides context for a user interface element.
  38739. *
  38740. * @example
  38741. * ```jsx
  38742. * import { Tooltip, Text } from `@wordpress/components/ui`;
  38743. *
  38744. * function Example() {
  38745. * return (
  38746. * <Tooltip content="Code is Poetry">
  38747. * <Text>WordPress.org</Text>
  38748. * </Tooltip>
  38749. * )
  38750. * }
  38751. * ```
  38752. */
  38753. const ConnectedTooltip = contextConnect(component_Tooltip, 'Tooltip');
  38754. /* harmony default export */ var tooltip_component = (ConnectedTooltip);
  38755. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/color-display.js
  38756. /**
  38757. * External dependencies
  38758. */
  38759. /**
  38760. * WordPress dependencies
  38761. */
  38762. /**
  38763. * Internal dependencies
  38764. */
  38765. const ValueDisplay = _ref => {
  38766. let {
  38767. values
  38768. } = _ref;
  38769. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, values.map(_ref2 => {
  38770. let [value, abbreviation] = _ref2;
  38771. return (0,external_wp_element_namespaceObject.createElement)(flex_item_component, {
  38772. key: abbreviation,
  38773. isBlock: true,
  38774. display: "flex"
  38775. }, (0,external_wp_element_namespaceObject.createElement)(text_component, {
  38776. color: COLORS.ui.theme
  38777. }, abbreviation), (0,external_wp_element_namespaceObject.createElement)(text_component, null, value));
  38778. }));
  38779. };
  38780. const HslDisplay = _ref3 => {
  38781. let {
  38782. color,
  38783. enableAlpha
  38784. } = _ref3;
  38785. const {
  38786. h,
  38787. s,
  38788. l,
  38789. a
  38790. } = color.toHsl();
  38791. const values = [[Math.floor(h), 'H'], [Math.round(s * 100), 'S'], [Math.round(l * 100), 'L']];
  38792. if (enableAlpha) {
  38793. values.push([Math.round(a * 100), 'A']);
  38794. }
  38795. return (0,external_wp_element_namespaceObject.createElement)(ValueDisplay, {
  38796. values: values
  38797. });
  38798. };
  38799. const RgbDisplay = _ref4 => {
  38800. let {
  38801. color,
  38802. enableAlpha
  38803. } = _ref4;
  38804. const {
  38805. r,
  38806. g,
  38807. b,
  38808. a
  38809. } = color.toRgb();
  38810. const values = [[r, 'R'], [g, 'G'], [b, 'B']];
  38811. if (enableAlpha) {
  38812. values.push([Math.round(a * 100), 'A']);
  38813. }
  38814. return (0,external_wp_element_namespaceObject.createElement)(ValueDisplay, {
  38815. values: values
  38816. });
  38817. };
  38818. const HexDisplay = _ref5 => {
  38819. let {
  38820. color
  38821. } = _ref5;
  38822. const colorWithoutHash = color.toHex().slice(1).toUpperCase();
  38823. return (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(text_component, {
  38824. color: COLORS.ui.theme
  38825. }, "#"), (0,external_wp_element_namespaceObject.createElement)(text_component, null, colorWithoutHash));
  38826. };
  38827. const getComponent = colorType => {
  38828. switch (colorType) {
  38829. case 'hsl':
  38830. return HslDisplay;
  38831. case 'rgb':
  38832. return RgbDisplay;
  38833. default:
  38834. case 'hex':
  38835. return HexDisplay;
  38836. }
  38837. };
  38838. const ColorDisplay = _ref6 => {
  38839. let {
  38840. color,
  38841. colorType,
  38842. enableAlpha
  38843. } = _ref6;
  38844. const [copiedColor, setCopiedColor] = (0,external_wp_element_namespaceObject.useState)(null);
  38845. const copyTimer = (0,external_wp_element_namespaceObject.useRef)();
  38846. const props = {
  38847. color,
  38848. enableAlpha
  38849. };
  38850. const Component = getComponent(colorType);
  38851. const copyRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(() => {
  38852. switch (colorType) {
  38853. case 'hsl':
  38854. {
  38855. return color.toHslString();
  38856. }
  38857. case 'rgb':
  38858. {
  38859. return color.toRgbString();
  38860. }
  38861. default:
  38862. case 'hex':
  38863. {
  38864. return color.toHex();
  38865. }
  38866. }
  38867. }, () => {
  38868. if (copyTimer.current) {
  38869. clearTimeout(copyTimer.current);
  38870. }
  38871. setCopiedColor(color.toHex());
  38872. copyTimer.current = setTimeout(() => {
  38873. setCopiedColor(null);
  38874. copyTimer.current = undefined;
  38875. }, 3000);
  38876. });
  38877. (0,external_wp_element_namespaceObject.useEffect)(() => {
  38878. // Clear copyTimer on component unmount.
  38879. return () => {
  38880. if (copyTimer.current) {
  38881. clearTimeout(copyTimer.current);
  38882. }
  38883. };
  38884. }, []);
  38885. return (0,external_wp_element_namespaceObject.createElement)(tooltip_component, {
  38886. content: (0,external_wp_element_namespaceObject.createElement)(text_component, {
  38887. color: "white"
  38888. }, copiedColor === color.toHex() ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy'))
  38889. }, (0,external_wp_element_namespaceObject.createElement)(flex_component, {
  38890. justify: "flex-start",
  38891. gap: space(1),
  38892. ref: copyRef,
  38893. style: {
  38894. height: 30
  38895. }
  38896. }, (0,external_wp_element_namespaceObject.createElement)(Component, props)));
  38897. };
  38898. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/input-with-slider.js
  38899. /**
  38900. * Internal dependencies
  38901. */
  38902. const InputWithSlider = _ref => {
  38903. let {
  38904. min,
  38905. max,
  38906. label,
  38907. abbreviation,
  38908. onChange,
  38909. value
  38910. } = _ref;
  38911. return (0,external_wp_element_namespaceObject.createElement)(spacer_component, {
  38912. as: h_stack_component,
  38913. spacing: 4
  38914. }, (0,external_wp_element_namespaceObject.createElement)(NumberControlWrapper, {
  38915. min: min,
  38916. max: max,
  38917. label: label,
  38918. hideLabelFromVision: true,
  38919. value: value,
  38920. onChange: onChange,
  38921. prefix: (0,external_wp_element_namespaceObject.createElement)(spacer_component, {
  38922. as: text_component,
  38923. paddingLeft: space(3.5),
  38924. color: COLORS.ui.theme,
  38925. lineHeight: 1
  38926. }, abbreviation),
  38927. hideHTMLArrows: true
  38928. }), (0,external_wp_element_namespaceObject.createElement)(styles_RangeControl, {
  38929. label: label,
  38930. hideLabelFromVision: true,
  38931. min: min,
  38932. max: max,
  38933. value: value,
  38934. onChange: onChange,
  38935. withInputField: false
  38936. }));
  38937. };
  38938. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/rgb-input.js
  38939. /**
  38940. * External dependencies
  38941. */
  38942. /**
  38943. * Internal dependencies
  38944. */
  38945. const RgbInput = _ref => {
  38946. let {
  38947. color,
  38948. onChange,
  38949. enableAlpha
  38950. } = _ref;
  38951. const {
  38952. r,
  38953. g,
  38954. b,
  38955. a
  38956. } = color.toRgb();
  38957. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  38958. min: 0,
  38959. max: 255,
  38960. label: "Red",
  38961. abbreviation: "R",
  38962. value: r,
  38963. onChange: nextR => onChange(w({
  38964. r: nextR,
  38965. g,
  38966. b,
  38967. a
  38968. }))
  38969. }), (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  38970. min: 0,
  38971. max: 255,
  38972. label: "Green",
  38973. abbreviation: "G",
  38974. value: g,
  38975. onChange: nextG => onChange(w({
  38976. r,
  38977. g: nextG,
  38978. b,
  38979. a
  38980. }))
  38981. }), (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  38982. min: 0,
  38983. max: 255,
  38984. label: "Blue",
  38985. abbreviation: "B",
  38986. value: b,
  38987. onChange: nextB => onChange(w({
  38988. r,
  38989. g,
  38990. b: nextB,
  38991. a
  38992. }))
  38993. }), enableAlpha && (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  38994. min: 0,
  38995. max: 100,
  38996. label: "Alpha",
  38997. abbreviation: "A",
  38998. value: Math.trunc(a * 100),
  38999. onChange: nextA => onChange(w({
  39000. r,
  39001. g,
  39002. b,
  39003. a: nextA / 100
  39004. }))
  39005. }));
  39006. };
  39007. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/hsl-input.js
  39008. /**
  39009. * External dependencies
  39010. */
  39011. /**
  39012. * Internal dependencies
  39013. */
  39014. const HslInput = _ref => {
  39015. let {
  39016. color,
  39017. onChange,
  39018. enableAlpha
  39019. } = _ref;
  39020. const {
  39021. h,
  39022. s,
  39023. l,
  39024. a
  39025. } = color.toHsl();
  39026. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  39027. min: 0,
  39028. max: 359,
  39029. label: "Hue",
  39030. abbreviation: "H",
  39031. value: h,
  39032. onChange: nextH => {
  39033. onChange(w({
  39034. h: nextH,
  39035. s,
  39036. l,
  39037. a
  39038. }));
  39039. }
  39040. }), (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  39041. min: 0,
  39042. max: 100,
  39043. label: "Saturation",
  39044. abbreviation: "S",
  39045. value: s,
  39046. onChange: nextS => {
  39047. onChange(w({
  39048. h,
  39049. s: nextS,
  39050. l,
  39051. a
  39052. }));
  39053. }
  39054. }), (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  39055. min: 0,
  39056. max: 100,
  39057. label: "Lightness",
  39058. abbreviation: "L",
  39059. value: l,
  39060. onChange: nextL => {
  39061. onChange(w({
  39062. h,
  39063. s,
  39064. l: nextL,
  39065. a
  39066. }));
  39067. }
  39068. }), enableAlpha && (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  39069. min: 0,
  39070. max: 100,
  39071. label: "Alpha",
  39072. abbreviation: "A",
  39073. value: Math.trunc(100 * a),
  39074. onChange: nextA => {
  39075. onChange(w({
  39076. h,
  39077. s,
  39078. l,
  39079. a: nextA / 100
  39080. }));
  39081. }
  39082. }));
  39083. };
  39084. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/hex-input.js
  39085. /**
  39086. * External dependencies
  39087. */
  39088. /**
  39089. * WordPress dependencies
  39090. */
  39091. /**
  39092. * Internal dependencies
  39093. */
  39094. const HexInput = _ref => {
  39095. let {
  39096. color,
  39097. onChange,
  39098. enableAlpha
  39099. } = _ref;
  39100. const handleChange = nextValue => {
  39101. if (!nextValue) return;
  39102. const hexValue = nextValue.startsWith('#') ? nextValue : '#' + nextValue;
  39103. onChange(w(hexValue));
  39104. };
  39105. return (0,external_wp_element_namespaceObject.createElement)(ColorHexInputControl, {
  39106. prefix: (0,external_wp_element_namespaceObject.createElement)(spacer_component, {
  39107. as: text_component,
  39108. marginLeft: space(3.5),
  39109. color: COLORS.ui.theme,
  39110. lineHeight: 1
  39111. }, "#"),
  39112. value: color.toHex().slice(1).toUpperCase(),
  39113. onChange: handleChange,
  39114. maxLength: enableAlpha ? 9 : 7,
  39115. label: (0,external_wp_i18n_namespaceObject.__)('Hex color'),
  39116. hideLabelFromVision: true
  39117. });
  39118. };
  39119. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/color-input.js
  39120. /**
  39121. * External dependencies
  39122. */
  39123. /**
  39124. * Internal dependencies
  39125. */
  39126. const ColorInput = _ref => {
  39127. let {
  39128. colorType,
  39129. color,
  39130. onChange,
  39131. enableAlpha
  39132. } = _ref;
  39133. const props = {
  39134. color,
  39135. onChange,
  39136. enableAlpha
  39137. };
  39138. switch (colorType) {
  39139. case 'hsl':
  39140. return (0,external_wp_element_namespaceObject.createElement)(HslInput, props);
  39141. case 'rgb':
  39142. return (0,external_wp_element_namespaceObject.createElement)(RgbInput, props);
  39143. default:
  39144. case 'hex':
  39145. return (0,external_wp_element_namespaceObject.createElement)(HexInput, props);
  39146. }
  39147. };
  39148. ;// CONCATENATED MODULE: ./node_modules/react-colorful/dist/index.module.js
  39149. function index_module_u(){return(index_module_u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function index_module_c(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(o[t]=e[t]);return o}function index_module_i(e){var t=(0,external_React_.useRef)(e),n=(0,external_React_.useRef)(function(e){t.current&&t.current(e)});return t.current=e,n.current}var index_module_s=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=1),e>t?t:e<r?r:e},index_module_f=function(e){return"touches"in e},index_module_v=function(e){return e&&e.ownerDocument.defaultView||self},index_module_d=function(e,r,t){var n=e.getBoundingClientRect(),o=index_module_f(r)?function(e,r){for(var t=0;t<e.length;t++)if(e[t].identifier===r)return e[t];return e[0]}(r.touches,t):r;return{left:index_module_s((o.pageX-(n.left+index_module_v(e).pageXOffset))/n.width),top:index_module_s((o.pageY-(n.top+index_module_v(e).pageYOffset))/n.height)}},index_module_h=function(e){!index_module_f(e)&&e.preventDefault()},index_module_m=external_React_default().memo(function(o){var a=o.onMove,l=o.onKey,s=index_module_c(o,["onMove","onKey"]),m=(0,external_React_.useRef)(null),g=index_module_i(a),p=index_module_i(l),b=(0,external_React_.useRef)(null),_=(0,external_React_.useRef)(!1),x=(0,external_React_.useMemo)(function(){var e=function(e){index_module_h(e),(index_module_f(e)?e.touches.length>0:e.buttons>0)&&m.current?g(index_module_d(m.current,e,b.current)):t(!1)},r=function(){return t(!1)};function t(t){var n=_.current,o=index_module_v(m.current),a=t?o.addEventListener:o.removeEventListener;a(n?"touchmove":"mousemove",e),a(n?"touchend":"mouseup",r)}return[function(e){var r=e.nativeEvent,n=m.current;if(n&&(index_module_h(r),!function(e,r){return r&&!index_module_f(e)}(r,_.current)&&n)){if(index_module_f(r)){_.current=!0;var o=r.changedTouches||[];o.length&&(b.current=o[0].identifier)}n.focus(),g(index_module_d(n,r,b.current)),t(!0)}},function(e){var r=e.which||e.keyCode;r<37||r>40||(e.preventDefault(),p({left:39===r?.05:37===r?-.05:0,top:40===r?.05:38===r?-.05:0}))},t]},[p,g]),C=x[0],E=x[1],H=x[2];return (0,external_React_.useEffect)(function(){return H},[H]),external_React_default().createElement("div",index_module_u({},s,{onTouchStart:C,onMouseDown:C,className:"react-colorful__interactive",ref:m,onKeyDown:E,tabIndex:0,role:"slider"}))}),index_module_g=function(e){return e.filter(Boolean).join(" ")},index_module_p=function(r){var t=r.color,n=r.left,o=r.top,a=void 0===o?.5:o,l=index_module_g(["react-colorful__pointer",r.className]);return external_React_default().createElement("div",{className:l,style:{top:100*a+"%",left:100*n+"%"}},external_React_default().createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},index_module_b=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=Math.pow(10,r)),Math.round(t*e)/t},_={grad:.9,turn:360,rad:360/(2*Math.PI)},index_module_x=function(e){return"#"===e[0]&&(e=e.substr(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:1}:{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:1}},C=function(e,r){return void 0===r&&(r="deg"),Number(e)*(_[r]||1)},index_module_E=function(e){var r=/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?index_module_M({h:C(r[1],r[2]),s:Number(r[3]),l:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?100:1)}):{h:0,s:0,v:0,a:1}},index_module_H=index_module_E,index_module_M=function(e){var r=e.s,t=e.l;return{h:e.h,s:(r*=(t<50?t:100-t)/100)>0?2*r/(t+r)*100:0,v:t+r,a:e.a}},index_module_N=function(e){var r=e.s,t=e.v,n=e.a,o=(200-r)*t/100;return{h:index_module_b(e.h),s:index_module_b(o>0&&o<200?r*t/100/(o<=100?o:200-o)*100:0),l:index_module_b(o/2),a:index_module_b(n,2)}},index_module_w=function(e){var r=index_module_N(e);return"hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},index_module_y=function(e){var r=index_module_N(e);return"hsla("+r.h+", "+r.s+"%, "+r.l+"%, "+r.a+")"},q=function(e){var r=e.h,t=e.s,n=e.v,o=e.a;r=r/360*6,t/=100,n/=100;var a=Math.floor(r),l=n*(1-t),u=n*(1-(r-a)*t),c=n*(1-(1-r+a)*t),i=a%6;return{r:index_module_b(255*[n,u,l,l,c,n][i]),g:index_module_b(255*[c,n,n,u,l,l][i]),b:index_module_b(255*[l,l,c,n,n,u][i]),a:index_module_b(o,2)}},index_module_k=function(e){var r=/hsva?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?D({h:C(r[1],r[2]),s:Number(r[3]),v:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?100:1)}):{h:0,s:0,v:0,a:1}},O=index_module_k,index_module_I=function(e){var r=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?B({r:Number(r[1])/(r[2]?100/255:1),g:Number(r[3])/(r[4]?100/255:1),b:Number(r[5])/(r[6]?100/255:1),a:void 0===r[7]?1:Number(r[7])/(r[8]?100:1)}):{h:0,s:0,v:0,a:1}},index_module_j=index_module_I,z=function(e){var r=e.toString(16);return r.length<2?"0"+r:r},B=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=Math.max(r,t,n),l=a-Math.min(r,t,n),u=l?a===r?(t-n)/l:a===t?2+(n-r)/l:4+(r-t)/l:0;return{h:index_module_b(60*(u<0?u+6:u)),s:index_module_b(a?l/a*100:0),v:index_module_b(a/255*100),a:o}},D=function(e){return{h:index_module_b(e.h),s:index_module_b(e.s),v:index_module_b(e.v),a:index_module_b(e.a,2)}},K=external_React_default().memo(function(r){var t=r.hue,n=r.onChange,o=index_module_g(["react-colorful__hue",r.className]);return external_React_default().createElement("div",{className:o},external_React_default().createElement(index_module_m,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:index_module_s(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuetext":index_module_b(t)},external_React_default().createElement(index_module_p,{className:"react-colorful__hue-pointer",left:t/360,color:index_module_w({h:t,s:100,v:100,a:1})})))}),L=external_React_default().memo(function(r){var t=r.hsva,n=r.onChange,o={backgroundColor:index_module_w({h:t.h,s:100,v:100,a:1})};return external_React_default().createElement("div",{className:"react-colorful__saturation",style:o},external_React_default().createElement(index_module_m,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:index_module_s(t.s+100*e.left,0,100),v:index_module_s(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+index_module_b(t.s)+"%, Brightness "+index_module_b(t.v)+"%"},external_React_default().createElement(index_module_p,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:index_module_w(t)})))}),A=function(e,r){if(e===r)return!0;for(var t in e)if(e[t]!==r[t])return!1;return!0},index_module_S=function(e,r){return e.replace(/\s/g,"")===r.replace(/\s/g,"")};function T(e,t,l){var u=index_module_i(l),c=(0,external_React_.useState)(function(){return e.toHsva(t)}),s=c[0],f=c[1],v=(0,external_React_.useRef)({color:t,hsva:s});(0,external_React_.useEffect)(function(){if(!e.equal(t,v.current.color)){var r=e.toHsva(t);v.current={hsva:r,color:t},f(r)}},[t,e]),(0,external_React_.useEffect)(function(){var r;A(s,v.current.hsva)||e.equal(r=e.fromHsva(s),v.current.color)||(v.current={hsva:s,color:r},u(r))},[s,e,u]);var d=(0,external_React_.useCallback)(function(e){f(function(r){return Object.assign({},r,e)})},[]);return[s,d]}var F,P="undefined"!=typeof window?external_React_.useLayoutEffect:external_React_.useEffect,X=function(){return F||( true?__webpack_require__.nc:0)},Y=function(e){F=e},R=new Map,index_module_V=function(e){P(function(){var r=e.current?e.current.ownerDocument:document;if(void 0!==r&&!R.has(r)){var t=r.createElement("style");t.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',R.set(r,t);var n=X();n&&t.setAttribute("nonce",n),r.head.appendChild(t)}},[])},index_module_$=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=index_module_c(t,["className","colorModel","color","onChange"]),f=(0,external_React_.useRef)(null);index_module_V(f);var v=T(o,l,i),d=v[0],h=v[1],m=index_module_g(["react-colorful",n]);return external_React_default().createElement("div",index_module_u({},s,{ref:f,className:m}),external_React_default().createElement(L,{hsva:d,onChange:h}),external_React_default().createElement(K,{hue:d.h,onChange:h,className:"react-colorful__last-control"}))},G={defaultColor:"000",toHsva:function(e){return B(index_module_x(e))},fromHsva:function(e){return t=(r=q(e)).g,n=r.b,"#"+z(r.r)+z(t)+z(n);var r,t,n},equal:function(e,r){return e.toLowerCase()===r.toLowerCase()||A(index_module_x(e),index_module_x(r))}},J=function(r){return e.createElement(index_module_$,index_module_u({},r,{colorModel:G}))},Q=function(r){var t=r.className,n=r.hsva,o=r.onChange,a={backgroundImage:"linear-gradient(90deg, "+index_module_y(Object.assign({},n,{a:0}))+", "+index_module_y(Object.assign({},n,{a:1}))+")"},l=index_module_g(["react-colorful__alpha",t]);return external_React_default().createElement("div",{className:l},external_React_default().createElement("div",{className:"react-colorful__alpha-gradient",style:a}),external_React_default().createElement(index_module_m,{onMove:function(e){o({a:e.left})},onKey:function(e){o({a:index_module_s(n.a+e.left)})},"aria-label":"Alpha","aria-valuetext":index_module_b(100*n.a)+"%"},external_React_default().createElement(index_module_p,{className:"react-colorful__alpha-pointer",left:n.a,color:index_module_y(n)})))},U=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=index_module_c(t,["className","colorModel","color","onChange"]),f=(0,external_React_.useRef)(null);index_module_V(f);var v=T(o,l,i),d=v[0],h=v[1],m=index_module_g(["react-colorful",n]);return external_React_default().createElement("div",index_module_u({},s,{ref:f,className:m}),external_React_default().createElement(L,{hsva:d,onChange:h}),external_React_default().createElement(K,{hue:d.h,onChange:h}),external_React_default().createElement(Q,{hsva:d,onChange:h,className:"react-colorful__last-control"}))},W={defaultColor:{h:0,s:0,l:0,a:1},toHsva:index_module_M,fromHsva:index_module_N,equal:A},Z=function(r){return e.createElement(U,index_module_u({},r,{colorModel:W}))},ee={defaultColor:"hsla(0, 0%, 0%, 1)",toHsva:index_module_E,fromHsva:index_module_y,equal:index_module_S},re=function(r){return e.createElement(U,index_module_u({},r,{colorModel:ee}))},te={defaultColor:{h:0,s:0,l:0},toHsva:function(e){return index_module_M({h:e.h,s:e.s,l:e.l,a:1})},fromHsva:function(e){return{h:(r=index_module_N(e)).h,s:r.s,l:r.l};var r},equal:A},ne=function(r){return e.createElement(index_module_$,index_module_u({},r,{colorModel:te}))},oe={defaultColor:"hsl(0, 0%, 0%)",toHsva:index_module_H,fromHsva:index_module_w,equal:index_module_S},ae=function(r){return e.createElement(index_module_$,index_module_u({},r,{colorModel:oe}))},le={defaultColor:{h:0,s:0,v:0,a:1},toHsva:function(e){return e},fromHsva:D,equal:A},ue=function(r){return e.createElement(U,index_module_u({},r,{colorModel:le}))},ce={defaultColor:"hsva(0, 0%, 0%, 1)",toHsva:index_module_k,fromHsva:function(e){var r=D(e);return"hsva("+r.h+", "+r.s+"%, "+r.v+"%, "+r.a+")"},equal:index_module_S},ie=function(r){return e.createElement(U,index_module_u({},r,{colorModel:ce}))},se={defaultColor:{h:0,s:0,v:0},toHsva:function(e){return{h:e.h,s:e.s,v:e.v,a:1}},fromHsva:function(e){var r=D(e);return{h:r.h,s:r.s,v:r.v}},equal:A},fe=function(r){return e.createElement(index_module_$,index_module_u({},r,{colorModel:se}))},ve={defaultColor:"hsv(0, 0%, 0%)",toHsva:O,fromHsva:function(e){var r=D(e);return"hsv("+r.h+", "+r.s+"%, "+r.v+"%)"},equal:index_module_S},de=function(r){return e.createElement(index_module_$,index_module_u({},r,{colorModel:ve}))},he={defaultColor:{r:0,g:0,b:0,a:1},toHsva:B,fromHsva:q,equal:A},me=function(r){return e.createElement(U,index_module_u({},r,{colorModel:he}))},ge={defaultColor:"rgba(0, 0, 0, 1)",toHsva:index_module_I,fromHsva:function(e){var r=q(e);return"rgba("+r.r+", "+r.g+", "+r.b+", "+r.a+")"},equal:index_module_S},pe=function(r){return external_React_default().createElement(U,index_module_u({},r,{colorModel:ge}))},be={defaultColor:{r:0,g:0,b:0},toHsva:function(e){return B({r:e.r,g:e.g,b:e.b,a:1})},fromHsva:function(e){return{r:(r=q(e)).r,g:r.g,b:r.b};var r},equal:A},_e=function(r){return e.createElement(index_module_$,index_module_u({},r,{colorModel:be}))},xe={defaultColor:"rgb(0, 0, 0)",toHsva:index_module_j,fromHsva:function(e){var r=q(e);return"rgb("+r.r+", "+r.g+", "+r.b+")"},equal:index_module_S},Ce=function(r){return external_React_default().createElement(index_module_$,index_module_u({},r,{colorModel:xe}))},Ee=/^#?([0-9A-F]{3,8})$/i,He=function(r){var t=r.color,l=void 0===t?"":t,s=r.onChange,f=r.onBlur,v=r.escape,d=r.validate,h=r.format,m=r.process,g=index_module_c(r,["color","onChange","onBlur","escape","validate","format","process"]),p=o(function(){return v(l)}),b=p[0],_=p[1],x=index_module_i(s),C=index_module_i(f),E=a(function(e){var r=v(e.target.value);_(r),d(r)&&x(m?m(r):r)},[v,m,d,x]),H=a(function(e){d(e.target.value)||_(v(l)),C(e)},[l,v,d,C]);return n(function(){_(v(l))},[l,v]),e.createElement("input",index_module_u({},g,{value:h?h(b):b,spellCheck:"false",onChange:E,onBlur:H}))},Me=function(e){return"#"+e},Ne=function(r){var t=r.prefixed,n=r.alpha,o=index_module_c(r,["prefixed","alpha"]),l=a(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substr(0,n?8:6)},[n]),i=a(function(e){return function(e,r){var t=Ee.exec(e),n=t?t[1].length:0;return 3===n||6===n||!!r&&4===n||!!r&&8===n}(e,n)},[n]);return e.createElement(He,index_module_u({},o,{escape:l,format:t?Me:void 0,process:Me,validate:i}))};
  39150. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/picker.js
  39151. /**
  39152. * External dependencies
  39153. */
  39154. /**
  39155. * WordPress dependencies
  39156. */
  39157. const Picker = _ref => {
  39158. let {
  39159. color,
  39160. enableAlpha,
  39161. onChange
  39162. } = _ref;
  39163. const Component = enableAlpha ? pe : Ce;
  39164. const rgbColor = (0,external_wp_element_namespaceObject.useMemo)(() => color.toRgbString(), [color]);
  39165. return (0,external_wp_element_namespaceObject.createElement)(Component, {
  39166. color: rgbColor,
  39167. onChange: nextColor => {
  39168. onChange(w(nextColor));
  39169. }
  39170. });
  39171. };
  39172. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-value.js
  39173. /**
  39174. * WordPress dependencies
  39175. */
  39176. /**
  39177. * Simplified and improved implementation of useControlledState.
  39178. *
  39179. * @param props
  39180. * @param props.defaultValue
  39181. * @param props.value
  39182. * @param props.onChange
  39183. * @return The controlled value and the value setter.
  39184. */
  39185. function useControlledValue(_ref) {
  39186. let {
  39187. defaultValue,
  39188. onChange,
  39189. value: valueProp
  39190. } = _ref;
  39191. const hasValue = typeof valueProp !== 'undefined';
  39192. const initialValue = hasValue ? valueProp : defaultValue;
  39193. const [state, setState] = (0,external_wp_element_namespaceObject.useState)(initialValue);
  39194. const value = hasValue ? valueProp : state;
  39195. let setValue;
  39196. if (hasValue && typeof onChange === 'function') {
  39197. setValue = onChange;
  39198. } else if (!hasValue && typeof onChange === 'function') {
  39199. setValue = nextValue => {
  39200. onChange(nextValue);
  39201. setState(nextValue);
  39202. };
  39203. } else {
  39204. setValue = setState;
  39205. }
  39206. return [value, setValue];
  39207. }
  39208. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/component.js
  39209. /**
  39210. * External dependencies
  39211. */
  39212. /**
  39213. * WordPress dependencies
  39214. */
  39215. /**
  39216. * Internal dependencies
  39217. */
  39218. k([names]);
  39219. const options = [{
  39220. label: 'RGB',
  39221. value: 'rgb'
  39222. }, {
  39223. label: 'HSL',
  39224. value: 'hsl'
  39225. }, {
  39226. label: 'Hex',
  39227. value: 'hex'
  39228. }];
  39229. const ColorPicker = (props, forwardedRef) => {
  39230. const {
  39231. enableAlpha = false,
  39232. color: colorProp,
  39233. onChange,
  39234. defaultValue = '#fff',
  39235. copyFormat,
  39236. ...divProps
  39237. } = useContextSystem(props, 'ColorPicker'); // Use a safe default value for the color and remove the possibility of `undefined`.
  39238. const [color, setColor] = useControlledValue({
  39239. onChange,
  39240. value: colorProp,
  39241. defaultValue
  39242. });
  39243. const safeColordColor = (0,external_wp_element_namespaceObject.useMemo)(() => {
  39244. return w(color || '');
  39245. }, [color]);
  39246. const debouncedSetColor = (0,external_wp_compose_namespaceObject.useDebounce)(setColor);
  39247. const handleChange = (0,external_wp_element_namespaceObject.useCallback)(nextValue => {
  39248. debouncedSetColor(nextValue.toHex());
  39249. }, [debouncedSetColor]);
  39250. const [showInputs, setShowInputs] = (0,external_wp_element_namespaceObject.useState)(false);
  39251. const [colorType, setColorType] = (0,external_wp_element_namespaceObject.useState)(copyFormat || 'hex');
  39252. return (0,external_wp_element_namespaceObject.createElement)(ColorfulWrapper, extends_extends({
  39253. ref: forwardedRef
  39254. }, divProps), (0,external_wp_element_namespaceObject.createElement)(Picker, {
  39255. onChange: handleChange,
  39256. color: safeColordColor,
  39257. enableAlpha: enableAlpha
  39258. }), (0,external_wp_element_namespaceObject.createElement)(AuxiliaryColorArtefactWrapper, null, (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  39259. justify: "space-between"
  39260. }, showInputs ? (0,external_wp_element_namespaceObject.createElement)(styles_SelectControl, {
  39261. options: options,
  39262. value: colorType,
  39263. onChange: nextColorType => setColorType(nextColorType),
  39264. label: (0,external_wp_i18n_namespaceObject.__)('Color format'),
  39265. hideLabelFromVision: true
  39266. }) : (0,external_wp_element_namespaceObject.createElement)(ColorDisplay, {
  39267. color: safeColordColor,
  39268. colorType: copyFormat || colorType,
  39269. enableAlpha: enableAlpha
  39270. }), (0,external_wp_element_namespaceObject.createElement)(DetailsControlButton, {
  39271. isSmall: true,
  39272. onClick: () => setShowInputs(!showInputs),
  39273. icon: library_settings,
  39274. isPressed: showInputs,
  39275. label: showInputs ? (0,external_wp_i18n_namespaceObject.__)('Hide detailed inputs') : (0,external_wp_i18n_namespaceObject.__)('Show detailed inputs')
  39276. })), (0,external_wp_element_namespaceObject.createElement)(spacer_component, {
  39277. margin: 4
  39278. }), showInputs && (0,external_wp_element_namespaceObject.createElement)(ColorInput, {
  39279. colorType: colorType,
  39280. color: safeColordColor,
  39281. onChange: handleChange,
  39282. enableAlpha: enableAlpha
  39283. })));
  39284. };
  39285. const ConnectedColorPicker = contextConnect(ColorPicker, 'ColorPicker');
  39286. /* harmony default export */ var color_picker_component = (ConnectedColorPicker);
  39287. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/use-deprecated-props.js
  39288. /**
  39289. * External dependencies
  39290. */
  39291. /**
  39292. * WordPress dependencies
  39293. */
  39294. /**
  39295. * Internal dependencies
  39296. */
  39297. function isLegacyProps(props) {
  39298. var _props$color;
  39299. return typeof props.onChangeComplete !== 'undefined' || typeof props.disableAlpha !== 'undefined' || typeof ((_props$color = props.color) === null || _props$color === void 0 ? void 0 : _props$color.hex) === 'string';
  39300. }
  39301. function getColorFromLegacyProps(props) {
  39302. if (typeof (props === null || props === void 0 ? void 0 : props.color) === 'undefined') {
  39303. return undefined;
  39304. }
  39305. if (typeof props.color === 'string') {
  39306. return props.color;
  39307. }
  39308. if (props.color.hex) {
  39309. return props.color.hex;
  39310. }
  39311. return undefined;
  39312. }
  39313. const transformColorStringToLegacyColor = memize_default()(color => {
  39314. const colordColor = w(color);
  39315. const hex = colordColor.toHex();
  39316. const rgb = colordColor.toRgb();
  39317. const hsv = colordColor.toHsv();
  39318. const hsl = colordColor.toHsl();
  39319. return {
  39320. hex,
  39321. rgb,
  39322. hsv,
  39323. hsl,
  39324. source: 'hex',
  39325. oldHue: hsl.h
  39326. };
  39327. });
  39328. function use_deprecated_props_useDeprecatedProps(props) {
  39329. const onChange = (0,external_wp_element_namespaceObject.useCallback)(color => {
  39330. var _props$onChange;
  39331. if (isLegacyProps(props)) {
  39332. return props.onChangeComplete(transformColorStringToLegacyColor(color));
  39333. }
  39334. return (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, color);
  39335. }, [props.onChangeComplete, props.onChange]);
  39336. const color = (0,external_wp_element_namespaceObject.useMemo)(() => {
  39337. return isLegacyProps(props) ? getColorFromLegacyProps(props) : props.color;
  39338. }, [props.color]);
  39339. const enableAlpha = (0,external_wp_element_namespaceObject.useMemo)(() => {
  39340. return isLegacyProps(props) ? !props.disableAlpha : props.enableAlpha;
  39341. }, [props.disableAlpha, props.enableAlpha]);
  39342. return { ...(isLegacyProps(props) ? {} : props),
  39343. onChange,
  39344. color,
  39345. enableAlpha
  39346. };
  39347. }
  39348. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/legacy-adapter.js
  39349. /**
  39350. * Internal dependencies
  39351. */
  39352. const LegacyAdapter = props => {
  39353. return (0,external_wp_element_namespaceObject.createElement)(color_picker_component, use_deprecated_props_useDeprecatedProps(props));
  39354. };
  39355. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
  39356. /**
  39357. * WordPress dependencies
  39358. */
  39359. const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  39360. xmlns: "http://www.w3.org/2000/svg",
  39361. viewBox: "0 0 24 24"
  39362. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  39363. d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
  39364. }));
  39365. /* harmony default export */ var library_check = (check);
  39366. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/circular-option-picker/index.js
  39367. // @ts-nocheck
  39368. /**
  39369. * External dependencies
  39370. */
  39371. /**
  39372. * WordPress dependencies
  39373. */
  39374. /**
  39375. * Internal dependencies
  39376. */
  39377. function Option(_ref) {
  39378. let {
  39379. className,
  39380. isSelected,
  39381. selectedIconProps,
  39382. tooltipText,
  39383. ...additionalProps
  39384. } = _ref;
  39385. const optionButton = (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  39386. isPressed: isSelected,
  39387. className: "components-circular-option-picker__option"
  39388. }, additionalProps));
  39389. return (0,external_wp_element_namespaceObject.createElement)("div", {
  39390. className: classnames_default()(className, 'components-circular-option-picker__option-wrapper')
  39391. }, tooltipText ? (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  39392. text: tooltipText
  39393. }, optionButton) : optionButton, isSelected && (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, extends_extends({
  39394. icon: library_check
  39395. }, selectedIconProps ? selectedIconProps : {})));
  39396. }
  39397. function DropdownLinkAction(_ref2) {
  39398. let {
  39399. buttonProps,
  39400. className,
  39401. dropdownProps,
  39402. linkText
  39403. } = _ref2;
  39404. return (0,external_wp_element_namespaceObject.createElement)(Dropdown, extends_extends({
  39405. className: classnames_default()('components-circular-option-picker__dropdown-link-action', className),
  39406. renderToggle: _ref3 => {
  39407. let {
  39408. isOpen,
  39409. onToggle
  39410. } = _ref3;
  39411. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  39412. "aria-expanded": isOpen,
  39413. "aria-haspopup": "true",
  39414. onClick: onToggle,
  39415. variant: "link"
  39416. }, buttonProps), linkText);
  39417. }
  39418. }, dropdownProps));
  39419. }
  39420. function ButtonAction(_ref4) {
  39421. let {
  39422. className,
  39423. children,
  39424. ...additionalProps
  39425. } = _ref4;
  39426. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  39427. className: classnames_default()('components-circular-option-picker__clear', className),
  39428. isSmall: true,
  39429. variant: "secondary"
  39430. }, additionalProps), children);
  39431. }
  39432. function CircularOptionPicker(_ref5) {
  39433. let {
  39434. actions,
  39435. className,
  39436. options,
  39437. children
  39438. } = _ref5;
  39439. return (0,external_wp_element_namespaceObject.createElement)("div", {
  39440. className: classnames_default()('components-circular-option-picker', className)
  39441. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  39442. className: "components-circular-option-picker__swatches"
  39443. }, options), children, actions && (0,external_wp_element_namespaceObject.createElement)("div", {
  39444. className: "components-circular-option-picker__custom-clear-wrapper"
  39445. }, actions));
  39446. }
  39447. CircularOptionPicker.Option = Option;
  39448. CircularOptionPicker.ButtonAction = ButtonAction;
  39449. CircularOptionPicker.DropdownLinkAction = DropdownLinkAction;
  39450. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/v-stack/hook.js
  39451. /**
  39452. * Internal dependencies
  39453. */
  39454. /**
  39455. *
  39456. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
  39457. */
  39458. function useVStack(props) {
  39459. const {
  39460. expanded = false,
  39461. ...otherProps
  39462. } = useContextSystem(props, 'VStack');
  39463. const hStackProps = useHStack({
  39464. direction: 'column',
  39465. expanded,
  39466. ...otherProps
  39467. });
  39468. return hStackProps;
  39469. }
  39470. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/v-stack/component.js
  39471. /**
  39472. * Internal dependencies
  39473. */
  39474. /**
  39475. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
  39476. * @param {import('react').ForwardedRef<any>} forwardedRef
  39477. */
  39478. function VStack(props, forwardedRef) {
  39479. const vStackProps = useVStack(props);
  39480. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, vStackProps, {
  39481. ref: forwardedRef
  39482. }));
  39483. }
  39484. /**
  39485. * `VStack` (or Vertical Stack) is a layout component that arranges child elements in a vertical line.
  39486. *
  39487. * `VStack` can render anything inside.
  39488. *
  39489. * @example
  39490. * ```jsx
  39491. * import {
  39492. * __experimentalText as Text,
  39493. * __experimentalVStack as VStack,
  39494. * } from `@wordpress/components`;
  39495. *
  39496. * function Example() {
  39497. * return (
  39498. * <VStack>
  39499. * <Text>Code</Text>
  39500. * <Text>is</Text>
  39501. * <Text>Poetry</Text>
  39502. * </VStack>
  39503. * );
  39504. * }
  39505. * ```
  39506. */
  39507. const ConnectedVStack = contextConnect(VStack, 'VStack');
  39508. /* harmony default export */ var v_stack_component = (ConnectedVStack);
  39509. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/component.js
  39510. /**
  39511. * Internal dependencies
  39512. */
  39513. /**
  39514. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props
  39515. * @param {import('react').ForwardedRef<any>} forwardedRef
  39516. */
  39517. function component_Truncate(props, forwardedRef) {
  39518. const truncateProps = useTruncate(props);
  39519. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  39520. as: "span"
  39521. }, truncateProps, {
  39522. ref: forwardedRef
  39523. }));
  39524. }
  39525. /**
  39526. * `Truncate` is a typography primitive that trims text content.
  39527. * For almost all cases, it is recommended that `Text`, `Heading`, or
  39528. * `Subheading` is used to render text content. However,`Truncate` is
  39529. * available for custom implementations.
  39530. *
  39531. * @example
  39532. * ```jsx
  39533. * import { __experimentalTruncate as Truncate } from `@wordpress/components`;
  39534. *
  39535. * function Example() {
  39536. * return (
  39537. * <Truncate>
  39538. * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ex
  39539. * neque, vulputate a diam et, luctus convallis lacus. Vestibulum ac
  39540. * mollis mi. Morbi id elementum massa.
  39541. * </Truncate>
  39542. * );
  39543. * }
  39544. * ```
  39545. */
  39546. const ConnectedTruncate = contextConnect(component_Truncate, 'Truncate');
  39547. /* harmony default export */ var truncate_component = (ConnectedTruncate);
  39548. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/heading/hook.js
  39549. /**
  39550. * Internal dependencies
  39551. */
  39552. function useHeading(props) {
  39553. const {
  39554. as: asProp,
  39555. level = 2,
  39556. ...otherProps
  39557. } = useContextSystem(props, 'Heading');
  39558. const as = asProp || `h${level}`;
  39559. const a11yProps = {};
  39560. if (typeof as === 'string' && as[0] !== 'h') {
  39561. // If not a semantic `h` element, add a11y props:
  39562. a11yProps.role = 'heading';
  39563. a11yProps['aria-level'] = typeof level === 'string' ? parseInt(level) : level;
  39564. }
  39565. const textProps = useText({
  39566. color: COLORS.darkGray.heading,
  39567. size: getHeadingFontSize(level),
  39568. isBlock: true,
  39569. weight: config_values.fontWeightHeading,
  39570. ...otherProps
  39571. });
  39572. return { ...textProps,
  39573. ...a11yProps,
  39574. as
  39575. };
  39576. }
  39577. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/heading/component.js
  39578. /**
  39579. * External dependencies
  39580. */
  39581. /**
  39582. * Internal dependencies
  39583. */
  39584. function UnconnectedHeading(props, forwardedRef) {
  39585. const headerProps = useHeading(props);
  39586. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, headerProps, {
  39587. ref: forwardedRef
  39588. }));
  39589. }
  39590. /**
  39591. * `Heading` renders headings and titles using the library's typography system.
  39592. *
  39593. * @example
  39594. * ```jsx
  39595. * import { __experimentalHeading as Heading } from "@wordpress/components";
  39596. *
  39597. * function Example() {
  39598. * return <Heading>Code is Poetry</Heading>;
  39599. * }
  39600. * ```
  39601. */
  39602. const Heading = contextConnect(UnconnectedHeading, 'Heading');
  39603. /* harmony default export */ var heading_component = (Heading);
  39604. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-palette/styles.js
  39605. function color_palette_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  39606. /**
  39607. * External dependencies
  39608. */
  39609. /**
  39610. * Internal dependencies
  39611. */
  39612. const ColorHeading = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? {
  39613. target: "e1uu5br00"
  39614. } : 0)( true ? {
  39615. name: "13lxv2o",
  39616. styles: "text-transform:uppercase;line-height:24px;font-weight:500;&&&{font-size:11px;margin-bottom:0;}"
  39617. } : 0);
  39618. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-palette/index.js
  39619. // @ts-nocheck
  39620. /**
  39621. * External dependencies
  39622. */
  39623. /**
  39624. * WordPress dependencies
  39625. */
  39626. /**
  39627. * Internal dependencies
  39628. */
  39629. k([names, a11y]);
  39630. function SinglePalette(_ref) {
  39631. let {
  39632. className,
  39633. clearColor,
  39634. colors,
  39635. onChange,
  39636. value,
  39637. actions
  39638. } = _ref;
  39639. const colorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
  39640. return (0,external_lodash_namespaceObject.map)(colors, _ref2 => {
  39641. let {
  39642. color,
  39643. name
  39644. } = _ref2;
  39645. const colordColor = w(color);
  39646. return (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.Option, {
  39647. key: color,
  39648. isSelected: value === color,
  39649. selectedIconProps: value === color ? {
  39650. fill: colordColor.contrast() > colordColor.contrast('#000') ? '#fff' : '#000'
  39651. } : {},
  39652. tooltipText: name || // translators: %s: color hex code e.g: "#f00".
  39653. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color code: %s'), color),
  39654. style: {
  39655. backgroundColor: color,
  39656. color
  39657. },
  39658. onClick: value === color ? clearColor : () => onChange(color),
  39659. "aria-label": name ? // translators: %s: The name of the color e.g: "vivid red".
  39660. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color: %s'), name) : // translators: %s: color hex code e.g: "#f00".
  39661. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color code: %s'), color)
  39662. });
  39663. });
  39664. }, [colors, value, onChange, clearColor]);
  39665. return (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker, {
  39666. className: className,
  39667. options: colorOptions,
  39668. actions: actions
  39669. });
  39670. }
  39671. function MultiplePalettes(_ref3) {
  39672. let {
  39673. className,
  39674. clearColor,
  39675. colors,
  39676. onChange,
  39677. value,
  39678. actions
  39679. } = _ref3;
  39680. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  39681. spacing: 3,
  39682. className: className
  39683. }, colors.map((_ref4, index) => {
  39684. let {
  39685. name,
  39686. colors: colorPalette
  39687. } = _ref4;
  39688. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  39689. spacing: 2,
  39690. key: index
  39691. }, (0,external_wp_element_namespaceObject.createElement)(ColorHeading, null, name), (0,external_wp_element_namespaceObject.createElement)(SinglePalette, {
  39692. clearColor: clearColor,
  39693. colors: colorPalette,
  39694. onChange: onChange,
  39695. value: value,
  39696. actions: colors.length === index + 1 ? actions : null
  39697. }));
  39698. }));
  39699. }
  39700. function CustomColorPickerDropdown(_ref5) {
  39701. let {
  39702. isRenderedInSidebar,
  39703. ...props
  39704. } = _ref5;
  39705. return (0,external_wp_element_namespaceObject.createElement)(Dropdown, extends_extends({
  39706. contentClassName: classnames_default()('components-color-palette__custom-color-dropdown-content', {
  39707. 'is-rendered-in-sidebar': isRenderedInSidebar
  39708. })
  39709. }, props));
  39710. }
  39711. const extractColorNameFromCurrentValue = function (currentValue) {
  39712. let colors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  39713. let showMultiplePalettes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  39714. if (!currentValue) {
  39715. return '';
  39716. } // Normalize format of `colors` to simplify the following loop
  39717. const colorPalettes = showMultiplePalettes ? colors : [{
  39718. colors
  39719. }];
  39720. for (const {
  39721. colors: paletteColors
  39722. } of colorPalettes) {
  39723. for (const {
  39724. name: colorName,
  39725. color: colorValue
  39726. } of paletteColors) {
  39727. if (w(currentValue).toHex() === w(colorValue).toHex()) {
  39728. return colorName;
  39729. }
  39730. }
  39731. } // translators: shown when the user has picked a custom color (i.e not in the palette of colors).
  39732. return (0,external_wp_i18n_namespaceObject.__)('Custom');
  39733. };
  39734. function ColorPalette(_ref6) {
  39735. let {
  39736. clearable = true,
  39737. className,
  39738. colors,
  39739. disableCustomColors = false,
  39740. enableAlpha,
  39741. onChange,
  39742. value,
  39743. __experimentalHasMultipleOrigins = false,
  39744. __experimentalIsRenderedInSidebar = false
  39745. } = _ref6;
  39746. const clearColor = (0,external_wp_element_namespaceObject.useCallback)(() => onChange(undefined), [onChange]);
  39747. const showMultiplePalettes = __experimentalHasMultipleOrigins && (colors === null || colors === void 0 ? void 0 : colors.length);
  39748. const Component = showMultiplePalettes ? MultiplePalettes : SinglePalette;
  39749. const renderCustomColorPicker = () => (0,external_wp_element_namespaceObject.createElement)(LegacyAdapter, {
  39750. color: value,
  39751. onChange: color => onChange(color),
  39752. enableAlpha: enableAlpha
  39753. });
  39754. let dropdownPosition;
  39755. if (__experimentalIsRenderedInSidebar) {
  39756. dropdownPosition = 'bottom left';
  39757. }
  39758. const colordColor = w(value);
  39759. const valueWithoutLeadingHash = value !== null && value !== void 0 && value.startsWith('#') ? value.substring(1) : value !== null && value !== void 0 ? value : '';
  39760. const buttonLabelName = (0,external_wp_element_namespaceObject.useMemo)(() => extractColorNameFromCurrentValue(value, colors, showMultiplePalettes), [value, colors, showMultiplePalettes]);
  39761. const customColorAccessibleLabel = !!valueWithoutLeadingHash ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: The name of the color e.g: "vivid red". %2$s: The color's hex code e.g: "#f00".
  39762. (0,external_wp_i18n_namespaceObject.__)('Custom color picker. The currently selected color is called "%1$s" and has a value of "%2$s".'), buttonLabelName, valueWithoutLeadingHash) : (0,external_wp_i18n_namespaceObject.__)('Custom color picker.');
  39763. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  39764. spacing: 3,
  39765. className: className
  39766. }, !disableCustomColors && (0,external_wp_element_namespaceObject.createElement)(CustomColorPickerDropdown, {
  39767. position: dropdownPosition,
  39768. isRenderedInSidebar: __experimentalIsRenderedInSidebar,
  39769. renderContent: renderCustomColorPicker,
  39770. renderToggle: _ref7 => {
  39771. let {
  39772. isOpen,
  39773. onToggle
  39774. } = _ref7;
  39775. return (0,external_wp_element_namespaceObject.createElement)(flex_component, {
  39776. as: 'button',
  39777. justify: "space-between",
  39778. align: "flex-start",
  39779. className: "components-color-palette__custom-color",
  39780. "aria-expanded": isOpen,
  39781. "aria-haspopup": "true",
  39782. onClick: onToggle,
  39783. "aria-label": customColorAccessibleLabel,
  39784. style: {
  39785. background: value,
  39786. color: colordColor.contrast() > colordColor.contrast('#000') ? '#fff' : '#000'
  39787. }
  39788. }, (0,external_wp_element_namespaceObject.createElement)(flex_item_component, {
  39789. isBlock: true,
  39790. as: truncate_component,
  39791. className: "components-color-palette__custom-color-name"
  39792. }, buttonLabelName), (0,external_wp_element_namespaceObject.createElement)(flex_item_component, {
  39793. as: "span",
  39794. className: "components-color-palette__custom-color-value"
  39795. }, valueWithoutLeadingHash));
  39796. }
  39797. }), (0,external_wp_element_namespaceObject.createElement)(Component, {
  39798. clearable: clearable,
  39799. clearColor: clearColor,
  39800. colors: colors,
  39801. onChange: onChange,
  39802. value: value,
  39803. actions: !!clearable && (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.ButtonAction, {
  39804. onClick: clearColor
  39805. }, (0,external_wp_i18n_namespaceObject.__)('Clear'))
  39806. }));
  39807. }
  39808. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/utils.js
  39809. /**
  39810. * WordPress dependencies
  39811. */
  39812. /**
  39813. * Internal dependencies
  39814. */
  39815. const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web';
  39816. const allUnits = {
  39817. px: {
  39818. value: 'px',
  39819. label: isWeb ? 'px' : (0,external_wp_i18n_namespaceObject.__)('Pixels (px)'),
  39820. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Pixels (px)'),
  39821. step: 1
  39822. },
  39823. '%': {
  39824. value: '%',
  39825. label: isWeb ? '%' : (0,external_wp_i18n_namespaceObject.__)('Percentage (%)'),
  39826. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Percent (%)'),
  39827. step: 0.1
  39828. },
  39829. em: {
  39830. value: 'em',
  39831. label: isWeb ? 'em' : (0,external_wp_i18n_namespaceObject.__)('Relative to parent font size (em)'),
  39832. a11yLabel: (0,external_wp_i18n_namespaceObject._x)('ems', 'Relative to parent font size (em)'),
  39833. step: 0.01
  39834. },
  39835. rem: {
  39836. value: 'rem',
  39837. label: isWeb ? 'rem' : (0,external_wp_i18n_namespaceObject.__)('Relative to root font size (rem)'),
  39838. a11yLabel: (0,external_wp_i18n_namespaceObject._x)('rems', 'Relative to root font size (rem)'),
  39839. step: 0.01
  39840. },
  39841. vw: {
  39842. value: 'vw',
  39843. label: isWeb ? 'vw' : (0,external_wp_i18n_namespaceObject.__)('Viewport width (vw)'),
  39844. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport width (vw)'),
  39845. step: 0.1
  39846. },
  39847. vh: {
  39848. value: 'vh',
  39849. label: isWeb ? 'vh' : (0,external_wp_i18n_namespaceObject.__)('Viewport height (vh)'),
  39850. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport height (vh)'),
  39851. step: 0.1
  39852. },
  39853. vmin: {
  39854. value: 'vmin',
  39855. label: isWeb ? 'vmin' : (0,external_wp_i18n_namespaceObject.__)('Viewport smallest dimension (vmin)'),
  39856. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport smallest dimension (vmin)'),
  39857. step: 0.1
  39858. },
  39859. vmax: {
  39860. value: 'vmax',
  39861. label: isWeb ? 'vmax' : (0,external_wp_i18n_namespaceObject.__)('Viewport largest dimension (vmax)'),
  39862. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport largest dimension (vmax)'),
  39863. step: 0.1
  39864. },
  39865. ch: {
  39866. value: 'ch',
  39867. label: isWeb ? 'ch' : (0,external_wp_i18n_namespaceObject.__)('Width of the zero (0) character (ch)'),
  39868. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Width of the zero (0) character (ch)'),
  39869. step: 0.01
  39870. },
  39871. ex: {
  39872. value: 'ex',
  39873. label: isWeb ? 'ex' : (0,external_wp_i18n_namespaceObject.__)('x-height of the font (ex)'),
  39874. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('x-height of the font (ex)'),
  39875. step: 0.01
  39876. },
  39877. cm: {
  39878. value: 'cm',
  39879. label: isWeb ? 'cm' : (0,external_wp_i18n_namespaceObject.__)('Centimeters (cm)'),
  39880. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Centimeters (cm)'),
  39881. step: 0.001
  39882. },
  39883. mm: {
  39884. value: 'mm',
  39885. label: isWeb ? 'mm' : (0,external_wp_i18n_namespaceObject.__)('Millimeters (mm)'),
  39886. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Millimeters (mm)'),
  39887. step: 0.1
  39888. },
  39889. in: {
  39890. value: 'in',
  39891. label: isWeb ? 'in' : (0,external_wp_i18n_namespaceObject.__)('Inches (in)'),
  39892. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Inches (in)'),
  39893. step: 0.001
  39894. },
  39895. pc: {
  39896. value: 'pc',
  39897. label: isWeb ? 'pc' : (0,external_wp_i18n_namespaceObject.__)('Picas (pc)'),
  39898. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Picas (pc)'),
  39899. step: 1
  39900. },
  39901. pt: {
  39902. value: 'pt',
  39903. label: isWeb ? 'pt' : (0,external_wp_i18n_namespaceObject.__)('Points (pt)'),
  39904. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Points (pt)'),
  39905. step: 1
  39906. }
  39907. };
  39908. /**
  39909. * An array of all available CSS length units.
  39910. */
  39911. const ALL_CSS_UNITS = Object.values(allUnits);
  39912. /**
  39913. * Units of measurements. `a11yLabel` is used by screenreaders.
  39914. */
  39915. const CSS_UNITS = [allUnits.px, allUnits['%'], allUnits.em, allUnits.rem, allUnits.vw, allUnits.vh];
  39916. const DEFAULT_UNIT = allUnits.px;
  39917. /**
  39918. * Handles legacy value + unit handling.
  39919. * This component use to manage both incoming value and units separately.
  39920. *
  39921. * Moving forward, ideally the value should be a string that contains both
  39922. * the value and unit, example: '10px'
  39923. *
  39924. * @param rawValue The raw value as a string (may or may not contain the unit)
  39925. * @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`
  39926. * @param allowedUnits Units to derive from.
  39927. * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
  39928. * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse
  39929. * from the raw value could not be matched against the list of allowed units.
  39930. */
  39931. function getParsedQuantityAndUnit(rawValue, fallbackUnit, allowedUnits) {
  39932. const initialValue = fallbackUnit ? `${rawValue !== null && rawValue !== void 0 ? rawValue : ''}${fallbackUnit}` : rawValue;
  39933. return parseQuantityAndUnitFromRawValue(initialValue, allowedUnits);
  39934. }
  39935. /**
  39936. * Checks if units are defined.
  39937. *
  39938. * @param units List of units.
  39939. * @return Whether the list actually contains any units.
  39940. */
  39941. function hasUnits(units) {
  39942. // Although the `isArray` check shouldn't be necessary (given the signature of
  39943. // this typed function), it's better to stay on the side of caution, since
  39944. // this function may be called from un-typed environments.
  39945. return Array.isArray(units) && !!units.length;
  39946. }
  39947. /**
  39948. * Parses a quantity and unit from a raw string value, given a list of allowed
  39949. * units and otherwise falling back to the default unit.
  39950. *
  39951. * @param rawValue The raw value as a string (may or may not contain the unit)
  39952. * @param allowedUnits Units to derive from.
  39953. * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
  39954. * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed
  39955. * from the raw value could not be matched against the list of allowed units.
  39956. */
  39957. function parseQuantityAndUnitFromRawValue(rawValue) {
  39958. var _trimmedValue, _unitMatch$;
  39959. let allowedUnits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ALL_CSS_UNITS;
  39960. let trimmedValue;
  39961. let quantityToReturn;
  39962. if (typeof rawValue !== 'undefined' || rawValue === null) {
  39963. trimmedValue = `${rawValue}`.trim();
  39964. const parsedQuantity = parseFloat(trimmedValue);
  39965. quantityToReturn = !isFinite(parsedQuantity) ? undefined : parsedQuantity;
  39966. }
  39967. const unitMatch = (_trimmedValue = trimmedValue) === null || _trimmedValue === void 0 ? void 0 : _trimmedValue.match(/[\d.\-\+]*\s*(.*)/);
  39968. const matchedUnit = unitMatch === null || unitMatch === void 0 ? void 0 : (_unitMatch$ = unitMatch[1]) === null || _unitMatch$ === void 0 ? void 0 : _unitMatch$.toLowerCase();
  39969. let unitToReturn;
  39970. if (hasUnits(allowedUnits)) {
  39971. const match = allowedUnits.find(item => item.value === matchedUnit);
  39972. unitToReturn = match === null || match === void 0 ? void 0 : match.value;
  39973. } else {
  39974. unitToReturn = DEFAULT_UNIT.value;
  39975. }
  39976. return [quantityToReturn, unitToReturn];
  39977. }
  39978. /**
  39979. * Parses quantity and unit from a raw value. Validates parsed value, using fallback
  39980. * value if invalid.
  39981. *
  39982. * @param rawValue The next value.
  39983. * @param allowedUnits Units to derive from.
  39984. * @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.
  39985. * @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.
  39986. * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
  39987. * could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The
  39988. * unit can be `undefined` only if the unit parsed from the raw value could not be matched against
  39989. * the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of
  39990. * `allowedUnits` is passed empty.
  39991. */
  39992. function getValidParsedQuantityAndUnit(rawValue, allowedUnits, fallbackQuantity, fallbackUnit) {
  39993. const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(rawValue, allowedUnits); // The parsed value from `parseQuantityAndUnitFromRawValue` should now be
  39994. // either a real number or undefined. If undefined, use the fallback value.
  39995. const quantityToReturn = parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : fallbackQuantity; // If no unit is parsed from the raw value, or if the fallback unit is not
  39996. // defined, use the first value from the list of allowed units as fallback.
  39997. let unitToReturn = parsedUnit || fallbackUnit;
  39998. if (!unitToReturn && hasUnits(allowedUnits)) {
  39999. unitToReturn = allowedUnits[0].value;
  40000. }
  40001. return [quantityToReturn, unitToReturn];
  40002. }
  40003. /**
  40004. * Takes a unit value and finds the matching accessibility label for the
  40005. * unit abbreviation.
  40006. *
  40007. * @param unit Unit value (example: `px`)
  40008. * @return a11y label for the unit abbreviation
  40009. */
  40010. function getAccessibleLabelForUnit(unit) {
  40011. const match = ALL_CSS_UNITS.find(item => item.value === unit);
  40012. return match !== null && match !== void 0 && match.a11yLabel ? match === null || match === void 0 ? void 0 : match.a11yLabel : match === null || match === void 0 ? void 0 : match.value;
  40013. }
  40014. /**
  40015. * Filters available units based on values defined a list of allowed unit values.
  40016. *
  40017. * @param allowedUnitValues Collection of allowed unit value strings.
  40018. * @param availableUnits Collection of available unit objects.
  40019. * @return Filtered units.
  40020. */
  40021. function filterUnitsWithSettings() {
  40022. let allowedUnitValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  40023. let availableUnits = arguments.length > 1 ? arguments[1] : undefined;
  40024. // Although the `isArray` check shouldn't be necessary (given the signature of
  40025. // this typed function), it's better to stay on the side of caution, since
  40026. // this function may be called from un-typed environments.
  40027. return Array.isArray(availableUnits) ? availableUnits.filter(unit => allowedUnitValues.includes(unit.value)) : [];
  40028. }
  40029. /**
  40030. * Custom hook to retrieve and consolidate units setting from add_theme_support().
  40031. * TODO: ideally this hook shouldn't be needed
  40032. * https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823
  40033. *
  40034. * @param args An object containing units, settingPath & defaultUnits.
  40035. * @param args.units Collection of all potentially available units.
  40036. * @param args.availableUnits Collection of unit value strings for filtering available units.
  40037. * @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.
  40038. *
  40039. * @return Filtered list of units, with their default values updated following the `defaultValues`
  40040. * argument's property.
  40041. */
  40042. const useCustomUnits = _ref => {
  40043. let {
  40044. units = ALL_CSS_UNITS,
  40045. availableUnits = [],
  40046. defaultValues
  40047. } = _ref;
  40048. const customUnitsToReturn = filterUnitsWithSettings(availableUnits, units);
  40049. if (defaultValues) {
  40050. customUnitsToReturn.forEach((unit, i) => {
  40051. if (defaultValues[unit.value]) {
  40052. const [parsedDefaultValue] = parseQuantityAndUnitFromRawValue(defaultValues[unit.value]);
  40053. customUnitsToReturn[i].default = parsedDefaultValue;
  40054. }
  40055. });
  40056. }
  40057. return customUnitsToReturn;
  40058. };
  40059. /**
  40060. * Get available units with the unit for the currently selected value
  40061. * prepended if it is not available in the list of units.
  40062. *
  40063. * This is useful to ensure that the current value's unit is always
  40064. * accurately displayed in the UI, even if the intention is to hide
  40065. * the availability of that unit.
  40066. *
  40067. * @param rawValue Selected value to parse.
  40068. * @param legacyUnit Legacy unit value, if rawValue needs it appended.
  40069. * @param units List of available units.
  40070. *
  40071. * @return A collection of units containing the unit for the current value.
  40072. */
  40073. function getUnitsWithCurrentUnit(rawValue, legacyUnit) {
  40074. let units = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ALL_CSS_UNITS;
  40075. const unitsToReturn = Array.isArray(units) ? [...units] : [];
  40076. const [, currentUnit] = getParsedQuantityAndUnit(rawValue, legacyUnit, ALL_CSS_UNITS);
  40077. if (currentUnit && !unitsToReturn.some(unit => unit.value === currentUnit)) {
  40078. if (allUnits[currentUnit]) {
  40079. unitsToReturn.unshift(allUnits[currentUnit]);
  40080. }
  40081. }
  40082. return unitsToReturn;
  40083. }
  40084. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-dropdown/hook.js
  40085. /**
  40086. * WordPress dependencies
  40087. */
  40088. /**
  40089. * Internal dependencies
  40090. */
  40091. function useBorderControlDropdown(props) {
  40092. const {
  40093. border,
  40094. className,
  40095. colors,
  40096. contentClassName,
  40097. onChange,
  40098. previousStyleSelection,
  40099. ...otherProps
  40100. } = useContextSystem(props, 'BorderControlDropdown');
  40101. const [widthValue] = parseQuantityAndUnitFromRawValue(border === null || border === void 0 ? void 0 : border.width);
  40102. const hasZeroWidth = widthValue === 0;
  40103. const onColorChange = color => {
  40104. const style = (border === null || border === void 0 ? void 0 : border.style) === 'none' ? previousStyleSelection : border === null || border === void 0 ? void 0 : border.style;
  40105. const width = hasZeroWidth && !!color ? '1px' : border === null || border === void 0 ? void 0 : border.width;
  40106. onChange({
  40107. color,
  40108. style,
  40109. width
  40110. });
  40111. };
  40112. const onStyleChange = style => {
  40113. const width = hasZeroWidth && !!style ? '1px' : border === null || border === void 0 ? void 0 : border.width;
  40114. onChange({ ...border,
  40115. style,
  40116. width
  40117. });
  40118. };
  40119. const onReset = () => {
  40120. onChange({ ...border,
  40121. color: undefined,
  40122. style: undefined
  40123. });
  40124. }; // Generate class names.
  40125. const cx = useCx();
  40126. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40127. return cx(borderControlDropdown(), className);
  40128. }, [className, cx]);
  40129. const indicatorClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40130. return cx(borderColorIndicator);
  40131. }, [cx]);
  40132. const indicatorWrapperClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40133. return cx(colorIndicatorWrapper(border));
  40134. }, [border, cx]);
  40135. const popoverClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40136. return cx(borderControlPopover, contentClassName);
  40137. }, [cx, contentClassName]);
  40138. const popoverControlsClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40139. return cx(borderControlPopoverControls);
  40140. }, [cx]);
  40141. const popoverContentClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40142. return cx(borderControlPopoverContent);
  40143. }, [cx]);
  40144. const resetButtonClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40145. return cx(resetButton);
  40146. }, [cx]);
  40147. return { ...otherProps,
  40148. border,
  40149. className: classes,
  40150. colors,
  40151. indicatorClassName,
  40152. indicatorWrapperClassName,
  40153. onColorChange,
  40154. onStyleChange,
  40155. onReset,
  40156. popoverClassName,
  40157. popoverContentClassName,
  40158. popoverControlsClassName,
  40159. resetButtonClassName
  40160. };
  40161. }
  40162. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-dropdown/component.js
  40163. /**
  40164. * External dependencies
  40165. */
  40166. /**
  40167. * WordPress dependencies
  40168. */
  40169. /**
  40170. * Internal dependencies
  40171. */
  40172. const component_noop = () => undefined;
  40173. const getColorObject = (colorValue, colors, hasMultipleColorOrigins) => {
  40174. if (!colorValue || !colors) {
  40175. return;
  40176. }
  40177. if (hasMultipleColorOrigins) {
  40178. let matchedColor;
  40179. colors.some(origin => origin.colors.some(color => {
  40180. if (color.color === colorValue) {
  40181. matchedColor = color;
  40182. return true;
  40183. }
  40184. return false;
  40185. }));
  40186. return matchedColor;
  40187. }
  40188. return colors.find(color => color.color === colorValue);
  40189. };
  40190. const getToggleAriaLabel = (colorValue, colorObject, style, isStyleEnabled) => {
  40191. if (isStyleEnabled) {
  40192. if (colorObject) {
  40193. return style ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: The name of the color e.g. "vivid red". %2$s: The color's hex code e.g.: "#f00:". %3$s: The current border style selection e.g. "solid".
  40194. 'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s". The currently selected style is "%3$s".', colorObject.name, colorObject.color, style) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: The name of the color e.g. "vivid red". %2$s: The color's hex code e.g.: "#f00:".
  40195. 'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s".', colorObject.name, colorObject.color);
  40196. }
  40197. if (colorValue) {
  40198. return style ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: The color's hex code e.g.: "#f00:". %2$s: The current border style selection e.g. "solid".
  40199. 'Border color and style picker. The currently selected color has a value of "%1$s". The currently selected style is "%2$s".', colorValue, style) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: The color's hex code e.g.: "#f00:".
  40200. 'Border color and style picker. The currently selected color has a value of "%1$s".', colorValue);
  40201. }
  40202. return (0,external_wp_i18n_namespaceObject.__)('Border color and style picker.');
  40203. }
  40204. if (colorObject) {
  40205. return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: The name of the color e.g. "vivid red". %2$s: The color's hex code e.g.: "#f00:".
  40206. 'Border color picker. The currently selected color is called "%1$s" and has a value of "%2$s".', colorObject.name, colorObject.color);
  40207. }
  40208. if (colorValue) {
  40209. return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: The color's hex code e.g.: "#f00:".
  40210. 'Border color picker. The currently selected color has a value of "%1$s".', colorValue);
  40211. }
  40212. return (0,external_wp_i18n_namespaceObject.__)('Border color picker.');
  40213. };
  40214. const BorderControlDropdown = (props, forwardedRef) => {
  40215. const {
  40216. __experimentalHasMultipleOrigins,
  40217. __experimentalIsRenderedInSidebar,
  40218. border,
  40219. colors,
  40220. disableCustomColors,
  40221. enableAlpha,
  40222. indicatorClassName,
  40223. indicatorWrapperClassName,
  40224. onReset,
  40225. onColorChange,
  40226. onStyleChange,
  40227. popoverClassName,
  40228. popoverContentClassName,
  40229. popoverControlsClassName,
  40230. resetButtonClassName,
  40231. showDropdownHeader,
  40232. enableStyle = true,
  40233. ...otherProps
  40234. } = useBorderControlDropdown(props);
  40235. const {
  40236. color,
  40237. style
  40238. } = border || {};
  40239. const colorObject = getColorObject(color, colors, !!__experimentalHasMultipleOrigins);
  40240. const toggleAriaLabel = getToggleAriaLabel(color, colorObject, style, enableStyle);
  40241. const dropdownPosition = __experimentalIsRenderedInSidebar ? 'bottom left' : undefined;
  40242. const renderToggle = _ref => {
  40243. let {
  40244. onToggle = component_noop
  40245. } = _ref;
  40246. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  40247. onClick: onToggle,
  40248. variant: "tertiary",
  40249. "aria-label": toggleAriaLabel,
  40250. position: dropdownPosition
  40251. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  40252. className: indicatorWrapperClassName
  40253. }, (0,external_wp_element_namespaceObject.createElement)(color_indicator, {
  40254. className: indicatorClassName,
  40255. colorValue: color
  40256. })));
  40257. };
  40258. const renderContent = _ref2 => {
  40259. let {
  40260. onClose
  40261. } = _ref2;
  40262. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  40263. className: popoverControlsClassName,
  40264. spacing: 6
  40265. }, showDropdownHeader ? (0,external_wp_element_namespaceObject.createElement)(h_stack_component, null, (0,external_wp_element_namespaceObject.createElement)(StyledLabel, null, (0,external_wp_i18n_namespaceObject.__)('Border color')), (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  40266. isSmall: true,
  40267. label: (0,external_wp_i18n_namespaceObject.__)('Close border color'),
  40268. icon: close_small,
  40269. onClick: onClose
  40270. })) : undefined, (0,external_wp_element_namespaceObject.createElement)(ColorPalette, {
  40271. className: popoverContentClassName,
  40272. value: color,
  40273. onChange: onColorChange,
  40274. colors,
  40275. disableCustomColors,
  40276. __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
  40277. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  40278. clearable: false,
  40279. enableAlpha: enableAlpha
  40280. }), enableStyle && (0,external_wp_element_namespaceObject.createElement)(border_control_style_picker_component, {
  40281. label: (0,external_wp_i18n_namespaceObject.__)('Style'),
  40282. value: style,
  40283. onChange: onStyleChange
  40284. })), (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  40285. className: resetButtonClassName,
  40286. variant: "tertiary",
  40287. onClick: () => {
  40288. onReset();
  40289. onClose();
  40290. }
  40291. }, (0,external_wp_i18n_namespaceObject.__)('Reset to default')));
  40292. };
  40293. return (0,external_wp_element_namespaceObject.createElement)(Dropdown, extends_extends({
  40294. renderToggle: renderToggle,
  40295. renderContent: renderContent,
  40296. contentClassName: popoverClassName
  40297. }, otherProps, {
  40298. ref: forwardedRef
  40299. }));
  40300. };
  40301. const ConnectedBorderControlDropdown = contextConnect(BorderControlDropdown, 'BorderControlDropdown');
  40302. /* harmony default export */ var border_control_dropdown_component = (ConnectedBorderControlDropdown);
  40303. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/unit-select-control.js
  40304. /**
  40305. * External dependencies
  40306. */
  40307. function UnitSelectControl(_ref) {
  40308. let {
  40309. className,
  40310. isUnitSelectTabbable: isTabbable = true,
  40311. onChange,
  40312. size = 'default',
  40313. unit = 'px',
  40314. units = CSS_UNITS,
  40315. ...props
  40316. } = _ref;
  40317. if (!hasUnits(units) || (units === null || units === void 0 ? void 0 : units.length) === 1) {
  40318. return (0,external_wp_element_namespaceObject.createElement)(UnitLabel, {
  40319. className: "components-unit-control__unit-label",
  40320. selectSize: size
  40321. }, unit);
  40322. }
  40323. const handleOnChange = event => {
  40324. const {
  40325. value: unitValue
  40326. } = event.target;
  40327. const data = units.find(option => option.value === unitValue);
  40328. onChange === null || onChange === void 0 ? void 0 : onChange(unitValue, {
  40329. event,
  40330. data
  40331. });
  40332. };
  40333. const classes = classnames_default()('components-unit-control__select', className);
  40334. return (0,external_wp_element_namespaceObject.createElement)(UnitSelect, extends_extends({
  40335. className: classes,
  40336. onChange: handleOnChange,
  40337. selectSize: size,
  40338. tabIndex: isTabbable ? undefined : -1,
  40339. value: unit
  40340. }, props), units.map(option => (0,external_wp_element_namespaceObject.createElement)("option", {
  40341. value: option.value,
  40342. key: option.value
  40343. }, option.label)));
  40344. }
  40345. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/index.js
  40346. /**
  40347. * External dependencies
  40348. */
  40349. /**
  40350. * WordPress dependencies
  40351. */
  40352. /**
  40353. * Internal dependencies
  40354. */
  40355. function UnforwardedUnitControl(unitControlProps, forwardedRef) {
  40356. const {
  40357. __unstableStateReducer: stateReducerProp,
  40358. autoComplete = 'off',
  40359. className,
  40360. disabled = false,
  40361. disableUnits = false,
  40362. isPressEnterToChange = false,
  40363. isResetValueOnUnitChange = false,
  40364. isUnitSelectTabbable = true,
  40365. label,
  40366. onChange: onChangeProp,
  40367. onUnitChange,
  40368. size = 'default',
  40369. style,
  40370. unit: unitProp,
  40371. units: unitsProp = CSS_UNITS,
  40372. value: valueProp,
  40373. onBlur: onBlurProp,
  40374. ...props
  40375. } = unitControlProps;
  40376. if ('unit' in unitControlProps) {
  40377. external_wp_deprecated_default()('UnitControl unit prop', {
  40378. since: '5.6',
  40379. hint: 'The unit should be provided within the `value` prop.',
  40380. version: '6.2'
  40381. });
  40382. } // The `value` prop, in theory, should not be `null`, but the following line
  40383. // ensures it fallback to `undefined` in case a consumer of `UnitControl`
  40384. // still passes `null` as a `value`.
  40385. const nonNullValueProp = valueProp !== null && valueProp !== void 0 ? valueProp : undefined;
  40386. const units = (0,external_wp_element_namespaceObject.useMemo)(() => getUnitsWithCurrentUnit(nonNullValueProp, unitProp, unitsProp), [nonNullValueProp, unitProp, unitsProp]);
  40387. const [parsedQuantity, parsedUnit] = getParsedQuantityAndUnit(nonNullValueProp, unitProp, units);
  40388. const [unit, setUnit] = use_controlled_state(unitProp, {
  40389. initial: parsedUnit,
  40390. fallback: ''
  40391. });
  40392. (0,external_wp_element_namespaceObject.useEffect)(() => {
  40393. if (parsedUnit !== undefined) {
  40394. setUnit(parsedUnit);
  40395. }
  40396. }, [parsedUnit]); // Stores parsed value for hand-off in state reducer.
  40397. const refParsedQuantity = (0,external_wp_element_namespaceObject.useRef)(undefined);
  40398. const classes = classnames_default()('components-unit-control', className);
  40399. const handleOnQuantityChange = (nextQuantityValue, changeProps) => {
  40400. if (nextQuantityValue === '' || typeof nextQuantityValue === 'undefined' || nextQuantityValue === null) {
  40401. onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp('', changeProps);
  40402. return;
  40403. }
  40404. /*
  40405. * Customizing the onChange callback.
  40406. * This allows as to broadcast a combined value+unit to onChange.
  40407. */
  40408. const onChangeValue = getValidParsedQuantityAndUnit(nextQuantityValue, units, parsedQuantity, unit).join('');
  40409. onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(onChangeValue, changeProps);
  40410. };
  40411. const handleOnUnitChange = (nextUnitValue, changeProps) => {
  40412. const {
  40413. data
  40414. } = changeProps;
  40415. let nextValue = `${parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : ''}${nextUnitValue}`;
  40416. if (isResetValueOnUnitChange && (data === null || data === void 0 ? void 0 : data.default) !== undefined) {
  40417. nextValue = `${data.default}${nextUnitValue}`;
  40418. }
  40419. onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(nextValue, changeProps);
  40420. onUnitChange === null || onUnitChange === void 0 ? void 0 : onUnitChange(nextUnitValue, changeProps);
  40421. setUnit(nextUnitValue);
  40422. };
  40423. const mayUpdateUnit = event => {
  40424. if (!isNaN(Number(event.currentTarget.value))) {
  40425. refParsedQuantity.current = undefined;
  40426. return;
  40427. }
  40428. const [validParsedQuantity, validParsedUnit] = getValidParsedQuantityAndUnit(event.currentTarget.value, units, parsedQuantity, unit);
  40429. refParsedQuantity.current = validParsedQuantity;
  40430. if (isPressEnterToChange && validParsedUnit !== unit) {
  40431. const data = Array.isArray(units) ? units.find(option => option.value === validParsedUnit) : undefined;
  40432. const changeProps = {
  40433. event,
  40434. data
  40435. };
  40436. onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(`${validParsedQuantity !== null && validParsedQuantity !== void 0 ? validParsedQuantity : ''}${validParsedUnit}`, changeProps);
  40437. onUnitChange === null || onUnitChange === void 0 ? void 0 : onUnitChange(validParsedUnit, changeProps);
  40438. setUnit(validParsedUnit);
  40439. }
  40440. };
  40441. const handleOnBlur = event => {
  40442. mayUpdateUnit(event);
  40443. onBlurProp === null || onBlurProp === void 0 ? void 0 : onBlurProp(event);
  40444. };
  40445. const handleOnKeyDown = event => {
  40446. const {
  40447. key
  40448. } = event;
  40449. if (key === 'Enter') {
  40450. mayUpdateUnit(event);
  40451. }
  40452. };
  40453. /**
  40454. * "Middleware" function that intercepts updates from InputControl.
  40455. * This allows us to tap into actions to transform the (next) state for
  40456. * InputControl.
  40457. *
  40458. * @param state State from InputControl
  40459. * @param action Action triggering state change
  40460. * @return The updated state to apply to InputControl
  40461. */
  40462. const unitControlStateReducer = (state, action) => {
  40463. const nextState = { ...state
  40464. };
  40465. /*
  40466. * On commits (when pressing ENTER and on blur if
  40467. * isPressEnterToChange is true), if a parse has been performed
  40468. * then use that result to update the state.
  40469. */
  40470. if (action.type === COMMIT) {
  40471. if (refParsedQuantity.current !== undefined) {
  40472. var _refParsedQuantity$cu;
  40473. nextState.value = ((_refParsedQuantity$cu = refParsedQuantity.current) !== null && _refParsedQuantity$cu !== void 0 ? _refParsedQuantity$cu : '').toString();
  40474. refParsedQuantity.current = undefined;
  40475. }
  40476. }
  40477. return nextState;
  40478. };
  40479. let stateReducer = unitControlStateReducer;
  40480. if (stateReducerProp) {
  40481. stateReducer = (state, action) => {
  40482. const baseState = unitControlStateReducer(state, action);
  40483. return stateReducerProp(baseState, action);
  40484. };
  40485. }
  40486. const inputSuffix = !disableUnits ? (0,external_wp_element_namespaceObject.createElement)(UnitSelectControl, {
  40487. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Select unit'),
  40488. disabled: disabled,
  40489. isUnitSelectTabbable: isUnitSelectTabbable,
  40490. onChange: handleOnUnitChange,
  40491. size: size,
  40492. unit: unit,
  40493. units: units,
  40494. onBlur: onBlurProp
  40495. }) : null;
  40496. let step = props.step;
  40497. /*
  40498. * If no step prop has been passed, lookup the active unit and
  40499. * try to get step from `units`, or default to a value of `1`
  40500. */
  40501. if (!step && units) {
  40502. var _activeUnit$step;
  40503. const activeUnit = units.find(option => option.value === unit);
  40504. step = (_activeUnit$step = activeUnit === null || activeUnit === void 0 ? void 0 : activeUnit.step) !== null && _activeUnit$step !== void 0 ? _activeUnit$step : 1;
  40505. }
  40506. return (0,external_wp_element_namespaceObject.createElement)(unit_control_styles_Root, {
  40507. className: "components-unit-control-wrapper",
  40508. style: style
  40509. }, (0,external_wp_element_namespaceObject.createElement)(ValueInput, extends_extends({
  40510. "aria-label": label,
  40511. type: isPressEnterToChange ? 'text' : 'number'
  40512. }, (0,external_lodash_namespaceObject.omit)(props, ['children']), {
  40513. autoComplete: autoComplete,
  40514. className: classes,
  40515. disabled: disabled,
  40516. disableUnits: disableUnits,
  40517. isPressEnterToChange: isPressEnterToChange,
  40518. label: label,
  40519. onBlur: handleOnBlur,
  40520. onKeyDown: handleOnKeyDown,
  40521. onChange: handleOnQuantityChange,
  40522. ref: forwardedRef,
  40523. size: size,
  40524. suffix: inputSuffix,
  40525. value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : '',
  40526. step: step,
  40527. __unstableStateReducer: stateReducer
  40528. })));
  40529. }
  40530. /**
  40531. * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).
  40532. *
  40533. *
  40534. * @example
  40535. * ```jsx
  40536. * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';
  40537. * import { useState } from '@wordpress/element';
  40538. *
  40539. * const Example = () => {
  40540. * const [ value, setValue ] = useState( '10px' );
  40541. *
  40542. * return <UnitControl onChange={ setValue } value={ value } />;
  40543. * };
  40544. * ```
  40545. */
  40546. const UnitControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedUnitControl);
  40547. /* harmony default export */ var unit_control = (UnitControl);
  40548. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control/hook.js
  40549. /**
  40550. * WordPress dependencies
  40551. */
  40552. /**
  40553. * Internal dependencies
  40554. */
  40555. const sanitizeBorder = border => {
  40556. const hasNoWidth = (border === null || border === void 0 ? void 0 : border.width) === undefined || border.width === '';
  40557. const hasNoColor = (border === null || border === void 0 ? void 0 : border.color) === undefined; // If width and color are undefined, unset any style selection as well.
  40558. if (hasNoWidth && hasNoColor) {
  40559. return undefined;
  40560. }
  40561. return border;
  40562. };
  40563. function useBorderControl(props) {
  40564. const {
  40565. className,
  40566. isCompact,
  40567. onChange,
  40568. shouldSanitizeBorder = true,
  40569. value: border,
  40570. width,
  40571. ...otherProps
  40572. } = useContextSystem(props, 'BorderControl');
  40573. const [widthValue, originalWidthUnit] = parseQuantityAndUnitFromRawValue(border === null || border === void 0 ? void 0 : border.width);
  40574. const widthUnit = originalWidthUnit || 'px';
  40575. const hadPreviousZeroWidth = widthValue === 0;
  40576. const [colorSelection, setColorSelection] = (0,external_wp_element_namespaceObject.useState)();
  40577. const [styleSelection, setStyleSelection] = (0,external_wp_element_namespaceObject.useState)();
  40578. const onBorderChange = (0,external_wp_element_namespaceObject.useCallback)(newBorder => {
  40579. if (shouldSanitizeBorder) {
  40580. return onChange(sanitizeBorder(newBorder));
  40581. }
  40582. onChange(newBorder);
  40583. }, [onChange, shouldSanitizeBorder, sanitizeBorder]);
  40584. const onWidthChange = (0,external_wp_element_namespaceObject.useCallback)(newWidth => {
  40585. const newWidthValue = newWidth === '' ? undefined : newWidth;
  40586. const [parsedValue] = parseQuantityAndUnitFromRawValue(newWidth);
  40587. const hasZeroWidth = parsedValue === 0;
  40588. const updatedBorder = { ...border,
  40589. width: newWidthValue
  40590. }; // Setting the border width explicitly to zero will also set the
  40591. // border style to `none` and clear the border color.
  40592. if (hasZeroWidth && !hadPreviousZeroWidth) {
  40593. // Before clearing the color and style selections, keep track of
  40594. // the current selections so they can be restored when the width
  40595. // changes to a non-zero value.
  40596. setColorSelection(border === null || border === void 0 ? void 0 : border.color);
  40597. setStyleSelection(border === null || border === void 0 ? void 0 : border.style); // Clear the color and style border properties.
  40598. updatedBorder.color = undefined;
  40599. updatedBorder.style = 'none';
  40600. } // Selection has changed from zero border width to non-zero width.
  40601. if (!hasZeroWidth && hadPreviousZeroWidth) {
  40602. // Restore previous border color and style selections if width
  40603. // is now not zero.
  40604. if (updatedBorder.color === undefined) {
  40605. updatedBorder.color = colorSelection;
  40606. }
  40607. if (updatedBorder.style === 'none') {
  40608. updatedBorder.style = styleSelection;
  40609. }
  40610. }
  40611. onBorderChange(updatedBorder);
  40612. }, [border, hadPreviousZeroWidth, onBorderChange]);
  40613. const onSliderChange = (0,external_wp_element_namespaceObject.useCallback)(value => {
  40614. onWidthChange(`${value}${widthUnit}`);
  40615. }, [onWidthChange, widthUnit]); // Generate class names.
  40616. const cx = useCx();
  40617. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40618. return cx(borderControl, className);
  40619. }, [className, cx]);
  40620. const innerWrapperClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40621. const wrapperWidth = isCompact ? '90px' : width;
  40622. const widthStyle = !!wrapperWidth && styles_wrapperWidth(wrapperWidth);
  40623. return cx(innerWrapper(), widthStyle);
  40624. }, [isCompact, width, cx]);
  40625. const widthControlClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40626. return cx(borderWidthControl());
  40627. }, [cx]);
  40628. const sliderClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40629. return cx(borderSlider());
  40630. }, [cx]);
  40631. return { ...otherProps,
  40632. className: classes,
  40633. innerWrapperClassName,
  40634. onBorderChange,
  40635. onSliderChange,
  40636. onWidthChange,
  40637. previousStyleSelection: styleSelection,
  40638. sliderClassName,
  40639. value: border,
  40640. widthControlClassName,
  40641. widthUnit,
  40642. widthValue
  40643. };
  40644. }
  40645. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control/component.js
  40646. /**
  40647. * Internal dependencies
  40648. */
  40649. const BorderLabel = props => {
  40650. const {
  40651. label,
  40652. hideLabelFromVision
  40653. } = props;
  40654. if (!label) {
  40655. return null;
  40656. }
  40657. return hideLabelFromVision ? (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  40658. as: "label"
  40659. }, label) : (0,external_wp_element_namespaceObject.createElement)(StyledLabel, null, label);
  40660. };
  40661. const BorderControl = (props, forwardedRef) => {
  40662. const {
  40663. colors,
  40664. disableCustomColors,
  40665. enableAlpha,
  40666. enableStyle = true,
  40667. hideLabelFromVision,
  40668. innerWrapperClassName,
  40669. label,
  40670. onBorderChange,
  40671. onSliderChange,
  40672. onWidthChange,
  40673. placeholder,
  40674. popoverContentClassName,
  40675. previousStyleSelection,
  40676. showDropdownHeader,
  40677. sliderClassName,
  40678. value: border,
  40679. widthControlClassName,
  40680. widthUnit,
  40681. widthValue,
  40682. withSlider,
  40683. __experimentalHasMultipleOrigins,
  40684. __experimentalIsRenderedInSidebar,
  40685. ...otherProps
  40686. } = useBorderControl(props);
  40687. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  40688. ref: forwardedRef
  40689. }), (0,external_wp_element_namespaceObject.createElement)(BorderLabel, {
  40690. label: label,
  40691. hideLabelFromVision: hideLabelFromVision
  40692. }), (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  40693. spacing: 3
  40694. }, (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  40695. className: innerWrapperClassName,
  40696. alignment: "stretch"
  40697. }, (0,external_wp_element_namespaceObject.createElement)(border_control_dropdown_component, {
  40698. border: border,
  40699. colors: colors,
  40700. contentClassName: popoverContentClassName,
  40701. disableCustomColors: disableCustomColors,
  40702. enableAlpha: enableAlpha,
  40703. enableStyle: enableStyle,
  40704. onChange: onBorderChange,
  40705. previousStyleSelection: previousStyleSelection,
  40706. showDropdownHeader: showDropdownHeader,
  40707. __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
  40708. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar
  40709. }), (0,external_wp_element_namespaceObject.createElement)(unit_control, {
  40710. className: widthControlClassName,
  40711. min: 0,
  40712. onChange: onWidthChange,
  40713. value: (border === null || border === void 0 ? void 0 : border.width) || '',
  40714. placeholder: placeholder
  40715. })), withSlider && (0,external_wp_element_namespaceObject.createElement)(range_control, {
  40716. className: sliderClassName,
  40717. initialPosition: 0,
  40718. max: 100,
  40719. min: 0,
  40720. onChange: onSliderChange,
  40721. step: ['px', '%'].includes(widthUnit) ? 1 : 0.1,
  40722. value: widthValue || undefined,
  40723. withInputField: false
  40724. })));
  40725. };
  40726. const ConnectedBorderControl = contextConnect(BorderControl, 'BorderControl');
  40727. /* harmony default export */ var border_control_component = (ConnectedBorderControl);
  40728. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/grid/utils.js
  40729. const grid_utils_ALIGNMENTS = {
  40730. bottom: {
  40731. alignItems: 'flex-end',
  40732. justifyContent: 'center'
  40733. },
  40734. bottomLeft: {
  40735. alignItems: 'flex-start',
  40736. justifyContent: 'flex-end'
  40737. },
  40738. bottomRight: {
  40739. alignItems: 'flex-end',
  40740. justifyContent: 'flex-end'
  40741. },
  40742. center: {
  40743. alignItems: 'center',
  40744. justifyContent: 'center'
  40745. },
  40746. spaced: {
  40747. alignItems: 'center',
  40748. justifyContent: 'space-between'
  40749. },
  40750. left: {
  40751. alignItems: 'center',
  40752. justifyContent: 'flex-start'
  40753. },
  40754. right: {
  40755. alignItems: 'center',
  40756. justifyContent: 'flex-end'
  40757. },
  40758. stretch: {
  40759. alignItems: 'stretch'
  40760. },
  40761. top: {
  40762. alignItems: 'flex-start',
  40763. justifyContent: 'center'
  40764. },
  40765. topLeft: {
  40766. alignItems: 'flex-start',
  40767. justifyContent: 'flex-start'
  40768. },
  40769. topRight: {
  40770. alignItems: 'flex-start',
  40771. justifyContent: 'flex-end'
  40772. }
  40773. };
  40774. /* eslint-disable jsdoc/valid-types */
  40775. /**
  40776. * @param {keyof typeof ALIGNMENTS | undefined} alignment
  40777. * @return {{ alignItems?: import('react').CSSProperties['alignItems'], justifyContent?: import('react').CSSProperties['justifyContent']}} CSS props for alignment
  40778. */
  40779. function utils_getAlignmentProps(alignment) {
  40780. const alignmentProps = alignment ? grid_utils_ALIGNMENTS[alignment] : {};
  40781. return alignmentProps;
  40782. }
  40783. /* eslint-enable jsdoc/valid-types */
  40784. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/grid/hook.js
  40785. /**
  40786. * External dependencies
  40787. */
  40788. /**
  40789. * WordPress dependencies
  40790. */
  40791. /**
  40792. * Internal dependencies
  40793. */
  40794. /**
  40795. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
  40796. */
  40797. function useGrid(props) {
  40798. const {
  40799. align,
  40800. alignment,
  40801. className,
  40802. columnGap,
  40803. columns = 2,
  40804. gap = 3,
  40805. isInline = false,
  40806. justify,
  40807. rowGap,
  40808. rows,
  40809. templateColumns,
  40810. templateRows,
  40811. ...otherProps
  40812. } = useContextSystem(props, 'Grid');
  40813. const columnsAsArray = Array.isArray(columns) ? columns : [columns];
  40814. const column = useResponsiveValue(columnsAsArray);
  40815. const rowsAsArray = Array.isArray(rows) ? rows : [rows];
  40816. const row = useResponsiveValue(rowsAsArray);
  40817. const gridTemplateColumns = templateColumns || !!columns && `repeat( ${column}, 1fr )`;
  40818. const gridTemplateRows = templateRows || !!rows && `repeat( ${row}, 1fr )`;
  40819. const cx = useCx();
  40820. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40821. const alignmentProps = utils_getAlignmentProps(alignment);
  40822. const gridClasses = /*#__PURE__*/emotion_react_browser_esm_css({
  40823. alignItems: align,
  40824. display: isInline ? 'inline-grid' : 'grid',
  40825. gap: `calc( ${config_values.gridBase} * ${gap} )`,
  40826. gridTemplateColumns: gridTemplateColumns || undefined,
  40827. gridTemplateRows: gridTemplateRows || undefined,
  40828. gridRowGap: rowGap,
  40829. gridColumnGap: columnGap,
  40830. justifyContent: justify,
  40831. verticalAlign: isInline ? 'middle' : undefined,
  40832. ...alignmentProps
  40833. }, true ? "" : 0, true ? "" : 0);
  40834. return cx(gridClasses, className);
  40835. }, [align, alignment, className, columnGap, cx, gap, gridTemplateColumns, gridTemplateRows, isInline, justify, rowGap]);
  40836. return { ...otherProps,
  40837. className: classes
  40838. };
  40839. }
  40840. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/grid/component.js
  40841. /**
  40842. * Internal dependencies
  40843. */
  40844. /**
  40845. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
  40846. * @param {import('react').ForwardedRef<any>} forwardedRef
  40847. */
  40848. function Grid(props, forwardedRef) {
  40849. const gridProps = useGrid(props);
  40850. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, gridProps, {
  40851. ref: forwardedRef
  40852. }));
  40853. }
  40854. /**
  40855. * `Grid` is a primitive layout component that can arrange content in a grid configuration.
  40856. *
  40857. * @example
  40858. * ```jsx
  40859. * import {
  40860. * __experimentalGrid as Grid,
  40861. * __experimentalText as Text
  40862. * } from `@wordpress/components`;
  40863. *
  40864. * function Example() {
  40865. * return (
  40866. * <Grid columns={ 3 }>
  40867. * <Text>Code</Text>
  40868. * <Text>is</Text>
  40869. * <Text>Poetry</Text>
  40870. * </Grid>
  40871. * );
  40872. * }
  40873. * ```
  40874. */
  40875. const ConnectedGrid = contextConnect(Grid, 'Grid');
  40876. /* harmony default export */ var grid_component = (ConnectedGrid);
  40877. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-split-controls/hook.js
  40878. /**
  40879. * WordPress dependencies
  40880. */
  40881. /**
  40882. * Internal dependencies
  40883. */
  40884. function useBorderBoxControlSplitControls(props) {
  40885. const {
  40886. className,
  40887. ...otherProps
  40888. } = useContextSystem(props, 'BorderBoxControlSplitControls'); // Generate class names.
  40889. const cx = useCx();
  40890. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40891. return cx(BorderBoxControlSplitControls, className);
  40892. }, [className, rtl.watch()]);
  40893. const centeredClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  40894. return cx(CenteredBorderControl, className);
  40895. }, []);
  40896. return { ...otherProps,
  40897. centeredClassName,
  40898. className: classes
  40899. };
  40900. }
  40901. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-split-controls/component.js
  40902. /**
  40903. * WordPress dependencies
  40904. */
  40905. /**
  40906. * Internal dependencies
  40907. */
  40908. const component_BorderBoxControlSplitControls = (props, forwardedRef) => {
  40909. const {
  40910. centeredClassName,
  40911. colors,
  40912. disableCustomColors,
  40913. enableAlpha,
  40914. enableStyle,
  40915. onChange,
  40916. popoverClassNames,
  40917. value,
  40918. __experimentalHasMultipleOrigins,
  40919. __experimentalIsRenderedInSidebar,
  40920. ...otherProps
  40921. } = useBorderBoxControlSplitControls(props);
  40922. const sharedBorderControlProps = {
  40923. colors,
  40924. disableCustomColors,
  40925. enableAlpha,
  40926. enableStyle,
  40927. isCompact: true,
  40928. __experimentalHasMultipleOrigins,
  40929. __experimentalIsRenderedInSidebar
  40930. };
  40931. return (0,external_wp_element_namespaceObject.createElement)(grid_component, extends_extends({}, otherProps, {
  40932. ref: forwardedRef,
  40933. gap: 4
  40934. }), (0,external_wp_element_namespaceObject.createElement)(border_box_control_visualizer_component, {
  40935. value: value
  40936. }), (0,external_wp_element_namespaceObject.createElement)(border_control_component, extends_extends({
  40937. className: centeredClassName,
  40938. hideLabelFromVision: true,
  40939. label: (0,external_wp_i18n_namespaceObject.__)('Top border'),
  40940. onChange: newBorder => onChange(newBorder, 'top'),
  40941. popoverContentClassName: popoverClassNames === null || popoverClassNames === void 0 ? void 0 : popoverClassNames.top,
  40942. value: value === null || value === void 0 ? void 0 : value.top
  40943. }, sharedBorderControlProps)), (0,external_wp_element_namespaceObject.createElement)(border_control_component, extends_extends({
  40944. hideLabelFromVision: true,
  40945. label: (0,external_wp_i18n_namespaceObject.__)('Left border'),
  40946. onChange: newBorder => onChange(newBorder, 'left'),
  40947. popoverContentClassName: popoverClassNames === null || popoverClassNames === void 0 ? void 0 : popoverClassNames.left,
  40948. value: value === null || value === void 0 ? void 0 : value.left
  40949. }, sharedBorderControlProps)), (0,external_wp_element_namespaceObject.createElement)(border_control_component, extends_extends({
  40950. hideLabelFromVision: true,
  40951. label: (0,external_wp_i18n_namespaceObject.__)('Right border'),
  40952. onChange: newBorder => onChange(newBorder, 'right'),
  40953. popoverContentClassName: popoverClassNames === null || popoverClassNames === void 0 ? void 0 : popoverClassNames.right,
  40954. value: value === null || value === void 0 ? void 0 : value.right
  40955. }, sharedBorderControlProps)), (0,external_wp_element_namespaceObject.createElement)(border_control_component, extends_extends({
  40956. className: centeredClassName,
  40957. hideLabelFromVision: true,
  40958. label: (0,external_wp_i18n_namespaceObject.__)('Bottom border'),
  40959. onChange: newBorder => onChange(newBorder, 'bottom'),
  40960. popoverContentClassName: popoverClassNames === null || popoverClassNames === void 0 ? void 0 : popoverClassNames.bottom,
  40961. value: value === null || value === void 0 ? void 0 : value.bottom
  40962. }, sharedBorderControlProps)));
  40963. };
  40964. const ConnectedBorderBoxControlSplitControls = contextConnect(component_BorderBoxControlSplitControls, 'BorderBoxControlSplitControls');
  40965. /* harmony default export */ var border_box_control_split_controls_component = (ConnectedBorderBoxControlSplitControls);
  40966. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/utils.js
  40967. /**
  40968. * External dependencies
  40969. */
  40970. /**
  40971. * Internal dependencies
  40972. */
  40973. const sides = ['top', 'right', 'bottom', 'left'];
  40974. const borderProps = ['color', 'style', 'width'];
  40975. const isEmptyBorder = border => {
  40976. if (!border) {
  40977. return true;
  40978. }
  40979. return !borderProps.some(prop => border[prop] !== undefined);
  40980. };
  40981. const isDefinedBorder = border => {
  40982. // No border, no worries :)
  40983. if (!border) {
  40984. return false;
  40985. } // If we have individual borders per side within the border object we
  40986. // need to check whether any of those side borders have been set.
  40987. if (hasSplitBorders(border)) {
  40988. const allSidesEmpty = sides.every(side => isEmptyBorder(border[side]));
  40989. return !allSidesEmpty;
  40990. } // If we have a top-level border only, check if that is empty. e.g.
  40991. // { color: undefined, style: undefined, width: undefined }
  40992. // Border radius can still be set within the border object as it is
  40993. // handled separately.
  40994. return !isEmptyBorder(border);
  40995. };
  40996. const isCompleteBorder = border => {
  40997. if (!border) {
  40998. return false;
  40999. }
  41000. return borderProps.every(prop => border[prop] !== undefined);
  41001. };
  41002. const hasSplitBorders = function () {
  41003. let border = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  41004. return Object.keys(border).some(side => sides.indexOf(side) !== -1);
  41005. };
  41006. const hasMixedBorders = borders => {
  41007. if (!hasSplitBorders(borders)) {
  41008. return false;
  41009. }
  41010. const shorthandBorders = sides.map(side => getShorthandBorderStyle(borders === null || borders === void 0 ? void 0 : borders[side]));
  41011. return !shorthandBorders.every(border => border === shorthandBorders[0]);
  41012. };
  41013. const getSplitBorders = border => {
  41014. if (!border || isEmptyBorder(border)) {
  41015. return undefined;
  41016. }
  41017. return {
  41018. top: border,
  41019. right: border,
  41020. bottom: border,
  41021. left: border
  41022. };
  41023. };
  41024. const getBorderDiff = (original, updated) => {
  41025. const diff = {};
  41026. if (original.color !== updated.color) {
  41027. diff.color = updated.color;
  41028. }
  41029. if (original.style !== updated.style) {
  41030. diff.style = updated.style;
  41031. }
  41032. if (original.width !== updated.width) {
  41033. diff.width = updated.width;
  41034. }
  41035. return diff;
  41036. };
  41037. const getCommonBorder = borders => {
  41038. if (!borders) {
  41039. return undefined;
  41040. }
  41041. const colors = [];
  41042. const styles = [];
  41043. const widths = [];
  41044. sides.forEach(side => {
  41045. var _borders$side, _borders$side2, _borders$side3;
  41046. colors.push((_borders$side = borders[side]) === null || _borders$side === void 0 ? void 0 : _borders$side.color);
  41047. styles.push((_borders$side2 = borders[side]) === null || _borders$side2 === void 0 ? void 0 : _borders$side2.style);
  41048. widths.push((_borders$side3 = borders[side]) === null || _borders$side3 === void 0 ? void 0 : _borders$side3.width);
  41049. });
  41050. const allColorsMatch = colors.every(value => value === colors[0]);
  41051. const allStylesMatch = styles.every(value => value === styles[0]);
  41052. const allWidthsMatch = widths.every(value => value === widths[0]);
  41053. return {
  41054. color: allColorsMatch ? colors[0] : undefined,
  41055. style: allStylesMatch ? styles[0] : undefined,
  41056. width: allWidthsMatch ? widths[0] : undefined
  41057. };
  41058. };
  41059. const getShorthandBorderStyle = (border, fallbackBorder) => {
  41060. if (isEmptyBorder(border)) {
  41061. return fallbackBorder;
  41062. }
  41063. const {
  41064. color: fallbackColor,
  41065. style: fallbackStyle,
  41066. width: fallbackWidth
  41067. } = fallbackBorder || {};
  41068. const {
  41069. color = fallbackColor,
  41070. style = fallbackStyle,
  41071. width = fallbackWidth
  41072. } = border;
  41073. const hasVisibleBorder = !!width && width !== '0' || !!color;
  41074. const borderStyle = hasVisibleBorder ? style || 'solid' : style;
  41075. return [width, borderStyle, color].filter(Boolean).join(' ');
  41076. };
  41077. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control/hook.js
  41078. /**
  41079. * WordPress dependencies
  41080. */
  41081. /**
  41082. * Internal dependencies
  41083. */
  41084. function useBorderBoxControl(props) {
  41085. const {
  41086. className,
  41087. onChange,
  41088. value,
  41089. ...otherProps
  41090. } = useContextSystem(props, 'BorderBoxControl');
  41091. const mixedBorders = hasMixedBorders(value);
  41092. const splitBorders = hasSplitBorders(value);
  41093. const linkedValue = splitBorders ? getCommonBorder(value) : value;
  41094. const splitValue = splitBorders ? value : getSplitBorders(value);
  41095. const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(!mixedBorders);
  41096. const toggleLinked = () => setIsLinked(!isLinked);
  41097. const onLinkedChange = newBorder => {
  41098. if (!newBorder) {
  41099. return onChange(undefined);
  41100. } // If we have all props defined on the new border apply it.
  41101. if (!mixedBorders || isCompleteBorder(newBorder)) {
  41102. return onChange(isEmptyBorder(newBorder) ? undefined : newBorder);
  41103. } // If we had mixed borders we might have had some shared border props
  41104. // that we need to maintain. For example; we could have mixed borders
  41105. // with all the same color but different widths. Then from the linked
  41106. // control we change the color. We should keep the separate widths.
  41107. const changes = getBorderDiff(linkedValue, newBorder);
  41108. const updatedBorders = {
  41109. top: { ...(value === null || value === void 0 ? void 0 : value.top),
  41110. ...changes
  41111. },
  41112. right: { ...(value === null || value === void 0 ? void 0 : value.right),
  41113. ...changes
  41114. },
  41115. bottom: { ...(value === null || value === void 0 ? void 0 : value.bottom),
  41116. ...changes
  41117. },
  41118. left: { ...(value === null || value === void 0 ? void 0 : value.left),
  41119. ...changes
  41120. }
  41121. };
  41122. if (hasMixedBorders(updatedBorders)) {
  41123. return onChange(updatedBorders);
  41124. }
  41125. const filteredResult = isEmptyBorder(updatedBorders.top) ? undefined : updatedBorders.top;
  41126. onChange(filteredResult);
  41127. };
  41128. const onSplitChange = (newBorder, side) => {
  41129. const updatedBorders = { ...splitValue,
  41130. [side]: newBorder
  41131. };
  41132. if (hasMixedBorders(updatedBorders)) {
  41133. onChange(updatedBorders);
  41134. } else {
  41135. onChange(newBorder);
  41136. }
  41137. };
  41138. const cx = useCx();
  41139. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  41140. return cx(BorderBoxControl, className);
  41141. }, [className]);
  41142. const linkedControlClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  41143. return cx(LinkedBorderControl);
  41144. }, []);
  41145. return { ...otherProps,
  41146. className: classes,
  41147. hasMixedBorders: mixedBorders,
  41148. isLinked,
  41149. linkedControlClassName,
  41150. onLinkedChange,
  41151. onSplitChange,
  41152. toggleLinked,
  41153. linkedValue,
  41154. splitValue
  41155. };
  41156. }
  41157. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control/component.js
  41158. /**
  41159. * WordPress dependencies
  41160. */
  41161. /**
  41162. * Internal dependencies
  41163. */
  41164. const component_BorderLabel = props => {
  41165. const {
  41166. label,
  41167. hideLabelFromVision
  41168. } = props;
  41169. if (!label) {
  41170. return null;
  41171. }
  41172. return hideLabelFromVision ? (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  41173. as: "label"
  41174. }, label) : (0,external_wp_element_namespaceObject.createElement)(StyledLabel, null, label);
  41175. };
  41176. const component_BorderBoxControl = (props, forwardedRef) => {
  41177. const {
  41178. className,
  41179. colors,
  41180. disableCustomColors,
  41181. enableAlpha,
  41182. enableStyle,
  41183. hasMixedBorders,
  41184. hideLabelFromVision,
  41185. isLinked,
  41186. label,
  41187. linkedControlClassName,
  41188. linkedValue,
  41189. onLinkedChange,
  41190. onSplitChange,
  41191. popoverClassNames,
  41192. splitValue,
  41193. toggleLinked,
  41194. __experimentalHasMultipleOrigins,
  41195. __experimentalIsRenderedInSidebar,
  41196. ...otherProps
  41197. } = useBorderBoxControl(props);
  41198. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  41199. className: className
  41200. }, otherProps, {
  41201. ref: forwardedRef
  41202. }), (0,external_wp_element_namespaceObject.createElement)(component_BorderLabel, {
  41203. label: label,
  41204. hideLabelFromVision: hideLabelFromVision
  41205. }), (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  41206. alignment: 'start',
  41207. expanded: true,
  41208. spacing: 0
  41209. }, isLinked ? (0,external_wp_element_namespaceObject.createElement)(border_control_component, {
  41210. className: linkedControlClassName,
  41211. colors: colors,
  41212. disableCustomColors: disableCustomColors,
  41213. enableAlpha: enableAlpha,
  41214. enableStyle: enableStyle,
  41215. onChange: onLinkedChange,
  41216. placeholder: hasMixedBorders ? (0,external_wp_i18n_namespaceObject.__)('Mixed') : undefined,
  41217. popoverContentClassName: popoverClassNames === null || popoverClassNames === void 0 ? void 0 : popoverClassNames.linked,
  41218. shouldSanitizeBorder: false // This component will handle that.
  41219. ,
  41220. value: linkedValue,
  41221. withSlider: true,
  41222. width: '110px',
  41223. __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
  41224. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar
  41225. }) : (0,external_wp_element_namespaceObject.createElement)(border_box_control_split_controls_component, {
  41226. colors: colors,
  41227. disableCustomColors: disableCustomColors,
  41228. enableAlpha: enableAlpha,
  41229. enableStyle: enableStyle,
  41230. onChange: onSplitChange,
  41231. popoverClassNames: popoverClassNames,
  41232. value: splitValue,
  41233. __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
  41234. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar
  41235. }), (0,external_wp_element_namespaceObject.createElement)(border_box_control_linked_button_component, {
  41236. onClick: toggleLinked,
  41237. isLinked: isLinked
  41238. })));
  41239. };
  41240. const ConnectedBorderBoxControl = contextConnect(component_BorderBoxControl, 'BorderBoxControl');
  41241. /* harmony default export */ var border_box_control_component = (ConnectedBorderBoxControl);
  41242. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/styles/box-control-styles.js
  41243. function box_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  41244. /**
  41245. * External dependencies
  41246. */
  41247. /**
  41248. * Internal dependencies
  41249. */
  41250. const box_control_styles_Root = emotion_styled_base_browser_esm("div", true ? {
  41251. target: "e7pk0lh6"
  41252. } : 0)( true ? {
  41253. name: "14bvcyk",
  41254. styles: "box-sizing:border-box;max-width:235px;padding-bottom:12px;width:100%"
  41255. } : 0);
  41256. const Header = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  41257. target: "e7pk0lh5"
  41258. } : 0)("color:", COLORS.ui.label, ";margin-bottom:8px;" + ( true ? "" : 0));
  41259. const HeaderControlWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  41260. target: "e7pk0lh4"
  41261. } : 0)( true ? {
  41262. name: "aujtid",
  41263. styles: "min-height:30px;gap:0"
  41264. } : 0);
  41265. const UnitControlWrapper = emotion_styled_base_browser_esm("div", true ? {
  41266. target: "e7pk0lh3"
  41267. } : 0)( true ? {
  41268. name: "112jwab",
  41269. styles: "box-sizing:border-box;max-width:80px"
  41270. } : 0);
  41271. const LayoutContainer = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  41272. target: "e7pk0lh2"
  41273. } : 0)( true ? {
  41274. name: "xy18ro",
  41275. styles: "justify-content:center;padding-top:8px"
  41276. } : 0);
  41277. const Layout = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  41278. target: "e7pk0lh1"
  41279. } : 0)( true ? {
  41280. name: "3tw5wk",
  41281. styles: "position:relative;height:100%;width:100%;justify-content:flex-start"
  41282. } : 0);
  41283. var box_control_styles_ref = true ? {
  41284. name: "1ch9yvl",
  41285. styles: "border-radius:0"
  41286. } : 0;
  41287. var box_control_styles_ref2 = true ? {
  41288. name: "tg3mx0",
  41289. styles: "border-radius:2px"
  41290. } : 0;
  41291. const unitControlBorderRadiusStyles = _ref3 => {
  41292. let {
  41293. isFirst,
  41294. isLast,
  41295. isOnly
  41296. } = _ref3;
  41297. if (isFirst) {
  41298. return rtl({
  41299. borderTopRightRadius: 0,
  41300. borderBottomRightRadius: 0
  41301. })();
  41302. }
  41303. if (isLast) {
  41304. return rtl({
  41305. borderTopLeftRadius: 0,
  41306. borderBottomLeftRadius: 0
  41307. })();
  41308. }
  41309. if (isOnly) {
  41310. return box_control_styles_ref2;
  41311. }
  41312. return box_control_styles_ref;
  41313. };
  41314. const unitControlMarginStyles = _ref4 => {
  41315. let {
  41316. isFirst,
  41317. isOnly
  41318. } = _ref4;
  41319. const marginLeft = isFirst || isOnly ? 0 : -1;
  41320. return rtl({
  41321. marginLeft
  41322. })();
  41323. };
  41324. const box_control_styles_UnitControl = /*#__PURE__*/emotion_styled_base_browser_esm(unit_control, true ? {
  41325. target: "e7pk0lh0"
  41326. } : 0)("max-width:60px;", unitControlBorderRadiusStyles, ";", unitControlMarginStyles, ";" + ( true ? "" : 0));
  41327. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/unit-control.js
  41328. /**
  41329. * External dependencies
  41330. */
  41331. /**
  41332. * Internal dependencies
  41333. */
  41334. function BoxUnitControl(_ref) {
  41335. let {
  41336. isFirst,
  41337. isLast,
  41338. isOnly,
  41339. onHoverOn = external_lodash_namespaceObject.noop,
  41340. onHoverOff = external_lodash_namespaceObject.noop,
  41341. label,
  41342. value,
  41343. ...props
  41344. } = _ref;
  41345. const bindHoverGesture = useHover(_ref2 => {
  41346. let {
  41347. event,
  41348. ...state
  41349. } = _ref2;
  41350. if (state.hovering) {
  41351. onHoverOn(event, state);
  41352. } else {
  41353. onHoverOff(event, state);
  41354. }
  41355. });
  41356. return (0,external_wp_element_namespaceObject.createElement)(UnitControlWrapper, bindHoverGesture(), (0,external_wp_element_namespaceObject.createElement)(unit_control_Tooltip, {
  41357. text: label
  41358. }, (0,external_wp_element_namespaceObject.createElement)(box_control_styles_UnitControl, extends_extends({
  41359. "aria-label": label,
  41360. className: "component-box-control__unit-control",
  41361. hideHTMLArrows: true,
  41362. isFirst: isFirst,
  41363. isLast: isLast,
  41364. isOnly: isOnly,
  41365. isPressEnterToChange: true,
  41366. isResetValueOnUnitChange: false,
  41367. value: value
  41368. }, props))));
  41369. }
  41370. function unit_control_Tooltip(_ref3) {
  41371. let {
  41372. children,
  41373. text
  41374. } = _ref3;
  41375. if (!text) return children;
  41376. /**
  41377. * Wrapping the children in a `<div />` as Tooltip as it attempts
  41378. * to render the <UnitControl />. Using a plain `<div />` appears to
  41379. * resolve this issue.
  41380. *
  41381. * Originally discovered and referenced here:
  41382. * https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026
  41383. */
  41384. return (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  41385. text: text,
  41386. position: "top"
  41387. }, (0,external_wp_element_namespaceObject.createElement)("div", null, children));
  41388. }
  41389. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/utils.js
  41390. /**
  41391. * External dependencies
  41392. */
  41393. /**
  41394. * WordPress dependencies
  41395. */
  41396. /**
  41397. * Internal dependencies
  41398. */
  41399. const LABELS = {
  41400. all: (0,external_wp_i18n_namespaceObject.__)('All'),
  41401. top: (0,external_wp_i18n_namespaceObject.__)('Top'),
  41402. bottom: (0,external_wp_i18n_namespaceObject.__)('Bottom'),
  41403. left: (0,external_wp_i18n_namespaceObject.__)('Left'),
  41404. right: (0,external_wp_i18n_namespaceObject.__)('Right'),
  41405. mixed: (0,external_wp_i18n_namespaceObject.__)('Mixed'),
  41406. vertical: (0,external_wp_i18n_namespaceObject.__)('Vertical'),
  41407. horizontal: (0,external_wp_i18n_namespaceObject.__)('Horizontal')
  41408. };
  41409. const DEFAULT_VALUES = {
  41410. top: undefined,
  41411. right: undefined,
  41412. bottom: undefined,
  41413. left: undefined
  41414. };
  41415. const DEFAULT_VISUALIZER_VALUES = {
  41416. top: false,
  41417. right: false,
  41418. bottom: false,
  41419. left: false
  41420. };
  41421. const ALL_SIDES = ['top', 'right', 'bottom', 'left'];
  41422. /**
  41423. * Gets an items with the most occurrence within an array
  41424. * https://stackoverflow.com/a/20762713
  41425. *
  41426. * @param {Array<any>} arr Array of items to check.
  41427. * @return {any} The item with the most occurrences.
  41428. */
  41429. function mode(arr) {
  41430. return arr.sort((a, b) => arr.filter(v => v === a).length - arr.filter(v => v === b).length).pop();
  41431. }
  41432. /**
  41433. * Gets the 'all' input value and unit from values data.
  41434. *
  41435. * @param {Object} values Box values.
  41436. * @param {Object} selectedUnits Box units.
  41437. * @param {Array} availableSides Available box sides to evaluate.
  41438. *
  41439. * @return {string} A value + unit for the 'all' input.
  41440. */
  41441. function getAllValue() {
  41442. let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  41443. let selectedUnits = arguments.length > 1 ? arguments[1] : undefined;
  41444. let availableSides = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ALL_SIDES;
  41445. const sides = normalizeSides(availableSides);
  41446. const parsedQuantitiesAndUnits = sides.map(side => parseQuantityAndUnitFromRawValue(values[side]));
  41447. const allParsedQuantities = parsedQuantitiesAndUnits.map(value => {
  41448. var _value$;
  41449. return (_value$ = value[0]) !== null && _value$ !== void 0 ? _value$ : '';
  41450. });
  41451. const allParsedUnits = parsedQuantitiesAndUnits.map(value => value[1]);
  41452. const commonQuantity = allParsedQuantities.every(v => v === allParsedQuantities[0]) ? allParsedQuantities[0] : '';
  41453. /**
  41454. * The isNumber check is important. On reset actions, the incoming value
  41455. * may be null or an empty string.
  41456. *
  41457. * Also, the value may also be zero (0), which is considered a valid unit value.
  41458. *
  41459. * isNumber() is more specific for these cases, rather than relying on a
  41460. * simple truthy check.
  41461. */
  41462. let commonUnit;
  41463. if ((0,external_lodash_namespaceObject.isNumber)(commonQuantity)) {
  41464. commonUnit = mode(allParsedUnits);
  41465. } else {
  41466. var _getAllUnitFallback;
  41467. // Set meaningful unit selection if no commonQuantity and user has previously
  41468. // selected units without assigning values while controls were unlinked.
  41469. commonUnit = (_getAllUnitFallback = getAllUnitFallback(selectedUnits)) !== null && _getAllUnitFallback !== void 0 ? _getAllUnitFallback : mode(allParsedUnits);
  41470. }
  41471. return [commonQuantity, commonUnit].join('');
  41472. }
  41473. /**
  41474. * Determine the most common unit selection to use as a fallback option.
  41475. *
  41476. * @param {Object} selectedUnits Current unit selections for individual sides.
  41477. * @return {string} Most common unit selection.
  41478. */
  41479. function getAllUnitFallback(selectedUnits) {
  41480. if (!selectedUnits || typeof selectedUnits !== 'object') {
  41481. return undefined;
  41482. }
  41483. const filteredUnits = Object.values(selectedUnits).filter(Boolean);
  41484. return mode(filteredUnits);
  41485. }
  41486. /**
  41487. * Checks to determine if values are mixed.
  41488. *
  41489. * @param {Object} values Box values.
  41490. * @param {Object} selectedUnits Box units.
  41491. * @param {Array} sides Available box sides to evaluate.
  41492. *
  41493. * @return {boolean} Whether values are mixed.
  41494. */
  41495. function isValuesMixed() {
  41496. let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  41497. let selectedUnits = arguments.length > 1 ? arguments[1] : undefined;
  41498. let sides = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ALL_SIDES;
  41499. const allValue = getAllValue(values, selectedUnits, sides);
  41500. const isMixed = isNaN(parseFloat(allValue));
  41501. return isMixed;
  41502. }
  41503. /**
  41504. * Checks to determine if values are defined.
  41505. *
  41506. * @param {Object} values Box values.
  41507. *
  41508. * @return {boolean} Whether values are mixed.
  41509. */
  41510. function isValuesDefined(values) {
  41511. return values !== undefined && !(0,external_lodash_namespaceObject.isEmpty)(Object.values(values).filter( // Switching units when input is empty causes values only
  41512. // containing units. This gives false positive on mixed values
  41513. // unless filtered.
  41514. value => !!value && /\d/.test(value)));
  41515. }
  41516. /**
  41517. * Get initial selected side, factoring in whether the sides are linked,
  41518. * and whether the vertical / horizontal directions are grouped via splitOnAxis.
  41519. *
  41520. * @param {boolean} isLinked Whether the box control's fields are linked.
  41521. * @param {boolean} splitOnAxis Whether splitting by horizontal or vertical axis.
  41522. * @return {string} The initial side.
  41523. */
  41524. function getInitialSide(isLinked, splitOnAxis) {
  41525. let initialSide = 'all';
  41526. if (!isLinked) {
  41527. initialSide = splitOnAxis ? 'vertical' : 'top';
  41528. }
  41529. return initialSide;
  41530. }
  41531. /**
  41532. * Normalizes provided sides configuration to an array containing only top,
  41533. * right, bottom and left. This essentially just maps `horizontal` or `vertical`
  41534. * to their appropriate sides to facilitate correctly determining value for
  41535. * all input control.
  41536. *
  41537. * @param {Array} sides Available sides for box control.
  41538. * @return {Array} Normalized sides configuration.
  41539. */
  41540. function normalizeSides(sides) {
  41541. const filteredSides = [];
  41542. if (!(sides !== null && sides !== void 0 && sides.length)) {
  41543. return ALL_SIDES;
  41544. }
  41545. if (sides.includes('vertical')) {
  41546. filteredSides.push(...['top', 'bottom']);
  41547. } else if (sides.includes('horizontal')) {
  41548. filteredSides.push(...['left', 'right']);
  41549. } else {
  41550. const newSides = ALL_SIDES.filter(side => sides.includes(side));
  41551. filteredSides.push(...newSides);
  41552. }
  41553. return filteredSides;
  41554. }
  41555. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/all-input-control.js
  41556. /**
  41557. * External dependencies
  41558. */
  41559. /**
  41560. * Internal dependencies
  41561. */
  41562. function AllInputControl(_ref) {
  41563. let {
  41564. onChange = external_lodash_namespaceObject.noop,
  41565. onFocus = external_lodash_namespaceObject.noop,
  41566. onHoverOn = external_lodash_namespaceObject.noop,
  41567. onHoverOff = external_lodash_namespaceObject.noop,
  41568. values,
  41569. sides,
  41570. selectedUnits,
  41571. setSelectedUnits,
  41572. ...props
  41573. } = _ref;
  41574. const allValue = getAllValue(values, selectedUnits, sides);
  41575. const hasValues = isValuesDefined(values);
  41576. const isMixed = hasValues && isValuesMixed(values, selectedUnits, sides);
  41577. const allPlaceholder = isMixed ? LABELS.mixed : null;
  41578. const handleOnFocus = event => {
  41579. onFocus(event, {
  41580. side: 'all'
  41581. });
  41582. }; // Applies a value to an object representing top, right, bottom and left
  41583. // sides while taking into account any custom side configuration.
  41584. const applyValueToSides = (currentValues, newValue) => {
  41585. const newValues = { ...currentValues
  41586. };
  41587. if (sides !== null && sides !== void 0 && sides.length) {
  41588. sides.forEach(side => {
  41589. if (side === 'vertical') {
  41590. newValues.top = newValue;
  41591. newValues.bottom = newValue;
  41592. } else if (side === 'horizontal') {
  41593. newValues.left = newValue;
  41594. newValues.right = newValue;
  41595. } else {
  41596. newValues[side] = newValue;
  41597. }
  41598. });
  41599. } else {
  41600. ALL_SIDES.forEach(side => newValues[side] = newValue);
  41601. }
  41602. return newValues;
  41603. };
  41604. const handleOnChange = next => {
  41605. const isNumeric = !isNaN(parseFloat(next));
  41606. const nextValue = isNumeric ? next : undefined;
  41607. const nextValues = applyValueToSides(values, nextValue);
  41608. onChange(nextValues);
  41609. }; // Set selected unit so it can be used as fallback by unlinked controls
  41610. // when individual sides do not have a value containing a unit.
  41611. const handleOnUnitChange = unit => {
  41612. const newUnits = applyValueToSides(selectedUnits, unit);
  41613. setSelectedUnits(newUnits);
  41614. };
  41615. const handleOnHoverOn = () => {
  41616. onHoverOn({
  41617. top: true,
  41618. bottom: true,
  41619. left: true,
  41620. right: true
  41621. });
  41622. };
  41623. const handleOnHoverOff = () => {
  41624. onHoverOff({
  41625. top: false,
  41626. bottom: false,
  41627. left: false,
  41628. right: false
  41629. });
  41630. };
  41631. return (0,external_wp_element_namespaceObject.createElement)(BoxUnitControl, extends_extends({}, props, {
  41632. disableUnits: isMixed,
  41633. isOnly: true,
  41634. value: allValue,
  41635. onChange: handleOnChange,
  41636. onUnitChange: handleOnUnitChange,
  41637. onFocus: handleOnFocus,
  41638. onHoverOn: handleOnHoverOn,
  41639. onHoverOff: handleOnHoverOff,
  41640. placeholder: allPlaceholder
  41641. }));
  41642. }
  41643. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/input-controls.js
  41644. /**
  41645. * External dependencies
  41646. */
  41647. /**
  41648. * Internal dependencies
  41649. */
  41650. function BoxInputControls(_ref) {
  41651. let {
  41652. onChange = external_lodash_namespaceObject.noop,
  41653. onFocus = external_lodash_namespaceObject.noop,
  41654. onHoverOn = external_lodash_namespaceObject.noop,
  41655. onHoverOff = external_lodash_namespaceObject.noop,
  41656. values,
  41657. selectedUnits,
  41658. setSelectedUnits,
  41659. sides,
  41660. ...props
  41661. } = _ref;
  41662. const createHandleOnFocus = side => event => {
  41663. onFocus(event, {
  41664. side
  41665. });
  41666. };
  41667. const createHandleOnHoverOn = side => () => {
  41668. onHoverOn({
  41669. [side]: true
  41670. });
  41671. };
  41672. const createHandleOnHoverOff = side => () => {
  41673. onHoverOff({
  41674. [side]: false
  41675. });
  41676. };
  41677. const handleOnChange = nextValues => {
  41678. onChange(nextValues);
  41679. };
  41680. const createHandleOnChange = side => (next, _ref2) => {
  41681. let {
  41682. event
  41683. } = _ref2;
  41684. const {
  41685. altKey
  41686. } = event;
  41687. const nextValues = { ...values
  41688. };
  41689. const isNumeric = !isNaN(parseFloat(next));
  41690. const nextValue = isNumeric ? next : undefined;
  41691. nextValues[side] = nextValue;
  41692. /**
  41693. * Supports changing pair sides. For example, holding the ALT key
  41694. * when changing the TOP will also update BOTTOM.
  41695. */
  41696. if (altKey) {
  41697. switch (side) {
  41698. case 'top':
  41699. nextValues.bottom = nextValue;
  41700. break;
  41701. case 'bottom':
  41702. nextValues.top = nextValue;
  41703. break;
  41704. case 'left':
  41705. nextValues.right = nextValue;
  41706. break;
  41707. case 'right':
  41708. nextValues.left = nextValue;
  41709. break;
  41710. }
  41711. }
  41712. handleOnChange(nextValues);
  41713. };
  41714. const createHandleOnUnitChange = side => next => {
  41715. const newUnits = { ...selectedUnits
  41716. };
  41717. newUnits[side] = next;
  41718. setSelectedUnits(newUnits);
  41719. }; // Filter sides if custom configuration provided, maintaining default order.
  41720. const filteredSides = sides !== null && sides !== void 0 && sides.length ? ALL_SIDES.filter(side => sides.includes(side)) : ALL_SIDES;
  41721. const first = filteredSides[0];
  41722. const last = filteredSides[filteredSides.length - 1];
  41723. const only = first === last && first;
  41724. return (0,external_wp_element_namespaceObject.createElement)(LayoutContainer, {
  41725. className: "component-box-control__input-controls-wrapper"
  41726. }, (0,external_wp_element_namespaceObject.createElement)(Layout, {
  41727. gap: 0,
  41728. align: "top",
  41729. className: "component-box-control__input-controls"
  41730. }, filteredSides.map(side => {
  41731. const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(values[side]);
  41732. const computedUnit = values[side] ? parsedUnit : selectedUnits[side];
  41733. return (0,external_wp_element_namespaceObject.createElement)(BoxUnitControl, extends_extends({}, props, {
  41734. isFirst: first === side,
  41735. isLast: last === side,
  41736. isOnly: only === side,
  41737. value: [parsedQuantity, computedUnit].join(''),
  41738. onChange: createHandleOnChange(side),
  41739. onUnitChange: createHandleOnUnitChange(side),
  41740. onFocus: createHandleOnFocus(side),
  41741. onHoverOn: createHandleOnHoverOn(side),
  41742. onHoverOff: createHandleOnHoverOff(side),
  41743. label: LABELS[side],
  41744. key: `box-control-${side}`
  41745. }));
  41746. })));
  41747. }
  41748. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/axial-input-controls.js
  41749. /**
  41750. * Internal dependencies
  41751. */
  41752. const groupedSides = ['vertical', 'horizontal'];
  41753. function AxialInputControls(_ref) {
  41754. let {
  41755. onChange,
  41756. onFocus,
  41757. onHoverOn,
  41758. onHoverOff,
  41759. values,
  41760. selectedUnits,
  41761. setSelectedUnits,
  41762. sides,
  41763. ...props
  41764. } = _ref;
  41765. const createHandleOnFocus = side => event => {
  41766. if (!onFocus) {
  41767. return;
  41768. }
  41769. onFocus(event, {
  41770. side
  41771. });
  41772. };
  41773. const createHandleOnHoverOn = side => () => {
  41774. if (!onHoverOn) {
  41775. return;
  41776. }
  41777. if (side === 'vertical') {
  41778. onHoverOn({
  41779. top: true,
  41780. bottom: true
  41781. });
  41782. }
  41783. if (side === 'horizontal') {
  41784. onHoverOn({
  41785. left: true,
  41786. right: true
  41787. });
  41788. }
  41789. };
  41790. const createHandleOnHoverOff = side => () => {
  41791. if (!onHoverOff) {
  41792. return;
  41793. }
  41794. if (side === 'vertical') {
  41795. onHoverOff({
  41796. top: false,
  41797. bottom: false
  41798. });
  41799. }
  41800. if (side === 'horizontal') {
  41801. onHoverOff({
  41802. left: false,
  41803. right: false
  41804. });
  41805. }
  41806. };
  41807. const createHandleOnChange = side => next => {
  41808. if (!onChange) {
  41809. return;
  41810. }
  41811. const nextValues = { ...values
  41812. };
  41813. const isNumeric = !isNaN(parseFloat(next));
  41814. const nextValue = isNumeric ? next : undefined;
  41815. if (side === 'vertical') {
  41816. nextValues.top = nextValue;
  41817. nextValues.bottom = nextValue;
  41818. }
  41819. if (side === 'horizontal') {
  41820. nextValues.left = nextValue;
  41821. nextValues.right = nextValue;
  41822. }
  41823. onChange(nextValues);
  41824. };
  41825. const createHandleOnUnitChange = side => next => {
  41826. const newUnits = { ...selectedUnits
  41827. };
  41828. if (side === 'vertical') {
  41829. newUnits.top = next;
  41830. newUnits.bottom = next;
  41831. }
  41832. if (side === 'horizontal') {
  41833. newUnits.left = next;
  41834. newUnits.right = next;
  41835. }
  41836. setSelectedUnits(newUnits);
  41837. }; // Filter sides if custom configuration provided, maintaining default order.
  41838. const filteredSides = sides !== null && sides !== void 0 && sides.length ? groupedSides.filter(side => sides.includes(side)) : groupedSides;
  41839. const first = filteredSides[0];
  41840. const last = filteredSides[filteredSides.length - 1];
  41841. const only = first === last;
  41842. return (0,external_wp_element_namespaceObject.createElement)(Layout, {
  41843. gap: 0,
  41844. align: "top",
  41845. className: "component-box-control__vertical-horizontal-input-controls"
  41846. }, filteredSides.map(side => {
  41847. const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(side === 'vertical' ? values.top : values.left);
  41848. const selectedUnit = side === 'vertical' ? selectedUnits.top : selectedUnits.left;
  41849. return (0,external_wp_element_namespaceObject.createElement)(BoxUnitControl, extends_extends({}, props, {
  41850. isFirst: first === side,
  41851. isLast: last === side,
  41852. isOnly: only === side,
  41853. value: [parsedQuantity, selectedUnit !== null && selectedUnit !== void 0 ? selectedUnit : parsedUnit].join(''),
  41854. onChange: createHandleOnChange(side),
  41855. onUnitChange: createHandleOnUnitChange(side),
  41856. onFocus: createHandleOnFocus(side),
  41857. onHoverOn: createHandleOnHoverOn(side),
  41858. onHoverOff: createHandleOnHoverOff(side),
  41859. label: LABELS[side],
  41860. key: side
  41861. }));
  41862. }));
  41863. }
  41864. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/styles/box-control-icon-styles.js
  41865. function box_control_icon_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  41866. /**
  41867. * External dependencies
  41868. */
  41869. const box_control_icon_styles_Root = emotion_styled_base_browser_esm("span", true ? {
  41870. target: "eaw9yqk8"
  41871. } : 0)( true ? {
  41872. name: "1w884gc",
  41873. styles: "box-sizing:border-box;display:block;width:24px;height:24px;position:relative;padding:4px"
  41874. } : 0);
  41875. const Viewbox = emotion_styled_base_browser_esm("span", true ? {
  41876. target: "eaw9yqk7"
  41877. } : 0)( true ? {
  41878. name: "i6vjox",
  41879. styles: "box-sizing:border-box;display:block;position:relative;width:100%;height:100%"
  41880. } : 0);
  41881. const strokeFocus = _ref => {
  41882. let {
  41883. isFocused
  41884. } = _ref;
  41885. return /*#__PURE__*/emotion_react_browser_esm_css({
  41886. backgroundColor: 'currentColor',
  41887. opacity: isFocused ? 1 : 0.3
  41888. }, true ? "" : 0, true ? "" : 0);
  41889. };
  41890. const Stroke = emotion_styled_base_browser_esm("span", true ? {
  41891. target: "eaw9yqk6"
  41892. } : 0)("box-sizing:border-box;display:block;pointer-events:none;position:absolute;", strokeFocus, ";" + ( true ? "" : 0));
  41893. const VerticalStroke = /*#__PURE__*/emotion_styled_base_browser_esm(Stroke, true ? {
  41894. target: "eaw9yqk5"
  41895. } : 0)( true ? {
  41896. name: "1k2w39q",
  41897. styles: "bottom:3px;top:3px;width:2px"
  41898. } : 0);
  41899. const HorizontalStroke = /*#__PURE__*/emotion_styled_base_browser_esm(Stroke, true ? {
  41900. target: "eaw9yqk4"
  41901. } : 0)( true ? {
  41902. name: "1q9b07k",
  41903. styles: "height:2px;left:3px;right:3px"
  41904. } : 0);
  41905. const TopStroke = /*#__PURE__*/emotion_styled_base_browser_esm(HorizontalStroke, true ? {
  41906. target: "eaw9yqk3"
  41907. } : 0)( true ? {
  41908. name: "abcix4",
  41909. styles: "top:0"
  41910. } : 0);
  41911. const RightStroke = /*#__PURE__*/emotion_styled_base_browser_esm(VerticalStroke, true ? {
  41912. target: "eaw9yqk2"
  41913. } : 0)( true ? {
  41914. name: "1wf8jf",
  41915. styles: "right:0"
  41916. } : 0);
  41917. const BottomStroke = /*#__PURE__*/emotion_styled_base_browser_esm(HorizontalStroke, true ? {
  41918. target: "eaw9yqk1"
  41919. } : 0)( true ? {
  41920. name: "8tapst",
  41921. styles: "bottom:0"
  41922. } : 0);
  41923. const LeftStroke = /*#__PURE__*/emotion_styled_base_browser_esm(VerticalStroke, true ? {
  41924. target: "eaw9yqk0"
  41925. } : 0)( true ? {
  41926. name: "1ode3cm",
  41927. styles: "left:0"
  41928. } : 0);
  41929. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/icon.js
  41930. /**
  41931. * Internal dependencies
  41932. */
  41933. const BASE_ICON_SIZE = 24;
  41934. function BoxControlIcon(_ref) {
  41935. let {
  41936. size = 24,
  41937. side = 'all',
  41938. sides,
  41939. ...props
  41940. } = _ref;
  41941. const isSideDisabled = value => (sides === null || sides === void 0 ? void 0 : sides.length) && !sides.includes(value);
  41942. const hasSide = value => {
  41943. if (isSideDisabled(value)) {
  41944. return false;
  41945. }
  41946. return side === 'all' || side === value;
  41947. };
  41948. const top = hasSide('top') || hasSide('vertical');
  41949. const right = hasSide('right') || hasSide('horizontal');
  41950. const bottom = hasSide('bottom') || hasSide('vertical');
  41951. const left = hasSide('left') || hasSide('horizontal'); // Simulates SVG Icon scaling.
  41952. const scale = size / BASE_ICON_SIZE;
  41953. return (0,external_wp_element_namespaceObject.createElement)(box_control_icon_styles_Root, extends_extends({
  41954. style: {
  41955. transform: `scale(${scale})`
  41956. }
  41957. }, props), (0,external_wp_element_namespaceObject.createElement)(Viewbox, null, (0,external_wp_element_namespaceObject.createElement)(TopStroke, {
  41958. isFocused: top
  41959. }), (0,external_wp_element_namespaceObject.createElement)(RightStroke, {
  41960. isFocused: right
  41961. }), (0,external_wp_element_namespaceObject.createElement)(BottomStroke, {
  41962. isFocused: bottom
  41963. }), (0,external_wp_element_namespaceObject.createElement)(LeftStroke, {
  41964. isFocused: left
  41965. })));
  41966. }
  41967. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/linked-button.js
  41968. /**
  41969. * WordPress dependencies
  41970. */
  41971. /**
  41972. * Internal dependencies
  41973. */
  41974. function LinkedButton(_ref) {
  41975. let {
  41976. isLinked,
  41977. ...props
  41978. } = _ref;
  41979. const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink Sides') : (0,external_wp_i18n_namespaceObject.__)('Link Sides');
  41980. return (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  41981. text: label
  41982. }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({}, props, {
  41983. className: "component-box-control__linked-button",
  41984. variant: isLinked ? 'primary' : 'secondary',
  41985. isSmall: true,
  41986. icon: isLinked ? library_link : link_off,
  41987. iconSize: 16,
  41988. "aria-label": label
  41989. }))));
  41990. }
  41991. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/styles/box-control-visualizer-styles.js
  41992. function box_control_visualizer_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  41993. /**
  41994. * External dependencies
  41995. */
  41996. /**
  41997. * Internal dependencies
  41998. */
  41999. var box_control_visualizer_styles_ref = true ? {
  42000. name: "11f5o9n",
  42001. styles: "bottom:0;left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:1"
  42002. } : 0;
  42003. const containerPositionStyles = _ref2 => {
  42004. let {
  42005. isPositionAbsolute
  42006. } = _ref2;
  42007. if (!isPositionAbsolute) return '';
  42008. return box_control_visualizer_styles_ref;
  42009. };
  42010. const box_control_visualizer_styles_Container = emotion_styled_base_browser_esm("div", true ? {
  42011. target: "e1df9b4q5"
  42012. } : 0)("box-sizing:border-box;position:relative;", containerPositionStyles, ";" + ( true ? "" : 0));
  42013. const Side = emotion_styled_base_browser_esm("div", true ? {
  42014. target: "e1df9b4q4"
  42015. } : 0)("box-sizing:border-box;background:", COLORS.blue.wordpress[700], ";background:", COLORS.ui.theme, ";filter:brightness( 1 );opacity:0;position:absolute;pointer-events:none;transition:opacity 120ms linear;z-index:1;", _ref3 => {
  42016. let {
  42017. isActive
  42018. } = _ref3;
  42019. return isActive && `
  42020. opacity: 0.3;
  42021. `;
  42022. }, ";" + ( true ? "" : 0));
  42023. const TopView = /*#__PURE__*/emotion_styled_base_browser_esm(Side, true ? {
  42024. target: "e1df9b4q3"
  42025. } : 0)( true ? {
  42026. name: "5i97ct",
  42027. styles: "top:0;left:0;right:0"
  42028. } : 0);
  42029. const RightView = /*#__PURE__*/emotion_styled_base_browser_esm(Side, true ? {
  42030. target: "e1df9b4q2"
  42031. } : 0)("top:0;bottom:0;", rtl({
  42032. right: 0
  42033. }), ";" + ( true ? "" : 0));
  42034. const BottomView = /*#__PURE__*/emotion_styled_base_browser_esm(Side, true ? {
  42035. target: "e1df9b4q1"
  42036. } : 0)( true ? {
  42037. name: "8cxke2",
  42038. styles: "bottom:0;left:0;right:0"
  42039. } : 0);
  42040. const LeftView = /*#__PURE__*/emotion_styled_base_browser_esm(Side, true ? {
  42041. target: "e1df9b4q0"
  42042. } : 0)("top:0;bottom:0;", rtl({
  42043. left: 0
  42044. }), ";" + ( true ? "" : 0));
  42045. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/visualizer.js
  42046. /**
  42047. * WordPress dependencies
  42048. */
  42049. /**
  42050. * Internal dependencies
  42051. */
  42052. function BoxControlVisualizer(_ref) {
  42053. let {
  42054. children,
  42055. showValues = DEFAULT_VISUALIZER_VALUES,
  42056. values: valuesProp = DEFAULT_VALUES,
  42057. ...props
  42058. } = _ref;
  42059. const isPositionAbsolute = !children;
  42060. return (0,external_wp_element_namespaceObject.createElement)(box_control_visualizer_styles_Container, extends_extends({}, props, {
  42061. isPositionAbsolute: isPositionAbsolute,
  42062. "aria-hidden": "true"
  42063. }), (0,external_wp_element_namespaceObject.createElement)(Sides, {
  42064. showValues: showValues,
  42065. values: valuesProp
  42066. }), children);
  42067. }
  42068. function Sides(_ref2) {
  42069. let {
  42070. showValues = DEFAULT_VISUALIZER_VALUES,
  42071. values
  42072. } = _ref2;
  42073. const {
  42074. top,
  42075. right,
  42076. bottom,
  42077. left
  42078. } = values;
  42079. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(Top, {
  42080. isVisible: showValues.top,
  42081. value: top
  42082. }), (0,external_wp_element_namespaceObject.createElement)(Right, {
  42083. isVisible: showValues.right,
  42084. value: right
  42085. }), (0,external_wp_element_namespaceObject.createElement)(Bottom, {
  42086. isVisible: showValues.bottom,
  42087. value: bottom
  42088. }), (0,external_wp_element_namespaceObject.createElement)(Left, {
  42089. isVisible: showValues.left,
  42090. value: left
  42091. }));
  42092. }
  42093. function Top(_ref3) {
  42094. let {
  42095. isVisible = false,
  42096. value
  42097. } = _ref3;
  42098. const height = value;
  42099. const animationProps = useSideAnimation(height);
  42100. const isActive = animationProps.isActive || isVisible;
  42101. return (0,external_wp_element_namespaceObject.createElement)(TopView, {
  42102. isActive: isActive,
  42103. style: {
  42104. height
  42105. }
  42106. });
  42107. }
  42108. function Right(_ref4) {
  42109. let {
  42110. isVisible = false,
  42111. value
  42112. } = _ref4;
  42113. const width = value;
  42114. const animationProps = useSideAnimation(width);
  42115. const isActive = animationProps.isActive || isVisible;
  42116. return (0,external_wp_element_namespaceObject.createElement)(RightView, {
  42117. isActive: isActive,
  42118. style: {
  42119. width
  42120. }
  42121. });
  42122. }
  42123. function Bottom(_ref5) {
  42124. let {
  42125. isVisible = false,
  42126. value
  42127. } = _ref5;
  42128. const height = value;
  42129. const animationProps = useSideAnimation(height);
  42130. const isActive = animationProps.isActive || isVisible;
  42131. return (0,external_wp_element_namespaceObject.createElement)(BottomView, {
  42132. isActive: isActive,
  42133. style: {
  42134. height
  42135. }
  42136. });
  42137. }
  42138. function Left(_ref6) {
  42139. let {
  42140. isVisible = false,
  42141. value
  42142. } = _ref6;
  42143. const width = value;
  42144. const animationProps = useSideAnimation(width);
  42145. const isActive = animationProps.isActive || isVisible;
  42146. return (0,external_wp_element_namespaceObject.createElement)(LeftView, {
  42147. isActive: isActive,
  42148. style: {
  42149. width
  42150. }
  42151. });
  42152. }
  42153. /**
  42154. * Custom hook that renders the "flash" animation whenever the value changes.
  42155. *
  42156. * @param {string} value Value of (box) side.
  42157. */
  42158. function useSideAnimation(value) {
  42159. const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false);
  42160. const valueRef = (0,external_wp_element_namespaceObject.useRef)(value);
  42161. const timeoutRef = (0,external_wp_element_namespaceObject.useRef)();
  42162. const clearTimer = () => {
  42163. if (timeoutRef.current) {
  42164. window.clearTimeout(timeoutRef.current);
  42165. }
  42166. };
  42167. (0,external_wp_element_namespaceObject.useEffect)(() => {
  42168. if (value !== valueRef.current) {
  42169. setIsActive(true);
  42170. valueRef.current = value;
  42171. clearTimer();
  42172. timeoutRef.current = setTimeout(() => {
  42173. setIsActive(false);
  42174. }, 400);
  42175. }
  42176. return () => clearTimer();
  42177. }, [value]);
  42178. return {
  42179. isActive
  42180. };
  42181. }
  42182. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/index.js
  42183. /**
  42184. * External dependencies
  42185. */
  42186. /**
  42187. * WordPress dependencies
  42188. */
  42189. /**
  42190. * Internal dependencies
  42191. */
  42192. const defaultInputProps = {
  42193. min: 0
  42194. };
  42195. function box_control_useUniqueId(idProp) {
  42196. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BoxControl, 'inspector-box-control');
  42197. return idProp || instanceId;
  42198. }
  42199. function BoxControl(_ref) {
  42200. let {
  42201. id: idProp,
  42202. inputProps = defaultInputProps,
  42203. onChange = external_lodash_namespaceObject.noop,
  42204. onChangeShowVisualizer = external_lodash_namespaceObject.noop,
  42205. label = (0,external_wp_i18n_namespaceObject.__)('Box Control'),
  42206. values: valuesProp,
  42207. units,
  42208. sides,
  42209. splitOnAxis = false,
  42210. allowReset = true,
  42211. resetValues = DEFAULT_VALUES
  42212. } = _ref;
  42213. const [values, setValues] = use_controlled_state(valuesProp, {
  42214. fallback: DEFAULT_VALUES
  42215. });
  42216. const inputValues = values || DEFAULT_VALUES;
  42217. const hasInitialValue = isValuesDefined(valuesProp);
  42218. const hasOneSide = (sides === null || sides === void 0 ? void 0 : sides.length) === 1;
  42219. const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(hasInitialValue);
  42220. const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(!hasInitialValue || !isValuesMixed(inputValues) || hasOneSide);
  42221. const [side, setSide] = (0,external_wp_element_namespaceObject.useState)(getInitialSide(isLinked, splitOnAxis)); // Tracking selected units via internal state allows filtering of CSS unit
  42222. // only values from being saved while maintaining preexisting unit selection
  42223. // behaviour. Filtering CSS only values prevents invalid style values.
  42224. const [selectedUnits, setSelectedUnits] = (0,external_wp_element_namespaceObject.useState)({
  42225. top: parseQuantityAndUnitFromRawValue(valuesProp === null || valuesProp === void 0 ? void 0 : valuesProp.top)[1],
  42226. right: parseQuantityAndUnitFromRawValue(valuesProp === null || valuesProp === void 0 ? void 0 : valuesProp.right)[1],
  42227. bottom: parseQuantityAndUnitFromRawValue(valuesProp === null || valuesProp === void 0 ? void 0 : valuesProp.bottom)[1],
  42228. left: parseQuantityAndUnitFromRawValue(valuesProp === null || valuesProp === void 0 ? void 0 : valuesProp.left)[1]
  42229. });
  42230. const id = box_control_useUniqueId(idProp);
  42231. const headingId = `${id}-heading`;
  42232. const toggleLinked = () => {
  42233. setIsLinked(!isLinked);
  42234. setSide(getInitialSide(!isLinked, splitOnAxis));
  42235. };
  42236. const handleOnFocus = (event, _ref2) => {
  42237. let {
  42238. side: nextSide
  42239. } = _ref2;
  42240. setSide(nextSide);
  42241. };
  42242. const handleOnChange = nextValues => {
  42243. onChange(nextValues);
  42244. setValues(nextValues);
  42245. setIsDirty(true);
  42246. };
  42247. const handleOnHoverOn = function () {
  42248. let next = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  42249. onChangeShowVisualizer({ ...DEFAULT_VISUALIZER_VALUES,
  42250. ...next
  42251. });
  42252. };
  42253. const handleOnHoverOff = function () {
  42254. let next = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  42255. onChangeShowVisualizer({ ...DEFAULT_VISUALIZER_VALUES,
  42256. ...next
  42257. });
  42258. };
  42259. const handleOnReset = () => {
  42260. onChange(resetValues);
  42261. setValues(resetValues);
  42262. setSelectedUnits(resetValues);
  42263. setIsDirty(false);
  42264. };
  42265. const inputControlProps = { ...inputProps,
  42266. onChange: handleOnChange,
  42267. onFocus: handleOnFocus,
  42268. onHoverOn: handleOnHoverOn,
  42269. onHoverOff: handleOnHoverOff,
  42270. isLinked,
  42271. units,
  42272. selectedUnits,
  42273. setSelectedUnits,
  42274. sides,
  42275. values: inputValues
  42276. };
  42277. return (0,external_wp_element_namespaceObject.createElement)(box_control_styles_Root, {
  42278. id: id,
  42279. role: "region",
  42280. "aria-labelledby": headingId
  42281. }, (0,external_wp_element_namespaceObject.createElement)(Header, {
  42282. className: "component-box-control__header"
  42283. }, (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(text_component, {
  42284. id: headingId,
  42285. className: "component-box-control__label"
  42286. }, label)), allowReset && (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  42287. className: "component-box-control__reset-button",
  42288. isSecondary: true,
  42289. isSmall: true,
  42290. onClick: handleOnReset,
  42291. disabled: !isDirty
  42292. }, (0,external_wp_i18n_namespaceObject.__)('Reset')))), (0,external_wp_element_namespaceObject.createElement)(HeaderControlWrapper, {
  42293. className: "component-box-control__header-control-wrapper"
  42294. }, (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(BoxControlIcon, {
  42295. side: side,
  42296. sides: sides
  42297. })), isLinked && (0,external_wp_element_namespaceObject.createElement)(flex_block_component, null, (0,external_wp_element_namespaceObject.createElement)(AllInputControl, extends_extends({
  42298. "aria-label": label
  42299. }, inputControlProps))), !isLinked && splitOnAxis && (0,external_wp_element_namespaceObject.createElement)(flex_block_component, null, (0,external_wp_element_namespaceObject.createElement)(AxialInputControls, inputControlProps)), !hasOneSide && (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(LinkedButton, {
  42300. onClick: toggleLinked,
  42301. isLinked: isLinked
  42302. }))), !isLinked && !splitOnAxis && (0,external_wp_element_namespaceObject.createElement)(BoxInputControls, inputControlProps));
  42303. }
  42304. BoxControl.__Visualizer = BoxControlVisualizer;
  42305. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/button-group/index.js
  42306. /**
  42307. * External dependencies
  42308. */
  42309. /**
  42310. * WordPress dependencies
  42311. */
  42312. function ButtonGroup(_ref, ref) {
  42313. let {
  42314. className,
  42315. ...props
  42316. } = _ref;
  42317. const classes = classnames_default()('components-button-group', className);
  42318. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({
  42319. ref: ref,
  42320. role: "group",
  42321. className: classes
  42322. }, props));
  42323. }
  42324. /* harmony default export */ var button_group = ((0,external_wp_element_namespaceObject.forwardRef)(ButtonGroup));
  42325. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/elevation/styles.js
  42326. function elevation_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  42327. /**
  42328. * External dependencies
  42329. */
  42330. const Elevation = true ? {
  42331. name: "12ip69d",
  42332. styles: "background:transparent;display:block;margin:0!important;pointer-events:none;position:absolute;will-change:box-shadow"
  42333. } : 0;
  42334. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/elevation/hook.js
  42335. /**
  42336. * External dependencies
  42337. */
  42338. /**
  42339. * WordPress dependencies
  42340. */
  42341. /**
  42342. * Internal dependencies
  42343. */
  42344. /**
  42345. * @param {number} value
  42346. * @return {string} The box shadow value.
  42347. */
  42348. function getBoxShadow(value) {
  42349. const boxShadowColor = `rgba(0 ,0, 0, ${value / 20})`;
  42350. const boxShadow = `0 ${value}px ${value * 2}px 0
  42351. ${boxShadowColor}`;
  42352. return boxShadow;
  42353. }
  42354. /**
  42355. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
  42356. */
  42357. function useElevation(props) {
  42358. const {
  42359. active,
  42360. borderRadius = 'inherit',
  42361. className,
  42362. focus,
  42363. hover,
  42364. isInteractive = false,
  42365. offset = 0,
  42366. value = 0,
  42367. ...otherProps
  42368. } = useContextSystem(props, 'Elevation');
  42369. const cx = useCx();
  42370. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  42371. /** @type {number | undefined} */
  42372. let hoverValue = !(0,external_lodash_namespaceObject.isNil)(hover) ? hover : value * 2;
  42373. /** @type {number | undefined} */
  42374. let activeValue = !(0,external_lodash_namespaceObject.isNil)(active) ? active : value / 2;
  42375. if (!isInteractive) {
  42376. hoverValue = !(0,external_lodash_namespaceObject.isNil)(hover) ? hover : undefined;
  42377. activeValue = !(0,external_lodash_namespaceObject.isNil)(active) ? active : undefined;
  42378. }
  42379. const transition = `box-shadow ${config_values.transitionDuration} ${config_values.transitionTimingFunction}`;
  42380. const sx = {};
  42381. sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({
  42382. borderRadius,
  42383. bottom: offset,
  42384. boxShadow: getBoxShadow(value),
  42385. opacity: config_values.elevationIntensity,
  42386. left: offset,
  42387. right: offset,
  42388. top: offset,
  42389. transition
  42390. }, reduceMotion('transition'), true ? "" : 0, true ? "" : 0);
  42391. if (!(0,external_lodash_namespaceObject.isNil)(hoverValue)) {
  42392. sx.hover = /*#__PURE__*/emotion_react_browser_esm_css("*:hover>&{box-shadow:", getBoxShadow(hoverValue), ";}" + ( true ? "" : 0), true ? "" : 0);
  42393. }
  42394. if (!(0,external_lodash_namespaceObject.isNil)(activeValue)) {
  42395. sx.active = /*#__PURE__*/emotion_react_browser_esm_css("*:active>&{box-shadow:", getBoxShadow(activeValue), ";}" + ( true ? "" : 0), true ? "" : 0);
  42396. }
  42397. if (!(0,external_lodash_namespaceObject.isNil)(focus)) {
  42398. sx.focus = /*#__PURE__*/emotion_react_browser_esm_css("*:focus>&{box-shadow:", getBoxShadow(focus), ";}" + ( true ? "" : 0), true ? "" : 0);
  42399. }
  42400. return cx(Elevation, sx.Base, sx.hover && sx.hover, sx.focus && sx.focus, sx.active && sx.active, className);
  42401. }, [active, borderRadius, className, cx, focus, hover, isInteractive, offset, value]);
  42402. return { ...otherProps,
  42403. className: classes,
  42404. 'aria-hidden': true
  42405. };
  42406. }
  42407. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/elevation/component.js
  42408. /**
  42409. * Internal dependencies
  42410. */
  42411. /**
  42412. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
  42413. * @param {import('react').ForwardedRef<any>} forwardedRef
  42414. */
  42415. function component_Elevation(props, forwardedRef) {
  42416. const elevationProps = useElevation(props);
  42417. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, elevationProps, {
  42418. ref: forwardedRef
  42419. }));
  42420. }
  42421. /**
  42422. * `Elevation` is a core component that renders shadow, using the library's shadow system.
  42423. *
  42424. * The shadow effect is generated using the `value` prop.
  42425. *
  42426. * @example
  42427. * ```jsx
  42428. * import {
  42429. * __experimentalElevation as Elevation,
  42430. * __experimentalSurface as Surface,
  42431. * __experimentalText as Text,
  42432. * } from '@wordpress/components';
  42433. *
  42434. * function Example() {
  42435. * return (
  42436. * <Surface>
  42437. * <Text>Code is Poetry</Text>
  42438. * <Elevation value={ 5 } />
  42439. * </Surface>
  42440. * );
  42441. * }
  42442. * ```
  42443. */
  42444. const ConnectedElevation = contextConnect(component_Elevation, 'Elevation');
  42445. /* harmony default export */ var elevation_component = (ConnectedElevation);
  42446. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/styles.js
  42447. function card_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  42448. /**
  42449. * External dependencies
  42450. */
  42451. /**
  42452. * Internal dependencies
  42453. */
  42454. // Since the border for `Card` is rendered via the `box-shadow` property
  42455. // (as opposed to the `border` property), the value of the border radius needs
  42456. // to be adjusted by removing 1px (this is because the `box-shadow` renders
  42457. // as an "outer radius").
  42458. const adjustedBorderRadius = `calc(${config_values.cardBorderRadius} - 1px)`;
  42459. const Card = /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:0 0 0 1px ", config_values.surfaceBorderColor, ";outline:none;" + ( true ? "" : 0), true ? "" : 0);
  42460. const styles_Header = true ? {
  42461. name: "1showjb",
  42462. styles: "border-bottom:1px solid;box-sizing:border-box;&:last-child{border-bottom:none;}"
  42463. } : 0;
  42464. const Footer = true ? {
  42465. name: "14n5oej",
  42466. styles: "border-top:1px solid;box-sizing:border-box;&:first-of-type{border-top:none;}"
  42467. } : 0;
  42468. const Content = true ? {
  42469. name: "13udsys",
  42470. styles: "height:100%"
  42471. } : 0;
  42472. const Body = true ? {
  42473. name: "6ywzd",
  42474. styles: "box-sizing:border-box;height:auto;max-height:100%"
  42475. } : 0;
  42476. const Media = true ? {
  42477. name: "dq805e",
  42478. styles: "box-sizing:border-box;overflow:hidden;&>img,&>iframe{display:block;height:auto;max-width:100%;width:100%;}"
  42479. } : 0;
  42480. const Divider = true ? {
  42481. name: "c990dr",
  42482. styles: "box-sizing:border-box;display:block;width:100%"
  42483. } : 0;
  42484. const borderRadius = /*#__PURE__*/emotion_react_browser_esm_css("&:first-of-type{border-top-left-radius:", adjustedBorderRadius, ";border-top-right-radius:", adjustedBorderRadius, ";}&:last-of-type{border-bottom-left-radius:", adjustedBorderRadius, ";border-bottom-right-radius:", adjustedBorderRadius, ";}" + ( true ? "" : 0), true ? "" : 0);
  42485. const borderColor = /*#__PURE__*/emotion_react_browser_esm_css("border-color:", config_values.colorDivider, ";" + ( true ? "" : 0), true ? "" : 0);
  42486. const boxShadowless = true ? {
  42487. name: "1t90u8d",
  42488. styles: "box-shadow:none"
  42489. } : 0;
  42490. const borderless = true ? {
  42491. name: "1e1ncky",
  42492. styles: "border:none"
  42493. } : 0;
  42494. const rounded = /*#__PURE__*/emotion_react_browser_esm_css("border-radius:", adjustedBorderRadius, ";" + ( true ? "" : 0), true ? "" : 0);
  42495. const xSmallCardPadding = /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingXSmall, ";" + ( true ? "" : 0), true ? "" : 0);
  42496. const cardPaddings = {
  42497. large: /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingLarge, ";" + ( true ? "" : 0), true ? "" : 0),
  42498. medium: /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingMedium, ";" + ( true ? "" : 0), true ? "" : 0),
  42499. small: /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingSmall, ";" + ( true ? "" : 0), true ? "" : 0),
  42500. xSmall: xSmallCardPadding,
  42501. // The `extraSmall` size is not officially documented, but the following styles
  42502. // are kept for legacy reasons to support older values of the `size` prop.
  42503. extraSmall: xSmallCardPadding
  42504. };
  42505. const shady = /*#__PURE__*/emotion_react_browser_esm_css("background-color:", COLORS.lightGray[200], ";" + ( true ? "" : 0), true ? "" : 0);
  42506. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/surface/styles.js
  42507. /**
  42508. * External dependencies
  42509. */
  42510. /**
  42511. * Internal dependencies
  42512. */
  42513. const Surface = /*#__PURE__*/emotion_react_browser_esm_css("background-color:", config_values.surfaceColor, ";color:", COLORS.darkGray.primary, ";position:relative;" + ( true ? "" : 0), true ? "" : 0);
  42514. const background = /*#__PURE__*/emotion_react_browser_esm_css("background-color:", config_values.surfaceBackgroundColor, ";" + ( true ? "" : 0), true ? "" : 0);
  42515. /**
  42516. * @param {Object} props
  42517. * @param {boolean} [props.borderBottom]
  42518. * @param {boolean} [props.borderLeft]
  42519. * @param {boolean} [props.borderRight]
  42520. * @param {boolean} [props.borderTop]
  42521. */
  42522. function getBorders(_ref) {
  42523. let {
  42524. borderBottom,
  42525. borderLeft,
  42526. borderRight,
  42527. borderTop
  42528. } = _ref;
  42529. const borderStyle = `1px solid ${config_values.surfaceBorderColor}`;
  42530. return /*#__PURE__*/emotion_react_browser_esm_css({
  42531. borderBottom: borderBottom ? borderStyle : undefined,
  42532. borderLeft: borderLeft ? borderStyle : undefined,
  42533. borderRight: borderRight ? borderStyle : undefined,
  42534. borderTop: borderTop ? borderStyle : undefined
  42535. }, true ? "" : 0, true ? "" : 0);
  42536. }
  42537. const primary = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
  42538. const secondary = /*#__PURE__*/emotion_react_browser_esm_css("background:", config_values.surfaceBackgroundTintColor, ";" + ( true ? "" : 0), true ? "" : 0);
  42539. const tertiary = /*#__PURE__*/emotion_react_browser_esm_css("background:", config_values.surfaceBackgroundTertiaryColor, ";" + ( true ? "" : 0), true ? "" : 0);
  42540. /**
  42541. * @param {string} surfaceBackgroundSize
  42542. */
  42543. const customBackgroundSize = surfaceBackgroundSize => [surfaceBackgroundSize, surfaceBackgroundSize].join(' ');
  42544. /**
  42545. * @param {string} surfaceBackgroundSizeDotted
  42546. */
  42547. const dottedBackground1 = surfaceBackgroundSizeDotted => ['90deg', [config_values.surfaceBackgroundColor, surfaceBackgroundSizeDotted].join(' '), 'transparent 1%'].join(',');
  42548. /**
  42549. * @param {string} surfaceBackgroundSizeDotted
  42550. */
  42551. const dottedBackground2 = surfaceBackgroundSizeDotted => [[config_values.surfaceBackgroundColor, surfaceBackgroundSizeDotted].join(' '), 'transparent 1%'].join(',');
  42552. /**
  42553. * @param {string} surfaceBackgroundSizeDotted
  42554. */
  42555. const dottedBackgroundCombined = surfaceBackgroundSizeDotted => [`linear-gradient( ${dottedBackground1(surfaceBackgroundSizeDotted)} ) center`, `linear-gradient( ${dottedBackground2(surfaceBackgroundSizeDotted)} ) center`, config_values.surfaceBorderBoldColor].join(',');
  42556. /**
  42557. *
  42558. * @param {string} surfaceBackgroundSize
  42559. * @param {string} surfaceBackgroundSizeDotted
  42560. */
  42561. const getDotted = (surfaceBackgroundSize, surfaceBackgroundSizeDotted) => /*#__PURE__*/emotion_react_browser_esm_css("background:", dottedBackgroundCombined(surfaceBackgroundSizeDotted), ";background-size:", customBackgroundSize(surfaceBackgroundSize), ";" + ( true ? "" : 0), true ? "" : 0);
  42562. const gridBackground1 = [`${config_values.surfaceBorderSubtleColor} 1px`, 'transparent 1px'].join(',');
  42563. const gridBackground2 = ['90deg', `${config_values.surfaceBorderSubtleColor} 1px`, 'transparent 1px'].join(',');
  42564. const gridBackgroundCombined = [`linear-gradient( ${gridBackground1} )`, `linear-gradient( ${gridBackground2} )`].join(',');
  42565. /**
  42566. * @param {string} surfaceBackgroundSize
  42567. * @return {import('@emotion/react').SerializedStyles} CSS.
  42568. */
  42569. const getGrid = surfaceBackgroundSize => {
  42570. return /*#__PURE__*/emotion_react_browser_esm_css("background:", config_values.surfaceBackgroundColor, ";background-image:", gridBackgroundCombined, ";background-size:", customBackgroundSize(surfaceBackgroundSize), ";" + ( true ? "" : 0), true ? "" : 0);
  42571. };
  42572. /**
  42573. * @param {'dotted' | 'grid' | 'primary' | 'secondary' | 'tertiary'} variant
  42574. * @param {string} surfaceBackgroundSize
  42575. * @param {string} surfaceBackgroundSizeDotted
  42576. */
  42577. const getVariant = (variant, surfaceBackgroundSize, surfaceBackgroundSizeDotted) => {
  42578. switch (variant) {
  42579. case 'dotted':
  42580. {
  42581. return getDotted(surfaceBackgroundSize, surfaceBackgroundSizeDotted);
  42582. }
  42583. case 'grid':
  42584. {
  42585. return getGrid(surfaceBackgroundSize);
  42586. }
  42587. case 'primary':
  42588. {
  42589. return primary;
  42590. }
  42591. case 'secondary':
  42592. {
  42593. return secondary;
  42594. }
  42595. case 'tertiary':
  42596. {
  42597. return tertiary;
  42598. }
  42599. }
  42600. };
  42601. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/surface/hook.js
  42602. /**
  42603. * WordPress dependencies
  42604. */
  42605. /**
  42606. * Internal dependencies
  42607. */
  42608. /**
  42609. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
  42610. */
  42611. function useSurface(props) {
  42612. const {
  42613. backgroundSize = 12,
  42614. borderBottom = false,
  42615. borderLeft = false,
  42616. borderRight = false,
  42617. borderTop = false,
  42618. className,
  42619. variant = 'primary',
  42620. ...otherProps
  42621. } = useContextSystem(props, 'Surface');
  42622. const cx = useCx();
  42623. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  42624. const sx = {};
  42625. sx.borders = getBorders({
  42626. borderBottom,
  42627. borderLeft,
  42628. borderRight,
  42629. borderTop
  42630. });
  42631. return cx(Surface, sx.borders, getVariant(variant, `${backgroundSize}px`, `${backgroundSize - 1}px`), className);
  42632. }, [backgroundSize, borderBottom, borderLeft, borderRight, borderTop, className, cx, variant]);
  42633. return { ...otherProps,
  42634. className: classes
  42635. };
  42636. }
  42637. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card/hook.js
  42638. /**
  42639. * WordPress dependencies
  42640. */
  42641. /**
  42642. * Internal dependencies
  42643. */
  42644. /**
  42645. * @param {import('../../ui/context').WordPressComponentProps<import('../types').Props, 'div'>} props
  42646. */
  42647. function card_hook_useDeprecatedProps(_ref) {
  42648. let {
  42649. elevation,
  42650. isElevated,
  42651. ...otherProps
  42652. } = _ref;
  42653. /**@type {import('../../ui/context').WordPressComponentProps<import('../types').Props, 'div'>} */
  42654. const propsToReturn = { ...otherProps
  42655. };
  42656. let computedElevation = elevation;
  42657. if (isElevated) {
  42658. var _computedElevation;
  42659. external_wp_deprecated_default()('Card isElevated prop', {
  42660. since: '5.9',
  42661. alternative: 'elevation'
  42662. });
  42663. (_computedElevation = computedElevation) !== null && _computedElevation !== void 0 ? _computedElevation : computedElevation = 2;
  42664. } // The `elevation` prop should only be passed when it's not `undefined`,
  42665. // otherwise it will override the value that gets derived from `useContextSystem`.
  42666. if (typeof computedElevation !== 'undefined') {
  42667. propsToReturn.elevation = computedElevation;
  42668. }
  42669. return propsToReturn;
  42670. }
  42671. /**
  42672. * @param {import('../../ui/context').WordPressComponentProps<import('../types').Props, 'div'>} props
  42673. */
  42674. function useCard(props) {
  42675. const {
  42676. className,
  42677. elevation = 0,
  42678. isBorderless = false,
  42679. isRounded = true,
  42680. size = 'medium',
  42681. ...otherProps
  42682. } = useContextSystem(card_hook_useDeprecatedProps(props), 'Card');
  42683. const cx = useCx();
  42684. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  42685. return cx(Card, isBorderless && boxShadowless, isRounded && rounded, className);
  42686. }, [className, cx, isBorderless, isRounded]);
  42687. const surfaceProps = useSurface({ ...otherProps,
  42688. className: classes
  42689. });
  42690. return { ...surfaceProps,
  42691. elevation,
  42692. isBorderless,
  42693. isRounded,
  42694. size
  42695. };
  42696. }
  42697. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card/component.js
  42698. /**
  42699. * External dependencies
  42700. */
  42701. /**
  42702. * WordPress dependencies
  42703. */
  42704. /**
  42705. * Internal dependencies
  42706. */
  42707. /**
  42708. * @param {import('../../ui/context').WordPressComponentProps<import('../types').Props, 'div'>} props
  42709. * @param {import('react').ForwardedRef<any>} forwardedRef
  42710. */
  42711. function component_Card(props, forwardedRef) {
  42712. const {
  42713. children,
  42714. elevation,
  42715. isBorderless,
  42716. isRounded,
  42717. size,
  42718. ...otherProps
  42719. } = useCard(props);
  42720. const elevationBorderRadius = isRounded ? config_values.cardBorderRadius : 0;
  42721. const cx = useCx();
  42722. const elevationClassName = (0,external_wp_element_namespaceObject.useMemo)(() => cx( /*#__PURE__*/emotion_react_browser_esm_css({
  42723. borderRadius: elevationBorderRadius
  42724. }, true ? "" : 0, true ? "" : 0)), [cx, elevationBorderRadius]);
  42725. const contextProviderValue = (0,external_wp_element_namespaceObject.useMemo)(() => {
  42726. const contextProps = {
  42727. size,
  42728. isBorderless
  42729. };
  42730. return {
  42731. CardBody: contextProps,
  42732. CardHeader: contextProps,
  42733. CardFooter: contextProps
  42734. };
  42735. }, [isBorderless, size]);
  42736. return (0,external_wp_element_namespaceObject.createElement)(ContextSystemProvider, {
  42737. value: contextProviderValue
  42738. }, (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  42739. ref: forwardedRef
  42740. }), (0,external_wp_element_namespaceObject.createElement)(component, {
  42741. className: cx(Content)
  42742. }, children), (0,external_wp_element_namespaceObject.createElement)(elevation_component, {
  42743. className: elevationClassName,
  42744. isInteractive: false,
  42745. value: elevation ? 1 : 0
  42746. }), (0,external_wp_element_namespaceObject.createElement)(elevation_component, {
  42747. className: elevationClassName,
  42748. isInteractive: false,
  42749. value: elevation
  42750. })));
  42751. }
  42752. /**
  42753. * `Card` provides a flexible and extensible content container.
  42754. * `Card` also provides a convenient set of sub-components such as `CardBody`,
  42755. * `CardHeader`, `CardFooter`, and more.
  42756. *
  42757. * @example
  42758. * ```jsx
  42759. * import {
  42760. * Card,
  42761. * CardHeader,
  42762. * CardBody,
  42763. * CardFooter,
  42764. * Text,
  42765. * Heading,
  42766. * } from `@wordpress/components`;
  42767. *
  42768. * function Example() {
  42769. * return (
  42770. * <Card>
  42771. * <CardHeader>
  42772. * <Heading size={ 4 }>Card Title</Heading>
  42773. * </CardHeader>
  42774. * <CardBody>
  42775. * <Text>Card Content</Text>
  42776. * </CardBody>
  42777. * <CardFooter>
  42778. * <Text>Card Footer</Text>
  42779. * </CardFooter>
  42780. * </Card>
  42781. * );
  42782. * }
  42783. * ```
  42784. */
  42785. const ConnectedCard = contextConnect(component_Card, 'Card');
  42786. /* harmony default export */ var card_component = (ConnectedCard);
  42787. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scrollable/styles.js
  42788. function scrollable_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  42789. /**
  42790. * External dependencies
  42791. */
  42792. /**
  42793. * Internal dependencies
  42794. */
  42795. const scrollableScrollbar = /*#__PURE__*/emotion_react_browser_esm_css("@media only screen and ( min-device-width: 40em ){&::-webkit-scrollbar{height:12px;width:12px;}&::-webkit-scrollbar-track{background-color:transparent;}&::-webkit-scrollbar-track{background:", config_values.colorScrollbarTrack, ";border-radius:8px;}&::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:", config_values.colorScrollbarThumb, ";border:2px solid rgba( 0, 0, 0, 0 );border-radius:7px;}&:hover::-webkit-scrollbar-thumb{background-color:", config_values.colorScrollbarThumbHover, ";}}" + ( true ? "" : 0), true ? "" : 0);
  42796. const Scrollable = true ? {
  42797. name: "13udsys",
  42798. styles: "height:100%"
  42799. } : 0;
  42800. const styles_Content = true ? {
  42801. name: "bjn8wh",
  42802. styles: "position:relative"
  42803. } : 0;
  42804. const styles_smoothScroll = true ? {
  42805. name: "7zq9w",
  42806. styles: "scroll-behavior:smooth"
  42807. } : 0;
  42808. const scrollX = true ? {
  42809. name: "q33xhg",
  42810. styles: "overflow-x:auto;overflow-y:hidden"
  42811. } : 0;
  42812. const scrollY = true ? {
  42813. name: "103x71s",
  42814. styles: "overflow-x:hidden;overflow-y:auto"
  42815. } : 0;
  42816. const scrollAuto = true ? {
  42817. name: "umwchj",
  42818. styles: "overflow-y:auto"
  42819. } : 0;
  42820. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scrollable/hook.js
  42821. /**
  42822. * WordPress dependencies
  42823. */
  42824. /**
  42825. * Internal dependencies
  42826. */
  42827. /* eslint-disable jsdoc/valid-types */
  42828. /**
  42829. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
  42830. */
  42831. /* eslint-enable jsdoc/valid-types */
  42832. function useScrollable(props) {
  42833. const {
  42834. className,
  42835. scrollDirection = 'y',
  42836. smoothScroll = false,
  42837. ...otherProps
  42838. } = useContextSystem(props, 'Scrollable');
  42839. const cx = useCx();
  42840. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Scrollable, scrollableScrollbar, smoothScroll && styles_smoothScroll, scrollDirection === 'x' && scrollX, scrollDirection === 'y' && scrollY, scrollDirection === 'auto' && scrollAuto, className), [className, cx, scrollDirection, smoothScroll]);
  42841. return { ...otherProps,
  42842. className: classes
  42843. };
  42844. }
  42845. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scrollable/component.js
  42846. /**
  42847. * Internal dependencies
  42848. */
  42849. /**
  42850. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
  42851. * @param {import('react').ForwardedRef<any>} forwardedRef
  42852. */
  42853. function component_Scrollable(props, forwardedRef) {
  42854. const scrollableProps = useScrollable(props);
  42855. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, scrollableProps, {
  42856. ref: forwardedRef
  42857. }));
  42858. }
  42859. /**
  42860. * `Scrollable` is a layout component that content in a scrollable container.
  42861. *
  42862. * @example
  42863. * ```jsx
  42864. * import { __experimentalScrollable as Scrollable } from `@wordpress/components`;
  42865. *
  42866. * function Example() {
  42867. * return (
  42868. * <Scrollable style={ { maxHeight: 200 } }>
  42869. * <div style={ { height: 500 } }>...</div>
  42870. * </Scrollable>
  42871. * );
  42872. * }
  42873. * ```
  42874. */
  42875. const ConnectedScrollable = contextConnect(component_Scrollable, 'Scrollable');
  42876. /* harmony default export */ var scrollable_component = (ConnectedScrollable);
  42877. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-body/hook.js
  42878. /**
  42879. * WordPress dependencies
  42880. */
  42881. /**
  42882. * Internal dependencies
  42883. */
  42884. /**
  42885. * @param {import('../../ui/context').WordPressComponentProps<import('../types').BodyProps, 'div'>} props
  42886. */
  42887. function useCardBody(props) {
  42888. const {
  42889. className,
  42890. isScrollable = false,
  42891. isShady = false,
  42892. size = 'medium',
  42893. ...otherProps
  42894. } = useContextSystem(props, 'CardBody');
  42895. const cx = useCx();
  42896. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Body, borderRadius, cardPaddings[size], isShady && shady, // This classname is added for legacy compatibility reasons.
  42897. 'components-card__body', className), [className, cx, isShady, size]);
  42898. return { ...otherProps,
  42899. className: classes,
  42900. isScrollable
  42901. };
  42902. }
  42903. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-body/component.js
  42904. /**
  42905. * Internal dependencies
  42906. */
  42907. /**
  42908. * @param {import('../../ui/context').WordPressComponentProps<import('../types').BodyProps, 'div'>} props
  42909. * @param {import('react').ForwardedRef<any>} forwardedRef
  42910. */
  42911. function CardBody(props, forwardedRef) {
  42912. const {
  42913. isScrollable,
  42914. ...otherProps
  42915. } = useCardBody(props);
  42916. if (isScrollable) {
  42917. return (0,external_wp_element_namespaceObject.createElement)(scrollable_component, extends_extends({}, otherProps, {
  42918. ref: forwardedRef
  42919. }));
  42920. }
  42921. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  42922. ref: forwardedRef
  42923. }));
  42924. }
  42925. /**
  42926. * `CardBody` renders an optional content area for a `Card`.
  42927. * Multiple `CardBody` components can be used within `Card` if needed.
  42928. *
  42929. * @example
  42930. * ```jsx
  42931. * import { Card, CardBody } from `@wordpress/components`;
  42932. *
  42933. * <Card>
  42934. * <CardBody>
  42935. * ...
  42936. * </CardBody>
  42937. * </Card>
  42938. * ```
  42939. */
  42940. const ConnectedCardBody = contextConnect(CardBody, 'CardBody');
  42941. /* harmony default export */ var card_body_component = (ConnectedCardBody);
  42942. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Separator/Separator.js
  42943. // Automatically generated
  42944. var SEPARATOR_KEYS = ["orientation"];
  42945. var useSeparator = createHook({
  42946. name: "Separator",
  42947. compose: useRole,
  42948. keys: SEPARATOR_KEYS,
  42949. useOptions: function useOptions(_ref) {
  42950. var _ref$orientation = _ref.orientation,
  42951. orientation = _ref$orientation === void 0 ? "horizontal" : _ref$orientation,
  42952. options = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["orientation"]);
  42953. return _objectSpread2({
  42954. orientation: orientation
  42955. }, options);
  42956. },
  42957. useProps: function useProps(options, htmlProps) {
  42958. return _objectSpread2({
  42959. role: "separator",
  42960. "aria-orientation": options.orientation
  42961. }, htmlProps);
  42962. }
  42963. });
  42964. var Separator = createComponent({
  42965. as: "hr",
  42966. memo: true,
  42967. useHook: useSeparator
  42968. });
  42969. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/divider/styles.js
  42970. function divider_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  42971. /**
  42972. * External dependencies
  42973. */
  42974. /**
  42975. * Internal dependencies
  42976. */
  42977. const MARGIN_DIRECTIONS = {
  42978. vertical: {
  42979. start: 'marginLeft',
  42980. end: 'marginRight'
  42981. },
  42982. horizontal: {
  42983. start: 'marginTop',
  42984. end: 'marginBottom'
  42985. }
  42986. }; // Renders the correct margins given the Divider's `orientation` and the writing direction.
  42987. // When both the generic `margin` and the specific `marginStart|marginEnd` props are defined,
  42988. // the latter will take priority.
  42989. const renderMargin = _ref2 => {
  42990. let {
  42991. 'aria-orientation': orientation = 'horizontal',
  42992. margin,
  42993. marginStart,
  42994. marginEnd
  42995. } = _ref2;
  42996. return /*#__PURE__*/emotion_react_browser_esm_css(rtl({
  42997. [MARGIN_DIRECTIONS[orientation].start]: space(marginStart !== null && marginStart !== void 0 ? marginStart : margin),
  42998. [MARGIN_DIRECTIONS[orientation].end]: space(marginEnd !== null && marginEnd !== void 0 ? marginEnd : margin)
  42999. })(), true ? "" : 0, true ? "" : 0);
  43000. };
  43001. var styles_ref = true ? {
  43002. name: "1u4hpl4",
  43003. styles: "display:inline"
  43004. } : 0;
  43005. const renderDisplay = _ref3 => {
  43006. let {
  43007. 'aria-orientation': orientation = 'horizontal'
  43008. } = _ref3;
  43009. return orientation === 'vertical' ? styles_ref : undefined;
  43010. };
  43011. const renderBorder = _ref4 => {
  43012. let {
  43013. 'aria-orientation': orientation = 'horizontal'
  43014. } = _ref4;
  43015. return /*#__PURE__*/emotion_react_browser_esm_css({
  43016. [orientation === 'vertical' ? 'borderRight' : 'borderBottom']: '1px solid currentColor'
  43017. }, true ? "" : 0, true ? "" : 0);
  43018. };
  43019. const renderSize = _ref5 => {
  43020. let {
  43021. 'aria-orientation': orientation = 'horizontal'
  43022. } = _ref5;
  43023. return /*#__PURE__*/emotion_react_browser_esm_css({
  43024. height: orientation === 'vertical' ? 'auto' : 0,
  43025. width: orientation === 'vertical' ? 0 : 'auto'
  43026. }, true ? "" : 0, true ? "" : 0);
  43027. };
  43028. const DividerView = emotion_styled_base_browser_esm("hr", true ? {
  43029. target: "e19on6iw0"
  43030. } : 0)("border:0;margin:0;", renderDisplay, " ", renderBorder, " ", renderSize, " ", renderMargin, ";" + ( true ? "" : 0));
  43031. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/divider/component.js
  43032. /**
  43033. * External dependencies
  43034. */
  43035. // eslint-disable-next-line no-restricted-imports
  43036. /**
  43037. * Internal dependencies
  43038. */
  43039. function UnconnectedDivider(props, forwardedRef) {
  43040. const contextProps = useContextSystem(props, 'Divider');
  43041. return (0,external_wp_element_namespaceObject.createElement)(Separator, extends_extends({
  43042. as: DividerView
  43043. }, contextProps, {
  43044. ref: forwardedRef
  43045. }));
  43046. }
  43047. /**
  43048. * `Divider` is a layout component that separates groups of related content.
  43049. *
  43050. * @example
  43051. * ```js
  43052. * import {
  43053. * __experimentalDivider as Divider,
  43054. * __experimentalText as Text,
  43055. * __experimentalVStack as VStack,
  43056. * } from `@wordpress/components`;
  43057. *
  43058. * function Example() {
  43059. * return (
  43060. * <VStack spacing={4}>
  43061. * <Text>Some text here</Text>
  43062. * <Divider />
  43063. * <Text>Some more text here</Text>
  43064. * </VStack>
  43065. * );
  43066. * }
  43067. * ```
  43068. */
  43069. const component_Divider = contextConnect(UnconnectedDivider, 'Divider');
  43070. /* harmony default export */ var divider_component = (component_Divider);
  43071. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-divider/hook.js
  43072. /**
  43073. * WordPress dependencies
  43074. */
  43075. /**
  43076. * Internal dependencies
  43077. */
  43078. /**
  43079. * @param {import('../../ui/context').WordPressComponentProps<import('../../divider').DividerProps, 'hr', false>} props
  43080. */
  43081. function useCardDivider(props) {
  43082. const {
  43083. className,
  43084. ...otherProps
  43085. } = useContextSystem(props, 'CardDivider');
  43086. const cx = useCx();
  43087. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Divider, borderColor, // This classname is added for legacy compatibility reasons.
  43088. 'components-card__divider', className), [className, cx]);
  43089. return { ...otherProps,
  43090. className: classes
  43091. };
  43092. }
  43093. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-divider/component.js
  43094. /**
  43095. * Internal dependencies
  43096. */
  43097. /**
  43098. * @param {import('../../ui/context').WordPressComponentProps<import('../../divider').DividerProps, 'hr', false>} props
  43099. * @param {import('react').ForwardedRef<any>} forwardedRef
  43100. */
  43101. function CardDivider(props, forwardedRef) {
  43102. const dividerProps = useCardDivider(props);
  43103. return (0,external_wp_element_namespaceObject.createElement)(divider_component, extends_extends({}, dividerProps, {
  43104. ref: forwardedRef
  43105. }));
  43106. }
  43107. /**
  43108. * `CardDivider` renders an optional divider within a `Card`.
  43109. * It is typically used to divide multiple `CardBody` components from each other.
  43110. *
  43111. * @example
  43112. * ```jsx
  43113. * import { Card, CardBody, CardDivider } from `@wordpress/components`;
  43114. *
  43115. * <Card>
  43116. * <CardBody>...</CardBody>
  43117. * <CardDivider />
  43118. * <CardBody>...</CardBody>
  43119. * </Card>
  43120. * ```
  43121. */
  43122. const ConnectedCardDivider = contextConnect(CardDivider, 'CardDivider');
  43123. /* harmony default export */ var card_divider_component = (ConnectedCardDivider);
  43124. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-footer/hook.js
  43125. /**
  43126. * WordPress dependencies
  43127. */
  43128. /**
  43129. * Internal dependencies
  43130. */
  43131. /**
  43132. * @param {import('../../ui/context').WordPressComponentProps<import('../types').FooterProps, 'div'>} props
  43133. */
  43134. function useCardFooter(props) {
  43135. const {
  43136. className,
  43137. justify,
  43138. isBorderless = false,
  43139. isShady = false,
  43140. size = 'medium',
  43141. ...otherProps
  43142. } = useContextSystem(props, 'CardFooter');
  43143. const cx = useCx();
  43144. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Footer, borderRadius, borderColor, cardPaddings[size], isBorderless && borderless, isShady && shady, // This classname is added for legacy compatibility reasons.
  43145. 'components-card__footer', className), [className, cx, isBorderless, isShady, size]);
  43146. return { ...otherProps,
  43147. className: classes,
  43148. justify
  43149. };
  43150. }
  43151. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-footer/component.js
  43152. /**
  43153. * Internal dependencies
  43154. */
  43155. /**
  43156. * @param {import('../../ui/context').WordPressComponentProps<import('../types').FooterProps, 'div'>} props
  43157. * @param {import('react').ForwardedRef<any>} forwardedRef
  43158. */
  43159. function CardFooter(props, forwardedRef) {
  43160. const footerProps = useCardFooter(props);
  43161. return (0,external_wp_element_namespaceObject.createElement)(flex_component, extends_extends({}, footerProps, {
  43162. ref: forwardedRef
  43163. }));
  43164. }
  43165. /**
  43166. * `CardFooter` renders an optional footer within a `Card`.
  43167. *
  43168. * @example
  43169. * ```jsx
  43170. * import { Card, CardBody, CardFooter } from `@wordpress/components`;
  43171. *
  43172. * <Card>
  43173. * <CardBody>...</CardBody>
  43174. * <CardFooter>...</CardFooter>
  43175. * </Card>
  43176. * ```
  43177. */
  43178. const ConnectedCardFooter = contextConnect(CardFooter, 'CardFooter');
  43179. /* harmony default export */ var card_footer_component = (ConnectedCardFooter);
  43180. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-header/hook.js
  43181. /**
  43182. * WordPress dependencies
  43183. */
  43184. /**
  43185. * Internal dependencies
  43186. */
  43187. /**
  43188. * @param {import('../../ui/context').WordPressComponentProps<import('../types').HeaderProps, 'div'>} props
  43189. */
  43190. function useCardHeader(props) {
  43191. const {
  43192. className,
  43193. isBorderless = false,
  43194. isShady = false,
  43195. size = 'medium',
  43196. ...otherProps
  43197. } = useContextSystem(props, 'CardHeader');
  43198. const cx = useCx();
  43199. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(styles_Header, borderRadius, borderColor, cardPaddings[size], isBorderless && borderless, isShady && shady, // This classname is added for legacy compatibility reasons.
  43200. 'components-card__header', className), [className, cx, isBorderless, isShady, size]);
  43201. return { ...otherProps,
  43202. className: classes
  43203. };
  43204. }
  43205. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-header/component.js
  43206. /**
  43207. * Internal dependencies
  43208. */
  43209. /**
  43210. * @param {import('../../ui/context').WordPressComponentProps<import('../types').HeaderProps, 'div'>} props
  43211. * @param {import('react').ForwardedRef<any>} forwardedRef
  43212. */
  43213. function CardHeader(props, forwardedRef) {
  43214. const headerProps = useCardHeader(props);
  43215. return (0,external_wp_element_namespaceObject.createElement)(flex_component, extends_extends({}, headerProps, {
  43216. ref: forwardedRef
  43217. }));
  43218. }
  43219. /**
  43220. * `CardHeader` renders an optional header within a `Card`.
  43221. *
  43222. * @example
  43223. * ```jsx
  43224. * import { Card, CardBody, CardHeader } from `@wordpress/components`;
  43225. *
  43226. * <Card>
  43227. * <CardHeader>...</CardHeader>
  43228. * <CardBody>...</CardBody>
  43229. * </Card>
  43230. * ```
  43231. */
  43232. const ConnectedCardHeader = contextConnect(CardHeader, 'CardHeader');
  43233. /* harmony default export */ var card_header_component = (ConnectedCardHeader);
  43234. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-media/hook.js
  43235. /**
  43236. * WordPress dependencies
  43237. */
  43238. /**
  43239. * Internal dependencies
  43240. */
  43241. /**
  43242. * @param {import('../../ui/context').WordPressComponentProps<{ children: import('react').ReactNode }, 'div'>} props
  43243. */
  43244. function useCardMedia(props) {
  43245. const {
  43246. className,
  43247. ...otherProps
  43248. } = useContextSystem(props, 'CardMedia');
  43249. const cx = useCx();
  43250. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Media, borderRadius, // This classname is added for legacy compatibility reasons.
  43251. 'components-card__media', className), [className, cx]);
  43252. return { ...otherProps,
  43253. className: classes
  43254. };
  43255. }
  43256. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-media/component.js
  43257. /**
  43258. * Internal dependencies
  43259. */
  43260. /**
  43261. * @param {import('../../ui/context').WordPressComponentProps<{ children: import('react').ReactNode }, 'div'>} props
  43262. * @param {import('react').ForwardedRef<any>} forwardedRef
  43263. */
  43264. function CardMedia(props, forwardedRef) {
  43265. const cardMediaProps = useCardMedia(props);
  43266. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, cardMediaProps, {
  43267. ref: forwardedRef
  43268. }));
  43269. }
  43270. /**
  43271. * `CardMedia` provides a container for media elements within a `Card`.
  43272. *
  43273. * @example
  43274. * ```jsx
  43275. * import { Card, CardBody, CardMedia } from '@wordpress/components';
  43276. *
  43277. * const Example = () => (
  43278. * <Card>
  43279. * <CardMedia>
  43280. * <img src="..." />
  43281. * </CardMedia>
  43282. * <CardBody>...</CardBody>
  43283. * </Card>
  43284. * );
  43285. * ```
  43286. */
  43287. const ConnectedCardMedia = contextConnect(CardMedia, 'CardMedia');
  43288. /* harmony default export */ var card_media_component = (ConnectedCardMedia);
  43289. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/reset.js
  43290. /**
  43291. * WordPress dependencies
  43292. */
  43293. const reset_reset = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  43294. xmlns: "http://www.w3.org/2000/svg",
  43295. viewBox: "0 0 24 24"
  43296. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  43297. d: "M7 11.5h10V13H7z"
  43298. }));
  43299. /* harmony default export */ var library_reset = (reset_reset);
  43300. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/checkbox-control/index.js
  43301. /**
  43302. * External dependencies
  43303. */
  43304. /**
  43305. * WordPress dependencies
  43306. */
  43307. /**
  43308. * Internal dependencies
  43309. */
  43310. function CheckboxControl(_ref) {
  43311. let {
  43312. label,
  43313. className,
  43314. heading,
  43315. checked,
  43316. indeterminate,
  43317. help,
  43318. onChange,
  43319. ...props
  43320. } = _ref;
  43321. if (heading) {
  43322. external_wp_deprecated_default()('`heading` prop in `CheckboxControl`', {
  43323. alternative: 'a separate element to implement a heading',
  43324. since: '5.8'
  43325. });
  43326. }
  43327. const [showCheckedIcon, setShowCheckedIcon] = (0,external_wp_element_namespaceObject.useState)(false);
  43328. const [showIndeterminateIcon, setShowIndeterminateIcon] = (0,external_wp_element_namespaceObject.useState)(false); // Run the following callback everytime the `ref` (and the additional
  43329. // dependencies) change.
  43330. const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
  43331. if (!node) {
  43332. return;
  43333. } // It cannot be set using an HTML attribute.
  43334. node.indeterminate = !!indeterminate;
  43335. setShowCheckedIcon(node.matches(':checked'));
  43336. setShowIndeterminateIcon(node.matches(':indeterminate'));
  43337. }, [checked, indeterminate]);
  43338. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CheckboxControl);
  43339. const id = `inspector-checkbox-control-${instanceId}`;
  43340. const onChangeValue = event => onChange(event.target.checked);
  43341. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  43342. label: heading,
  43343. id: id,
  43344. help: help,
  43345. className: classnames_default()('components-checkbox-control', className)
  43346. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  43347. className: "components-checkbox-control__input-container"
  43348. }, (0,external_wp_element_namespaceObject.createElement)("input", extends_extends({
  43349. ref: ref,
  43350. id: id,
  43351. className: "components-checkbox-control__input",
  43352. type: "checkbox",
  43353. value: "1",
  43354. onChange: onChangeValue,
  43355. checked: checked,
  43356. "aria-describedby": !!help ? id + '__help' : undefined
  43357. }, props)), showIndeterminateIcon ? (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  43358. icon: library_reset,
  43359. className: "components-checkbox-control__indeterminate",
  43360. role: "presentation"
  43361. }) : null, showCheckedIcon ? (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  43362. icon: library_check,
  43363. className: "components-checkbox-control__checked",
  43364. role: "presentation"
  43365. }) : null), (0,external_wp_element_namespaceObject.createElement)("label", {
  43366. className: "components-checkbox-control__label",
  43367. htmlFor: id
  43368. }, label));
  43369. }
  43370. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/clipboard-button/index.js
  43371. /**
  43372. * External dependencies
  43373. */
  43374. /**
  43375. * WordPress dependencies
  43376. */
  43377. /**
  43378. * Internal dependencies
  43379. */
  43380. const TIMEOUT = 4000;
  43381. function ClipboardButton(_ref) {
  43382. let {
  43383. className,
  43384. children,
  43385. onCopy,
  43386. onFinishCopy,
  43387. text,
  43388. ...buttonProps
  43389. } = _ref;
  43390. external_wp_deprecated_default()('wp.components.ClipboardButton', {
  43391. since: '5.8',
  43392. alternative: 'wp.compose.useCopyToClipboard'
  43393. });
  43394. const timeoutId = (0,external_wp_element_namespaceObject.useRef)();
  43395. const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, () => {
  43396. onCopy();
  43397. clearTimeout(timeoutId.current);
  43398. if (onFinishCopy) {
  43399. timeoutId.current = setTimeout(() => onFinishCopy(), TIMEOUT);
  43400. }
  43401. });
  43402. (0,external_wp_element_namespaceObject.useEffect)(() => {
  43403. clearTimeout(timeoutId.current);
  43404. }, []);
  43405. const classes = classnames_default()('components-clipboard-button', className); // Workaround for inconsistent behavior in Safari, where <textarea> is not
  43406. // the document.activeElement at the moment when the copy event fires.
  43407. // This causes documentHasSelection() in the copy-handler component to
  43408. // mistakenly override the ClipboardButton, and copy a serialized string
  43409. // of the current block instead.
  43410. const focusOnCopyEventTarget = event => {
  43411. event.target.focus();
  43412. };
  43413. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({}, buttonProps, {
  43414. className: classes,
  43415. ref: ref,
  43416. onCopy: focusOnCopyEventTarget
  43417. }), children);
  43418. }
  43419. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
  43420. /**
  43421. * WordPress dependencies
  43422. */
  43423. const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  43424. xmlns: "http://www.w3.org/2000/svg",
  43425. viewBox: "0 0 24 24"
  43426. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  43427. d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
  43428. }));
  43429. /* harmony default export */ var library_plus = (plus);
  43430. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
  43431. /**
  43432. * WordPress dependencies
  43433. */
  43434. const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  43435. xmlns: "http://www.w3.org/2000/svg",
  43436. viewBox: "0 0 24 24"
  43437. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  43438. d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
  43439. }));
  43440. /* harmony default export */ var more_vertical = (moreVertical);
  43441. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/styles.js
  43442. function item_group_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  43443. /**
  43444. * External dependencies
  43445. */
  43446. /**
  43447. * Internal dependencies
  43448. */
  43449. const unstyledButton = /*#__PURE__*/emotion_react_browser_esm_css("appearance:none;border:1px solid transparent;cursor:pointer;background:none;text-align:left;&:hover{color:", COLORS.admin.theme, ";}&:focus{background-color:transparent;color:", COLORS.admin.theme, ";border-color:", COLORS.admin.theme, ";outline:3px solid transparent;}" + ( true ? "" : 0), true ? "" : 0);
  43450. const itemWrapper = true ? {
  43451. name: "1bcj5ek",
  43452. styles: "width:100%;display:block"
  43453. } : 0;
  43454. const item = true ? {
  43455. name: "a5hqs6",
  43456. styles: "width:100%;display:block;margin:0;color:inherit"
  43457. } : 0;
  43458. const bordered = /*#__PURE__*/emotion_react_browser_esm_css("border:1px solid ", config_values.surfaceBorderColor, ";" + ( true ? "" : 0), true ? "" : 0);
  43459. const separated = /*#__PURE__*/emotion_react_browser_esm_css(">*:not( marquee )>*{border-bottom:1px solid ", config_values.surfaceBorderColor, ";}>*:last-of-type>*:not( :focus ){border-bottom-color:transparent;}" + ( true ? "" : 0), true ? "" : 0);
  43460. const styles_borderRadius = config_values.controlBorderRadius;
  43461. const styles_spacedAround = /*#__PURE__*/emotion_react_browser_esm_css("border-radius:", styles_borderRadius, ";" + ( true ? "" : 0), true ? "" : 0);
  43462. const styles_rounded = /*#__PURE__*/emotion_react_browser_esm_css("border-radius:", styles_borderRadius, ";>*:first-of-type>*{border-top-left-radius:", styles_borderRadius, ";border-top-right-radius:", styles_borderRadius, ";}>*:last-of-type>*{border-bottom-left-radius:", styles_borderRadius, ";border-bottom-right-radius:", styles_borderRadius, ";}" + ( true ? "" : 0), true ? "" : 0);
  43463. const baseFontHeight = `calc(${config_values.fontSize} * ${config_values.fontLineHeightBase})`;
  43464. /*
  43465. * Math:
  43466. * - Use the desired height as the base value
  43467. * - Subtract the computed height of (default) text
  43468. * - Subtract the effects of border
  43469. * - Divide the calculated number by 2, in order to get an individual top/bottom padding
  43470. */
  43471. const paddingY = `calc((${config_values.controlHeight} - ${baseFontHeight} - 2px) / 2)`;
  43472. const paddingYSmall = `calc((${config_values.controlHeightSmall} - ${baseFontHeight} - 2px) / 2)`;
  43473. const paddingYLarge = `calc((${config_values.controlHeightLarge} - ${baseFontHeight} - 2px) / 2)`;
  43474. const itemSizes = {
  43475. small: /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingYSmall, " ", config_values.controlPaddingXSmall, ";" + ( true ? "" : 0), true ? "" : 0),
  43476. medium: /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingY, " ", config_values.controlPaddingX, ";" + ( true ? "" : 0), true ? "" : 0),
  43477. large: /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingYLarge, " ", config_values.controlPaddingXLarge, ";" + ( true ? "" : 0), true ? "" : 0)
  43478. };
  43479. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/item-group/hook.js
  43480. /**
  43481. * Internal dependencies
  43482. */
  43483. /**
  43484. * Internal dependencies
  43485. */
  43486. function useItemGroup(props) {
  43487. const {
  43488. className,
  43489. isBordered = false,
  43490. isRounded = true,
  43491. isSeparated = false,
  43492. role = 'list',
  43493. ...otherProps
  43494. } = useContextSystem(props, 'ItemGroup');
  43495. const cx = useCx();
  43496. const classes = cx(isBordered && bordered, isSeparated && separated, isRounded && styles_rounded, className);
  43497. return {
  43498. isBordered,
  43499. className: classes,
  43500. role,
  43501. isSeparated,
  43502. ...otherProps
  43503. };
  43504. }
  43505. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/context.js
  43506. /**
  43507. * WordPress dependencies
  43508. */
  43509. /**
  43510. * Internal dependencies
  43511. */
  43512. const ItemGroupContext = (0,external_wp_element_namespaceObject.createContext)({
  43513. size: 'medium'
  43514. });
  43515. const useItemGroupContext = () => (0,external_wp_element_namespaceObject.useContext)(ItemGroupContext);
  43516. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/item-group/component.js
  43517. /**
  43518. * External dependencies
  43519. */
  43520. /**
  43521. * Internal dependencies
  43522. */
  43523. function ItemGroup(props, forwardedRef) {
  43524. const {
  43525. isBordered,
  43526. isSeparated,
  43527. size: sizeProp,
  43528. ...otherProps
  43529. } = useItemGroup(props);
  43530. const {
  43531. size: contextSize
  43532. } = useItemGroupContext();
  43533. const spacedAround = !isBordered && !isSeparated;
  43534. const size = sizeProp || contextSize;
  43535. const contextValue = {
  43536. spacedAround,
  43537. size
  43538. };
  43539. return (0,external_wp_element_namespaceObject.createElement)(ItemGroupContext.Provider, {
  43540. value: contextValue
  43541. }, (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  43542. ref: forwardedRef
  43543. })));
  43544. }
  43545. /* harmony default export */ var item_group_component = (contextConnect(ItemGroup, 'ItemGroup'));
  43546. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-bar/constants.js
  43547. const GRADIENT_MARKERS_WIDTH = 16;
  43548. const INSERT_POINT_WIDTH = 16;
  43549. const MINIMUM_ABSOLUTE_LEFT_POSITION = 5;
  43550. const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = 10;
  43551. const MINIMUM_DISTANCE_BETWEEN_POINTS = 0;
  43552. const MINIMUM_SIGNIFICANT_MOVE = 5;
  43553. const KEYBOARD_CONTROL_POINT_VARIATION = MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;
  43554. const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER = (INSERT_POINT_WIDTH + GRADIENT_MARKERS_WIDTH) / 2;
  43555. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-bar/utils.js
  43556. /**
  43557. * Internal dependencies
  43558. */
  43559. /**
  43560. * Control point for the gradient bar.
  43561. *
  43562. * @typedef {Object} ControlPoint
  43563. * @property {string} color Color of the control point.
  43564. * @property {number} position Integer position of the control point as a percentage.
  43565. */
  43566. /**
  43567. * Color as parsed from the gradient by gradient-parser.
  43568. *
  43569. * @typedef {Object} Color
  43570. * @property {string} r Red component.
  43571. * @property {string} g Green component.
  43572. * @property {string} b Green component.
  43573. * @property {string} [a] Optional alpha component.
  43574. */
  43575. /**
  43576. * Clamps a number between 0 and 100.
  43577. *
  43578. * @param {number} value Value to clamp.
  43579. *
  43580. * @return {number} Value clamped between 0 and 100.
  43581. */
  43582. function clampPercent(value) {
  43583. return Math.max(0, Math.min(100, value));
  43584. }
  43585. /**
  43586. * Check if a control point is overlapping with another.
  43587. *
  43588. * @param {ControlPoint[]} value Array of control points.
  43589. * @param {number} initialIndex Index of the position to test.
  43590. * @param {number} newPosition New position of the control point.
  43591. * @param {number} minDistance Distance considered to be overlapping.
  43592. *
  43593. * @return {boolean} True if the point is overlapping.
  43594. */
  43595. function isOverlapping(value, initialIndex, newPosition) {
  43596. let minDistance = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : MINIMUM_DISTANCE_BETWEEN_POINTS;
  43597. const initialPosition = value[initialIndex].position;
  43598. const minPosition = Math.min(initialPosition, newPosition);
  43599. const maxPosition = Math.max(initialPosition, newPosition);
  43600. return value.some((_ref, index) => {
  43601. let {
  43602. position
  43603. } = _ref;
  43604. return index !== initialIndex && (Math.abs(position - newPosition) < minDistance || minPosition < position && position < maxPosition);
  43605. });
  43606. }
  43607. /**
  43608. * Adds a control point from an array and returns the new array.
  43609. *
  43610. * @param {ControlPoint[]} points Array of control points.
  43611. * @param {number} position Position to insert the new point.
  43612. * @param {Color} color Color to update the control point at index.
  43613. *
  43614. * @return {ControlPoint[]} New array of control points.
  43615. */
  43616. function addControlPoint(points, position, color) {
  43617. const nextIndex = points.findIndex(point => point.position > position);
  43618. const newPoint = {
  43619. color,
  43620. position
  43621. };
  43622. const newPoints = points.slice();
  43623. newPoints.splice(nextIndex - 1, 0, newPoint);
  43624. return newPoints;
  43625. }
  43626. /**
  43627. * Removes a control point from an array and returns the new array.
  43628. *
  43629. * @param {ControlPoint[]} points Array of control points.
  43630. * @param {number} index Index to remove.
  43631. *
  43632. * @return {ControlPoint[]} New array of control points.
  43633. */
  43634. function removeControlPoint(points, index) {
  43635. return points.filter((point, pointIndex) => {
  43636. return pointIndex !== index;
  43637. });
  43638. }
  43639. /**
  43640. * Updates a control point from an array and returns the new array.
  43641. *
  43642. * @param {ControlPoint[]} points Array of control points.
  43643. * @param {number} index Index to update.
  43644. * @param {ControlPoint[]} newPoint New control point to replace the index.
  43645. *
  43646. * @return {ControlPoint[]} New array of control points.
  43647. */
  43648. function updateControlPoint(points, index, newPoint) {
  43649. const newValue = points.slice();
  43650. newValue[index] = newPoint;
  43651. return newValue;
  43652. }
  43653. /**
  43654. * Updates the position of a control point from an array and returns the new array.
  43655. *
  43656. * @param {ControlPoint[]} points Array of control points.
  43657. * @param {number} index Index to update.
  43658. * @param {number} newPosition Position to move the control point at index.
  43659. *
  43660. * @return {ControlPoint[]} New array of control points.
  43661. */
  43662. function updateControlPointPosition(points, index, newPosition) {
  43663. if (isOverlapping(points, index, newPosition)) {
  43664. return points;
  43665. }
  43666. const newPoint = { ...points[index],
  43667. position: newPosition
  43668. };
  43669. return updateControlPoint(points, index, newPoint);
  43670. }
  43671. /**
  43672. * Updates the position of a control point from an array and returns the new array.
  43673. *
  43674. * @param {ControlPoint[]} points Array of control points.
  43675. * @param {number} index Index to update.
  43676. * @param {Color} newColor Color to update the control point at index.
  43677. *
  43678. * @return {ControlPoint[]} New array of control points.
  43679. */
  43680. function updateControlPointColor(points, index, newColor) {
  43681. const newPoint = { ...points[index],
  43682. color: newColor
  43683. };
  43684. return updateControlPoint(points, index, newPoint);
  43685. }
  43686. /**
  43687. * Updates the position of a control point from an array and returns the new array.
  43688. *
  43689. * @param {ControlPoint[]} points Array of control points.
  43690. * @param {number} position Position of the color stop.
  43691. * @param {string} newColor Color to update the control point at index.
  43692. *
  43693. * @return {ControlPoint[]} New array of control points.
  43694. */
  43695. function updateControlPointColorByPosition(points, position, newColor) {
  43696. const index = points.findIndex(point => point.position === position);
  43697. return updateControlPointColor(points, index, newColor);
  43698. }
  43699. /**
  43700. * Gets the horizontal coordinate when dragging a control point with the mouse.
  43701. *
  43702. * @param {number} mouseXCoordinate Horizontal coordinate of the mouse position.
  43703. * @param {Element} containerElement Container for the gradient picker.
  43704. * @param {number} positionedElementWidth Width of the positioned element.
  43705. *
  43706. * @return {number} Whole number percentage from the left.
  43707. */
  43708. function getHorizontalRelativeGradientPosition(mouseXCoordinate, containerElement, positionedElementWidth) {
  43709. if (!containerElement) {
  43710. return;
  43711. }
  43712. const {
  43713. x,
  43714. width
  43715. } = containerElement.getBoundingClientRect();
  43716. const absolutePositionValue = mouseXCoordinate - x - MINIMUM_ABSOLUTE_LEFT_POSITION - positionedElementWidth / 2;
  43717. const availableWidth = width - MINIMUM_ABSOLUTE_LEFT_POSITION - INSERT_POINT_WIDTH;
  43718. return Math.round(clampPercent(absolutePositionValue * 100 / availableWidth));
  43719. }
  43720. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-bar/control-points.js
  43721. /**
  43722. * External dependencies
  43723. */
  43724. /**
  43725. * WordPress dependencies
  43726. */
  43727. /**
  43728. * Internal dependencies
  43729. */
  43730. function ControlPointButton(_ref) {
  43731. let {
  43732. isOpen,
  43733. position,
  43734. color,
  43735. ...additionalProps
  43736. } = _ref;
  43737. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ControlPointButton);
  43738. const descriptionId = `components-custom-gradient-picker__control-point-button-description-${instanceId}`;
  43739. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  43740. "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: gradient position e.g: 70, %2$s: gradient color code e.g: rgb(52,121,151).
  43741. (0,external_wp_i18n_namespaceObject.__)('Gradient control point at position %1$s%% with color code %2$s.'), position, color),
  43742. "aria-describedby": descriptionId,
  43743. "aria-haspopup": "true",
  43744. "aria-expanded": isOpen,
  43745. className: classnames_default()('components-custom-gradient-picker__control-point-button', {
  43746. 'is-active': isOpen
  43747. }),
  43748. style: {
  43749. left: `${position}%`
  43750. }
  43751. }, additionalProps)), (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  43752. id: descriptionId
  43753. }, (0,external_wp_i18n_namespaceObject.__)('Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.')));
  43754. }
  43755. function GradientColorPickerDropdown(_ref2) {
  43756. let {
  43757. isRenderedInSidebar,
  43758. gradientPickerDomRef,
  43759. ...props
  43760. } = _ref2;
  43761. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => {
  43762. const result = {
  43763. className: 'components-custom-gradient-picker__color-picker-popover',
  43764. position: 'top'
  43765. };
  43766. if (isRenderedInSidebar) {
  43767. result.anchorRef = gradientPickerDomRef.current;
  43768. result.position = 'bottom left';
  43769. }
  43770. return result;
  43771. }, [gradientPickerDomRef.current, isRenderedInSidebar]);
  43772. return (0,external_wp_element_namespaceObject.createElement)(CustomColorPickerDropdown, extends_extends({
  43773. isRenderedInSidebar: isRenderedInSidebar,
  43774. popoverProps: popoverProps
  43775. }, props));
  43776. }
  43777. function ControlPoints(_ref3) {
  43778. let {
  43779. disableRemove,
  43780. disableAlpha,
  43781. gradientPickerDomRef,
  43782. ignoreMarkerPosition,
  43783. value: controlPoints,
  43784. onChange,
  43785. onStartControlPointChange,
  43786. onStopControlPointChange,
  43787. __experimentalIsRenderedInSidebar
  43788. } = _ref3;
  43789. const controlPointMoveState = (0,external_wp_element_namespaceObject.useRef)();
  43790. const onMouseMove = event => {
  43791. const relativePosition = getHorizontalRelativeGradientPosition(event.clientX, gradientPickerDomRef.current, GRADIENT_MARKERS_WIDTH);
  43792. const {
  43793. initialPosition,
  43794. index,
  43795. significantMoveHappened
  43796. } = controlPointMoveState.current;
  43797. if (!significantMoveHappened && Math.abs(initialPosition - relativePosition) >= MINIMUM_SIGNIFICANT_MOVE) {
  43798. controlPointMoveState.current.significantMoveHappened = true;
  43799. }
  43800. onChange(updateControlPointPosition(controlPoints, index, relativePosition));
  43801. };
  43802. const cleanEventListeners = () => {
  43803. if (window && window.removeEventListener && controlPointMoveState.current && controlPointMoveState.current.listenersActivated) {
  43804. window.removeEventListener('mousemove', onMouseMove);
  43805. window.removeEventListener('mouseup', cleanEventListeners);
  43806. onStopControlPointChange();
  43807. controlPointMoveState.current.listenersActivated = false;
  43808. }
  43809. };
  43810. (0,external_wp_element_namespaceObject.useEffect)(() => {
  43811. return () => {
  43812. cleanEventListeners();
  43813. };
  43814. }, []);
  43815. return controlPoints.map((point, index) => {
  43816. const initialPosition = point === null || point === void 0 ? void 0 : point.position;
  43817. return ignoreMarkerPosition !== initialPosition && (0,external_wp_element_namespaceObject.createElement)(GradientColorPickerDropdown, {
  43818. gradientPickerDomRef: gradientPickerDomRef,
  43819. isRenderedInSidebar: __experimentalIsRenderedInSidebar,
  43820. key: index,
  43821. onClose: onStopControlPointChange,
  43822. renderToggle: _ref4 => {
  43823. let {
  43824. isOpen,
  43825. onToggle
  43826. } = _ref4;
  43827. return (0,external_wp_element_namespaceObject.createElement)(ControlPointButton, {
  43828. key: index,
  43829. onClick: () => {
  43830. if (controlPointMoveState.current && controlPointMoveState.current.significantMoveHappened) {
  43831. return;
  43832. }
  43833. if (isOpen) {
  43834. onStopControlPointChange();
  43835. } else {
  43836. onStartControlPointChange();
  43837. }
  43838. onToggle();
  43839. },
  43840. onMouseDown: () => {
  43841. if (window && window.addEventListener) {
  43842. controlPointMoveState.current = {
  43843. initialPosition,
  43844. index,
  43845. significantMoveHappened: false,
  43846. listenersActivated: true
  43847. };
  43848. onStartControlPointChange();
  43849. window.addEventListener('mousemove', onMouseMove);
  43850. window.addEventListener('mouseup', cleanEventListeners);
  43851. }
  43852. },
  43853. onKeyDown: event => {
  43854. if (event.keyCode === external_wp_keycodes_namespaceObject.LEFT) {
  43855. // Stop propagation of the key press event to avoid focus moving
  43856. // to another editor area.
  43857. event.stopPropagation();
  43858. onChange(updateControlPointPosition(controlPoints, index, clampPercent(point.position - KEYBOARD_CONTROL_POINT_VARIATION)));
  43859. } else if (event.keyCode === external_wp_keycodes_namespaceObject.RIGHT) {
  43860. // Stop propagation of the key press event to avoid focus moving
  43861. // to another editor area.
  43862. event.stopPropagation();
  43863. onChange(updateControlPointPosition(controlPoints, index, clampPercent(point.position + KEYBOARD_CONTROL_POINT_VARIATION)));
  43864. }
  43865. },
  43866. isOpen: isOpen,
  43867. position: point.position,
  43868. color: point.color
  43869. });
  43870. },
  43871. renderContent: _ref5 => {
  43872. let {
  43873. onClose
  43874. } = _ref5;
  43875. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(LegacyAdapter, {
  43876. enableAlpha: !disableAlpha,
  43877. color: point.color,
  43878. onChange: color => {
  43879. onChange(updateControlPointColor(controlPoints, index, w(color).toRgbString()));
  43880. }
  43881. }), !disableRemove && controlPoints.length > 2 && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  43882. className: "components-custom-gradient-picker__remove-control-point",
  43883. onClick: () => {
  43884. onChange(removeControlPoint(controlPoints, index));
  43885. onClose();
  43886. },
  43887. variant: "link"
  43888. }, (0,external_wp_i18n_namespaceObject.__)('Remove Control Point')));
  43889. }
  43890. });
  43891. });
  43892. }
  43893. function InsertPoint(_ref6) {
  43894. let {
  43895. value: controlPoints,
  43896. onChange,
  43897. onOpenInserter,
  43898. onCloseInserter,
  43899. insertPosition,
  43900. disableAlpha,
  43901. __experimentalIsRenderedInSidebar,
  43902. gradientPickerDomRef
  43903. } = _ref6;
  43904. const [alreadyInsertedPoint, setAlreadyInsertedPoint] = (0,external_wp_element_namespaceObject.useState)(false);
  43905. return (0,external_wp_element_namespaceObject.createElement)(GradientColorPickerDropdown, {
  43906. gradientPickerDomRef: gradientPickerDomRef,
  43907. isRenderedInSidebar: __experimentalIsRenderedInSidebar,
  43908. className: "components-custom-gradient-picker__inserter",
  43909. onClose: () => {
  43910. onCloseInserter();
  43911. },
  43912. renderToggle: _ref7 => {
  43913. let {
  43914. isOpen,
  43915. onToggle
  43916. } = _ref7;
  43917. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  43918. "aria-expanded": isOpen,
  43919. "aria-haspopup": "true",
  43920. onClick: () => {
  43921. if (isOpen) {
  43922. onCloseInserter();
  43923. } else {
  43924. setAlreadyInsertedPoint(false);
  43925. onOpenInserter();
  43926. }
  43927. onToggle();
  43928. },
  43929. className: "components-custom-gradient-picker__insert-point",
  43930. icon: library_plus,
  43931. style: {
  43932. left: insertPosition !== null ? `${insertPosition}%` : undefined
  43933. }
  43934. });
  43935. },
  43936. renderContent: () => (0,external_wp_element_namespaceObject.createElement)(LegacyAdapter, {
  43937. enableAlpha: !disableAlpha,
  43938. onChange: color => {
  43939. if (!alreadyInsertedPoint) {
  43940. onChange(addControlPoint(controlPoints, insertPosition, w(color).toRgbString()));
  43941. setAlreadyInsertedPoint(true);
  43942. } else {
  43943. onChange(updateControlPointColorByPosition(controlPoints, insertPosition, w(color).toRgbString()));
  43944. }
  43945. }
  43946. })
  43947. });
  43948. }
  43949. ControlPoints.InsertPoint = InsertPoint;
  43950. /* harmony default export */ var control_points = (ControlPoints);
  43951. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-bar/index.js
  43952. /**
  43953. * External dependencies
  43954. */
  43955. /**
  43956. * WordPress dependencies
  43957. */
  43958. /**
  43959. * Internal dependencies
  43960. */
  43961. function customGradientBarReducer(state, action) {
  43962. switch (action.type) {
  43963. case 'MOVE_INSERTER':
  43964. if (state.id === 'IDLE' || state.id === 'MOVING_INSERTER') {
  43965. return {
  43966. id: 'MOVING_INSERTER',
  43967. insertPosition: action.insertPosition
  43968. };
  43969. }
  43970. break;
  43971. case 'STOP_INSERTER_MOVE':
  43972. if (state.id === 'MOVING_INSERTER') {
  43973. return {
  43974. id: 'IDLE'
  43975. };
  43976. }
  43977. break;
  43978. case 'OPEN_INSERTER':
  43979. if (state.id === 'MOVING_INSERTER') {
  43980. return {
  43981. id: 'INSERTING_CONTROL_POINT',
  43982. insertPosition: state.insertPosition
  43983. };
  43984. }
  43985. break;
  43986. case 'CLOSE_INSERTER':
  43987. if (state.id === 'INSERTING_CONTROL_POINT') {
  43988. return {
  43989. id: 'IDLE'
  43990. };
  43991. }
  43992. break;
  43993. case 'START_CONTROL_CHANGE':
  43994. if (state.id === 'IDLE') {
  43995. return {
  43996. id: 'MOVING_CONTROL_POINT'
  43997. };
  43998. }
  43999. break;
  44000. case 'STOP_CONTROL_CHANGE':
  44001. if (state.id === 'MOVING_CONTROL_POINT') {
  44002. return {
  44003. id: 'IDLE'
  44004. };
  44005. }
  44006. break;
  44007. }
  44008. return state;
  44009. }
  44010. const customGradientBarReducerInitialState = {
  44011. id: 'IDLE'
  44012. };
  44013. function CustomGradientBar(_ref) {
  44014. let {
  44015. background,
  44016. hasGradient,
  44017. value: controlPoints,
  44018. onChange,
  44019. disableInserter = false,
  44020. disableAlpha = false,
  44021. __experimentalIsRenderedInSidebar
  44022. } = _ref;
  44023. const gradientPickerDomRef = (0,external_wp_element_namespaceObject.useRef)();
  44024. const [gradientBarState, gradientBarStateDispatch] = (0,external_wp_element_namespaceObject.useReducer)(customGradientBarReducer, customGradientBarReducerInitialState);
  44025. const onMouseEnterAndMove = event => {
  44026. const insertPosition = getHorizontalRelativeGradientPosition(event.clientX, gradientPickerDomRef.current, INSERT_POINT_WIDTH); // If the insert point is close to an existing control point don't show it.
  44027. if ((0,external_lodash_namespaceObject.some)(controlPoints, _ref2 => {
  44028. let {
  44029. position
  44030. } = _ref2;
  44031. return Math.abs(insertPosition - position) < MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;
  44032. })) {
  44033. if (gradientBarState.id === 'MOVING_INSERTER') {
  44034. gradientBarStateDispatch({
  44035. type: 'STOP_INSERTER_MOVE'
  44036. });
  44037. }
  44038. return;
  44039. }
  44040. gradientBarStateDispatch({
  44041. type: 'MOVE_INSERTER',
  44042. insertPosition
  44043. });
  44044. };
  44045. const onMouseLeave = () => {
  44046. gradientBarStateDispatch({
  44047. type: 'STOP_INSERTER_MOVE'
  44048. });
  44049. };
  44050. const isMovingInserter = gradientBarState.id === 'MOVING_INSERTER';
  44051. const isInsertingControlPoint = gradientBarState.id === 'INSERTING_CONTROL_POINT';
  44052. return (0,external_wp_element_namespaceObject.createElement)("div", {
  44053. ref: gradientPickerDomRef,
  44054. className: classnames_default()('components-custom-gradient-picker__gradient-bar', {
  44055. 'has-gradient': hasGradient
  44056. }),
  44057. onMouseEnter: onMouseEnterAndMove,
  44058. onMouseMove: onMouseEnterAndMove,
  44059. style: {
  44060. background
  44061. },
  44062. onMouseLeave: onMouseLeave
  44063. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  44064. className: "components-custom-gradient-picker__markers-container"
  44065. }, !disableInserter && (isMovingInserter || isInsertingControlPoint) && (0,external_wp_element_namespaceObject.createElement)(control_points.InsertPoint, {
  44066. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  44067. gradientPickerDomRef: gradientPickerDomRef,
  44068. disableAlpha: disableAlpha,
  44069. insertPosition: gradientBarState.insertPosition,
  44070. value: controlPoints,
  44071. onChange: onChange,
  44072. onOpenInserter: () => {
  44073. gradientBarStateDispatch({
  44074. type: 'OPEN_INSERTER'
  44075. });
  44076. },
  44077. onCloseInserter: () => {
  44078. gradientBarStateDispatch({
  44079. type: 'CLOSE_INSERTER'
  44080. });
  44081. }
  44082. }), (0,external_wp_element_namespaceObject.createElement)(control_points, {
  44083. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  44084. disableAlpha: disableAlpha,
  44085. disableRemove: disableInserter,
  44086. gradientPickerDomRef: gradientPickerDomRef,
  44087. ignoreMarkerPosition: isInsertingControlPoint ? gradientBarState.insertPosition : undefined,
  44088. value: controlPoints,
  44089. onChange: onChange,
  44090. onStartControlPointChange: () => {
  44091. gradientBarStateDispatch({
  44092. type: 'START_CONTROL_CHANGE'
  44093. });
  44094. },
  44095. onStopControlPointChange: () => {
  44096. gradientBarStateDispatch({
  44097. type: 'STOP_CONTROL_CHANGE'
  44098. });
  44099. }
  44100. })));
  44101. }
  44102. // EXTERNAL MODULE: ./node_modules/gradient-parser/build/node.js
  44103. var build_node = __webpack_require__(7115);
  44104. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/constants.js
  44105. /**
  44106. * WordPress dependencies
  44107. */
  44108. const DEFAULT_GRADIENT = 'linear-gradient(135deg, rgba(6, 147, 227, 1) 0%, rgb(155, 81, 224) 100%)';
  44109. const DEFAULT_LINEAR_GRADIENT_ANGLE = 180;
  44110. const HORIZONTAL_GRADIENT_ORIENTATION = {
  44111. type: 'angular',
  44112. value: 90
  44113. };
  44114. const GRADIENT_OPTIONS = [{
  44115. value: 'linear-gradient',
  44116. label: (0,external_wp_i18n_namespaceObject.__)('Linear')
  44117. }, {
  44118. value: 'radial-gradient',
  44119. label: (0,external_wp_i18n_namespaceObject.__)('Radial')
  44120. }];
  44121. const DIRECTIONAL_ORIENTATION_ANGLE_MAP = {
  44122. top: 0,
  44123. 'top right': 45,
  44124. 'right top': 45,
  44125. right: 90,
  44126. 'right bottom': 135,
  44127. 'bottom right': 135,
  44128. bottom: 180,
  44129. 'bottom left': 225,
  44130. 'left bottom': 225,
  44131. left: 270,
  44132. 'top left': 315,
  44133. 'left top': 315
  44134. };
  44135. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/serializer.js
  44136. /**
  44137. * External dependencies
  44138. */
  44139. function serializeGradientColor(_ref) {
  44140. let {
  44141. type,
  44142. value
  44143. } = _ref;
  44144. if (type === 'literal') {
  44145. return value;
  44146. }
  44147. if (type === 'hex') {
  44148. return `#${value}`;
  44149. }
  44150. return `${type}(${value.join(',')})`;
  44151. }
  44152. function serializeGradientPosition(position) {
  44153. if (!position) {
  44154. return '';
  44155. }
  44156. const {
  44157. value,
  44158. type
  44159. } = position;
  44160. return `${value}${type}`;
  44161. }
  44162. function serializeGradientColorStop(_ref2) {
  44163. let {
  44164. type,
  44165. value,
  44166. length
  44167. } = _ref2;
  44168. return `${serializeGradientColor({
  44169. type,
  44170. value
  44171. })} ${serializeGradientPosition(length)}`;
  44172. }
  44173. function serializeGradientOrientation(orientation) {
  44174. if (!orientation || orientation.type !== 'angular') {
  44175. return;
  44176. }
  44177. return `${orientation.value}deg`;
  44178. }
  44179. function serializeGradient(_ref3) {
  44180. let {
  44181. type,
  44182. orientation,
  44183. colorStops
  44184. } = _ref3;
  44185. const serializedOrientation = serializeGradientOrientation(orientation);
  44186. const serializedColorStops = colorStops.sort((colorStop1, colorStop2) => {
  44187. return (0,external_lodash_namespaceObject.get)(colorStop1, ['length', 'value'], 0) - (0,external_lodash_namespaceObject.get)(colorStop2, ['length', 'value'], 0);
  44188. }).map(serializeGradientColorStop);
  44189. return `${type}(${(0,external_lodash_namespaceObject.compact)([serializedOrientation, ...serializedColorStops]).join(',')})`;
  44190. }
  44191. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/utils.js
  44192. /**
  44193. * External dependencies
  44194. */
  44195. /**
  44196. * Internal dependencies
  44197. */
  44198. k([names]);
  44199. function getLinearGradientRepresentation(gradientAST) {
  44200. return serializeGradient({
  44201. type: 'linear-gradient',
  44202. orientation: HORIZONTAL_GRADIENT_ORIENTATION,
  44203. colorStops: gradientAST.colorStops
  44204. });
  44205. }
  44206. function hasUnsupportedLength(item) {
  44207. return item.length === undefined || item.length.type !== '%';
  44208. }
  44209. function getGradientAstWithDefault(value) {
  44210. var _gradientAST$orientat;
  44211. // gradientAST will contain the gradient AST as parsed by gradient-parser npm module.
  44212. // More information of its structure available at https://www.npmjs.com/package/gradient-parser#ast.
  44213. let gradientAST;
  44214. try {
  44215. gradientAST = build_node.parse(value)[0];
  44216. gradientAST.value = value;
  44217. } catch (error) {
  44218. gradientAST = build_node.parse(DEFAULT_GRADIENT)[0];
  44219. gradientAST.value = DEFAULT_GRADIENT;
  44220. }
  44221. if (((_gradientAST$orientat = gradientAST.orientation) === null || _gradientAST$orientat === void 0 ? void 0 : _gradientAST$orientat.type) === 'directional') {
  44222. gradientAST.orientation.type = 'angular';
  44223. gradientAST.orientation.value = DIRECTIONAL_ORIENTATION_ANGLE_MAP[gradientAST.orientation.value].toString();
  44224. }
  44225. if (gradientAST.colorStops.some(hasUnsupportedLength)) {
  44226. const {
  44227. colorStops
  44228. } = gradientAST;
  44229. const step = 100 / (colorStops.length - 1);
  44230. colorStops.forEach((stop, index) => {
  44231. stop.length = {
  44232. value: step * index,
  44233. type: '%'
  44234. };
  44235. });
  44236. gradientAST.value = serializeGradient(gradientAST);
  44237. }
  44238. return gradientAST;
  44239. }
  44240. function getGradientAstWithControlPoints(gradientAST, newControlPoints) {
  44241. return { ...gradientAST,
  44242. colorStops: newControlPoints.map(_ref => {
  44243. let {
  44244. position,
  44245. color
  44246. } = _ref;
  44247. const {
  44248. r,
  44249. g,
  44250. b,
  44251. a
  44252. } = w(color).toRgb();
  44253. return {
  44254. length: {
  44255. type: '%',
  44256. value: position.toString()
  44257. },
  44258. type: a < 1 ? 'rgba' : 'rgb',
  44259. value: a < 1 ? [r, g, b, a] : [r, g, b]
  44260. };
  44261. })
  44262. };
  44263. }
  44264. function getStopCssColor(colorStop) {
  44265. switch (colorStop.type) {
  44266. case 'hex':
  44267. return `#${colorStop.value}`;
  44268. case 'literal':
  44269. return colorStop.value;
  44270. case 'rgb':
  44271. case 'rgba':
  44272. return `${colorStop.type}(${colorStop.value.join(',')})`;
  44273. default:
  44274. // Should be unreachable if passing an AST from gradient-parser.
  44275. // See https://github.com/rafaelcaricio/gradient-parser#ast.
  44276. return 'transparent';
  44277. }
  44278. }
  44279. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js
  44280. function custom_gradient_picker_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  44281. /**
  44282. * External dependencies
  44283. */
  44284. /**
  44285. * Internal dependencies
  44286. */
  44287. const SelectWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_block_component, true ? {
  44288. target: "e99xvul1"
  44289. } : 0)( true ? {
  44290. name: "1gvx10y",
  44291. styles: "flex-grow:5"
  44292. } : 0);
  44293. const AccessoryWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_block_component, true ? {
  44294. target: "e99xvul0"
  44295. } : 0)( true ? {
  44296. name: "1gvx10y",
  44297. styles: "flex-grow:5"
  44298. } : 0);
  44299. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/index.js
  44300. /**
  44301. * External dependencies
  44302. */
  44303. /**
  44304. * WordPress dependencies
  44305. */
  44306. /**
  44307. * Internal dependencies
  44308. */
  44309. const GradientAnglePicker = _ref => {
  44310. let {
  44311. gradientAST,
  44312. hasGradient,
  44313. onChange
  44314. } = _ref;
  44315. const angle = (0,external_lodash_namespaceObject.get)(gradientAST, ['orientation', 'value'], DEFAULT_LINEAR_GRADIENT_ANGLE);
  44316. const onAngleChange = newAngle => {
  44317. onChange(serializeGradient({ ...gradientAST,
  44318. orientation: {
  44319. type: 'angular',
  44320. value: newAngle
  44321. }
  44322. }));
  44323. };
  44324. return (0,external_wp_element_namespaceObject.createElement)(AnglePickerControl, {
  44325. onChange: onAngleChange,
  44326. labelPosition: "top",
  44327. value: hasGradient ? angle : ''
  44328. });
  44329. };
  44330. const GradientTypePicker = _ref2 => {
  44331. let {
  44332. gradientAST,
  44333. hasGradient,
  44334. onChange
  44335. } = _ref2;
  44336. const {
  44337. type
  44338. } = gradientAST;
  44339. const onSetLinearGradient = () => {
  44340. onChange(serializeGradient({ ...gradientAST,
  44341. ...(gradientAST.orientation ? {} : {
  44342. orientation: HORIZONTAL_GRADIENT_ORIENTATION
  44343. }),
  44344. type: 'linear-gradient'
  44345. }));
  44346. };
  44347. const onSetRadialGradient = () => {
  44348. onChange(serializeGradient({ ...(0,external_lodash_namespaceObject.omit)(gradientAST, ['orientation']),
  44349. type: 'radial-gradient'
  44350. }));
  44351. };
  44352. const handleOnChange = next => {
  44353. if (next === 'linear-gradient') {
  44354. onSetLinearGradient();
  44355. }
  44356. if (next === 'radial-gradient') {
  44357. onSetRadialGradient();
  44358. }
  44359. };
  44360. return (0,external_wp_element_namespaceObject.createElement)(select_control, {
  44361. className: "components-custom-gradient-picker__type-picker",
  44362. label: (0,external_wp_i18n_namespaceObject.__)('Type'),
  44363. labelPosition: "top",
  44364. onChange: handleOnChange,
  44365. options: GRADIENT_OPTIONS,
  44366. size: "__unstable-large",
  44367. value: hasGradient && type
  44368. });
  44369. };
  44370. function CustomGradientPicker(_ref3) {
  44371. let {
  44372. value,
  44373. onChange,
  44374. __experimentalIsRenderedInSidebar
  44375. } = _ref3;
  44376. const gradientAST = getGradientAstWithDefault(value); // On radial gradients the bar should display a linear gradient.
  44377. // On radial gradients the bar represents a slice of the gradient from the center until the outside.
  44378. // On liner gradients the bar represents the color stops from left to right independently of the angle.
  44379. const background = getLinearGradientRepresentation(gradientAST);
  44380. const hasGradient = gradientAST.value !== DEFAULT_GRADIENT; // Control points color option may be hex from presets, custom colors will be rgb.
  44381. // The position should always be a percentage.
  44382. const controlPoints = gradientAST.colorStops.map(colorStop => ({
  44383. color: getStopCssColor(colorStop),
  44384. position: parseInt(colorStop.length.value)
  44385. }));
  44386. return (0,external_wp_element_namespaceObject.createElement)("div", {
  44387. className: "components-custom-gradient-picker"
  44388. }, (0,external_wp_element_namespaceObject.createElement)(CustomGradientBar, {
  44389. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  44390. background: background,
  44391. hasGradient: hasGradient,
  44392. value: controlPoints,
  44393. onChange: newControlPoints => {
  44394. onChange(serializeGradient(getGradientAstWithControlPoints(gradientAST, newControlPoints)));
  44395. }
  44396. }), (0,external_wp_element_namespaceObject.createElement)(flex_component, {
  44397. gap: 3,
  44398. className: "components-custom-gradient-picker__ui-line"
  44399. }, (0,external_wp_element_namespaceObject.createElement)(SelectWrapper, null, (0,external_wp_element_namespaceObject.createElement)(GradientTypePicker, {
  44400. gradientAST: gradientAST,
  44401. hasGradient: hasGradient,
  44402. onChange: onChange
  44403. })), (0,external_wp_element_namespaceObject.createElement)(AccessoryWrapper, null, gradientAST.type === 'linear-gradient' && (0,external_wp_element_namespaceObject.createElement)(GradientAnglePicker, {
  44404. gradientAST: gradientAST,
  44405. hasGradient: hasGradient,
  44406. onChange: onChange
  44407. }))));
  44408. }
  44409. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/gradient-picker/index.js
  44410. /**
  44411. * External dependencies
  44412. */
  44413. /**
  44414. * WordPress dependencies
  44415. */
  44416. /**
  44417. * Internal dependencies
  44418. */
  44419. function SingleOrigin(_ref) {
  44420. let {
  44421. className,
  44422. clearGradient,
  44423. gradients,
  44424. onChange,
  44425. value,
  44426. actions,
  44427. content
  44428. } = _ref;
  44429. const gradientOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
  44430. return (0,external_lodash_namespaceObject.map)(gradients, _ref2 => {
  44431. let {
  44432. gradient,
  44433. name
  44434. } = _ref2;
  44435. return (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.Option, {
  44436. key: gradient,
  44437. value: gradient,
  44438. isSelected: value === gradient,
  44439. tooltipText: name || // translators: %s: gradient code e.g: "linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);".
  44440. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Gradient code: %s'), gradient),
  44441. style: {
  44442. color: 'rgba( 0,0,0,0 )',
  44443. background: gradient
  44444. },
  44445. onClick: value === gradient ? clearGradient : () => onChange(gradient),
  44446. "aria-label": name ? // translators: %s: The name of the gradient e.g: "Angular red to blue".
  44447. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Gradient: %s'), name) : // translators: %s: gradient code e.g: "linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);".
  44448. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Gradient code: %s'), gradient)
  44449. });
  44450. });
  44451. }, [gradients, value, onChange, clearGradient]);
  44452. return (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker, {
  44453. className: className,
  44454. options: gradientOptions,
  44455. actions: actions
  44456. }, content);
  44457. }
  44458. function MultipleOrigin(_ref3) {
  44459. let {
  44460. className,
  44461. clearGradient,
  44462. gradients,
  44463. onChange,
  44464. value,
  44465. actions,
  44466. content
  44467. } = _ref3;
  44468. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  44469. spacing: 3,
  44470. className: className
  44471. }, gradients.map((_ref4, index) => {
  44472. let {
  44473. name,
  44474. gradients: gradientSet
  44475. } = _ref4;
  44476. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  44477. spacing: 2,
  44478. key: index
  44479. }, (0,external_wp_element_namespaceObject.createElement)(ColorHeading, null, name), (0,external_wp_element_namespaceObject.createElement)(SingleOrigin, extends_extends({
  44480. clearGradient: clearGradient,
  44481. gradients: gradientSet,
  44482. onChange: onChange,
  44483. value: value
  44484. }, gradients.length === index + 1 ? {
  44485. actions,
  44486. content
  44487. } : {})));
  44488. }));
  44489. }
  44490. function GradientPicker(_ref5) {
  44491. let {
  44492. className,
  44493. gradients,
  44494. onChange,
  44495. value,
  44496. clearable = true,
  44497. disableCustomGradients = false,
  44498. __experimentalHasMultipleOrigins,
  44499. __experimentalIsRenderedInSidebar
  44500. } = _ref5;
  44501. const clearGradient = (0,external_wp_element_namespaceObject.useCallback)(() => onChange(undefined), [onChange]);
  44502. const Component = __experimentalHasMultipleOrigins && gradients !== null && gradients !== void 0 && gradients.length ? MultipleOrigin : SingleOrigin;
  44503. return (0,external_wp_element_namespaceObject.createElement)(Component, {
  44504. className: className,
  44505. clearable: clearable,
  44506. clearGradient: clearGradient,
  44507. gradients: gradients,
  44508. onChange: onChange,
  44509. value: value,
  44510. actions: clearable && ((gradients === null || gradients === void 0 ? void 0 : gradients.length) || !disableCustomGradients) && (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.ButtonAction, {
  44511. onClick: clearGradient
  44512. }, (0,external_wp_i18n_namespaceObject.__)('Clear')),
  44513. content: !disableCustomGradients && (0,external_wp_element_namespaceObject.createElement)(CustomGradientPicker, {
  44514. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  44515. value: value,
  44516. onChange: onChange
  44517. })
  44518. });
  44519. }
  44520. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/menu.js
  44521. /**
  44522. * WordPress dependencies
  44523. */
  44524. const menu = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  44525. xmlns: "http://www.w3.org/2000/svg",
  44526. viewBox: "0 0 24 24"
  44527. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  44528. d: "M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z"
  44529. }));
  44530. /* harmony default export */ var library_menu = (menu);
  44531. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigable-container/container.js
  44532. // @ts-nocheck
  44533. /**
  44534. * External dependencies
  44535. */
  44536. /**
  44537. * WordPress dependencies
  44538. */
  44539. const MENU_ITEM_ROLES = ['menuitem', 'menuitemradio', 'menuitemcheckbox'];
  44540. function cycleValue(value, total, offset) {
  44541. const nextValue = value + offset;
  44542. if (nextValue < 0) {
  44543. return total + nextValue;
  44544. } else if (nextValue >= total) {
  44545. return nextValue - total;
  44546. }
  44547. return nextValue;
  44548. }
  44549. class NavigableContainer extends external_wp_element_namespaceObject.Component {
  44550. constructor() {
  44551. super(...arguments);
  44552. this.onKeyDown = this.onKeyDown.bind(this);
  44553. this.bindContainer = this.bindContainer.bind(this);
  44554. this.getFocusableContext = this.getFocusableContext.bind(this);
  44555. this.getFocusableIndex = this.getFocusableIndex.bind(this);
  44556. }
  44557. componentDidMount() {
  44558. // We use DOM event listeners instead of React event listeners
  44559. // because we want to catch events from the underlying DOM tree
  44560. // The React Tree can be different from the DOM tree when using
  44561. // portals. Block Toolbars for instance are rendered in a separate
  44562. // React Trees.
  44563. this.container.addEventListener('keydown', this.onKeyDown);
  44564. this.container.addEventListener('focus', this.onFocus);
  44565. }
  44566. componentWillUnmount() {
  44567. this.container.removeEventListener('keydown', this.onKeyDown);
  44568. this.container.removeEventListener('focus', this.onFocus);
  44569. }
  44570. bindContainer(ref) {
  44571. const {
  44572. forwardedRef
  44573. } = this.props;
  44574. this.container = ref;
  44575. if ((0,external_lodash_namespaceObject.isFunction)(forwardedRef)) {
  44576. forwardedRef(ref);
  44577. } else if (forwardedRef && 'current' in forwardedRef) {
  44578. forwardedRef.current = ref;
  44579. }
  44580. }
  44581. getFocusableContext(target) {
  44582. const {
  44583. onlyBrowserTabstops
  44584. } = this.props;
  44585. const finder = onlyBrowserTabstops ? external_wp_dom_namespaceObject.focus.tabbable : external_wp_dom_namespaceObject.focus.focusable;
  44586. const focusables = finder.find(this.container);
  44587. const index = this.getFocusableIndex(focusables, target);
  44588. if (index > -1 && target) {
  44589. return {
  44590. index,
  44591. target,
  44592. focusables
  44593. };
  44594. }
  44595. return null;
  44596. }
  44597. getFocusableIndex(focusables, target) {
  44598. const directIndex = focusables.indexOf(target);
  44599. if (directIndex !== -1) {
  44600. return directIndex;
  44601. }
  44602. }
  44603. onKeyDown(event) {
  44604. if (this.props.onKeyDown) {
  44605. this.props.onKeyDown(event);
  44606. }
  44607. const {
  44608. getFocusableContext
  44609. } = this;
  44610. const {
  44611. cycle = true,
  44612. eventToOffset,
  44613. onNavigate = external_lodash_namespaceObject.noop,
  44614. stopNavigationEvents
  44615. } = this.props;
  44616. const offset = eventToOffset(event); // eventToOffset returns undefined if the event is not handled by the component.
  44617. if (offset !== undefined && stopNavigationEvents) {
  44618. // Prevents arrow key handlers bound to the document directly interfering.
  44619. event.stopImmediatePropagation(); // When navigating a collection of items, prevent scroll containers
  44620. // from scrolling. The preventDefault also prevents Voiceover from
  44621. // 'handling' the event, as voiceover will try to use arrow keys
  44622. // for highlighting text.
  44623. const targetRole = event.target.getAttribute('role');
  44624. if (MENU_ITEM_ROLES.includes(targetRole)) {
  44625. event.preventDefault();
  44626. }
  44627. }
  44628. if (!offset) {
  44629. return;
  44630. }
  44631. const context = getFocusableContext(event.target.ownerDocument.activeElement);
  44632. if (!context) {
  44633. return;
  44634. }
  44635. const {
  44636. index,
  44637. focusables
  44638. } = context;
  44639. const nextIndex = cycle ? cycleValue(index, focusables.length, offset) : index + offset;
  44640. if (nextIndex >= 0 && nextIndex < focusables.length) {
  44641. focusables[nextIndex].focus();
  44642. onNavigate(nextIndex, focusables[nextIndex]);
  44643. }
  44644. }
  44645. render() {
  44646. const {
  44647. children,
  44648. ...props
  44649. } = this.props;
  44650. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({
  44651. ref: this.bindContainer
  44652. }, (0,external_lodash_namespaceObject.omit)(props, ['stopNavigationEvents', 'eventToOffset', 'onNavigate', 'onKeyDown', 'cycle', 'onlyBrowserTabstops', 'forwardedRef'])), children);
  44653. }
  44654. }
  44655. const forwardedNavigableContainer = (props, ref) => {
  44656. return (0,external_wp_element_namespaceObject.createElement)(NavigableContainer, extends_extends({}, props, {
  44657. forwardedRef: ref
  44658. }));
  44659. };
  44660. forwardedNavigableContainer.displayName = 'NavigableContainer';
  44661. /* harmony default export */ var container = ((0,external_wp_element_namespaceObject.forwardRef)(forwardedNavigableContainer));
  44662. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigable-container/menu.js
  44663. // @ts-nocheck
  44664. /**
  44665. * External dependencies
  44666. */
  44667. /**
  44668. * WordPress dependencies
  44669. */
  44670. /**
  44671. * Internal dependencies
  44672. */
  44673. function NavigableMenu(_ref, ref) {
  44674. let {
  44675. role = 'menu',
  44676. orientation = 'vertical',
  44677. ...rest
  44678. } = _ref;
  44679. const eventToOffset = evt => {
  44680. const {
  44681. keyCode
  44682. } = evt;
  44683. let next = [external_wp_keycodes_namespaceObject.DOWN];
  44684. let previous = [external_wp_keycodes_namespaceObject.UP];
  44685. if (orientation === 'horizontal') {
  44686. next = [external_wp_keycodes_namespaceObject.RIGHT];
  44687. previous = [external_wp_keycodes_namespaceObject.LEFT];
  44688. }
  44689. if (orientation === 'both') {
  44690. next = [external_wp_keycodes_namespaceObject.RIGHT, external_wp_keycodes_namespaceObject.DOWN];
  44691. previous = [external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.UP];
  44692. }
  44693. if ((0,external_lodash_namespaceObject.includes)(next, keyCode)) {
  44694. return 1;
  44695. } else if ((0,external_lodash_namespaceObject.includes)(previous, keyCode)) {
  44696. return -1;
  44697. } else if ((0,external_lodash_namespaceObject.includes)([external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT], keyCode)) {
  44698. // Key press should be handled, e.g. have event propagation and
  44699. // default behavior handled by NavigableContainer but not result
  44700. // in an offset.
  44701. return 0;
  44702. }
  44703. };
  44704. return (0,external_wp_element_namespaceObject.createElement)(container, extends_extends({
  44705. ref: ref,
  44706. stopNavigationEvents: true,
  44707. onlyBrowserTabstops: false,
  44708. role: role,
  44709. "aria-orientation": role === 'presentation' ? null : orientation,
  44710. eventToOffset: eventToOffset
  44711. }, rest));
  44712. }
  44713. /* harmony default export */ var navigable_container_menu = ((0,external_wp_element_namespaceObject.forwardRef)(NavigableMenu));
  44714. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown-menu/index.js
  44715. // @ts-nocheck
  44716. /**
  44717. * External dependencies
  44718. */
  44719. /**
  44720. * WordPress dependencies
  44721. */
  44722. /**
  44723. * Internal dependencies
  44724. */
  44725. function mergeProps() {
  44726. let defaultProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  44727. let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  44728. const mergedProps = { ...defaultProps,
  44729. ...props
  44730. };
  44731. if (props.className && defaultProps.className) {
  44732. mergedProps.className = classnames_default()(props.className, defaultProps.className);
  44733. }
  44734. return mergedProps;
  44735. }
  44736. function DropdownMenu(dropdownMenuProps) {
  44737. const {
  44738. children,
  44739. className,
  44740. controls,
  44741. icon = library_menu,
  44742. label,
  44743. popoverProps,
  44744. toggleProps,
  44745. menuProps,
  44746. disableOpenOnArrowDown = false,
  44747. text,
  44748. noIcons
  44749. } = dropdownMenuProps;
  44750. if ((0,external_lodash_namespaceObject.isEmpty)(controls) && !(0,external_lodash_namespaceObject.isFunction)(children)) {
  44751. return null;
  44752. } // Normalize controls to nested array of objects (sets of controls)
  44753. let controlSets;
  44754. if (!(0,external_lodash_namespaceObject.isEmpty)(controls)) {
  44755. controlSets = controls;
  44756. if (!Array.isArray(controlSets[0])) {
  44757. controlSets = [controlSets];
  44758. }
  44759. }
  44760. const mergedPopoverProps = mergeProps({
  44761. className: 'components-dropdown-menu__popover'
  44762. }, popoverProps);
  44763. return (0,external_wp_element_namespaceObject.createElement)(Dropdown, {
  44764. className: classnames_default()('components-dropdown-menu', className),
  44765. popoverProps: mergedPopoverProps,
  44766. renderToggle: _ref => {
  44767. var _toggleProps$showTool;
  44768. let {
  44769. isOpen,
  44770. onToggle
  44771. } = _ref;
  44772. const openOnArrowDown = event => {
  44773. if (disableOpenOnArrowDown) {
  44774. return;
  44775. }
  44776. if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
  44777. event.preventDefault();
  44778. onToggle();
  44779. }
  44780. };
  44781. const mergedToggleProps = mergeProps({
  44782. className: classnames_default()('components-dropdown-menu__toggle', {
  44783. 'is-opened': isOpen
  44784. })
  44785. }, toggleProps);
  44786. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({}, mergedToggleProps, {
  44787. icon: icon,
  44788. onClick: event => {
  44789. onToggle(event);
  44790. if (mergedToggleProps.onClick) {
  44791. mergedToggleProps.onClick(event);
  44792. }
  44793. },
  44794. onKeyDown: event => {
  44795. openOnArrowDown(event);
  44796. if (mergedToggleProps.onKeyDown) {
  44797. mergedToggleProps.onKeyDown(event);
  44798. }
  44799. },
  44800. "aria-haspopup": "true",
  44801. "aria-expanded": isOpen,
  44802. label: label,
  44803. text: text,
  44804. showTooltip: (_toggleProps$showTool = toggleProps === null || toggleProps === void 0 ? void 0 : toggleProps.showTooltip) !== null && _toggleProps$showTool !== void 0 ? _toggleProps$showTool : true
  44805. }), mergedToggleProps.children);
  44806. },
  44807. renderContent: props => {
  44808. const mergedMenuProps = mergeProps({
  44809. 'aria-label': label,
  44810. className: classnames_default()('components-dropdown-menu__menu', {
  44811. 'no-icons': noIcons
  44812. })
  44813. }, menuProps);
  44814. return (0,external_wp_element_namespaceObject.createElement)(navigable_container_menu, extends_extends({}, mergedMenuProps, {
  44815. role: "menu"
  44816. }), (0,external_lodash_namespaceObject.isFunction)(children) ? children(props) : null, (0,external_lodash_namespaceObject.flatMap)(controlSets, (controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  44817. key: [indexOfSet, indexOfControl].join(),
  44818. onClick: event => {
  44819. event.stopPropagation();
  44820. props.onClose();
  44821. if (control.onClick) {
  44822. control.onClick();
  44823. }
  44824. },
  44825. className: classnames_default()('components-dropdown-menu__menu-item', {
  44826. 'has-separator': indexOfSet > 0 && indexOfControl === 0,
  44827. 'is-active': control.isActive,
  44828. 'is-icon-only': !control.title
  44829. }),
  44830. icon: control.icon,
  44831. label: control.label,
  44832. "aria-checked": control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.isActive : undefined,
  44833. role: control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.role : 'menuitem',
  44834. disabled: control.isDisabled
  44835. }, control.title))));
  44836. }
  44837. });
  44838. }
  44839. /* harmony default export */ var dropdown_menu = (DropdownMenu);
  44840. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/palette-edit/styles.js
  44841. function palette_edit_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  44842. /**
  44843. * External dependencies
  44844. */
  44845. /**
  44846. * Internal dependencies
  44847. */
  44848. const IndicatorStyled = /*#__PURE__*/emotion_styled_base_browser_esm(CircularOptionPicker.Option, true ? {
  44849. target: "e5bw3229"
  44850. } : 0)("width:", space(6), ";height:", space(6), ";pointer-events:none;" + ( true ? "" : 0));
  44851. const NameInputControl = /*#__PURE__*/emotion_styled_base_browser_esm(input_control, true ? {
  44852. target: "e5bw3228"
  44853. } : 0)(Container, "{background:", COLORS.gray[100], ";border-radius:", config_values.controlBorderRadius, ";}", Input, Input, Input, Input, "{height:", space(8), ";}", BackdropUI, BackdropUI, BackdropUI, "{border-color:transparent;box-shadow:none;}" + ( true ? "" : 0));
  44854. const PaletteItem = /*#__PURE__*/emotion_styled_base_browser_esm(component, true ? {
  44855. target: "e5bw3227"
  44856. } : 0)("padding:3px 0 3px ", space(3), ";height:calc( 40px - ", config_values.borderWidth, " );border:1px solid ", config_values.surfaceBorderColor, ";border-bottom-color:transparent;&:first-of-type{border-top-left-radius:", config_values.controlBorderRadius, ";border-top-right-radius:", config_values.controlBorderRadius, ";}&:last-of-type{border-bottom-left-radius:", config_values.controlBorderRadius, ";border-bottom-right-radius:", config_values.controlBorderRadius, ";border-bottom-color:", config_values.surfaceBorderColor, ";}&.is-selected+&{border-top-color:transparent;}&.is-selected{border-color:", COLORS.blue.wordpress[700], ";}" + ( true ? "" : 0));
  44857. const NameContainer = emotion_styled_base_browser_esm("div", true ? {
  44858. target: "e5bw3226"
  44859. } : 0)("line-height:", space(8), ";margin-left:", space(2), ";margin-right:", space(2), ";white-space:nowrap;overflow:hidden;", PaletteItem, ":hover &{color:var( --wp-admin-theme-color, ", COLORS.blue.wordpress[700], " );}" + ( true ? "" : 0));
  44860. const PaletteHeading = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? {
  44861. target: "e5bw3225"
  44862. } : 0)("text-transform:uppercase;line-height:", space(6), ";font-weight:500;&&&{font-size:11px;margin-bottom:0;}" + ( true ? "" : 0));
  44863. const PaletteActionsContainer = /*#__PURE__*/emotion_styled_base_browser_esm(component, true ? {
  44864. target: "e5bw3224"
  44865. } : 0)("height:", space(6), ";display:flex;" + ( true ? "" : 0));
  44866. const PaletteHStackHeader = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? {
  44867. target: "e5bw3223"
  44868. } : 0)("margin-bottom:", space(2), ";" + ( true ? "" : 0));
  44869. const PaletteEditStyles = /*#__PURE__*/emotion_styled_base_browser_esm(component, true ? {
  44870. target: "e5bw3222"
  44871. } : 0)( true ? {
  44872. name: "u6wnko",
  44873. styles: "&&&{.components-button.has-icon{min-width:0;padding:0;}}"
  44874. } : 0);
  44875. const DoneButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
  44876. target: "e5bw3221"
  44877. } : 0)("&&{color:", COLORS.ui.theme, ";}" + ( true ? "" : 0));
  44878. const RemoveButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
  44879. target: "e5bw3220"
  44880. } : 0)("&&{margin-top:", space(1), ";}" + ( true ? "" : 0));
  44881. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/palette-edit/index.js
  44882. /**
  44883. * External dependencies
  44884. */
  44885. /**
  44886. * WordPress dependencies
  44887. */
  44888. /**
  44889. * Internal dependencies
  44890. */
  44891. const DEFAULT_COLOR = '#000';
  44892. function NameInput(_ref) {
  44893. let {
  44894. value,
  44895. onChange,
  44896. label
  44897. } = _ref;
  44898. return (0,external_wp_element_namespaceObject.createElement)(NameInputControl, {
  44899. label: label,
  44900. hideLabelFromVision: true,
  44901. value: value,
  44902. onChange: onChange
  44903. });
  44904. }
  44905. function getNameForPosition(position) {
  44906. return (0,external_wp_i18n_namespaceObject.sprintf)(
  44907. /* translators: %s: is a temporary id for a custom color */
  44908. (0,external_wp_i18n_namespaceObject.__)('Color %s '), position + 1);
  44909. }
  44910. function palette_edit_Option(_ref2) {
  44911. let {
  44912. canOnlyChangeValues,
  44913. element,
  44914. onChange,
  44915. isEditing,
  44916. onStartEditing,
  44917. onRemove,
  44918. onStopEditing,
  44919. slugPrefix,
  44920. isGradient
  44921. } = _ref2;
  44922. const focusOutsideProps = (0,external_wp_compose_namespaceObject.__experimentalUseFocusOutside)(onStopEditing);
  44923. const value = isGradient ? element.gradient : element.color;
  44924. return (0,external_wp_element_namespaceObject.createElement)(PaletteItem, extends_extends({
  44925. className: isEditing ? 'is-selected' : undefined,
  44926. as: "div",
  44927. onClick: onStartEditing
  44928. }, isEditing ? { ...focusOutsideProps
  44929. } : {
  44930. style: {
  44931. cursor: 'pointer'
  44932. }
  44933. }), (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  44934. justify: "flex-start"
  44935. }, (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(IndicatorStyled, {
  44936. style: {
  44937. background: value,
  44938. color: 'transparent'
  44939. }
  44940. })), (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, isEditing && !canOnlyChangeValues ? (0,external_wp_element_namespaceObject.createElement)(NameInput, {
  44941. label: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Gradient name') : (0,external_wp_i18n_namespaceObject.__)('Color name'),
  44942. value: element.name,
  44943. onChange: nextName => onChange({ ...element,
  44944. name: nextName,
  44945. slug: slugPrefix + (0,external_lodash_namespaceObject.kebabCase)(nextName)
  44946. })
  44947. }) : (0,external_wp_element_namespaceObject.createElement)(NameContainer, null, element.name)), isEditing && !canOnlyChangeValues && (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(RemoveButton, {
  44948. isSmall: true,
  44949. icon: line_solid,
  44950. label: (0,external_wp_i18n_namespaceObject.__)('Remove color'),
  44951. onClick: onRemove
  44952. }))), isEditing && (0,external_wp_element_namespaceObject.createElement)(popover, {
  44953. position: "bottom left",
  44954. className: "components-palette-edit__popover"
  44955. }, !isGradient && (0,external_wp_element_namespaceObject.createElement)(LegacyAdapter, {
  44956. color: value,
  44957. onChange: newColor => onChange({ ...element,
  44958. color: newColor
  44959. })
  44960. }), isGradient && (0,external_wp_element_namespaceObject.createElement)(CustomGradientPicker, {
  44961. __experimentalIsRenderedInSidebar: true,
  44962. value: value,
  44963. onChange: newGradient => onChange({ ...element,
  44964. gradient: newGradient
  44965. })
  44966. })));
  44967. }
  44968. function isTemporaryElement(slugPrefix, _ref3, index) {
  44969. let {
  44970. slug,
  44971. color,
  44972. gradient
  44973. } = _ref3;
  44974. return slug === slugPrefix + (0,external_lodash_namespaceObject.kebabCase)(getNameForPosition(index)) && (!!color && color === DEFAULT_COLOR || !!gradient && gradient === DEFAULT_GRADIENT);
  44975. }
  44976. function PaletteEditListView(_ref4) {
  44977. let {
  44978. elements,
  44979. onChange,
  44980. editingElement,
  44981. setEditingElement,
  44982. canOnlyChangeValues,
  44983. slugPrefix,
  44984. isGradient
  44985. } = _ref4;
  44986. // When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.
  44987. const elementsReference = (0,external_wp_element_namespaceObject.useRef)();
  44988. (0,external_wp_element_namespaceObject.useEffect)(() => {
  44989. elementsReference.current = elements;
  44990. }, [elements]);
  44991. (0,external_wp_element_namespaceObject.useEffect)(() => {
  44992. return () => {
  44993. if (elementsReference.current.some((element, index) => isTemporaryElement(slugPrefix, element, index))) {
  44994. const newElements = elementsReference.current.filter((element, index) => !isTemporaryElement(slugPrefix, element, index));
  44995. onChange(newElements.length ? newElements : undefined);
  44996. }
  44997. };
  44998. }, []);
  44999. const debounceOnChange = (0,external_wp_compose_namespaceObject.useDebounce)(onChange, 100);
  45000. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  45001. spacing: 3
  45002. }, (0,external_wp_element_namespaceObject.createElement)(item_group_component, {
  45003. isRounded: true
  45004. }, elements.map((element, index) => (0,external_wp_element_namespaceObject.createElement)(palette_edit_Option, {
  45005. isGradient: isGradient,
  45006. canOnlyChangeValues: canOnlyChangeValues,
  45007. key: index,
  45008. element: element,
  45009. onStartEditing: () => {
  45010. if (editingElement !== index) {
  45011. setEditingElement(index);
  45012. }
  45013. },
  45014. onChange: newElement => {
  45015. debounceOnChange(elements.map((currentElement, currentIndex) => {
  45016. if (currentIndex === index) {
  45017. return newElement;
  45018. }
  45019. return currentElement;
  45020. }));
  45021. },
  45022. onRemove: () => {
  45023. setEditingElement(null);
  45024. const newElements = elements.filter((_currentElement, currentIndex) => {
  45025. if (currentIndex === index) {
  45026. return false;
  45027. }
  45028. return true;
  45029. });
  45030. onChange(newElements.length ? newElements : undefined);
  45031. },
  45032. isEditing: index === editingElement,
  45033. onStopEditing: () => {
  45034. if (index === editingElement) {
  45035. setEditingElement(null);
  45036. }
  45037. },
  45038. slugPrefix: slugPrefix
  45039. }))));
  45040. }
  45041. const EMPTY_ARRAY = [];
  45042. function PaletteEdit(_ref5) {
  45043. let {
  45044. gradients,
  45045. colors = EMPTY_ARRAY,
  45046. onChange,
  45047. paletteLabel,
  45048. emptyMessage,
  45049. canOnlyChangeValues,
  45050. canReset,
  45051. slugPrefix = ''
  45052. } = _ref5;
  45053. const isGradient = !!gradients;
  45054. const elements = isGradient ? gradients : colors;
  45055. const [isEditing, setIsEditing] = (0,external_wp_element_namespaceObject.useState)(false);
  45056. const [editingElement, setEditingElement] = (0,external_wp_element_namespaceObject.useState)(null);
  45057. const isAdding = isEditing && editingElement && elements[editingElement] && !elements[editingElement].slug;
  45058. const elementsLength = elements.length;
  45059. const hasElements = elementsLength > 0;
  45060. return (0,external_wp_element_namespaceObject.createElement)(PaletteEditStyles, null, (0,external_wp_element_namespaceObject.createElement)(PaletteHStackHeader, null, (0,external_wp_element_namespaceObject.createElement)(PaletteHeading, null, paletteLabel), (0,external_wp_element_namespaceObject.createElement)(PaletteActionsContainer, null, isEditing && (0,external_wp_element_namespaceObject.createElement)(DoneButton, {
  45061. isSmall: true,
  45062. onClick: () => {
  45063. setIsEditing(false);
  45064. setEditingElement(null);
  45065. }
  45066. }, (0,external_wp_i18n_namespaceObject.__)('Done')), !canOnlyChangeValues && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  45067. isSmall: true,
  45068. isPressed: isAdding,
  45069. icon: library_plus,
  45070. label: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Add gradient') : (0,external_wp_i18n_namespaceObject.__)('Add color'),
  45071. onClick: () => {
  45072. const tempOptionName = getNameForPosition(elementsLength);
  45073. onChange([...elements, { ...(isGradient ? {
  45074. gradient: DEFAULT_GRADIENT
  45075. } : {
  45076. color: DEFAULT_COLOR
  45077. }),
  45078. name: tempOptionName,
  45079. slug: slugPrefix + (0,external_lodash_namespaceObject.kebabCase)(tempOptionName)
  45080. }]);
  45081. setIsEditing(true);
  45082. setEditingElement(elements.length);
  45083. }
  45084. }), hasElements && (!isEditing || !canOnlyChangeValues || canReset) && (0,external_wp_element_namespaceObject.createElement)(dropdown_menu, {
  45085. icon: more_vertical,
  45086. label: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Gradient options') : (0,external_wp_i18n_namespaceObject.__)('Color options'),
  45087. toggleProps: {
  45088. isSmall: true
  45089. }
  45090. }, _ref6 => {
  45091. let {
  45092. onClose
  45093. } = _ref6;
  45094. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(navigable_container_menu, {
  45095. role: "menu"
  45096. }, !isEditing && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  45097. variant: "tertiary",
  45098. onClick: () => {
  45099. setIsEditing(true);
  45100. onClose();
  45101. },
  45102. className: "components-palette-edit__menu-button"
  45103. }, isGradient ? (0,external_wp_i18n_namespaceObject.__)('Edit gradients') : (0,external_wp_i18n_namespaceObject.__)('Edit colors')), !canOnlyChangeValues && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  45104. variant: "tertiary",
  45105. onClick: () => {
  45106. setEditingElement(null);
  45107. setIsEditing(false);
  45108. onChange();
  45109. onClose();
  45110. },
  45111. className: "components-palette-edit__menu-button"
  45112. }, isGradient ? (0,external_wp_i18n_namespaceObject.__)('Remove all gradients') : (0,external_wp_i18n_namespaceObject.__)('Remove all colors')), canReset && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  45113. variant: "tertiary",
  45114. onClick: () => {
  45115. setEditingElement(null);
  45116. onChange();
  45117. onClose();
  45118. }
  45119. }, isGradient ? (0,external_wp_i18n_namespaceObject.__)('Reset gradient') : (0,external_wp_i18n_namespaceObject.__)('Reset colors'))));
  45120. }))), hasElements && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isEditing && (0,external_wp_element_namespaceObject.createElement)(PaletteEditListView, {
  45121. canOnlyChangeValues: canOnlyChangeValues,
  45122. elements: elements,
  45123. onChange: onChange,
  45124. editingElement: editingElement,
  45125. setEditingElement: setEditingElement,
  45126. slugPrefix: slugPrefix,
  45127. isGradient: isGradient
  45128. }), !isEditing && (isGradient ? (0,external_wp_element_namespaceObject.createElement)(GradientPicker, {
  45129. gradients: gradients,
  45130. onChange: () => {},
  45131. clearable: false,
  45132. disableCustomGradients: true
  45133. }) : (0,external_wp_element_namespaceObject.createElement)(ColorPalette, {
  45134. colors: colors,
  45135. onChange: () => {},
  45136. clearable: false,
  45137. disableCustomColors: true
  45138. }))), !hasElements && emptyMessage);
  45139. }
  45140. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/token-input.js
  45141. /**
  45142. * External dependencies
  45143. */
  45144. /**
  45145. * WordPress dependencies
  45146. */
  45147. class TokenInput extends external_wp_element_namespaceObject.Component {
  45148. constructor() {
  45149. super(...arguments);
  45150. this.onChange = this.onChange.bind(this);
  45151. this.bindInput = this.bindInput.bind(this);
  45152. }
  45153. focus() {
  45154. this.input.focus();
  45155. }
  45156. hasFocus() {
  45157. return this.input === this.input.ownerDocument.activeElement;
  45158. }
  45159. bindInput(ref) {
  45160. this.input = ref;
  45161. }
  45162. onChange(event) {
  45163. this.props.onChange({
  45164. value: event.target.value
  45165. });
  45166. }
  45167. render() {
  45168. const {
  45169. value,
  45170. isExpanded,
  45171. instanceId,
  45172. selectedSuggestionIndex,
  45173. className,
  45174. onChange,
  45175. ...props
  45176. } = this.props;
  45177. const size = value ? value.length + 1 : 0;
  45178. return (0,external_wp_element_namespaceObject.createElement)("input", extends_extends({
  45179. ref: this.bindInput,
  45180. id: `components-form-token-input-${instanceId}`,
  45181. type: "text"
  45182. }, props, {
  45183. value: value || '',
  45184. onChange: onChange ? this.onChange : undefined,
  45185. size: size,
  45186. className: classnames_default()(className, 'components-form-token-field__input'),
  45187. autoComplete: "off",
  45188. role: "combobox",
  45189. "aria-expanded": isExpanded,
  45190. "aria-autocomplete": "list",
  45191. "aria-owns": isExpanded ? `components-form-token-suggestions-${instanceId}` : undefined,
  45192. "aria-activedescendant": selectedSuggestionIndex !== -1 ? `components-form-token-suggestions-${instanceId}-${selectedSuggestionIndex}` : undefined,
  45193. "aria-describedby": `components-form-token-suggestions-howto-${instanceId}`
  45194. }));
  45195. }
  45196. }
  45197. /* harmony default export */ var token_input = (TokenInput);
  45198. // EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js
  45199. var lib = __webpack_require__(5425);
  45200. var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
  45201. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/suggestions-list.js
  45202. /**
  45203. * External dependencies
  45204. */
  45205. /**
  45206. * WordPress dependencies
  45207. */
  45208. const emptyList = Object.freeze([]);
  45209. const handleMouseDown = e => {
  45210. // By preventing default here, we will not lose focus of <input> when clicking a suggestion.
  45211. e.preventDefault();
  45212. };
  45213. function SuggestionsList(_ref) {
  45214. let {
  45215. selectedIndex,
  45216. scrollIntoView,
  45217. match = '',
  45218. onHover,
  45219. onSelect,
  45220. suggestions = emptyList,
  45221. displayTransform,
  45222. instanceId,
  45223. setTimeout
  45224. } = _ref;
  45225. const [scrollingIntoView, setScrollingIntoView] = (0,external_wp_element_namespaceObject.useState)(false);
  45226. const listRef = (0,external_wp_compose_namespaceObject.useRefEffect)(listNode => {
  45227. // only have to worry about scrolling selected suggestion into view
  45228. // when already expanded.
  45229. if (selectedIndex > -1 && scrollIntoView && listNode.children[selectedIndex]) {
  45230. setScrollingIntoView(true);
  45231. lib_default()(listNode.children[selectedIndex], listNode, {
  45232. onlyScrollIfNeeded: true
  45233. });
  45234. setTimeout(() => {
  45235. setScrollingIntoView(false);
  45236. }, 100);
  45237. }
  45238. }, [selectedIndex, scrollIntoView]);
  45239. const handleHover = suggestion => {
  45240. return () => {
  45241. if (!scrollingIntoView) {
  45242. onHover === null || onHover === void 0 ? void 0 : onHover(suggestion);
  45243. }
  45244. };
  45245. };
  45246. const handleClick = suggestion => {
  45247. return () => {
  45248. onSelect === null || onSelect === void 0 ? void 0 : onSelect(suggestion);
  45249. };
  45250. };
  45251. const computeSuggestionMatch = suggestion => {
  45252. const matchText = displayTransform(match || '').toLocaleLowerCase();
  45253. if (matchText.length === 0) {
  45254. return null;
  45255. }
  45256. suggestion = displayTransform(suggestion);
  45257. const indexOfMatch = suggestion.toLocaleLowerCase().indexOf(matchText);
  45258. return {
  45259. suggestionBeforeMatch: suggestion.substring(0, indexOfMatch),
  45260. suggestionMatch: suggestion.substring(indexOfMatch, indexOfMatch + matchText.length),
  45261. suggestionAfterMatch: suggestion.substring(indexOfMatch + matchText.length)
  45262. };
  45263. }; // We set `tabIndex` here because otherwise Firefox sets focus on this
  45264. // div when tabbing off of the input in `TokenField` -- not really sure
  45265. // why, since usually a div isn't focusable by default
  45266. // TODO does this still apply now that it's a <ul> and not a <div>?
  45267. return (0,external_wp_element_namespaceObject.createElement)("ul", {
  45268. ref: listRef,
  45269. className: "components-form-token-field__suggestions-list",
  45270. id: `components-form-token-suggestions-${instanceId}`,
  45271. role: "listbox"
  45272. }, (0,external_lodash_namespaceObject.map)(suggestions, (suggestion, index) => {
  45273. const matchText = computeSuggestionMatch(suggestion);
  45274. const className = classnames_default()('components-form-token-field__suggestion', {
  45275. 'is-selected': index === selectedIndex
  45276. });
  45277. /* eslint-disable jsx-a11y/click-events-have-key-events */
  45278. return (0,external_wp_element_namespaceObject.createElement)("li", {
  45279. id: `components-form-token-suggestions-${instanceId}-${index}`,
  45280. role: "option",
  45281. className: className,
  45282. key: suggestion !== null && suggestion !== void 0 && suggestion.value ? suggestion.value : displayTransform(suggestion),
  45283. onMouseDown: handleMouseDown,
  45284. onClick: handleClick(suggestion),
  45285. onMouseEnter: handleHover(suggestion),
  45286. "aria-selected": index === selectedIndex
  45287. }, matchText ? (0,external_wp_element_namespaceObject.createElement)("span", {
  45288. "aria-label": displayTransform(suggestion)
  45289. }, matchText.suggestionBeforeMatch, (0,external_wp_element_namespaceObject.createElement)("strong", {
  45290. className: "components-form-token-field__suggestion-match"
  45291. }, matchText.suggestionMatch), matchText.suggestionAfterMatch) : displayTransform(suggestion));
  45292. /* eslint-enable jsx-a11y/click-events-have-key-events */
  45293. }));
  45294. }
  45295. /* harmony default export */ var suggestions_list = ((0,external_wp_compose_namespaceObject.withSafeTimeout)(SuggestionsList));
  45296. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-outside/index.js
  45297. //@ts-nocheck
  45298. /**
  45299. * WordPress dependencies
  45300. */
  45301. /* harmony default export */ var with_focus_outside = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => {
  45302. const [handleFocusOutside, setHandleFocusOutside] = (0,external_wp_element_namespaceObject.useState)();
  45303. const bindFocusOutsideHandler = (0,external_wp_element_namespaceObject.useCallback)(node => setHandleFocusOutside(() => node !== null && node !== void 0 && node.handleFocusOutside ? node.handleFocusOutside.bind(node) : undefined), []);
  45304. return (0,external_wp_element_namespaceObject.createElement)("div", (0,external_wp_compose_namespaceObject.__experimentalUseFocusOutside)(handleFocusOutside), (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, extends_extends({
  45305. ref: bindFocusOutsideHandler
  45306. }, props)));
  45307. }, 'withFocusOutside'));
  45308. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/combobox-control/index.js
  45309. /**
  45310. * External dependencies
  45311. */
  45312. /**
  45313. * WordPress dependencies
  45314. */
  45315. /**
  45316. * Internal dependencies
  45317. */
  45318. const DetectOutside = with_focus_outside(class extends external_wp_element_namespaceObject.Component {
  45319. handleFocusOutside(event) {
  45320. this.props.onFocusOutside(event);
  45321. }
  45322. render() {
  45323. return this.props.children;
  45324. }
  45325. });
  45326. function ComboboxControl(_ref) {
  45327. var _currentOption$label;
  45328. let {
  45329. value,
  45330. label,
  45331. options,
  45332. onChange,
  45333. onFilterValueChange = external_lodash_namespaceObject.noop,
  45334. hideLabelFromVision,
  45335. help,
  45336. allowReset = true,
  45337. className,
  45338. messages = {
  45339. selected: (0,external_wp_i18n_namespaceObject.__)('Item selected.')
  45340. }
  45341. } = _ref;
  45342. const currentOption = options.find(option => option.value === value);
  45343. const currentLabel = (_currentOption$label = currentOption === null || currentOption === void 0 ? void 0 : currentOption.label) !== null && _currentOption$label !== void 0 ? _currentOption$label : '';
  45344. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ComboboxControl);
  45345. const [selectedSuggestion, setSelectedSuggestion] = (0,external_wp_element_namespaceObject.useState)(currentOption || null);
  45346. const [isExpanded, setIsExpanded] = (0,external_wp_element_namespaceObject.useState)(false);
  45347. const [inputHasFocus, setInputHasFocus] = (0,external_wp_element_namespaceObject.useState)(false);
  45348. const [inputValue, setInputValue] = (0,external_wp_element_namespaceObject.useState)('');
  45349. const inputContainer = (0,external_wp_element_namespaceObject.useRef)();
  45350. const matchingSuggestions = (0,external_wp_element_namespaceObject.useMemo)(() => {
  45351. const startsWithMatch = [];
  45352. const containsMatch = [];
  45353. const match = (0,external_lodash_namespaceObject.deburr)(inputValue.toLocaleLowerCase());
  45354. options.forEach(option => {
  45355. const index = (0,external_lodash_namespaceObject.deburr)(option.label).toLocaleLowerCase().indexOf(match);
  45356. if (index === 0) {
  45357. startsWithMatch.push(option);
  45358. } else if (index > 0) {
  45359. containsMatch.push(option);
  45360. }
  45361. });
  45362. return startsWithMatch.concat(containsMatch);
  45363. }, [inputValue, options, value]);
  45364. const onSuggestionSelected = newSelectedSuggestion => {
  45365. onChange(newSelectedSuggestion.value);
  45366. (0,external_wp_a11y_namespaceObject.speak)(messages.selected, 'assertive');
  45367. setSelectedSuggestion(newSelectedSuggestion);
  45368. setInputValue('');
  45369. setIsExpanded(false);
  45370. };
  45371. const handleArrowNavigation = function () {
  45372. let offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  45373. const index = matchingSuggestions.indexOf(selectedSuggestion);
  45374. let nextIndex = index + offset;
  45375. if (nextIndex < 0) {
  45376. nextIndex = matchingSuggestions.length - 1;
  45377. } else if (nextIndex >= matchingSuggestions.length) {
  45378. nextIndex = 0;
  45379. }
  45380. setSelectedSuggestion(matchingSuggestions[nextIndex]);
  45381. setIsExpanded(true);
  45382. };
  45383. const onKeyDown = event => {
  45384. let preventDefault = false;
  45385. if (event.defaultPrevented) {
  45386. return;
  45387. }
  45388. switch (event.keyCode) {
  45389. case external_wp_keycodes_namespaceObject.ENTER:
  45390. if (selectedSuggestion) {
  45391. onSuggestionSelected(selectedSuggestion);
  45392. preventDefault = true;
  45393. }
  45394. break;
  45395. case external_wp_keycodes_namespaceObject.UP:
  45396. handleArrowNavigation(-1);
  45397. preventDefault = true;
  45398. break;
  45399. case external_wp_keycodes_namespaceObject.DOWN:
  45400. handleArrowNavigation(1);
  45401. preventDefault = true;
  45402. break;
  45403. case external_wp_keycodes_namespaceObject.ESCAPE:
  45404. setIsExpanded(false);
  45405. setSelectedSuggestion(null);
  45406. preventDefault = true;
  45407. break;
  45408. default:
  45409. break;
  45410. }
  45411. if (preventDefault) {
  45412. event.preventDefault();
  45413. }
  45414. };
  45415. const onBlur = () => {
  45416. setInputHasFocus(false);
  45417. };
  45418. const onFocus = () => {
  45419. setInputHasFocus(true);
  45420. setIsExpanded(true);
  45421. onFilterValueChange('');
  45422. setInputValue('');
  45423. };
  45424. const onFocusOutside = () => {
  45425. setIsExpanded(false);
  45426. };
  45427. const onInputChange = event => {
  45428. const text = event.value;
  45429. setInputValue(text);
  45430. onFilterValueChange(text);
  45431. if (inputHasFocus) {
  45432. setIsExpanded(true);
  45433. }
  45434. };
  45435. const handleOnReset = () => {
  45436. onChange(null);
  45437. inputContainer.current.input.focus();
  45438. }; // Update current selections when the filter input changes.
  45439. (0,external_wp_element_namespaceObject.useEffect)(() => {
  45440. const hasMatchingSuggestions = matchingSuggestions.length > 0;
  45441. const hasSelectedMatchingSuggestions = matchingSuggestions.indexOf(selectedSuggestion) > 0;
  45442. if (hasMatchingSuggestions && !hasSelectedMatchingSuggestions) {
  45443. // If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.
  45444. setSelectedSuggestion(matchingSuggestions[0]);
  45445. }
  45446. }, [matchingSuggestions, selectedSuggestion]); // Announcements.
  45447. (0,external_wp_element_namespaceObject.useEffect)(() => {
  45448. const hasMatchingSuggestions = matchingSuggestions.length > 0;
  45449. if (isExpanded) {
  45450. const message = hasMatchingSuggestions ? (0,external_wp_i18n_namespaceObject.sprintf)(
  45451. /* translators: %d: number of results. */
  45452. (0,external_wp_i18n_namespaceObject._n)('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', matchingSuggestions.length), matchingSuggestions.length) : (0,external_wp_i18n_namespaceObject.__)('No results.');
  45453. (0,external_wp_a11y_namespaceObject.speak)(message, 'polite');
  45454. }
  45455. }, [matchingSuggestions, isExpanded]); // Disable reason: There is no appropriate role which describes the
  45456. // input container intended accessible usability.
  45457. // TODO: Refactor click detection to use blur to stop propagation.
  45458. /* eslint-disable jsx-a11y/no-static-element-interactions */
  45459. return (0,external_wp_element_namespaceObject.createElement)(DetectOutside, {
  45460. onFocusOutside: onFocusOutside
  45461. }, (0,external_wp_element_namespaceObject.createElement)(base_control, {
  45462. className: classnames_default()(className, 'components-combobox-control'),
  45463. tabIndex: "-1",
  45464. label: label,
  45465. id: `components-form-token-input-${instanceId}`,
  45466. hideLabelFromVision: hideLabelFromVision,
  45467. help: help
  45468. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  45469. className: "components-combobox-control__suggestions-container",
  45470. tabIndex: "-1",
  45471. onKeyDown: onKeyDown
  45472. }, (0,external_wp_element_namespaceObject.createElement)(flex_component, null, (0,external_wp_element_namespaceObject.createElement)(flex_block_component, null, (0,external_wp_element_namespaceObject.createElement)(token_input, {
  45473. className: "components-combobox-control__input",
  45474. instanceId: instanceId,
  45475. ref: inputContainer,
  45476. value: isExpanded ? inputValue : currentLabel,
  45477. "aria-label": currentLabel ? `${currentLabel}, ${label}` : null,
  45478. onFocus: onFocus,
  45479. onBlur: onBlur,
  45480. isExpanded: isExpanded,
  45481. selectedSuggestionIndex: matchingSuggestions.indexOf(selectedSuggestion),
  45482. onChange: onInputChange
  45483. })), allowReset && (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  45484. className: "components-combobox-control__reset",
  45485. icon: close_small,
  45486. disabled: !value,
  45487. onClick: handleOnReset,
  45488. label: (0,external_wp_i18n_namespaceObject.__)('Reset')
  45489. }))), isExpanded && (0,external_wp_element_namespaceObject.createElement)(suggestions_list, {
  45490. instanceId: instanceId,
  45491. match: {
  45492. label: inputValue
  45493. },
  45494. displayTransform: suggestion => suggestion.label,
  45495. suggestions: matchingSuggestions,
  45496. selectedIndex: matchingSuggestions.indexOf(selectedSuggestion),
  45497. onHover: setSelectedSuggestion,
  45498. onSelect: onSuggestionSelected,
  45499. scrollIntoView: true
  45500. }))));
  45501. /* eslint-enable jsx-a11y/no-static-element-interactions */
  45502. }
  45503. /* harmony default export */ var combobox_control = (ComboboxControl);
  45504. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/modal/aria-helper.js
  45505. // @ts-nocheck
  45506. /**
  45507. * External dependencies
  45508. */
  45509. const LIVE_REGION_ARIA_ROLES = new Set(['alert', 'status', 'log', 'marquee', 'timer']);
  45510. let hiddenElements = [],
  45511. isHidden = false;
  45512. /**
  45513. * Hides all elements in the body element from screen-readers except
  45514. * the provided element and elements that should not be hidden from
  45515. * screen-readers.
  45516. *
  45517. * The reason we do this is because `aria-modal="true"` currently is bugged
  45518. * in Safari, and support is spotty in other browsers overall. In the future
  45519. * we should consider removing these helper functions in favor of
  45520. * `aria-modal="true"`.
  45521. *
  45522. * @param {Element} unhiddenElement The element that should not be hidden.
  45523. */
  45524. function hideApp(unhiddenElement) {
  45525. if (isHidden) {
  45526. return;
  45527. }
  45528. const elements = document.body.children;
  45529. (0,external_lodash_namespaceObject.forEach)(elements, element => {
  45530. if (element === unhiddenElement) {
  45531. return;
  45532. }
  45533. if (elementShouldBeHidden(element)) {
  45534. element.setAttribute('aria-hidden', 'true');
  45535. hiddenElements.push(element);
  45536. }
  45537. });
  45538. isHidden = true;
  45539. }
  45540. /**
  45541. * Determines if the passed element should not be hidden from screen readers.
  45542. *
  45543. * @param {HTMLElement} element The element that should be checked.
  45544. *
  45545. * @return {boolean} Whether the element should not be hidden from screen-readers.
  45546. */
  45547. function elementShouldBeHidden(element) {
  45548. const role = element.getAttribute('role');
  45549. return !(element.tagName === 'SCRIPT' || element.hasAttribute('aria-hidden') || element.hasAttribute('aria-live') || LIVE_REGION_ARIA_ROLES.has(role));
  45550. }
  45551. /**
  45552. * Makes all elements in the body that have been hidden by `hideApp`
  45553. * visible again to screen-readers.
  45554. */
  45555. function showApp() {
  45556. if (!isHidden) {
  45557. return;
  45558. }
  45559. (0,external_lodash_namespaceObject.forEach)(hiddenElements, element => {
  45560. element.removeAttribute('aria-hidden');
  45561. });
  45562. hiddenElements = [];
  45563. isHidden = false;
  45564. }
  45565. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/modal/index.js
  45566. // @ts-nocheck
  45567. /**
  45568. * External dependencies
  45569. */
  45570. /**
  45571. * WordPress dependencies
  45572. */
  45573. /**
  45574. * Internal dependencies
  45575. */
  45576. // Used to count the number of open modals.
  45577. let openModalCount = 0;
  45578. function Modal(props, forwardedRef) {
  45579. const {
  45580. bodyOpenClassName = 'modal-open',
  45581. role = 'dialog',
  45582. title = null,
  45583. focusOnMount = true,
  45584. shouldCloseOnEsc = true,
  45585. shouldCloseOnClickOutside = true,
  45586. isDismissible = true,
  45587. /* Accessibility. */
  45588. aria = {
  45589. labelledby: null,
  45590. describedby: null
  45591. },
  45592. onRequestClose,
  45593. icon,
  45594. closeButtonLabel,
  45595. children,
  45596. style,
  45597. overlayClassName,
  45598. className,
  45599. contentLabel,
  45600. onKeyDown,
  45601. isFullScreen = false,
  45602. __experimentalHideHeader = false
  45603. } = props;
  45604. const ref = (0,external_wp_element_namespaceObject.useRef)();
  45605. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Modal);
  45606. const headingId = title ? `components-modal-header-${instanceId}` : aria.labelledby;
  45607. const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)(focusOnMount);
  45608. const constrainedTabbingRef = (0,external_wp_compose_namespaceObject.useConstrainedTabbing)();
  45609. const focusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
  45610. const focusOutsideProps = (0,external_wp_compose_namespaceObject.__experimentalUseFocusOutside)(onRequestClose);
  45611. (0,external_wp_element_namespaceObject.useEffect)(() => {
  45612. openModalCount++;
  45613. if (openModalCount === 1) {
  45614. hideApp(ref.current);
  45615. document.body.classList.add(bodyOpenClassName);
  45616. }
  45617. return () => {
  45618. openModalCount--;
  45619. if (openModalCount === 0) {
  45620. document.body.classList.remove(bodyOpenClassName);
  45621. showApp();
  45622. }
  45623. };
  45624. }, []);
  45625. function handleEscapeKeyDown(event) {
  45626. if (shouldCloseOnEsc && event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
  45627. event.preventDefault();
  45628. if (onRequestClose) {
  45629. onRequestClose(event);
  45630. }
  45631. }
  45632. }
  45633. return (0,external_wp_element_namespaceObject.createPortal)( // eslint-disable-next-line jsx-a11y/no-static-element-interactions
  45634. (0,external_wp_element_namespaceObject.createElement)("div", {
  45635. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]),
  45636. className: classnames_default()('components-modal__screen-overlay', overlayClassName),
  45637. onKeyDown: handleEscapeKeyDown
  45638. }, (0,external_wp_element_namespaceObject.createElement)(StyleProvider, {
  45639. document: document
  45640. }, (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({
  45641. className: classnames_default()('components-modal__frame', className, {
  45642. 'is-full-screen': isFullScreen
  45643. }),
  45644. style: style,
  45645. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([constrainedTabbingRef, focusReturnRef, focusOnMountRef]),
  45646. role: role,
  45647. "aria-label": contentLabel,
  45648. "aria-labelledby": contentLabel ? null : headingId,
  45649. "aria-describedby": aria.describedby,
  45650. tabIndex: "-1"
  45651. }, shouldCloseOnClickOutside ? focusOutsideProps : {}, {
  45652. onKeyDown: onKeyDown
  45653. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  45654. className: classnames_default()('components-modal__content', {
  45655. 'hide-header': __experimentalHideHeader
  45656. }),
  45657. role: "document"
  45658. }, !__experimentalHideHeader && (0,external_wp_element_namespaceObject.createElement)("div", {
  45659. className: "components-modal__header"
  45660. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  45661. className: "components-modal__header-heading-container"
  45662. }, icon && (0,external_wp_element_namespaceObject.createElement)("span", {
  45663. className: "components-modal__icon-container",
  45664. "aria-hidden": true
  45665. }, icon), title && (0,external_wp_element_namespaceObject.createElement)("h1", {
  45666. id: headingId,
  45667. className: "components-modal__header-heading"
  45668. }, title)), isDismissible && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  45669. onClick: onRequestClose,
  45670. icon: close_small,
  45671. label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)('Close dialog')
  45672. })), children)))), document.body);
  45673. }
  45674. /* harmony default export */ var modal = ((0,external_wp_element_namespaceObject.forwardRef)(Modal));
  45675. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/confirm-dialog/styles.js
  45676. function confirm_dialog_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  45677. /**
  45678. * External dependencies
  45679. */
  45680. /**
  45681. * The z-index for ConfirmDialog is being set here instead of in
  45682. * packages/base-styles/_z-index.scss, because this component uses
  45683. * emotion instead of sass.
  45684. *
  45685. * ConfirmDialog needs this higher z-index to ensure it renders on top of
  45686. * any parent Popover component.
  45687. */
  45688. const wrapper = true ? {
  45689. name: "7g5ii0",
  45690. styles: "&&{z-index:1000001;}"
  45691. } : 0;
  45692. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/confirm-dialog/component.js
  45693. /**
  45694. * External dependencies
  45695. */
  45696. /**
  45697. * WordPress dependencies
  45698. */
  45699. /**
  45700. * Internal dependencies
  45701. */
  45702. function ConfirmDialog(props, forwardedRef) {
  45703. const {
  45704. isOpen: isOpenProp,
  45705. onConfirm,
  45706. onCancel,
  45707. children,
  45708. confirmButtonText,
  45709. cancelButtonText,
  45710. ...otherProps
  45711. } = useContextSystem(props, 'ConfirmDialog');
  45712. const cx = useCx();
  45713. const wrapperClassName = cx(wrapper);
  45714. const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)();
  45715. const [shouldSelfClose, setShouldSelfClose] = (0,external_wp_element_namespaceObject.useState)();
  45716. (0,external_wp_element_namespaceObject.useEffect)(() => {
  45717. // We only allow the dialog to close itself if `isOpenProp` is *not* set.
  45718. // If `isOpenProp` is set, then it (probably) means it's controlled by a
  45719. // parent component. In that case, `shouldSelfClose` might do more harm than
  45720. // good, so we disable it.
  45721. const isIsOpenSet = typeof isOpenProp !== 'undefined';
  45722. setIsOpen(isIsOpenSet ? isOpenProp : true);
  45723. setShouldSelfClose(!isIsOpenSet);
  45724. }, [isOpenProp]);
  45725. const handleEvent = (0,external_wp_element_namespaceObject.useCallback)(callback => event => {
  45726. callback === null || callback === void 0 ? void 0 : callback(event);
  45727. if (shouldSelfClose) {
  45728. setIsOpen(false);
  45729. }
  45730. }, [shouldSelfClose, setIsOpen]);
  45731. const handleEnter = (0,external_wp_element_namespaceObject.useCallback)(event => {
  45732. if (event.key === 'Enter') {
  45733. handleEvent(onConfirm)(event);
  45734. }
  45735. }, [handleEvent, onConfirm]);
  45736. const cancelLabel = cancelButtonText !== null && cancelButtonText !== void 0 ? cancelButtonText : (0,external_wp_i18n_namespaceObject.__)('Cancel');
  45737. const confirmLabel = confirmButtonText !== null && confirmButtonText !== void 0 ? confirmButtonText : (0,external_wp_i18n_namespaceObject.__)('OK');
  45738. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isOpen && (0,external_wp_element_namespaceObject.createElement)(modal, extends_extends({
  45739. onRequestClose: handleEvent(onCancel),
  45740. onKeyDown: handleEnter,
  45741. closeButtonLabel: cancelLabel,
  45742. isDismissible: true,
  45743. ref: forwardedRef,
  45744. overlayClassName: wrapperClassName,
  45745. __experimentalHideHeader: true
  45746. }, otherProps), (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  45747. spacing: 8
  45748. }, (0,external_wp_element_namespaceObject.createElement)(text_component, null, children), (0,external_wp_element_namespaceObject.createElement)(flex_component, {
  45749. direction: "row",
  45750. justify: "flex-end"
  45751. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  45752. variant: "tertiary",
  45753. onClick: handleEvent(onCancel)
  45754. }, cancelLabel), (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  45755. variant: "primary",
  45756. onClick: handleEvent(onConfirm)
  45757. }, confirmLabel)))));
  45758. }
  45759. /* harmony default export */ var confirm_dialog_component = (contextConnect(ConfirmDialog, 'ConfirmDialog'));
  45760. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
  45761. function objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(source, excluded) {
  45762. if (source == null) return {};
  45763. var target = {};
  45764. var sourceKeys = Object.keys(source);
  45765. var key, i;
  45766. for (i = 0; i < sourceKeys.length; i++) {
  45767. key = sourceKeys[i];
  45768. if (excluded.indexOf(key) >= 0) continue;
  45769. target[key] = source[key];
  45770. }
  45771. return target;
  45772. }
  45773. // EXTERNAL MODULE: ./node_modules/prop-types/index.js
  45774. var prop_types = __webpack_require__(2652);
  45775. var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
  45776. // EXTERNAL MODULE: ./node_modules/downshift/node_modules/react-is/index.js
  45777. var react_is = __webpack_require__(2797);
  45778. ;// CONCATENATED MODULE: ./node_modules/compute-scroll-into-view/dist/index.module.js
  45779. function index_module_t(t){return"object"==typeof t&&null!=t&&1===t.nodeType}function index_module_e(t,e){return(!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function index_module_n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return index_module_e(r.overflowY,n)||index_module_e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return!1}function index_module_r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}/* harmony default export */ function index_module(e,i){var o=window,l=i.scrollMode,d=i.block,u=i.inline,h=i.boundary,a=i.skipOverflowHiddenElements,c="function"==typeof h?h:function(t){return t!==h};if(!index_module_t(e))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,s=[],p=e;index_module_t(p)&&c(p);){if((p=p.parentElement)===f){s.push(p);break}null!=p&&p===document.body&&index_module_n(p)&&!index_module_n(document.documentElement)||null!=p&&index_module_n(p,a)&&s.push(p)}for(var m=o.visualViewport?o.visualViewport.width:innerWidth,g=o.visualViewport?o.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,W=e.getBoundingClientRect(),b=W.height,H=W.width,y=W.top,E=W.right,M=W.bottom,V=W.left,x="start"===d||"nearest"===d?y:"end"===d?M:y+b/2,I="center"===u?V+H/2:"end"===u?E:V,C=[],T=0;T<s.length;T++){var k=s[T],B=k.getBoundingClientRect(),D=B.height,O=B.width,R=B.top,X=B.right,Y=B.bottom,L=B.left;if("if-needed"===l&&y>=0&&V>=0&&M<=g&&E<=m&&y>=R&&M<=Y&&V>=L&&E<=X)return C;var S=getComputedStyle(k),j=parseInt(S.borderLeftWidth,10),q=parseInt(S.borderTopWidth,10),z=parseInt(S.borderRightWidth,10),A=parseInt(S.borderBottomWidth,10),F=0,G=0,J="offsetWidth"in k?k.offsetWidth-k.clientWidth-j-z:0,K="offsetHeight"in k?k.offsetHeight-k.clientHeight-q-A:0;if(f===k)F="start"===d?x:"end"===d?x-g:"nearest"===d?index_module_r(v,v+g,g,q,A,v+x,v+x+b,b):x-g/2,G="start"===u?I:"center"===u?I-m/2:"end"===u?I-m:index_module_r(w,w+m,m,j,z,w+I,w+I+H,H),F=Math.max(0,F+v),G=Math.max(0,G+w);else{F="start"===d?x-R-q:"end"===d?x-Y+A+K:"nearest"===d?index_module_r(R,Y,D,q,A+K,x,x+b,b):x-(R+D/2)+K/2,G="start"===u?I-L-j:"center"===u?I-(L+O/2)+J/2:"end"===u?I-X+z+J:index_module_r(L,X,O,j,z+J,I,I+H,H);var N=k.scrollLeft,P=k.scrollTop;x+=P-(F=Math.max(0,Math.min(P+F,k.scrollHeight-D+K))),I+=N-(G=Math.max(0,Math.min(N+G,k.scrollWidth-O+J)))}C.push({el:k,top:F,left:G})}return C}
  45780. ;// CONCATENATED MODULE: ./node_modules/downshift/dist/downshift.esm.js
  45781. var idCounter = 0;
  45782. /**
  45783. * Accepts a parameter and returns it if it's a function
  45784. * or a noop function if it's not. This allows us to
  45785. * accept a callback, but not worry about it if it's not
  45786. * passed.
  45787. * @param {Function} cb the callback
  45788. * @return {Function} a function
  45789. */
  45790. function cbToCb(cb) {
  45791. return typeof cb === 'function' ? cb : downshift_esm_noop;
  45792. }
  45793. function downshift_esm_noop() {}
  45794. /**
  45795. * Scroll node into view if necessary
  45796. * @param {HTMLElement} node the element that should scroll into view
  45797. * @param {HTMLElement} menuNode the menu element of the component
  45798. */
  45799. function scrollIntoView(node, menuNode) {
  45800. if (!node) {
  45801. return;
  45802. }
  45803. var actions = index_module(node, {
  45804. boundary: menuNode,
  45805. block: 'nearest',
  45806. scrollMode: 'if-needed'
  45807. });
  45808. actions.forEach(function (_ref) {
  45809. var el = _ref.el,
  45810. top = _ref.top,
  45811. left = _ref.left;
  45812. el.scrollTop = top;
  45813. el.scrollLeft = left;
  45814. });
  45815. }
  45816. /**
  45817. * @param {HTMLElement} parent the parent node
  45818. * @param {HTMLElement} child the child node
  45819. * @param {Window} environment The window context where downshift renders.
  45820. * @return {Boolean} whether the parent is the child or the child is in the parent
  45821. */
  45822. function isOrContainsNode(parent, child, environment) {
  45823. var result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
  45824. return result;
  45825. }
  45826. /**
  45827. * Simple debounce implementation. Will call the given
  45828. * function once after the time given has passed since
  45829. * it was last called.
  45830. * @param {Function} fn the function to call after the time
  45831. * @param {Number} time the time to wait
  45832. * @return {Function} the debounced function
  45833. */
  45834. function downshift_esm_debounce(fn, time) {
  45835. var timeoutId;
  45836. function cancel() {
  45837. if (timeoutId) {
  45838. clearTimeout(timeoutId);
  45839. }
  45840. }
  45841. function wrapper() {
  45842. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  45843. args[_key] = arguments[_key];
  45844. }
  45845. cancel();
  45846. timeoutId = setTimeout(function () {
  45847. timeoutId = null;
  45848. fn.apply(void 0, args);
  45849. }, time);
  45850. }
  45851. wrapper.cancel = cancel;
  45852. return wrapper;
  45853. }
  45854. /**
  45855. * This is intended to be used to compose event handlers.
  45856. * They are executed in order until one of them sets
  45857. * `event.preventDownshiftDefault = true`.
  45858. * @param {...Function} fns the event handler functions
  45859. * @return {Function} the event handler to add to an element
  45860. */
  45861. function callAllEventHandlers() {
  45862. for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  45863. fns[_key2] = arguments[_key2];
  45864. }
  45865. return function (event) {
  45866. for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  45867. args[_key3 - 1] = arguments[_key3];
  45868. }
  45869. return fns.some(function (fn) {
  45870. if (fn) {
  45871. fn.apply(void 0, [event].concat(args));
  45872. }
  45873. return event.preventDownshiftDefault || event.hasOwnProperty('nativeEvent') && event.nativeEvent.preventDownshiftDefault;
  45874. });
  45875. };
  45876. }
  45877. function handleRefs() {
  45878. for (var _len4 = arguments.length, refs = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  45879. refs[_key4] = arguments[_key4];
  45880. }
  45881. return function (node) {
  45882. refs.forEach(function (ref) {
  45883. if (typeof ref === 'function') {
  45884. ref(node);
  45885. } else if (ref) {
  45886. ref.current = node;
  45887. }
  45888. });
  45889. };
  45890. }
  45891. /**
  45892. * This generates a unique ID for an instance of Downshift
  45893. * @return {String} the unique ID
  45894. */
  45895. function generateId() {
  45896. return String(idCounter++);
  45897. }
  45898. /**
  45899. * Resets idCounter to 0. Used for SSR.
  45900. */
  45901. function resetIdCounter() {
  45902. idCounter = 0;
  45903. }
  45904. /**
  45905. * Default implementation for status message. Only added when menu is open.
  45906. * Will specify if there are results in the list, and if so, how many,
  45907. * and what keys are relevant.
  45908. *
  45909. * @param {Object} param the downshift state and other relevant properties
  45910. * @return {String} the a11y status message
  45911. */
  45912. function getA11yStatusMessage$1(_ref2) {
  45913. var isOpen = _ref2.isOpen,
  45914. resultCount = _ref2.resultCount,
  45915. previousResultCount = _ref2.previousResultCount;
  45916. if (!isOpen) {
  45917. return '';
  45918. }
  45919. if (!resultCount) {
  45920. return 'No results are available.';
  45921. }
  45922. if (resultCount !== previousResultCount) {
  45923. return resultCount + " result" + (resultCount === 1 ? ' is' : 's are') + " available, use up and down arrow keys to navigate. Press Enter key to select.";
  45924. }
  45925. return '';
  45926. }
  45927. /**
  45928. * Takes an argument and if it's an array, returns the first item in the array
  45929. * otherwise returns the argument
  45930. * @param {*} arg the maybe-array
  45931. * @param {*} defaultValue the value if arg is falsey not defined
  45932. * @return {*} the arg or it's first item
  45933. */
  45934. function unwrapArray(arg, defaultValue) {
  45935. arg = Array.isArray(arg) ?
  45936. /* istanbul ignore next (preact) */
  45937. arg[0] : arg;
  45938. if (!arg && defaultValue) {
  45939. return defaultValue;
  45940. } else {
  45941. return arg;
  45942. }
  45943. }
  45944. /**
  45945. * @param {Object} element (P)react element
  45946. * @return {Boolean} whether it's a DOM element
  45947. */
  45948. function isDOMElement(element) {
  45949. return typeof element.type === 'string';
  45950. }
  45951. /**
  45952. * @param {Object} element (P)react element
  45953. * @return {Object} the props
  45954. */
  45955. function getElementProps(element) {
  45956. return element.props;
  45957. }
  45958. /**
  45959. * Throws a helpful error message for required properties. Useful
  45960. * to be used as a default in destructuring or object params.
  45961. * @param {String} fnName the function name
  45962. * @param {String} propName the prop name
  45963. */
  45964. function requiredProp(fnName, propName) {
  45965. // eslint-disable-next-line no-console
  45966. console.error("The property \"" + propName + "\" is required in \"" + fnName + "\"");
  45967. }
  45968. var stateKeys = (/* unused pure expression or super */ null && (['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type']));
  45969. /**
  45970. * @param {Object} state the state object
  45971. * @return {Object} state that is relevant to downshift
  45972. */
  45973. function pickState(state) {
  45974. if (state === void 0) {
  45975. state = {};
  45976. }
  45977. var result = {};
  45978. stateKeys.forEach(function (k) {
  45979. if (state.hasOwnProperty(k)) {
  45980. result[k] = state[k];
  45981. }
  45982. });
  45983. return result;
  45984. }
  45985. /**
  45986. * This will perform a shallow merge of the given state object
  45987. * with the state coming from props
  45988. * (for the controlled component scenario)
  45989. * This is used in state updater functions so they're referencing
  45990. * the right state regardless of where it comes from.
  45991. *
  45992. * @param {Object} state The state of the component/hook.
  45993. * @param {Object} props The props that may contain controlled values.
  45994. * @returns {Object} The merged controlled state.
  45995. */
  45996. function getState(state, props) {
  45997. return Object.keys(state).reduce(function (prevState, key) {
  45998. prevState[key] = isControlledProp(props, key) ? props[key] : state[key];
  45999. return prevState;
  46000. }, {});
  46001. }
  46002. /**
  46003. * This determines whether a prop is a "controlled prop" meaning it is
  46004. * state which is controlled by the outside of this component rather
  46005. * than within this component.
  46006. *
  46007. * @param {Object} props The props that may contain controlled values.
  46008. * @param {String} key the key to check
  46009. * @return {Boolean} whether it is a controlled controlled prop
  46010. */
  46011. function isControlledProp(props, key) {
  46012. return props[key] !== undefined;
  46013. }
  46014. /**
  46015. * Normalizes the 'key' property of a KeyboardEvent in IE/Edge
  46016. * @param {Object} event a keyboardEvent object
  46017. * @return {String} keyboard key
  46018. */
  46019. function normalizeArrowKey(event) {
  46020. var key = event.key,
  46021. keyCode = event.keyCode;
  46022. /* istanbul ignore next (ie) */
  46023. if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
  46024. return "Arrow" + key;
  46025. }
  46026. return key;
  46027. }
  46028. /**
  46029. * Simple check if the value passed is object literal
  46030. * @param {*} obj any things
  46031. * @return {Boolean} whether it's object literal
  46032. */
  46033. function downshift_esm_isPlainObject(obj) {
  46034. return Object.prototype.toString.call(obj) === '[object Object]';
  46035. }
  46036. /**
  46037. * Returns the new index in the list, in a circular way. If next value is out of bonds from the total,
  46038. * it will wrap to either 0 or itemCount - 1.
  46039. *
  46040. * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.
  46041. * @param {number} baseIndex The initial position to move from.
  46042. * @param {number} itemCount The total number of items.
  46043. * @param {Function} getItemNodeFromIndex Used to check if item is disabled.
  46044. * @param {boolean} circular Specify if navigation is circular. Default is true.
  46045. * @returns {number} The new index after the move.
  46046. */
  46047. function getNextWrappingIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {
  46048. if (circular === void 0) {
  46049. circular = true;
  46050. }
  46051. if (itemCount === 0) {
  46052. return -1;
  46053. }
  46054. var itemsLastIndex = itemCount - 1;
  46055. if (typeof baseIndex !== 'number' || baseIndex < 0 || baseIndex >= itemCount) {
  46056. baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1;
  46057. }
  46058. var newIndex = baseIndex + moveAmount;
  46059. if (newIndex < 0) {
  46060. newIndex = circular ? itemsLastIndex : 0;
  46061. } else if (newIndex > itemsLastIndex) {
  46062. newIndex = circular ? 0 : itemsLastIndex;
  46063. }
  46064. var nonDisabledNewIndex = getNextNonDisabledIndex(moveAmount, newIndex, itemCount, getItemNodeFromIndex, circular);
  46065. if (nonDisabledNewIndex === -1) {
  46066. return baseIndex >= itemCount ? -1 : baseIndex;
  46067. }
  46068. return nonDisabledNewIndex;
  46069. }
  46070. /**
  46071. * Returns the next index in the list of an item that is not disabled.
  46072. *
  46073. * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.
  46074. * @param {number} baseIndex The initial position to move from.
  46075. * @param {number} itemCount The total number of items.
  46076. * @param {Function} getItemNodeFromIndex Used to check if item is disabled.
  46077. * @param {boolean} circular Specify if navigation is circular. Default is true.
  46078. * @returns {number} The new index. Returns baseIndex if item is not disabled. Returns next non-disabled item otherwise. If no non-disabled found it will return -1.
  46079. */
  46080. function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {
  46081. var currentElementNode = getItemNodeFromIndex(baseIndex);
  46082. if (!currentElementNode || !currentElementNode.hasAttribute('disabled')) {
  46083. return baseIndex;
  46084. }
  46085. if (moveAmount > 0) {
  46086. for (var index = baseIndex + 1; index < itemCount; index++) {
  46087. if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {
  46088. return index;
  46089. }
  46090. }
  46091. } else {
  46092. for (var _index = baseIndex - 1; _index >= 0; _index--) {
  46093. if (!getItemNodeFromIndex(_index).hasAttribute('disabled')) {
  46094. return _index;
  46095. }
  46096. }
  46097. }
  46098. if (circular) {
  46099. return moveAmount > 0 ? getNextNonDisabledIndex(1, 0, itemCount, getItemNodeFromIndex, false) : getNextNonDisabledIndex(-1, itemCount - 1, itemCount, getItemNodeFromIndex, false);
  46100. }
  46101. return -1;
  46102. }
  46103. /**
  46104. * Checks if event target is within the downshift elements.
  46105. *
  46106. * @param {EventTarget} target Target to check.
  46107. * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
  46108. * @param {Window} environment The window context where downshift renders.
  46109. * @param {boolean} checkActiveElement Whether to also check activeElement.
  46110. *
  46111. * @returns {boolean} Whether or not the target is within downshift elements.
  46112. */
  46113. function targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) {
  46114. if (checkActiveElement === void 0) {
  46115. checkActiveElement = true;
  46116. }
  46117. return downshiftElements.some(function (contextNode) {
  46118. return contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment));
  46119. });
  46120. } // eslint-disable-next-line import/no-mutable-exports
  46121. var validateControlledUnchanged = (/* unused pure expression or super */ null && (downshift_esm_noop));
  46122. /* istanbul ignore next */
  46123. if (false) {}
  46124. var cleanupStatus = downshift_esm_debounce(function (documentProp) {
  46125. getStatusDiv(documentProp).textContent = '';
  46126. }, 500);
  46127. /**
  46128. * @param {String} status the status message
  46129. * @param {Object} documentProp document passed by the user.
  46130. */
  46131. function setStatus(status, documentProp) {
  46132. var div = getStatusDiv(documentProp);
  46133. if (!status) {
  46134. return;
  46135. }
  46136. div.textContent = status;
  46137. cleanupStatus(documentProp);
  46138. }
  46139. /**
  46140. * Get the status node or create it if it does not already exist.
  46141. * @param {Object} documentProp document passed by the user.
  46142. * @return {HTMLElement} the status node.
  46143. */
  46144. function getStatusDiv(documentProp) {
  46145. if (documentProp === void 0) {
  46146. documentProp = document;
  46147. }
  46148. var statusDiv = documentProp.getElementById('a11y-status-message');
  46149. if (statusDiv) {
  46150. return statusDiv;
  46151. }
  46152. statusDiv = documentProp.createElement('div');
  46153. statusDiv.setAttribute('id', 'a11y-status-message');
  46154. statusDiv.setAttribute('role', 'status');
  46155. statusDiv.setAttribute('aria-live', 'polite');
  46156. statusDiv.setAttribute('aria-relevant', 'additions text');
  46157. Object.assign(statusDiv.style, {
  46158. border: '0',
  46159. clip: 'rect(0 0 0 0)',
  46160. height: '1px',
  46161. margin: '-1px',
  46162. overflow: 'hidden',
  46163. padding: '0',
  46164. position: 'absolute',
  46165. width: '1px'
  46166. });
  46167. documentProp.body.appendChild(statusDiv);
  46168. return statusDiv;
  46169. }
  46170. var unknown = false ? 0 : 0;
  46171. var mouseUp = false ? 0 : 1;
  46172. var itemMouseEnter = false ? 0 : 2;
  46173. var keyDownArrowUp = false ? 0 : 3;
  46174. var keyDownArrowDown = false ? 0 : 4;
  46175. var keyDownEscape = false ? 0 : 5;
  46176. var keyDownEnter = false ? 0 : 6;
  46177. var keyDownHome = false ? 0 : 7;
  46178. var keyDownEnd = false ? 0 : 8;
  46179. var clickItem = false ? 0 : 9;
  46180. var blurInput = false ? 0 : 10;
  46181. var changeInput = false ? 0 : 11;
  46182. var keyDownSpaceButton = false ? 0 : 12;
  46183. var clickButton = false ? 0 : 13;
  46184. var blurButton = false ? 0 : 14;
  46185. var controlledPropUpdatedSelectedItem = false ? 0 : 15;
  46186. var touchEnd = false ? 0 : 16;
  46187. var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
  46188. __proto__: null,
  46189. unknown: unknown,
  46190. mouseUp: mouseUp,
  46191. itemMouseEnter: itemMouseEnter,
  46192. keyDownArrowUp: keyDownArrowUp,
  46193. keyDownArrowDown: keyDownArrowDown,
  46194. keyDownEscape: keyDownEscape,
  46195. keyDownEnter: keyDownEnter,
  46196. keyDownHome: keyDownHome,
  46197. keyDownEnd: keyDownEnd,
  46198. clickItem: clickItem,
  46199. blurInput: blurInput,
  46200. changeInput: changeInput,
  46201. keyDownSpaceButton: keyDownSpaceButton,
  46202. clickButton: clickButton,
  46203. blurButton: blurButton,
  46204. controlledPropUpdatedSelectedItem: controlledPropUpdatedSelectedItem,
  46205. touchEnd: touchEnd
  46206. });
  46207. var _excluded$4 = (/* unused pure expression or super */ null && (["refKey", "ref"])),
  46208. _excluded2$3 = (/* unused pure expression or super */ null && (["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"])),
  46209. _excluded3$2 = (/* unused pure expression or super */ null && (["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"])),
  46210. _excluded4$1 = (/* unused pure expression or super */ null && (["refKey", "ref"])),
  46211. _excluded5$1 = (/* unused pure expression or super */ null && (["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"]));
  46212. var Downshift = /*#__PURE__*/(/* unused pure expression or super */ null && (function () {
  46213. var Downshift = /*#__PURE__*/function (_Component) {
  46214. _inheritsLoose(Downshift, _Component);
  46215. function Downshift(_props) {
  46216. var _this;
  46217. _this = _Component.call(this, _props) || this; // fancy destructuring + defaults + aliases
  46218. // this basically says each value of state should either be set to
  46219. // the initial value or the default value if the initial value is not provided
  46220. _this.id = _this.props.id || "downshift-" + generateId();
  46221. _this.menuId = _this.props.menuId || _this.id + "-menu";
  46222. _this.labelId = _this.props.labelId || _this.id + "-label";
  46223. _this.inputId = _this.props.inputId || _this.id + "-input";
  46224. _this.getItemId = _this.props.getItemId || function (index) {
  46225. return _this.id + "-item-" + index;
  46226. };
  46227. _this.input = null;
  46228. _this.items = [];
  46229. _this.itemCount = null;
  46230. _this.previousResultCount = 0;
  46231. _this.timeoutIds = [];
  46232. _this.internalSetTimeout = function (fn, time) {
  46233. var id = setTimeout(function () {
  46234. _this.timeoutIds = _this.timeoutIds.filter(function (i) {
  46235. return i !== id;
  46236. });
  46237. fn();
  46238. }, time);
  46239. _this.timeoutIds.push(id);
  46240. };
  46241. _this.setItemCount = function (count) {
  46242. _this.itemCount = count;
  46243. };
  46244. _this.unsetItemCount = function () {
  46245. _this.itemCount = null;
  46246. };
  46247. _this.setHighlightedIndex = function (highlightedIndex, otherStateToSet) {
  46248. if (highlightedIndex === void 0) {
  46249. highlightedIndex = _this.props.defaultHighlightedIndex;
  46250. }
  46251. if (otherStateToSet === void 0) {
  46252. otherStateToSet = {};
  46253. }
  46254. otherStateToSet = pickState(otherStateToSet);
  46255. _this.internalSetState(_extends({
  46256. highlightedIndex: highlightedIndex
  46257. }, otherStateToSet));
  46258. };
  46259. _this.clearSelection = function (cb) {
  46260. _this.internalSetState({
  46261. selectedItem: null,
  46262. inputValue: '',
  46263. highlightedIndex: _this.props.defaultHighlightedIndex,
  46264. isOpen: _this.props.defaultIsOpen
  46265. }, cb);
  46266. };
  46267. _this.selectItem = function (item, otherStateToSet, cb) {
  46268. otherStateToSet = pickState(otherStateToSet);
  46269. _this.internalSetState(_extends({
  46270. isOpen: _this.props.defaultIsOpen,
  46271. highlightedIndex: _this.props.defaultHighlightedIndex,
  46272. selectedItem: item,
  46273. inputValue: _this.props.itemToString(item)
  46274. }, otherStateToSet), cb);
  46275. };
  46276. _this.selectItemAtIndex = function (itemIndex, otherStateToSet, cb) {
  46277. var item = _this.items[itemIndex];
  46278. if (item == null) {
  46279. return;
  46280. }
  46281. _this.selectItem(item, otherStateToSet, cb);
  46282. };
  46283. _this.selectHighlightedItem = function (otherStateToSet, cb) {
  46284. return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb);
  46285. };
  46286. _this.internalSetState = function (stateToSet, cb) {
  46287. var isItemSelected, onChangeArg;
  46288. var onStateChangeArg = {};
  46289. var isStateToSetFunction = typeof stateToSet === 'function'; // we want to call `onInputValueChange` before the `setState` call
  46290. // so someone controlling the `inputValue` state gets notified of
  46291. // the input change as soon as possible. This avoids issues with
  46292. // preserving the cursor position.
  46293. // See https://github.com/downshift-js/downshift/issues/217 for more info.
  46294. if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {
  46295. _this.props.onInputValueChange(stateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), stateToSet));
  46296. }
  46297. return _this.setState(function (state) {
  46298. state = _this.getState(state);
  46299. var newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet; // Your own function that could modify the state that will be set.
  46300. newStateToSet = _this.props.stateReducer(state, newStateToSet); // checks if an item is selected, regardless of if it's different from
  46301. // what was selected before
  46302. // used to determine if onSelect and onChange callbacks should be called
  46303. isItemSelected = newStateToSet.hasOwnProperty('selectedItem'); // this keeps track of the object we want to call with setState
  46304. var nextState = {}; // this is just used to tell whether the state changed
  46305. var nextFullState = {}; // we need to call on change if the outside world is controlling any of our state
  46306. // and we're trying to update that state. OR if the selection has changed and we're
  46307. // trying to update the selection
  46308. if (isItemSelected && newStateToSet.selectedItem !== state.selectedItem) {
  46309. onChangeArg = newStateToSet.selectedItem;
  46310. }
  46311. newStateToSet.type = newStateToSet.type || unknown;
  46312. Object.keys(newStateToSet).forEach(function (key) {
  46313. // onStateChangeArg should only have the state that is
  46314. // actually changing
  46315. if (state[key] !== newStateToSet[key]) {
  46316. onStateChangeArg[key] = newStateToSet[key];
  46317. } // the type is useful for the onStateChangeArg
  46318. // but we don't actually want to set it in internal state.
  46319. // this is an undocumented feature for now... Not all internalSetState
  46320. // calls support it and I'm not certain we want them to yet.
  46321. // But it enables users controlling the isOpen state to know when
  46322. // the isOpen state changes due to mouseup events which is quite handy.
  46323. if (key === 'type') {
  46324. return;
  46325. }
  46326. nextFullState[key] = newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
  46327. if (!isControlledProp(_this.props, key)) {
  46328. nextState[key] = newStateToSet[key];
  46329. }
  46330. }); // if stateToSet is a function, then we weren't able to call onInputValueChange
  46331. // earlier, so we'll call it now that we know what the inputValue state will be.
  46332. if (isStateToSetFunction && newStateToSet.hasOwnProperty('inputValue')) {
  46333. _this.props.onInputValueChange(newStateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), newStateToSet));
  46334. }
  46335. return nextState;
  46336. }, function () {
  46337. // call the provided callback if it's a function
  46338. cbToCb(cb)(); // only call the onStateChange and onChange callbacks if
  46339. // we have relevant information to pass them.
  46340. var hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1;
  46341. if (hasMoreStateThanType) {
  46342. _this.props.onStateChange(onStateChangeArg, _this.getStateAndHelpers());
  46343. }
  46344. if (isItemSelected) {
  46345. _this.props.onSelect(stateToSet.selectedItem, _this.getStateAndHelpers());
  46346. }
  46347. if (onChangeArg !== undefined) {
  46348. _this.props.onChange(onChangeArg, _this.getStateAndHelpers());
  46349. } // this is currently undocumented and therefore subject to change
  46350. // We'll try to not break it, but just be warned.
  46351. _this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers());
  46352. });
  46353. };
  46354. _this.rootRef = function (node) {
  46355. return _this._rootNode = node;
  46356. };
  46357. _this.getRootProps = function (_temp, _temp2) {
  46358. var _extends2;
  46359. var _ref = _temp === void 0 ? {} : _temp,
  46360. _ref$refKey = _ref.refKey,
  46361. refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
  46362. ref = _ref.ref,
  46363. rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
  46364. var _ref2 = _temp2 === void 0 ? {} : _temp2,
  46365. _ref2$suppressRefErro = _ref2.suppressRefError,
  46366. suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;
  46367. // this is used in the render to know whether the user has called getRootProps.
  46368. // It uses that to know whether to apply the props automatically
  46369. _this.getRootProps.called = true;
  46370. _this.getRootProps.refKey = refKey;
  46371. _this.getRootProps.suppressRefError = suppressRefError;
  46372. var _this$getState = _this.getState(),
  46373. isOpen = _this$getState.isOpen;
  46374. return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, _this.rootRef), _extends2.role = 'combobox', _extends2['aria-expanded'] = isOpen, _extends2['aria-haspopup'] = 'listbox', _extends2['aria-owns'] = isOpen ? _this.menuId : null, _extends2['aria-labelledby'] = _this.labelId, _extends2), rest);
  46375. };
  46376. _this.keyDownHandlers = {
  46377. ArrowDown: function ArrowDown(event) {
  46378. var _this2 = this;
  46379. event.preventDefault();
  46380. if (this.getState().isOpen) {
  46381. var amount = event.shiftKey ? 5 : 1;
  46382. this.moveHighlightedIndex(amount, {
  46383. type: keyDownArrowDown
  46384. });
  46385. } else {
  46386. this.internalSetState({
  46387. isOpen: true,
  46388. type: keyDownArrowDown
  46389. }, function () {
  46390. var itemCount = _this2.getItemCount();
  46391. if (itemCount > 0) {
  46392. var _this2$getState = _this2.getState(),
  46393. highlightedIndex = _this2$getState.highlightedIndex;
  46394. var nextHighlightedIndex = getNextWrappingIndex(1, highlightedIndex, itemCount, function (index) {
  46395. return _this2.getItemNodeFromIndex(index);
  46396. });
  46397. _this2.setHighlightedIndex(nextHighlightedIndex, {
  46398. type: keyDownArrowDown
  46399. });
  46400. }
  46401. });
  46402. }
  46403. },
  46404. ArrowUp: function ArrowUp(event) {
  46405. var _this3 = this;
  46406. event.preventDefault();
  46407. if (this.getState().isOpen) {
  46408. var amount = event.shiftKey ? -5 : -1;
  46409. this.moveHighlightedIndex(amount, {
  46410. type: keyDownArrowUp
  46411. });
  46412. } else {
  46413. this.internalSetState({
  46414. isOpen: true,
  46415. type: keyDownArrowUp
  46416. }, function () {
  46417. var itemCount = _this3.getItemCount();
  46418. if (itemCount > 0) {
  46419. var _this3$getState = _this3.getState(),
  46420. highlightedIndex = _this3$getState.highlightedIndex;
  46421. var nextHighlightedIndex = getNextWrappingIndex(-1, highlightedIndex, itemCount, function (index) {
  46422. return _this3.getItemNodeFromIndex(index);
  46423. });
  46424. _this3.setHighlightedIndex(nextHighlightedIndex, {
  46425. type: keyDownArrowUp
  46426. });
  46427. }
  46428. });
  46429. }
  46430. },
  46431. Enter: function Enter(event) {
  46432. if (event.which === 229) {
  46433. return;
  46434. }
  46435. var _this$getState2 = this.getState(),
  46436. isOpen = _this$getState2.isOpen,
  46437. highlightedIndex = _this$getState2.highlightedIndex;
  46438. if (isOpen && highlightedIndex != null) {
  46439. event.preventDefault();
  46440. var item = this.items[highlightedIndex];
  46441. var itemNode = this.getItemNodeFromIndex(highlightedIndex);
  46442. if (item == null || itemNode && itemNode.hasAttribute('disabled')) {
  46443. return;
  46444. }
  46445. this.selectHighlightedItem({
  46446. type: keyDownEnter
  46447. });
  46448. }
  46449. },
  46450. Escape: function Escape(event) {
  46451. event.preventDefault();
  46452. this.reset(_extends({
  46453. type: keyDownEscape
  46454. }, !this.state.isOpen && {
  46455. selectedItem: null,
  46456. inputValue: ''
  46457. }));
  46458. }
  46459. };
  46460. _this.buttonKeyDownHandlers = _extends({}, _this.keyDownHandlers, {
  46461. ' ': function _(event) {
  46462. event.preventDefault();
  46463. this.toggleMenu({
  46464. type: keyDownSpaceButton
  46465. });
  46466. }
  46467. });
  46468. _this.inputKeyDownHandlers = _extends({}, _this.keyDownHandlers, {
  46469. Home: function Home(event) {
  46470. var _this4 = this;
  46471. var _this$getState3 = this.getState(),
  46472. isOpen = _this$getState3.isOpen;
  46473. if (!isOpen) {
  46474. return;
  46475. }
  46476. event.preventDefault();
  46477. var itemCount = this.getItemCount();
  46478. if (itemCount <= 0 || !isOpen) {
  46479. return;
  46480. } // get next non-disabled starting downwards from 0 if that's disabled.
  46481. var newHighlightedIndex = getNextNonDisabledIndex(1, 0, itemCount, function (index) {
  46482. return _this4.getItemNodeFromIndex(index);
  46483. }, false);
  46484. this.setHighlightedIndex(newHighlightedIndex, {
  46485. type: keyDownHome
  46486. });
  46487. },
  46488. End: function End(event) {
  46489. var _this5 = this;
  46490. var _this$getState4 = this.getState(),
  46491. isOpen = _this$getState4.isOpen;
  46492. if (!isOpen) {
  46493. return;
  46494. }
  46495. event.preventDefault();
  46496. var itemCount = this.getItemCount();
  46497. if (itemCount <= 0 || !isOpen) {
  46498. return;
  46499. } // get next non-disabled starting upwards from last index if that's disabled.
  46500. var newHighlightedIndex = getNextNonDisabledIndex(-1, itemCount - 1, itemCount, function (index) {
  46501. return _this5.getItemNodeFromIndex(index);
  46502. }, false);
  46503. this.setHighlightedIndex(newHighlightedIndex, {
  46504. type: keyDownEnd
  46505. });
  46506. }
  46507. });
  46508. _this.getToggleButtonProps = function (_temp3) {
  46509. var _ref3 = _temp3 === void 0 ? {} : _temp3,
  46510. onClick = _ref3.onClick;
  46511. _ref3.onPress;
  46512. var onKeyDown = _ref3.onKeyDown,
  46513. onKeyUp = _ref3.onKeyUp,
  46514. onBlur = _ref3.onBlur,
  46515. rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$3);
  46516. var _this$getState5 = _this.getState(),
  46517. isOpen = _this$getState5.isOpen;
  46518. var enabledEventHandlers = {
  46519. onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),
  46520. onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),
  46521. onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),
  46522. onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur)
  46523. };
  46524. var eventHandlers = rest.disabled ? {} : enabledEventHandlers;
  46525. return _extends({
  46526. type: 'button',
  46527. role: 'button',
  46528. 'aria-label': isOpen ? 'close menu' : 'open menu',
  46529. 'aria-haspopup': true,
  46530. 'data-toggle': true
  46531. }, eventHandlers, rest);
  46532. };
  46533. _this.buttonHandleKeyUp = function (event) {
  46534. // Prevent click event from emitting in Firefox
  46535. event.preventDefault();
  46536. };
  46537. _this.buttonHandleKeyDown = function (event) {
  46538. var key = normalizeArrowKey(event);
  46539. if (_this.buttonKeyDownHandlers[key]) {
  46540. _this.buttonKeyDownHandlers[key].call(_assertThisInitialized(_this), event);
  46541. }
  46542. };
  46543. _this.buttonHandleClick = function (event) {
  46544. event.preventDefault(); // handle odd case for Safari and Firefox which
  46545. // don't give the button the focus properly.
  46546. /* istanbul ignore if (can't reasonably test this) */
  46547. if (_this.props.environment.document.activeElement === _this.props.environment.document.body) {
  46548. event.target.focus();
  46549. } // to simplify testing components that use downshift, we'll not wrap this in a setTimeout
  46550. // if the NODE_ENV is test. With the proper build system, this should be dead code eliminated
  46551. // when building for production and should therefore have no impact on production code.
  46552. if (false) {} else {
  46553. // Ensure that toggle of menu occurs after the potential blur event in iOS
  46554. _this.internalSetTimeout(function () {
  46555. return _this.toggleMenu({
  46556. type: clickButton
  46557. });
  46558. });
  46559. }
  46560. };
  46561. _this.buttonHandleBlur = function (event) {
  46562. var blurTarget = event.target; // Save blur target for comparison with activeElement later
  46563. // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element
  46564. _this.internalSetTimeout(function () {
  46565. if (!_this.isMouseDown && (_this.props.environment.document.activeElement == null || _this.props.environment.document.activeElement.id !== _this.inputId) && _this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
  46566. ) {
  46567. _this.reset({
  46568. type: blurButton
  46569. });
  46570. }
  46571. });
  46572. };
  46573. _this.getLabelProps = function (props) {
  46574. return _extends({
  46575. htmlFor: _this.inputId,
  46576. id: _this.labelId
  46577. }, props);
  46578. };
  46579. _this.getInputProps = function (_temp4) {
  46580. var _ref4 = _temp4 === void 0 ? {} : _temp4,
  46581. onKeyDown = _ref4.onKeyDown,
  46582. onBlur = _ref4.onBlur,
  46583. onChange = _ref4.onChange,
  46584. onInput = _ref4.onInput;
  46585. _ref4.onChangeText;
  46586. var rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$2);
  46587. var onChangeKey;
  46588. var eventHandlers = {};
  46589. /* istanbul ignore next (preact) */
  46590. {
  46591. onChangeKey = 'onChange';
  46592. }
  46593. var _this$getState6 = _this.getState(),
  46594. inputValue = _this$getState6.inputValue,
  46595. isOpen = _this$getState6.isOpen,
  46596. highlightedIndex = _this$getState6.highlightedIndex;
  46597. if (!rest.disabled) {
  46598. var _eventHandlers;
  46599. eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, _this.inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, _this.inputHandleBlur), _eventHandlers);
  46600. }
  46601. return _extends({
  46602. 'aria-autocomplete': 'list',
  46603. 'aria-activedescendant': isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : null,
  46604. 'aria-controls': isOpen ? _this.menuId : null,
  46605. 'aria-labelledby': _this.labelId,
  46606. // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
  46607. // revert back since autocomplete="nope" is ignored on latest Chrome and Opera
  46608. autoComplete: 'off',
  46609. value: inputValue,
  46610. id: _this.inputId
  46611. }, eventHandlers, rest);
  46612. };
  46613. _this.inputHandleKeyDown = function (event) {
  46614. var key = normalizeArrowKey(event);
  46615. if (key && _this.inputKeyDownHandlers[key]) {
  46616. _this.inputKeyDownHandlers[key].call(_assertThisInitialized(_this), event);
  46617. }
  46618. };
  46619. _this.inputHandleChange = function (event) {
  46620. _this.internalSetState({
  46621. type: changeInput,
  46622. isOpen: true,
  46623. inputValue: event.target.value,
  46624. highlightedIndex: _this.props.defaultHighlightedIndex
  46625. });
  46626. };
  46627. _this.inputHandleBlur = function () {
  46628. // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element
  46629. _this.internalSetTimeout(function () {
  46630. var downshiftButtonIsActive = _this.props.environment.document && !!_this.props.environment.document.activeElement && !!_this.props.environment.document.activeElement.dataset && _this.props.environment.document.activeElement.dataset.toggle && _this._rootNode && _this._rootNode.contains(_this.props.environment.document.activeElement);
  46631. if (!_this.isMouseDown && !downshiftButtonIsActive) {
  46632. _this.reset({
  46633. type: blurInput
  46634. });
  46635. }
  46636. });
  46637. };
  46638. _this.menuRef = function (node) {
  46639. _this._menuNode = node;
  46640. };
  46641. _this.getMenuProps = function (_temp5, _temp6) {
  46642. var _extends3;
  46643. var _ref5 = _temp5 === void 0 ? {} : _temp5,
  46644. _ref5$refKey = _ref5.refKey,
  46645. refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
  46646. ref = _ref5.ref,
  46647. props = _objectWithoutPropertiesLoose(_ref5, _excluded4$1);
  46648. var _ref6 = _temp6 === void 0 ? {} : _temp6,
  46649. _ref6$suppressRefErro = _ref6.suppressRefError,
  46650. suppressRefError = _ref6$suppressRefErro === void 0 ? false : _ref6$suppressRefErro;
  46651. _this.getMenuProps.called = true;
  46652. _this.getMenuProps.refKey = refKey;
  46653. _this.getMenuProps.suppressRefError = suppressRefError;
  46654. return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? null : _this.labelId, _extends3.id = _this.menuId, _extends3), props);
  46655. };
  46656. _this.getItemProps = function (_temp7) {
  46657. var _enabledEventHandlers;
  46658. var _ref7 = _temp7 === void 0 ? {} : _temp7,
  46659. onMouseMove = _ref7.onMouseMove,
  46660. onMouseDown = _ref7.onMouseDown,
  46661. onClick = _ref7.onClick;
  46662. _ref7.onPress;
  46663. var index = _ref7.index,
  46664. _ref7$item = _ref7.item,
  46665. item = _ref7$item === void 0 ? true ?
  46666. /* istanbul ignore next */
  46667. undefined : 0 : _ref7$item,
  46668. rest = _objectWithoutPropertiesLoose(_ref7, _excluded5$1);
  46669. if (index === undefined) {
  46670. _this.items.push(item);
  46671. index = _this.items.indexOf(item);
  46672. } else {
  46673. _this.items[index] = item;
  46674. }
  46675. var onSelectKey = 'onClick';
  46676. var customClickHandler = onClick;
  46677. var enabledEventHandlers = (_enabledEventHandlers = {
  46678. // onMouseMove is used over onMouseEnter here. onMouseMove
  46679. // is only triggered on actual mouse movement while onMouseEnter
  46680. // can fire on DOM changes, interrupting keyboard navigation
  46681. onMouseMove: callAllEventHandlers(onMouseMove, function () {
  46682. if (index === _this.getState().highlightedIndex) {
  46683. return;
  46684. }
  46685. _this.setHighlightedIndex(index, {
  46686. type: itemMouseEnter
  46687. }); // We never want to manually scroll when changing state based
  46688. // on `onMouseMove` because we will be moving the element out
  46689. // from under the user which is currently scrolling/moving the
  46690. // cursor
  46691. _this.avoidScrolling = true;
  46692. _this.internalSetTimeout(function () {
  46693. return _this.avoidScrolling = false;
  46694. }, 250);
  46695. }),
  46696. onMouseDown: callAllEventHandlers(onMouseDown, function (event) {
  46697. // This prevents the activeElement from being changed
  46698. // to the item so it can remain with the current activeElement
  46699. // which is a more common use case.
  46700. event.preventDefault();
  46701. })
  46702. }, _enabledEventHandlers[onSelectKey] = callAllEventHandlers(customClickHandler, function () {
  46703. _this.selectItemAtIndex(index, {
  46704. type: clickItem
  46705. });
  46706. }), _enabledEventHandlers); // Passing down the onMouseDown handler to prevent redirect
  46707. // of the activeElement if clicking on disabled items
  46708. var eventHandlers = rest.disabled ? {
  46709. onMouseDown: enabledEventHandlers.onMouseDown
  46710. } : enabledEventHandlers;
  46711. return _extends({
  46712. id: _this.getItemId(index),
  46713. role: 'option',
  46714. 'aria-selected': _this.getState().highlightedIndex === index
  46715. }, eventHandlers, rest);
  46716. };
  46717. _this.clearItems = function () {
  46718. _this.items = [];
  46719. };
  46720. _this.reset = function (otherStateToSet, cb) {
  46721. if (otherStateToSet === void 0) {
  46722. otherStateToSet = {};
  46723. }
  46724. otherStateToSet = pickState(otherStateToSet);
  46725. _this.internalSetState(function (_ref8) {
  46726. var selectedItem = _ref8.selectedItem;
  46727. return _extends({
  46728. isOpen: _this.props.defaultIsOpen,
  46729. highlightedIndex: _this.props.defaultHighlightedIndex,
  46730. inputValue: _this.props.itemToString(selectedItem)
  46731. }, otherStateToSet);
  46732. }, cb);
  46733. };
  46734. _this.toggleMenu = function (otherStateToSet, cb) {
  46735. if (otherStateToSet === void 0) {
  46736. otherStateToSet = {};
  46737. }
  46738. otherStateToSet = pickState(otherStateToSet);
  46739. _this.internalSetState(function (_ref9) {
  46740. var isOpen = _ref9.isOpen;
  46741. return _extends({
  46742. isOpen: !isOpen
  46743. }, isOpen && {
  46744. highlightedIndex: _this.props.defaultHighlightedIndex
  46745. }, otherStateToSet);
  46746. }, function () {
  46747. var _this$getState7 = _this.getState(),
  46748. isOpen = _this$getState7.isOpen,
  46749. highlightedIndex = _this$getState7.highlightedIndex;
  46750. if (isOpen) {
  46751. if (_this.getItemCount() > 0 && typeof highlightedIndex === 'number') {
  46752. _this.setHighlightedIndex(highlightedIndex, otherStateToSet);
  46753. }
  46754. }
  46755. cbToCb(cb)();
  46756. });
  46757. };
  46758. _this.openMenu = function (cb) {
  46759. _this.internalSetState({
  46760. isOpen: true
  46761. }, cb);
  46762. };
  46763. _this.closeMenu = function (cb) {
  46764. _this.internalSetState({
  46765. isOpen: false
  46766. }, cb);
  46767. };
  46768. _this.updateStatus = downshift_esm_debounce(function () {
  46769. var state = _this.getState();
  46770. var item = _this.items[state.highlightedIndex];
  46771. var resultCount = _this.getItemCount();
  46772. var status = _this.props.getA11yStatusMessage(_extends({
  46773. itemToString: _this.props.itemToString,
  46774. previousResultCount: _this.previousResultCount,
  46775. resultCount: resultCount,
  46776. highlightedItem: item
  46777. }, state));
  46778. _this.previousResultCount = resultCount;
  46779. setStatus(status, _this.props.environment.document);
  46780. }, 200);
  46781. var _this$props = _this.props,
  46782. defaultHighlightedIndex = _this$props.defaultHighlightedIndex,
  46783. _this$props$initialHi = _this$props.initialHighlightedIndex,
  46784. _highlightedIndex = _this$props$initialHi === void 0 ? defaultHighlightedIndex : _this$props$initialHi,
  46785. defaultIsOpen = _this$props.defaultIsOpen,
  46786. _this$props$initialIs = _this$props.initialIsOpen,
  46787. _isOpen = _this$props$initialIs === void 0 ? defaultIsOpen : _this$props$initialIs,
  46788. _this$props$initialIn = _this$props.initialInputValue,
  46789. _inputValue = _this$props$initialIn === void 0 ? '' : _this$props$initialIn,
  46790. _this$props$initialSe = _this$props.initialSelectedItem,
  46791. _selectedItem = _this$props$initialSe === void 0 ? null : _this$props$initialSe;
  46792. var _state = _this.getState({
  46793. highlightedIndex: _highlightedIndex,
  46794. isOpen: _isOpen,
  46795. inputValue: _inputValue,
  46796. selectedItem: _selectedItem
  46797. });
  46798. if (_state.selectedItem != null && _this.props.initialInputValue === undefined) {
  46799. _state.inputValue = _this.props.itemToString(_state.selectedItem);
  46800. }
  46801. _this.state = _state;
  46802. return _this;
  46803. }
  46804. var _proto = Downshift.prototype;
  46805. /**
  46806. * Clear all running timeouts
  46807. */
  46808. _proto.internalClearTimeouts = function internalClearTimeouts() {
  46809. this.timeoutIds.forEach(function (id) {
  46810. clearTimeout(id);
  46811. });
  46812. this.timeoutIds = [];
  46813. }
  46814. /**
  46815. * Gets the state based on internal state or props
  46816. * If a state value is passed via props, then that
  46817. * is the value given, otherwise it's retrieved from
  46818. * stateToMerge
  46819. *
  46820. * @param {Object} stateToMerge defaults to this.state
  46821. * @return {Object} the state
  46822. */
  46823. ;
  46824. _proto.getState = function getState$1(stateToMerge) {
  46825. if (stateToMerge === void 0) {
  46826. stateToMerge = this.state;
  46827. }
  46828. return getState(stateToMerge, this.props);
  46829. };
  46830. _proto.getItemCount = function getItemCount() {
  46831. // things read better this way. They're in priority order:
  46832. // 1. `this.itemCount`
  46833. // 2. `this.props.itemCount`
  46834. // 3. `this.items.length`
  46835. var itemCount = this.items.length;
  46836. if (this.itemCount != null) {
  46837. itemCount = this.itemCount;
  46838. } else if (this.props.itemCount !== undefined) {
  46839. itemCount = this.props.itemCount;
  46840. }
  46841. return itemCount;
  46842. };
  46843. _proto.getItemNodeFromIndex = function getItemNodeFromIndex(index) {
  46844. return this.props.environment.document.getElementById(this.getItemId(index));
  46845. };
  46846. _proto.scrollHighlightedItemIntoView = function scrollHighlightedItemIntoView() {
  46847. /* istanbul ignore else (react-native) */
  46848. {
  46849. var node = this.getItemNodeFromIndex(this.getState().highlightedIndex);
  46850. this.props.scrollIntoView(node, this._menuNode);
  46851. }
  46852. };
  46853. _proto.moveHighlightedIndex = function moveHighlightedIndex(amount, otherStateToSet) {
  46854. var _this6 = this;
  46855. var itemCount = this.getItemCount();
  46856. var _this$getState8 = this.getState(),
  46857. highlightedIndex = _this$getState8.highlightedIndex;
  46858. if (itemCount > 0) {
  46859. var nextHighlightedIndex = getNextWrappingIndex(amount, highlightedIndex, itemCount, function (index) {
  46860. return _this6.getItemNodeFromIndex(index);
  46861. });
  46862. this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet);
  46863. }
  46864. };
  46865. _proto.getStateAndHelpers = function getStateAndHelpers() {
  46866. var _this$getState9 = this.getState(),
  46867. highlightedIndex = _this$getState9.highlightedIndex,
  46868. inputValue = _this$getState9.inputValue,
  46869. selectedItem = _this$getState9.selectedItem,
  46870. isOpen = _this$getState9.isOpen;
  46871. var itemToString = this.props.itemToString;
  46872. var id = this.id;
  46873. var getRootProps = this.getRootProps,
  46874. getToggleButtonProps = this.getToggleButtonProps,
  46875. getLabelProps = this.getLabelProps,
  46876. getMenuProps = this.getMenuProps,
  46877. getInputProps = this.getInputProps,
  46878. getItemProps = this.getItemProps,
  46879. openMenu = this.openMenu,
  46880. closeMenu = this.closeMenu,
  46881. toggleMenu = this.toggleMenu,
  46882. selectItem = this.selectItem,
  46883. selectItemAtIndex = this.selectItemAtIndex,
  46884. selectHighlightedItem = this.selectHighlightedItem,
  46885. setHighlightedIndex = this.setHighlightedIndex,
  46886. clearSelection = this.clearSelection,
  46887. clearItems = this.clearItems,
  46888. reset = this.reset,
  46889. setItemCount = this.setItemCount,
  46890. unsetItemCount = this.unsetItemCount,
  46891. setState = this.internalSetState;
  46892. return {
  46893. // prop getters
  46894. getRootProps: getRootProps,
  46895. getToggleButtonProps: getToggleButtonProps,
  46896. getLabelProps: getLabelProps,
  46897. getMenuProps: getMenuProps,
  46898. getInputProps: getInputProps,
  46899. getItemProps: getItemProps,
  46900. // actions
  46901. reset: reset,
  46902. openMenu: openMenu,
  46903. closeMenu: closeMenu,
  46904. toggleMenu: toggleMenu,
  46905. selectItem: selectItem,
  46906. selectItemAtIndex: selectItemAtIndex,
  46907. selectHighlightedItem: selectHighlightedItem,
  46908. setHighlightedIndex: setHighlightedIndex,
  46909. clearSelection: clearSelection,
  46910. clearItems: clearItems,
  46911. setItemCount: setItemCount,
  46912. unsetItemCount: unsetItemCount,
  46913. setState: setState,
  46914. // props
  46915. itemToString: itemToString,
  46916. // derived
  46917. id: id,
  46918. // state
  46919. highlightedIndex: highlightedIndex,
  46920. inputValue: inputValue,
  46921. isOpen: isOpen,
  46922. selectedItem: selectedItem
  46923. };
  46924. } //////////////////////////// ROOT
  46925. ;
  46926. _proto.componentDidMount = function componentDidMount() {
  46927. var _this7 = this;
  46928. /* istanbul ignore if (react-native) */
  46929. if (false) {}
  46930. /* istanbul ignore if (react-native) */
  46931. {
  46932. // this.isMouseDown helps us track whether the mouse is currently held down.
  46933. // This is useful when the user clicks on an item in the list, but holds the mouse
  46934. // down long enough for the list to disappear (because the blur event fires on the input)
  46935. // this.isMouseDown is used in the blur handler on the input to determine whether the blur event should
  46936. // trigger hiding the menu.
  46937. var onMouseDown = function onMouseDown() {
  46938. _this7.isMouseDown = true;
  46939. };
  46940. var onMouseUp = function onMouseUp(event) {
  46941. _this7.isMouseDown = false; // if the target element or the activeElement is within a downshift node
  46942. // then we don't want to reset downshift
  46943. var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment);
  46944. if (!contextWithinDownshift && _this7.getState().isOpen) {
  46945. _this7.reset({
  46946. type: mouseUp
  46947. }, function () {
  46948. return _this7.props.onOuterClick(_this7.getStateAndHelpers());
  46949. });
  46950. }
  46951. }; // Touching an element in iOS gives focus and hover states, but touching out of
  46952. // the element will remove hover, and persist the focus state, resulting in the
  46953. // blur event not being triggered.
  46954. // this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen.
  46955. // If the user taps outside of Downshift, the component should be reset,
  46956. // but not if the user is swiping
  46957. var onTouchStart = function onTouchStart() {
  46958. _this7.isTouchMove = false;
  46959. };
  46960. var onTouchMove = function onTouchMove() {
  46961. _this7.isTouchMove = true;
  46962. };
  46963. var onTouchEnd = function onTouchEnd(event) {
  46964. var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment, false);
  46965. if (!_this7.isTouchMove && !contextWithinDownshift && _this7.getState().isOpen) {
  46966. _this7.reset({
  46967. type: touchEnd
  46968. }, function () {
  46969. return _this7.props.onOuterClick(_this7.getStateAndHelpers());
  46970. });
  46971. }
  46972. };
  46973. var environment = this.props.environment;
  46974. environment.addEventListener('mousedown', onMouseDown);
  46975. environment.addEventListener('mouseup', onMouseUp);
  46976. environment.addEventListener('touchstart', onTouchStart);
  46977. environment.addEventListener('touchmove', onTouchMove);
  46978. environment.addEventListener('touchend', onTouchEnd);
  46979. this.cleanup = function () {
  46980. _this7.internalClearTimeouts();
  46981. _this7.updateStatus.cancel();
  46982. environment.removeEventListener('mousedown', onMouseDown);
  46983. environment.removeEventListener('mouseup', onMouseUp);
  46984. environment.removeEventListener('touchstart', onTouchStart);
  46985. environment.removeEventListener('touchmove', onTouchMove);
  46986. environment.removeEventListener('touchend', onTouchEnd);
  46987. };
  46988. }
  46989. };
  46990. _proto.shouldScroll = function shouldScroll(prevState, prevProps) {
  46991. var _ref10 = this.props.highlightedIndex === undefined ? this.getState() : this.props,
  46992. currentHighlightedIndex = _ref10.highlightedIndex;
  46993. var _ref11 = prevProps.highlightedIndex === undefined ? prevState : prevProps,
  46994. prevHighlightedIndex = _ref11.highlightedIndex;
  46995. var scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;
  46996. var scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;
  46997. return scrollWhenOpen || scrollWhenNavigating;
  46998. };
  46999. _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
  47000. if (false) {}
  47001. if (isControlledProp(this.props, 'selectedItem') && this.props.selectedItemChanged(prevProps.selectedItem, this.props.selectedItem)) {
  47002. this.internalSetState({
  47003. type: controlledPropUpdatedSelectedItem,
  47004. inputValue: this.props.itemToString(this.props.selectedItem)
  47005. });
  47006. }
  47007. if (!this.avoidScrolling && this.shouldScroll(prevState, prevProps)) {
  47008. this.scrollHighlightedItemIntoView();
  47009. }
  47010. /* istanbul ignore else (react-native) */
  47011. {
  47012. this.updateStatus();
  47013. }
  47014. };
  47015. _proto.componentWillUnmount = function componentWillUnmount() {
  47016. this.cleanup(); // avoids memory leak
  47017. };
  47018. _proto.render = function render() {
  47019. var children = unwrapArray(this.props.children, downshift_esm_noop); // because the items are rerendered every time we call the children
  47020. // we clear this out each render and it will be populated again as
  47021. // getItemProps is called.
  47022. this.clearItems(); // we reset this so we know whether the user calls getRootProps during
  47023. // this render. If they do then we don't need to do anything,
  47024. // if they don't then we need to clone the element they return and
  47025. // apply the props for them.
  47026. this.getRootProps.called = false;
  47027. this.getRootProps.refKey = undefined;
  47028. this.getRootProps.suppressRefError = undefined; // we do something similar for getMenuProps
  47029. this.getMenuProps.called = false;
  47030. this.getMenuProps.refKey = undefined;
  47031. this.getMenuProps.suppressRefError = undefined; // we do something similar for getLabelProps
  47032. this.getLabelProps.called = false; // and something similar for getInputProps
  47033. this.getInputProps.called = false;
  47034. var element = unwrapArray(children(this.getStateAndHelpers()));
  47035. if (!element) {
  47036. return null;
  47037. }
  47038. if (this.getRootProps.called || this.props.suppressRefError) {
  47039. if (false) {}
  47040. return element;
  47041. } else if (isDOMElement(element)) {
  47042. // they didn't apply the root props, but we can clone
  47043. // this and apply the props ourselves
  47044. return /*#__PURE__*/cloneElement(element, this.getRootProps(getElementProps(element)));
  47045. }
  47046. /* istanbul ignore else */
  47047. if (false) {}
  47048. /* istanbul ignore next */
  47049. return undefined;
  47050. };
  47051. return Downshift;
  47052. }(Component);
  47053. Downshift.defaultProps = {
  47054. defaultHighlightedIndex: null,
  47055. defaultIsOpen: false,
  47056. getA11yStatusMessage: getA11yStatusMessage$1,
  47057. itemToString: function itemToString(i) {
  47058. if (i == null) {
  47059. return '';
  47060. }
  47061. if (false) {}
  47062. return String(i);
  47063. },
  47064. onStateChange: downshift_esm_noop,
  47065. onInputValueChange: downshift_esm_noop,
  47066. onUserAction: downshift_esm_noop,
  47067. onChange: downshift_esm_noop,
  47068. onSelect: downshift_esm_noop,
  47069. onOuterClick: downshift_esm_noop,
  47070. selectedItemChanged: function selectedItemChanged(prevItem, item) {
  47071. return prevItem !== item;
  47072. },
  47073. environment:
  47074. /* istanbul ignore next (ssr) */
  47075. typeof window === 'undefined' ? {} : window,
  47076. stateReducer: function stateReducer(state, stateToSet) {
  47077. return stateToSet;
  47078. },
  47079. suppressRefError: false,
  47080. scrollIntoView: scrollIntoView
  47081. };
  47082. Downshift.stateChangeTypes = stateChangeTypes$3;
  47083. return Downshift;
  47084. }()));
  47085. false ? 0 : void 0;
  47086. var Downshift$1 = (/* unused pure expression or super */ null && (Downshift));
  47087. function validateGetMenuPropsCalledCorrectly(node, _ref12) {
  47088. var refKey = _ref12.refKey;
  47089. if (!node) {
  47090. // eslint-disable-next-line no-console
  47091. console.error("downshift: The ref prop \"" + refKey + "\" from getMenuProps was not applied correctly on your menu element.");
  47092. }
  47093. }
  47094. function validateGetRootPropsCalledCorrectly(element, _ref13) {
  47095. var refKey = _ref13.refKey;
  47096. var refKeySpecified = refKey !== 'ref';
  47097. var isComposite = !isDOMElement(element);
  47098. if (isComposite && !refKeySpecified && !isForwardRef(element)) {
  47099. // eslint-disable-next-line no-console
  47100. console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
  47101. } else if (!isComposite && refKeySpecified) {
  47102. // eslint-disable-next-line no-console
  47103. console.error("downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \"" + refKey + "\"");
  47104. }
  47105. if (!isForwardRef(element) && !getElementProps(element)[refKey]) {
  47106. // eslint-disable-next-line no-console
  47107. console.error("downshift: You must apply the ref prop \"" + refKey + "\" from getRootProps onto your root element.");
  47108. }
  47109. }
  47110. var _excluded$3 = ["isInitialMount", "highlightedIndex", "items", "environment"];
  47111. var dropdownDefaultStateValues = {
  47112. highlightedIndex: -1,
  47113. isOpen: false,
  47114. selectedItem: null,
  47115. inputValue: ''
  47116. };
  47117. function callOnChangeProps(action, state, newState) {
  47118. var props = action.props,
  47119. type = action.type;
  47120. var changes = {};
  47121. Object.keys(state).forEach(function (key) {
  47122. invokeOnChangeHandler(key, action, state, newState);
  47123. if (newState[key] !== state[key]) {
  47124. changes[key] = newState[key];
  47125. }
  47126. });
  47127. if (props.onStateChange && Object.keys(changes).length) {
  47128. props.onStateChange(extends_extends({
  47129. type: type
  47130. }, changes));
  47131. }
  47132. }
  47133. function invokeOnChangeHandler(key, action, state, newState) {
  47134. var props = action.props,
  47135. type = action.type;
  47136. var handler = "on" + capitalizeString(key) + "Change";
  47137. if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {
  47138. props[handler](extends_extends({
  47139. type: type
  47140. }, newState));
  47141. }
  47142. }
  47143. /**
  47144. * Default state reducer that returns the changes.
  47145. *
  47146. * @param {Object} s state.
  47147. * @param {Object} a action with changes.
  47148. * @returns {Object} changes.
  47149. */
  47150. function stateReducer(s, a) {
  47151. return a.changes;
  47152. }
  47153. /**
  47154. * Returns a message to be added to aria-live region when item is selected.
  47155. *
  47156. * @param {Object} selectionParameters Parameters required to build the message.
  47157. * @returns {string} The a11y message.
  47158. */
  47159. function getA11ySelectionMessage(selectionParameters) {
  47160. var selectedItem = selectionParameters.selectedItem,
  47161. itemToStringLocal = selectionParameters.itemToString;
  47162. return selectedItem ? itemToStringLocal(selectedItem) + " has been selected." : '';
  47163. }
  47164. /**
  47165. * Debounced call for updating the a11y message.
  47166. */
  47167. var updateA11yStatus = downshift_esm_debounce(function (getA11yMessage, document) {
  47168. setStatus(getA11yMessage(), document);
  47169. }, 200); // istanbul ignore next
  47170. var downshift_esm_useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? external_React_.useLayoutEffect : external_React_.useEffect;
  47171. function useElementIds(_ref) {
  47172. var _ref$id = _ref.id,
  47173. id = _ref$id === void 0 ? "downshift-" + generateId() : _ref$id,
  47174. labelId = _ref.labelId,
  47175. menuId = _ref.menuId,
  47176. getItemId = _ref.getItemId,
  47177. toggleButtonId = _ref.toggleButtonId,
  47178. inputId = _ref.inputId;
  47179. var elementIdsRef = (0,external_React_.useRef)({
  47180. labelId: labelId || id + "-label",
  47181. menuId: menuId || id + "-menu",
  47182. getItemId: getItemId || function (index) {
  47183. return id + "-item-" + index;
  47184. },
  47185. toggleButtonId: toggleButtonId || id + "-toggle-button",
  47186. inputId: inputId || id + "-input"
  47187. });
  47188. return elementIdsRef.current;
  47189. }
  47190. function getItemIndex(index, item, items) {
  47191. if (index !== undefined) {
  47192. return index;
  47193. }
  47194. if (items.length === 0) {
  47195. return -1;
  47196. }
  47197. return items.indexOf(item);
  47198. }
  47199. function itemToString(item) {
  47200. return item ? String(item) : '';
  47201. }
  47202. function isAcceptedCharacterKey(key) {
  47203. return /^\S{1}$/.test(key);
  47204. }
  47205. function capitalizeString(string) {
  47206. return "" + string.slice(0, 1).toUpperCase() + string.slice(1);
  47207. }
  47208. function useLatestRef(val) {
  47209. var ref = (0,external_React_.useRef)(val); // technically this is not "concurrent mode safe" because we're manipulating
  47210. // the value during render (so it's not idempotent). However, the places this
  47211. // hook is used is to support memoizing callbacks which will be called
  47212. // *during* render, so we need the latest values *during* render.
  47213. // If not for this, then we'd probably want to use useLayoutEffect instead.
  47214. ref.current = val;
  47215. return ref;
  47216. }
  47217. /**
  47218. * Computes the controlled state using a the previous state, props,
  47219. * two reducers, one from downshift and an optional one from the user.
  47220. * Also calls the onChange handlers for state values that have changed.
  47221. *
  47222. * @param {Function} reducer Reducer function from downshift.
  47223. * @param {Object} initialState Initial state of the hook.
  47224. * @param {Object} props The hook props.
  47225. * @returns {Array} An array with the state and an action dispatcher.
  47226. */
  47227. function useEnhancedReducer(reducer, initialState, props) {
  47228. var prevStateRef = (0,external_React_.useRef)();
  47229. var actionRef = (0,external_React_.useRef)();
  47230. var enhancedReducer = (0,external_React_.useCallback)(function (state, action) {
  47231. actionRef.current = action;
  47232. state = getState(state, action.props);
  47233. var changes = reducer(state, action);
  47234. var newState = action.props.stateReducer(state, extends_extends({}, action, {
  47235. changes: changes
  47236. }));
  47237. return newState;
  47238. }, [reducer]);
  47239. var _useReducer = (0,external_React_.useReducer)(enhancedReducer, initialState),
  47240. state = _useReducer[0],
  47241. dispatch = _useReducer[1];
  47242. var propsRef = useLatestRef(props);
  47243. var dispatchWithProps = (0,external_React_.useCallback)(function (action) {
  47244. return dispatch(extends_extends({
  47245. props: propsRef.current
  47246. }, action));
  47247. }, [propsRef]);
  47248. var action = actionRef.current;
  47249. (0,external_React_.useEffect)(function () {
  47250. if (action && prevStateRef.current && prevStateRef.current !== state) {
  47251. callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
  47252. }
  47253. prevStateRef.current = state;
  47254. }, [state, props, action]);
  47255. return [state, dispatchWithProps];
  47256. }
  47257. /**
  47258. * Wraps the useEnhancedReducer and applies the controlled prop values before
  47259. * returning the new state.
  47260. *
  47261. * @param {Function} reducer Reducer function from downshift.
  47262. * @param {Object} initialState Initial state of the hook.
  47263. * @param {Object} props The hook props.
  47264. * @returns {Array} An array with the state and an action dispatcher.
  47265. */
  47266. function useControlledReducer$1(reducer, initialState, props) {
  47267. var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),
  47268. state = _useEnhancedReducer[0],
  47269. dispatch = _useEnhancedReducer[1];
  47270. return [getState(state, props), dispatch];
  47271. }
  47272. var defaultProps$3 = {
  47273. itemToString: itemToString,
  47274. stateReducer: stateReducer,
  47275. getA11ySelectionMessage: getA11ySelectionMessage,
  47276. scrollIntoView: scrollIntoView,
  47277. circularNavigation: false,
  47278. environment:
  47279. /* istanbul ignore next (ssr) */
  47280. typeof window === 'undefined' ? {} : window
  47281. };
  47282. function getDefaultValue$1(props, propKey, defaultStateValues) {
  47283. if (defaultStateValues === void 0) {
  47284. defaultStateValues = dropdownDefaultStateValues;
  47285. }
  47286. var defaultPropKey = "default" + capitalizeString(propKey);
  47287. if (defaultPropKey in props) {
  47288. return props[defaultPropKey];
  47289. }
  47290. return defaultStateValues[propKey];
  47291. }
  47292. function getInitialValue$1(props, propKey, defaultStateValues) {
  47293. if (defaultStateValues === void 0) {
  47294. defaultStateValues = dropdownDefaultStateValues;
  47295. }
  47296. if (propKey in props) {
  47297. return props[propKey];
  47298. }
  47299. var initialPropKey = "initial" + capitalizeString(propKey);
  47300. if (initialPropKey in props) {
  47301. return props[initialPropKey];
  47302. }
  47303. return getDefaultValue$1(props, propKey, defaultStateValues);
  47304. }
  47305. function getInitialState$2(props) {
  47306. var selectedItem = getInitialValue$1(props, 'selectedItem');
  47307. var isOpen = getInitialValue$1(props, 'isOpen');
  47308. var highlightedIndex = getInitialValue$1(props, 'highlightedIndex');
  47309. var inputValue = getInitialValue$1(props, 'inputValue');
  47310. return {
  47311. highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.indexOf(selectedItem) : highlightedIndex,
  47312. isOpen: isOpen,
  47313. selectedItem: selectedItem,
  47314. inputValue: inputValue
  47315. };
  47316. }
  47317. function getHighlightedIndexOnOpen(props, state, offset, getItemNodeFromIndex) {
  47318. var items = props.items,
  47319. initialHighlightedIndex = props.initialHighlightedIndex,
  47320. defaultHighlightedIndex = props.defaultHighlightedIndex;
  47321. var selectedItem = state.selectedItem,
  47322. highlightedIndex = state.highlightedIndex;
  47323. if (items.length === 0) {
  47324. return -1;
  47325. } // initialHighlightedIndex will give value to highlightedIndex on initial state only.
  47326. if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex) {
  47327. return initialHighlightedIndex;
  47328. }
  47329. if (defaultHighlightedIndex !== undefined) {
  47330. return defaultHighlightedIndex;
  47331. }
  47332. if (selectedItem) {
  47333. if (offset === 0) {
  47334. return items.indexOf(selectedItem);
  47335. }
  47336. return getNextWrappingIndex(offset, items.indexOf(selectedItem), items.length, getItemNodeFromIndex, false);
  47337. }
  47338. if (offset === 0) {
  47339. return -1;
  47340. }
  47341. return offset < 0 ? items.length - 1 : 0;
  47342. }
  47343. /**
  47344. * Reuse the movement tracking of mouse and touch events.
  47345. *
  47346. * @param {boolean} isOpen Whether the dropdown is open or not.
  47347. * @param {Array<Object>} downshiftElementRefs Downshift element refs to track movement (toggleButton, menu etc.)
  47348. * @param {Object} environment Environment where component/hook exists.
  47349. * @param {Function} handleBlur Handler on blur from mouse or touch.
  47350. * @returns {Object} Ref containing whether mouseDown or touchMove event is happening
  47351. */
  47352. function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, handleBlur) {
  47353. var mouseAndTouchTrackersRef = (0,external_React_.useRef)({
  47354. isMouseDown: false,
  47355. isTouchMove: false
  47356. });
  47357. (0,external_React_.useEffect)(function () {
  47358. // The same strategy for checking if a click occurred inside or outside downsift
  47359. // as in downshift.js.
  47360. var onMouseDown = function onMouseDown() {
  47361. mouseAndTouchTrackersRef.current.isMouseDown = true;
  47362. };
  47363. var onMouseUp = function onMouseUp(event) {
  47364. mouseAndTouchTrackersRef.current.isMouseDown = false;
  47365. if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
  47366. return ref.current;
  47367. }), environment)) {
  47368. handleBlur();
  47369. }
  47370. };
  47371. var onTouchStart = function onTouchStart() {
  47372. mouseAndTouchTrackersRef.current.isTouchMove = false;
  47373. };
  47374. var onTouchMove = function onTouchMove() {
  47375. mouseAndTouchTrackersRef.current.isTouchMove = true;
  47376. };
  47377. var onTouchEnd = function onTouchEnd(event) {
  47378. if (isOpen && !mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
  47379. return ref.current;
  47380. }), environment, false)) {
  47381. handleBlur();
  47382. }
  47383. };
  47384. environment.addEventListener('mousedown', onMouseDown);
  47385. environment.addEventListener('mouseup', onMouseUp);
  47386. environment.addEventListener('touchstart', onTouchStart);
  47387. environment.addEventListener('touchmove', onTouchMove);
  47388. environment.addEventListener('touchend', onTouchEnd);
  47389. return function cleanup() {
  47390. environment.removeEventListener('mousedown', onMouseDown);
  47391. environment.removeEventListener('mouseup', onMouseUp);
  47392. environment.removeEventListener('touchstart', onTouchStart);
  47393. environment.removeEventListener('touchmove', onTouchMove);
  47394. environment.removeEventListener('touchend', onTouchEnd);
  47395. }; // eslint-disable-next-line react-hooks/exhaustive-deps
  47396. }, [isOpen, environment]);
  47397. return mouseAndTouchTrackersRef;
  47398. }
  47399. /* istanbul ignore next */
  47400. // eslint-disable-next-line import/no-mutable-exports
  47401. var useGetterPropsCalledChecker = function useGetterPropsCalledChecker() {
  47402. return downshift_esm_noop;
  47403. };
  47404. /**
  47405. * Custom hook that checks if getter props are called correctly.
  47406. *
  47407. * @param {...any} propKeys Getter prop names to be handled.
  47408. * @returns {Function} Setter function called inside getter props to set call information.
  47409. */
  47410. /* istanbul ignore next */
  47411. if (false) {}
  47412. function useA11yMessageSetter(getA11yMessage, dependencyArray, _ref2) {
  47413. var isInitialMount = _ref2.isInitialMount,
  47414. highlightedIndex = _ref2.highlightedIndex,
  47415. items = _ref2.items,
  47416. environment = _ref2.environment,
  47417. rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref2, _excluded$3);
  47418. // Sets a11y status message on changes in state.
  47419. (0,external_React_.useEffect)(function () {
  47420. if (isInitialMount || false) {
  47421. return;
  47422. }
  47423. updateA11yStatus(function () {
  47424. return getA11yMessage(extends_extends({
  47425. highlightedIndex: highlightedIndex,
  47426. highlightedItem: items[highlightedIndex],
  47427. resultCount: items.length
  47428. }, rest));
  47429. }, environment.document); // eslint-disable-next-line react-hooks/exhaustive-deps
  47430. }, dependencyArray);
  47431. }
  47432. function useScrollIntoView(_ref3) {
  47433. var highlightedIndex = _ref3.highlightedIndex,
  47434. isOpen = _ref3.isOpen,
  47435. itemRefs = _ref3.itemRefs,
  47436. getItemNodeFromIndex = _ref3.getItemNodeFromIndex,
  47437. menuElement = _ref3.menuElement,
  47438. scrollIntoViewProp = _ref3.scrollIntoView;
  47439. // used not to scroll on highlight by mouse.
  47440. var shouldScrollRef = (0,external_React_.useRef)(true); // Scroll on highlighted item if change comes from keyboard.
  47441. downshift_esm_useIsomorphicLayoutEffect(function () {
  47442. if (highlightedIndex < 0 || !isOpen || !Object.keys(itemRefs.current).length) {
  47443. return;
  47444. }
  47445. if (shouldScrollRef.current === false) {
  47446. shouldScrollRef.current = true;
  47447. } else {
  47448. scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement);
  47449. } // eslint-disable-next-line react-hooks/exhaustive-deps
  47450. }, [highlightedIndex]);
  47451. return shouldScrollRef;
  47452. } // eslint-disable-next-line import/no-mutable-exports
  47453. var useControlPropsValidator = downshift_esm_noop;
  47454. /* istanbul ignore next */
  47455. if (false) {}
  47456. /* eslint-disable complexity */
  47457. function downshiftCommonReducer(state, action, stateChangeTypes) {
  47458. var type = action.type,
  47459. props = action.props;
  47460. var changes;
  47461. switch (type) {
  47462. case stateChangeTypes.ItemMouseMove:
  47463. changes = {
  47464. highlightedIndex: action.index
  47465. };
  47466. break;
  47467. case stateChangeTypes.MenuMouseLeave:
  47468. changes = {
  47469. highlightedIndex: -1
  47470. };
  47471. break;
  47472. case stateChangeTypes.ToggleButtonClick:
  47473. case stateChangeTypes.FunctionToggleMenu:
  47474. changes = {
  47475. isOpen: !state.isOpen,
  47476. highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0)
  47477. };
  47478. break;
  47479. case stateChangeTypes.FunctionOpenMenu:
  47480. changes = {
  47481. isOpen: true,
  47482. highlightedIndex: getHighlightedIndexOnOpen(props, state, 0)
  47483. };
  47484. break;
  47485. case stateChangeTypes.FunctionCloseMenu:
  47486. changes = {
  47487. isOpen: false
  47488. };
  47489. break;
  47490. case stateChangeTypes.FunctionSetHighlightedIndex:
  47491. changes = {
  47492. highlightedIndex: action.highlightedIndex
  47493. };
  47494. break;
  47495. case stateChangeTypes.FunctionSetInputValue:
  47496. changes = {
  47497. inputValue: action.inputValue
  47498. };
  47499. break;
  47500. case stateChangeTypes.FunctionReset:
  47501. changes = {
  47502. highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
  47503. isOpen: getDefaultValue$1(props, 'isOpen'),
  47504. selectedItem: getDefaultValue$1(props, 'selectedItem'),
  47505. inputValue: getDefaultValue$1(props, 'inputValue')
  47506. };
  47507. break;
  47508. default:
  47509. throw new Error('Reducer called without proper action type.');
  47510. }
  47511. return extends_extends({}, state, changes);
  47512. }
  47513. /* eslint-enable complexity */
  47514. function getItemIndexByCharacterKey(_a) {
  47515. var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;
  47516. var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
  47517. for (var index = 0; index < items.length; index++) {
  47518. var offsetIndex = (index + highlightedIndex + 1) % items.length;
  47519. var item = items[offsetIndex];
  47520. if (item !== undefined &&
  47521. itemToString(item)
  47522. .toLowerCase()
  47523. .startsWith(lowerCasedKeysSoFar)) {
  47524. var element = getItemNodeFromIndex(offsetIndex);
  47525. if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {
  47526. return offsetIndex;
  47527. }
  47528. }
  47529. }
  47530. return highlightedIndex;
  47531. }
  47532. var propTypes$2 = {
  47533. items: (prop_types_default()).array.isRequired,
  47534. itemToString: (prop_types_default()).func,
  47535. getA11yStatusMessage: (prop_types_default()).func,
  47536. getA11ySelectionMessage: (prop_types_default()).func,
  47537. circularNavigation: (prop_types_default()).bool,
  47538. highlightedIndex: (prop_types_default()).number,
  47539. defaultHighlightedIndex: (prop_types_default()).number,
  47540. initialHighlightedIndex: (prop_types_default()).number,
  47541. isOpen: (prop_types_default()).bool,
  47542. defaultIsOpen: (prop_types_default()).bool,
  47543. initialIsOpen: (prop_types_default()).bool,
  47544. selectedItem: (prop_types_default()).any,
  47545. initialSelectedItem: (prop_types_default()).any,
  47546. defaultSelectedItem: (prop_types_default()).any,
  47547. id: (prop_types_default()).string,
  47548. labelId: (prop_types_default()).string,
  47549. menuId: (prop_types_default()).string,
  47550. getItemId: (prop_types_default()).func,
  47551. toggleButtonId: (prop_types_default()).string,
  47552. stateReducer: (prop_types_default()).func,
  47553. onSelectedItemChange: (prop_types_default()).func,
  47554. onHighlightedIndexChange: (prop_types_default()).func,
  47555. onStateChange: (prop_types_default()).func,
  47556. onIsOpenChange: (prop_types_default()).func,
  47557. environment: prop_types_default().shape({
  47558. addEventListener: (prop_types_default()).func,
  47559. removeEventListener: (prop_types_default()).func,
  47560. document: prop_types_default().shape({
  47561. getElementById: (prop_types_default()).func,
  47562. activeElement: (prop_types_default()).any,
  47563. body: (prop_types_default()).any
  47564. })
  47565. })
  47566. };
  47567. /**
  47568. * Default implementation for status message. Only added when menu is open.
  47569. * Will specift if there are results in the list, and if so, how many,
  47570. * and what keys are relevant.
  47571. *
  47572. * @param {Object} param the downshift state and other relevant properties
  47573. * @return {String} the a11y status message
  47574. */
  47575. function getA11yStatusMessage(_a) {
  47576. var isOpen = _a.isOpen, resultCount = _a.resultCount, previousResultCount = _a.previousResultCount;
  47577. if (!isOpen) {
  47578. return '';
  47579. }
  47580. if (!resultCount) {
  47581. return 'No results are available.';
  47582. }
  47583. if (resultCount !== previousResultCount) {
  47584. return resultCount + " result" + (resultCount === 1 ? ' is' : 's are') + " available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.";
  47585. }
  47586. return '';
  47587. }
  47588. var defaultProps$2 = __assign(__assign({}, defaultProps$3), { getA11yStatusMessage: getA11yStatusMessage });
  47589. // eslint-disable-next-line import/no-mutable-exports
  47590. var validatePropTypes$2 = downshift_esm_noop;
  47591. /* istanbul ignore next */
  47592. if (false) {}
  47593. var MenuKeyDownArrowDown = false ? 0 : 0;
  47594. var MenuKeyDownArrowUp = false ? 0 : 1;
  47595. var MenuKeyDownEscape = false ? 0 : 2;
  47596. var MenuKeyDownHome = false ? 0 : 3;
  47597. var MenuKeyDownEnd = false ? 0 : 4;
  47598. var MenuKeyDownEnter = false ? 0 : 5;
  47599. var MenuKeyDownSpaceButton = false ? 0 : 6;
  47600. var MenuKeyDownCharacter = false ? 0 : 7;
  47601. var MenuBlur = false ? 0 : 8;
  47602. var MenuMouseLeave$1 = false ? 0 : 9;
  47603. var ItemMouseMove$1 = false ? 0 : 10;
  47604. var ItemClick$1 = false ? 0 : 11;
  47605. var ToggleButtonClick$1 = false ? 0 : 12;
  47606. var ToggleButtonKeyDownArrowDown = false ? 0 : 13;
  47607. var ToggleButtonKeyDownArrowUp = false ? 0 : 14;
  47608. var ToggleButtonKeyDownCharacter = false ? 0 : 15;
  47609. var FunctionToggleMenu$1 = false ? 0 : 16;
  47610. var FunctionOpenMenu$1 = false ? 0 : 17;
  47611. var FunctionCloseMenu$1 = false ? 0 : 18;
  47612. var FunctionSetHighlightedIndex$1 = false ? 0 : 19;
  47613. var FunctionSelectItem$1 = false ? 0 : 20;
  47614. var FunctionSetInputValue$1 = false ? 0 : 21;
  47615. var FunctionReset$2 = false ? 0 : 22;
  47616. var stateChangeTypes$2 = /*#__PURE__*/Object.freeze({
  47617. __proto__: null,
  47618. MenuKeyDownArrowDown: MenuKeyDownArrowDown,
  47619. MenuKeyDownArrowUp: MenuKeyDownArrowUp,
  47620. MenuKeyDownEscape: MenuKeyDownEscape,
  47621. MenuKeyDownHome: MenuKeyDownHome,
  47622. MenuKeyDownEnd: MenuKeyDownEnd,
  47623. MenuKeyDownEnter: MenuKeyDownEnter,
  47624. MenuKeyDownSpaceButton: MenuKeyDownSpaceButton,
  47625. MenuKeyDownCharacter: MenuKeyDownCharacter,
  47626. MenuBlur: MenuBlur,
  47627. MenuMouseLeave: MenuMouseLeave$1,
  47628. ItemMouseMove: ItemMouseMove$1,
  47629. ItemClick: ItemClick$1,
  47630. ToggleButtonClick: ToggleButtonClick$1,
  47631. ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,
  47632. ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,
  47633. ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,
  47634. FunctionToggleMenu: FunctionToggleMenu$1,
  47635. FunctionOpenMenu: FunctionOpenMenu$1,
  47636. FunctionCloseMenu: FunctionCloseMenu$1,
  47637. FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
  47638. FunctionSelectItem: FunctionSelectItem$1,
  47639. FunctionSetInputValue: FunctionSetInputValue$1,
  47640. FunctionReset: FunctionReset$2
  47641. });
  47642. /* eslint-disable complexity */
  47643. function downshiftSelectReducer(state, action) {
  47644. var type = action.type,
  47645. props = action.props,
  47646. shiftKey = action.shiftKey;
  47647. var changes;
  47648. switch (type) {
  47649. case ItemClick$1:
  47650. changes = {
  47651. isOpen: getDefaultValue$1(props, 'isOpen'),
  47652. highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
  47653. selectedItem: props.items[action.index]
  47654. };
  47655. break;
  47656. case ToggleButtonKeyDownCharacter:
  47657. {
  47658. var lowercasedKey = action.key;
  47659. var inputValue = "" + state.inputValue + lowercasedKey;
  47660. var itemIndex = getItemIndexByCharacterKey({
  47661. keysSoFar: inputValue,
  47662. highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
  47663. items: props.items,
  47664. itemToString: props.itemToString,
  47665. getItemNodeFromIndex: action.getItemNodeFromIndex
  47666. });
  47667. changes = extends_extends({
  47668. inputValue: inputValue
  47669. }, itemIndex >= 0 && {
  47670. selectedItem: props.items[itemIndex]
  47671. });
  47672. }
  47673. break;
  47674. case ToggleButtonKeyDownArrowDown:
  47675. changes = {
  47676. highlightedIndex: getHighlightedIndexOnOpen(props, state, 1, action.getItemNodeFromIndex),
  47677. isOpen: true
  47678. };
  47679. break;
  47680. case ToggleButtonKeyDownArrowUp:
  47681. changes = {
  47682. highlightedIndex: getHighlightedIndexOnOpen(props, state, -1, action.getItemNodeFromIndex),
  47683. isOpen: true
  47684. };
  47685. break;
  47686. case MenuKeyDownEnter:
  47687. case MenuKeyDownSpaceButton:
  47688. changes = extends_extends({
  47689. isOpen: getDefaultValue$1(props, 'isOpen'),
  47690. highlightedIndex: getDefaultValue$1(props, 'highlightedIndex')
  47691. }, state.highlightedIndex >= 0 && {
  47692. selectedItem: props.items[state.highlightedIndex]
  47693. });
  47694. break;
  47695. case MenuKeyDownHome:
  47696. changes = {
  47697. highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false)
  47698. };
  47699. break;
  47700. case MenuKeyDownEnd:
  47701. changes = {
  47702. highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false)
  47703. };
  47704. break;
  47705. case MenuKeyDownEscape:
  47706. changes = {
  47707. isOpen: false,
  47708. highlightedIndex: -1
  47709. };
  47710. break;
  47711. case MenuBlur:
  47712. changes = {
  47713. isOpen: false,
  47714. highlightedIndex: -1
  47715. };
  47716. break;
  47717. case MenuKeyDownCharacter:
  47718. {
  47719. var _lowercasedKey = action.key;
  47720. var _inputValue = "" + state.inputValue + _lowercasedKey;
  47721. var highlightedIndex = getItemIndexByCharacterKey({
  47722. keysSoFar: _inputValue,
  47723. highlightedIndex: state.highlightedIndex,
  47724. items: props.items,
  47725. itemToString: props.itemToString,
  47726. getItemNodeFromIndex: action.getItemNodeFromIndex
  47727. });
  47728. changes = extends_extends({
  47729. inputValue: _inputValue
  47730. }, highlightedIndex >= 0 && {
  47731. highlightedIndex: highlightedIndex
  47732. });
  47733. }
  47734. break;
  47735. case MenuKeyDownArrowDown:
  47736. changes = {
  47737. highlightedIndex: getNextWrappingIndex(shiftKey ? 5 : 1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
  47738. };
  47739. break;
  47740. case MenuKeyDownArrowUp:
  47741. changes = {
  47742. highlightedIndex: getNextWrappingIndex(shiftKey ? -5 : -1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
  47743. };
  47744. break;
  47745. case FunctionSelectItem$1:
  47746. changes = {
  47747. selectedItem: action.selectedItem
  47748. };
  47749. break;
  47750. default:
  47751. return downshiftCommonReducer(state, action, stateChangeTypes$2);
  47752. }
  47753. return extends_extends({}, state, changes);
  47754. }
  47755. /* eslint-enable complexity */
  47756. var _excluded$2 = ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"],
  47757. _excluded2$2 = ["onClick", "onKeyDown", "refKey", "ref"],
  47758. _excluded3$1 = ["item", "index", "onMouseMove", "onClick", "refKey", "ref"];
  47759. useSelect.stateChangeTypes = stateChangeTypes$2;
  47760. function useSelect(userProps) {
  47761. if (userProps === void 0) {
  47762. userProps = {};
  47763. }
  47764. validatePropTypes$2(userProps, useSelect); // Props defaults and destructuring.
  47765. var props = extends_extends({}, defaultProps$2, userProps);
  47766. var items = props.items,
  47767. scrollIntoView = props.scrollIntoView,
  47768. environment = props.environment,
  47769. initialIsOpen = props.initialIsOpen,
  47770. defaultIsOpen = props.defaultIsOpen,
  47771. itemToString = props.itemToString,
  47772. getA11ySelectionMessage = props.getA11ySelectionMessage,
  47773. getA11yStatusMessage = props.getA11yStatusMessage; // Initial state depending on controlled props.
  47774. var initialState = getInitialState$2(props);
  47775. var _useControlledReducer = useControlledReducer$1(downshiftSelectReducer, initialState, props),
  47776. state = _useControlledReducer[0],
  47777. dispatch = _useControlledReducer[1];
  47778. var isOpen = state.isOpen,
  47779. highlightedIndex = state.highlightedIndex,
  47780. selectedItem = state.selectedItem,
  47781. inputValue = state.inputValue; // Element efs.
  47782. var toggleButtonRef = (0,external_React_.useRef)(null);
  47783. var menuRef = (0,external_React_.useRef)(null);
  47784. var itemRefs = (0,external_React_.useRef)({}); // used not to trigger menu blur action in some scenarios.
  47785. var shouldBlurRef = (0,external_React_.useRef)(true); // used to keep the inputValue clearTimeout object between renders.
  47786. var clearTimeoutRef = (0,external_React_.useRef)(null); // prevent id re-generation between renders.
  47787. var elementIds = useElementIds(props); // used to keep track of how many items we had on previous cycle.
  47788. var previousResultCountRef = (0,external_React_.useRef)();
  47789. var isInitialMountRef = (0,external_React_.useRef)(true); // utility callback to get item element.
  47790. var latest = useLatestRef({
  47791. state: state,
  47792. props: props
  47793. }); // Some utils.
  47794. var getItemNodeFromIndex = (0,external_React_.useCallback)(function (index) {
  47795. return itemRefs.current[elementIds.getItemId(index)];
  47796. }, [elementIds]); // Effects.
  47797. // Sets a11y status message on changes in state.
  47798. useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], extends_extends({
  47799. isInitialMount: isInitialMountRef.current,
  47800. previousResultCount: previousResultCountRef.current,
  47801. items: items,
  47802. environment: environment,
  47803. itemToString: itemToString
  47804. }, state)); // Sets a11y status message on changes in selectedItem.
  47805. useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], extends_extends({
  47806. isInitialMount: isInitialMountRef.current,
  47807. previousResultCount: previousResultCountRef.current,
  47808. items: items,
  47809. environment: environment,
  47810. itemToString: itemToString
  47811. }, state)); // Scroll on highlighted item if change comes from keyboard.
  47812. var shouldScrollRef = useScrollIntoView({
  47813. menuElement: menuRef.current,
  47814. highlightedIndex: highlightedIndex,
  47815. isOpen: isOpen,
  47816. itemRefs: itemRefs,
  47817. scrollIntoView: scrollIntoView,
  47818. getItemNodeFromIndex: getItemNodeFromIndex
  47819. }); // Sets cleanup for the keysSoFar callback, debounded after 500ms.
  47820. (0,external_React_.useEffect)(function () {
  47821. // init the clean function here as we need access to dispatch.
  47822. clearTimeoutRef.current = downshift_esm_debounce(function (outerDispatch) {
  47823. outerDispatch({
  47824. type: FunctionSetInputValue$1,
  47825. inputValue: ''
  47826. });
  47827. }, 500); // Cancel any pending debounced calls on mount
  47828. return function () {
  47829. clearTimeoutRef.current.cancel();
  47830. };
  47831. }, []); // Invokes the keysSoFar callback set up above.
  47832. (0,external_React_.useEffect)(function () {
  47833. if (!inputValue) {
  47834. return;
  47835. }
  47836. clearTimeoutRef.current(dispatch);
  47837. }, [dispatch, inputValue]);
  47838. useControlPropsValidator({
  47839. isInitialMount: isInitialMountRef.current,
  47840. props: props,
  47841. state: state
  47842. });
  47843. /* Controls the focus on the menu or the toggle button. */
  47844. (0,external_React_.useEffect)(function () {
  47845. // Don't focus menu on first render.
  47846. if (isInitialMountRef.current) {
  47847. // Unless it was initialised as open.
  47848. if ((initialIsOpen || defaultIsOpen || isOpen) && menuRef.current) {
  47849. menuRef.current.focus();
  47850. }
  47851. return;
  47852. } // Focus menu on open.
  47853. if (isOpen) {
  47854. // istanbul ignore else
  47855. if (menuRef.current) {
  47856. menuRef.current.focus();
  47857. }
  47858. return;
  47859. } // Focus toggleButton on close, but not if it was closed with (Shift+)Tab.
  47860. if (environment.document.activeElement === menuRef.current) {
  47861. // istanbul ignore else
  47862. if (toggleButtonRef.current) {
  47863. shouldBlurRef.current = false;
  47864. toggleButtonRef.current.focus();
  47865. }
  47866. } // eslint-disable-next-line react-hooks/exhaustive-deps
  47867. }, [isOpen]);
  47868. (0,external_React_.useEffect)(function () {
  47869. if (isInitialMountRef.current) {
  47870. return;
  47871. }
  47872. previousResultCountRef.current = items.length;
  47873. }); // Add mouse/touch events to document.
  47874. var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {
  47875. dispatch({
  47876. type: MenuBlur
  47877. });
  47878. });
  47879. var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps'); // Make initial ref false.
  47880. (0,external_React_.useEffect)(function () {
  47881. isInitialMountRef.current = false;
  47882. }, []); // Reset itemRefs on close.
  47883. (0,external_React_.useEffect)(function () {
  47884. if (!isOpen) {
  47885. itemRefs.current = {};
  47886. }
  47887. }, [isOpen]); // Event handler functions.
  47888. var toggleButtonKeyDownHandlers = (0,external_React_.useMemo)(function () {
  47889. return {
  47890. ArrowDown: function ArrowDown(event) {
  47891. event.preventDefault();
  47892. dispatch({
  47893. type: ToggleButtonKeyDownArrowDown,
  47894. getItemNodeFromIndex: getItemNodeFromIndex,
  47895. shiftKey: event.shiftKey
  47896. });
  47897. },
  47898. ArrowUp: function ArrowUp(event) {
  47899. event.preventDefault();
  47900. dispatch({
  47901. type: ToggleButtonKeyDownArrowUp,
  47902. getItemNodeFromIndex: getItemNodeFromIndex,
  47903. shiftKey: event.shiftKey
  47904. });
  47905. }
  47906. };
  47907. }, [dispatch, getItemNodeFromIndex]);
  47908. var menuKeyDownHandlers = (0,external_React_.useMemo)(function () {
  47909. return {
  47910. ArrowDown: function ArrowDown(event) {
  47911. event.preventDefault();
  47912. dispatch({
  47913. type: MenuKeyDownArrowDown,
  47914. getItemNodeFromIndex: getItemNodeFromIndex,
  47915. shiftKey: event.shiftKey
  47916. });
  47917. },
  47918. ArrowUp: function ArrowUp(event) {
  47919. event.preventDefault();
  47920. dispatch({
  47921. type: MenuKeyDownArrowUp,
  47922. getItemNodeFromIndex: getItemNodeFromIndex,
  47923. shiftKey: event.shiftKey
  47924. });
  47925. },
  47926. Home: function Home(event) {
  47927. event.preventDefault();
  47928. dispatch({
  47929. type: MenuKeyDownHome,
  47930. getItemNodeFromIndex: getItemNodeFromIndex
  47931. });
  47932. },
  47933. End: function End(event) {
  47934. event.preventDefault();
  47935. dispatch({
  47936. type: MenuKeyDownEnd,
  47937. getItemNodeFromIndex: getItemNodeFromIndex
  47938. });
  47939. },
  47940. Escape: function Escape() {
  47941. dispatch({
  47942. type: MenuKeyDownEscape
  47943. });
  47944. },
  47945. Enter: function Enter(event) {
  47946. event.preventDefault();
  47947. dispatch({
  47948. type: MenuKeyDownEnter
  47949. });
  47950. },
  47951. ' ': function _(event) {
  47952. event.preventDefault();
  47953. dispatch({
  47954. type: MenuKeyDownSpaceButton
  47955. });
  47956. }
  47957. };
  47958. }, [dispatch, getItemNodeFromIndex]); // Action functions.
  47959. var toggleMenu = (0,external_React_.useCallback)(function () {
  47960. dispatch({
  47961. type: FunctionToggleMenu$1
  47962. });
  47963. }, [dispatch]);
  47964. var closeMenu = (0,external_React_.useCallback)(function () {
  47965. dispatch({
  47966. type: FunctionCloseMenu$1
  47967. });
  47968. }, [dispatch]);
  47969. var openMenu = (0,external_React_.useCallback)(function () {
  47970. dispatch({
  47971. type: FunctionOpenMenu$1
  47972. });
  47973. }, [dispatch]);
  47974. var setHighlightedIndex = (0,external_React_.useCallback)(function (newHighlightedIndex) {
  47975. dispatch({
  47976. type: FunctionSetHighlightedIndex$1,
  47977. highlightedIndex: newHighlightedIndex
  47978. });
  47979. }, [dispatch]);
  47980. var selectItem = (0,external_React_.useCallback)(function (newSelectedItem) {
  47981. dispatch({
  47982. type: FunctionSelectItem$1,
  47983. selectedItem: newSelectedItem
  47984. });
  47985. }, [dispatch]);
  47986. var reset = (0,external_React_.useCallback)(function () {
  47987. dispatch({
  47988. type: FunctionReset$2
  47989. });
  47990. }, [dispatch]);
  47991. var setInputValue = (0,external_React_.useCallback)(function (newInputValue) {
  47992. dispatch({
  47993. type: FunctionSetInputValue$1,
  47994. inputValue: newInputValue
  47995. });
  47996. }, [dispatch]); // Getter functions.
  47997. var getLabelProps = (0,external_React_.useCallback)(function (labelProps) {
  47998. return extends_extends({
  47999. id: elementIds.labelId,
  48000. htmlFor: elementIds.toggleButtonId
  48001. }, labelProps);
  48002. }, [elementIds]);
  48003. var getMenuProps = (0,external_React_.useCallback)(function (_temp, _temp2) {
  48004. var _extends2;
  48005. var _ref = _temp === void 0 ? {} : _temp,
  48006. onMouseLeave = _ref.onMouseLeave,
  48007. _ref$refKey = _ref.refKey,
  48008. refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
  48009. onKeyDown = _ref.onKeyDown,
  48010. onBlur = _ref.onBlur,
  48011. ref = _ref.ref,
  48012. rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref, _excluded$2);
  48013. var _ref2 = _temp2 === void 0 ? {} : _temp2,
  48014. _ref2$suppressRefErro = _ref2.suppressRefError,
  48015. suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;
  48016. var latestState = latest.current.state;
  48017. var menuHandleKeyDown = function menuHandleKeyDown(event) {
  48018. var key = normalizeArrowKey(event);
  48019. if (key && menuKeyDownHandlers[key]) {
  48020. menuKeyDownHandlers[key](event);
  48021. } else if (isAcceptedCharacterKey(key)) {
  48022. dispatch({
  48023. type: MenuKeyDownCharacter,
  48024. key: key,
  48025. getItemNodeFromIndex: getItemNodeFromIndex
  48026. });
  48027. }
  48028. };
  48029. var menuHandleBlur = function menuHandleBlur() {
  48030. // if the blur was a result of selection, we don't trigger this action.
  48031. if (shouldBlurRef.current === false) {
  48032. shouldBlurRef.current = true;
  48033. return;
  48034. }
  48035. var shouldBlur = !mouseAndTouchTrackersRef.current.isMouseDown;
  48036. /* istanbul ignore else */
  48037. if (shouldBlur) {
  48038. dispatch({
  48039. type: MenuBlur
  48040. });
  48041. }
  48042. };
  48043. var menuHandleMouseLeave = function menuHandleMouseLeave() {
  48044. dispatch({
  48045. type: MenuMouseLeave$1
  48046. });
  48047. };
  48048. setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);
  48049. return extends_extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {
  48050. menuRef.current = menuNode;
  48051. }), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = elementIds.labelId, _extends2.tabIndex = -1, _extends2), latestState.isOpen && latestState.highlightedIndex > -1 && {
  48052. 'aria-activedescendant': elementIds.getItemId(latestState.highlightedIndex)
  48053. }, {
  48054. onMouseLeave: callAllEventHandlers(onMouseLeave, menuHandleMouseLeave),
  48055. onKeyDown: callAllEventHandlers(onKeyDown, menuHandleKeyDown),
  48056. onBlur: callAllEventHandlers(onBlur, menuHandleBlur)
  48057. }, rest);
  48058. }, [dispatch, latest, menuKeyDownHandlers, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds, getItemNodeFromIndex]);
  48059. var getToggleButtonProps = (0,external_React_.useCallback)(function (_temp3, _temp4) {
  48060. var _extends3;
  48061. var _ref3 = _temp3 === void 0 ? {} : _temp3,
  48062. onClick = _ref3.onClick,
  48063. onKeyDown = _ref3.onKeyDown,
  48064. _ref3$refKey = _ref3.refKey,
  48065. refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
  48066. ref = _ref3.ref,
  48067. rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref3, _excluded2$2);
  48068. var _ref4 = _temp4 === void 0 ? {} : _temp4,
  48069. _ref4$suppressRefErro = _ref4.suppressRefError,
  48070. suppressRefError = _ref4$suppressRefErro === void 0 ? false : _ref4$suppressRefErro;
  48071. var toggleButtonHandleClick = function toggleButtonHandleClick() {
  48072. dispatch({
  48073. type: ToggleButtonClick$1
  48074. });
  48075. };
  48076. var toggleButtonHandleKeyDown = function toggleButtonHandleKeyDown(event) {
  48077. var key = normalizeArrowKey(event);
  48078. if (key && toggleButtonKeyDownHandlers[key]) {
  48079. toggleButtonKeyDownHandlers[key](event);
  48080. } else if (isAcceptedCharacterKey(key)) {
  48081. dispatch({
  48082. type: ToggleButtonKeyDownCharacter,
  48083. key: key,
  48084. getItemNodeFromIndex: getItemNodeFromIndex
  48085. });
  48086. }
  48087. };
  48088. var toggleProps = extends_extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (toggleButtonNode) {
  48089. toggleButtonRef.current = toggleButtonNode;
  48090. }), _extends3.id = elementIds.toggleButtonId, _extends3['aria-haspopup'] = 'listbox', _extends3['aria-expanded'] = latest.current.state.isOpen, _extends3['aria-labelledby'] = elementIds.labelId + " " + elementIds.toggleButtonId, _extends3), rest);
  48091. if (!rest.disabled) {
  48092. toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);
  48093. toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);
  48094. }
  48095. setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);
  48096. return toggleProps;
  48097. }, [dispatch, latest, toggleButtonKeyDownHandlers, setGetterPropCallInfo, elementIds, getItemNodeFromIndex]);
  48098. var getItemProps = (0,external_React_.useCallback)(function (_temp5) {
  48099. var _extends4;
  48100. var _ref5 = _temp5 === void 0 ? {} : _temp5,
  48101. item = _ref5.item,
  48102. index = _ref5.index,
  48103. onMouseMove = _ref5.onMouseMove,
  48104. onClick = _ref5.onClick,
  48105. _ref5$refKey = _ref5.refKey,
  48106. refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
  48107. ref = _ref5.ref,
  48108. rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref5, _excluded3$1);
  48109. var _latest$current = latest.current,
  48110. latestState = _latest$current.state,
  48111. latestProps = _latest$current.props;
  48112. var itemHandleMouseMove = function itemHandleMouseMove() {
  48113. if (index === latestState.highlightedIndex) {
  48114. return;
  48115. }
  48116. shouldScrollRef.current = false;
  48117. dispatch({
  48118. type: ItemMouseMove$1,
  48119. index: index
  48120. });
  48121. };
  48122. var itemHandleClick = function itemHandleClick() {
  48123. dispatch({
  48124. type: ItemClick$1,
  48125. index: index
  48126. });
  48127. };
  48128. var itemIndex = getItemIndex(index, item, latestProps.items);
  48129. if (itemIndex < 0) {
  48130. throw new Error('Pass either item or item index in getItemProps!');
  48131. }
  48132. var itemProps = extends_extends((_extends4 = {
  48133. role: 'option',
  48134. 'aria-selected': "" + (itemIndex === latestState.highlightedIndex),
  48135. id: elementIds.getItemId(itemIndex)
  48136. }, _extends4[refKey] = handleRefs(ref, function (itemNode) {
  48137. if (itemNode) {
  48138. itemRefs.current[elementIds.getItemId(itemIndex)] = itemNode;
  48139. }
  48140. }), _extends4), rest);
  48141. if (!rest.disabled) {
  48142. itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);
  48143. itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);
  48144. }
  48145. return itemProps;
  48146. }, [dispatch, latest, shouldScrollRef, elementIds]);
  48147. return {
  48148. // prop getters.
  48149. getToggleButtonProps: getToggleButtonProps,
  48150. getLabelProps: getLabelProps,
  48151. getMenuProps: getMenuProps,
  48152. getItemProps: getItemProps,
  48153. // actions.
  48154. toggleMenu: toggleMenu,
  48155. openMenu: openMenu,
  48156. closeMenu: closeMenu,
  48157. setHighlightedIndex: setHighlightedIndex,
  48158. selectItem: selectItem,
  48159. reset: reset,
  48160. setInputValue: setInputValue,
  48161. // state.
  48162. highlightedIndex: highlightedIndex,
  48163. isOpen: isOpen,
  48164. selectedItem: selectedItem,
  48165. inputValue: inputValue
  48166. };
  48167. }
  48168. var InputKeyDownArrowDown = false ? 0 : 0;
  48169. var InputKeyDownArrowUp = false ? 0 : 1;
  48170. var InputKeyDownEscape = false ? 0 : 2;
  48171. var InputKeyDownHome = false ? 0 : 3;
  48172. var InputKeyDownEnd = false ? 0 : 4;
  48173. var InputKeyDownEnter = false ? 0 : 5;
  48174. var InputChange = false ? 0 : 6;
  48175. var InputBlur = false ? 0 : 7;
  48176. var MenuMouseLeave = false ? 0 : 8;
  48177. var ItemMouseMove = false ? 0 : 9;
  48178. var ItemClick = false ? 0 : 10;
  48179. var ToggleButtonClick = false ? 0 : 11;
  48180. var FunctionToggleMenu = false ? 0 : 12;
  48181. var FunctionOpenMenu = false ? 0 : 13;
  48182. var FunctionCloseMenu = false ? 0 : 14;
  48183. var FunctionSetHighlightedIndex = false ? 0 : 15;
  48184. var FunctionSelectItem = false ? 0 : 16;
  48185. var FunctionSetInputValue = false ? 0 : 17;
  48186. var FunctionReset$1 = false ? 0 : 18;
  48187. var ControlledPropUpdatedSelectedItem = false ? 0 : 19;
  48188. var stateChangeTypes$1 = /*#__PURE__*/Object.freeze({
  48189. __proto__: null,
  48190. InputKeyDownArrowDown: InputKeyDownArrowDown,
  48191. InputKeyDownArrowUp: InputKeyDownArrowUp,
  48192. InputKeyDownEscape: InputKeyDownEscape,
  48193. InputKeyDownHome: InputKeyDownHome,
  48194. InputKeyDownEnd: InputKeyDownEnd,
  48195. InputKeyDownEnter: InputKeyDownEnter,
  48196. InputChange: InputChange,
  48197. InputBlur: InputBlur,
  48198. MenuMouseLeave: MenuMouseLeave,
  48199. ItemMouseMove: ItemMouseMove,
  48200. ItemClick: ItemClick,
  48201. ToggleButtonClick: ToggleButtonClick,
  48202. FunctionToggleMenu: FunctionToggleMenu,
  48203. FunctionOpenMenu: FunctionOpenMenu,
  48204. FunctionCloseMenu: FunctionCloseMenu,
  48205. FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
  48206. FunctionSelectItem: FunctionSelectItem,
  48207. FunctionSetInputValue: FunctionSetInputValue,
  48208. FunctionReset: FunctionReset$1,
  48209. ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem
  48210. });
  48211. function getInitialState$1(props) {
  48212. var initialState = getInitialState$2(props);
  48213. var selectedItem = initialState.selectedItem;
  48214. var inputValue = initialState.inputValue;
  48215. if (inputValue === '' && selectedItem && props.defaultInputValue === undefined && props.initialInputValue === undefined && props.inputValue === undefined) {
  48216. inputValue = props.itemToString(selectedItem);
  48217. }
  48218. return extends_extends({}, initialState, {
  48219. inputValue: inputValue
  48220. });
  48221. }
  48222. var propTypes$1 = {
  48223. items: (prop_types_default()).array.isRequired,
  48224. itemToString: (prop_types_default()).func,
  48225. getA11yStatusMessage: (prop_types_default()).func,
  48226. getA11ySelectionMessage: (prop_types_default()).func,
  48227. circularNavigation: (prop_types_default()).bool,
  48228. highlightedIndex: (prop_types_default()).number,
  48229. defaultHighlightedIndex: (prop_types_default()).number,
  48230. initialHighlightedIndex: (prop_types_default()).number,
  48231. isOpen: (prop_types_default()).bool,
  48232. defaultIsOpen: (prop_types_default()).bool,
  48233. initialIsOpen: (prop_types_default()).bool,
  48234. selectedItem: (prop_types_default()).any,
  48235. initialSelectedItem: (prop_types_default()).any,
  48236. defaultSelectedItem: (prop_types_default()).any,
  48237. inputValue: (prop_types_default()).string,
  48238. defaultInputValue: (prop_types_default()).string,
  48239. initialInputValue: (prop_types_default()).string,
  48240. id: (prop_types_default()).string,
  48241. labelId: (prop_types_default()).string,
  48242. menuId: (prop_types_default()).string,
  48243. getItemId: (prop_types_default()).func,
  48244. inputId: (prop_types_default()).string,
  48245. toggleButtonId: (prop_types_default()).string,
  48246. stateReducer: (prop_types_default()).func,
  48247. onSelectedItemChange: (prop_types_default()).func,
  48248. onHighlightedIndexChange: (prop_types_default()).func,
  48249. onStateChange: (prop_types_default()).func,
  48250. onIsOpenChange: (prop_types_default()).func,
  48251. onInputValueChange: (prop_types_default()).func,
  48252. environment: prop_types_default().shape({
  48253. addEventListener: (prop_types_default()).func,
  48254. removeEventListener: (prop_types_default()).func,
  48255. document: prop_types_default().shape({
  48256. getElementById: (prop_types_default()).func,
  48257. activeElement: (prop_types_default()).any,
  48258. body: (prop_types_default()).any
  48259. })
  48260. })
  48261. };
  48262. /**
  48263. * The useCombobox version of useControlledReducer, which also
  48264. * checks if the controlled prop selectedItem changed between
  48265. * renders. If so, it will also update inputValue with its
  48266. * string equivalent. It uses the common useEnhancedReducer to
  48267. * compute the rest of the state.
  48268. *
  48269. * @param {Function} reducer Reducer function from downshift.
  48270. * @param {Object} initialState Initial state of the hook.
  48271. * @param {Object} props The hook props.
  48272. * @returns {Array} An array with the state and an action dispatcher.
  48273. */
  48274. function useControlledReducer(reducer, initialState, props) {
  48275. var previousSelectedItemRef = (0,external_React_.useRef)();
  48276. var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),
  48277. state = _useEnhancedReducer[0],
  48278. dispatch = _useEnhancedReducer[1]; // ToDo: if needed, make same approach as selectedItemChanged from Downshift.
  48279. (0,external_React_.useEffect)(function () {
  48280. if (isControlledProp(props, 'selectedItem')) {
  48281. if (previousSelectedItemRef.current !== props.selectedItem) {
  48282. dispatch({
  48283. type: ControlledPropUpdatedSelectedItem,
  48284. inputValue: props.itemToString(props.selectedItem)
  48285. });
  48286. }
  48287. previousSelectedItemRef.current = state.selectedItem === previousSelectedItemRef.current ? props.selectedItem : state.selectedItem;
  48288. }
  48289. });
  48290. return [getState(state, props), dispatch];
  48291. } // eslint-disable-next-line import/no-mutable-exports
  48292. var validatePropTypes$1 = downshift_esm_noop;
  48293. /* istanbul ignore next */
  48294. if (false) {}
  48295. var defaultProps$1 = extends_extends({}, defaultProps$3, {
  48296. getA11yStatusMessage: getA11yStatusMessage$1,
  48297. circularNavigation: true
  48298. });
  48299. /* eslint-disable complexity */
  48300. function downshiftUseComboboxReducer(state, action) {
  48301. var type = action.type,
  48302. props = action.props,
  48303. shiftKey = action.shiftKey;
  48304. var changes;
  48305. switch (type) {
  48306. case ItemClick:
  48307. changes = {
  48308. isOpen: getDefaultValue$1(props, 'isOpen'),
  48309. highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
  48310. selectedItem: props.items[action.index],
  48311. inputValue: props.itemToString(props.items[action.index])
  48312. };
  48313. break;
  48314. case InputKeyDownArrowDown:
  48315. if (state.isOpen) {
  48316. changes = {
  48317. highlightedIndex: getNextWrappingIndex(shiftKey ? 5 : 1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
  48318. };
  48319. } else {
  48320. changes = {
  48321. highlightedIndex: getHighlightedIndexOnOpen(props, state, 1, action.getItemNodeFromIndex),
  48322. isOpen: props.items.length >= 0
  48323. };
  48324. }
  48325. break;
  48326. case InputKeyDownArrowUp:
  48327. if (state.isOpen) {
  48328. changes = {
  48329. highlightedIndex: getNextWrappingIndex(shiftKey ? -5 : -1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
  48330. };
  48331. } else {
  48332. changes = {
  48333. highlightedIndex: getHighlightedIndexOnOpen(props, state, -1, action.getItemNodeFromIndex),
  48334. isOpen: props.items.length >= 0
  48335. };
  48336. }
  48337. break;
  48338. case InputKeyDownEnter:
  48339. changes = extends_extends({}, state.isOpen && state.highlightedIndex >= 0 && {
  48340. selectedItem: props.items[state.highlightedIndex],
  48341. isOpen: getDefaultValue$1(props, 'isOpen'),
  48342. highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
  48343. inputValue: props.itemToString(props.items[state.highlightedIndex])
  48344. });
  48345. break;
  48346. case InputKeyDownEscape:
  48347. changes = extends_extends({
  48348. isOpen: false,
  48349. highlightedIndex: -1
  48350. }, !state.isOpen && {
  48351. selectedItem: null,
  48352. inputValue: ''
  48353. });
  48354. break;
  48355. case InputKeyDownHome:
  48356. changes = {
  48357. highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false)
  48358. };
  48359. break;
  48360. case InputKeyDownEnd:
  48361. changes = {
  48362. highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false)
  48363. };
  48364. break;
  48365. case InputBlur:
  48366. changes = extends_extends({
  48367. isOpen: false,
  48368. highlightedIndex: -1
  48369. }, state.highlightedIndex >= 0 && action.selectItem && {
  48370. selectedItem: props.items[state.highlightedIndex],
  48371. inputValue: props.itemToString(props.items[state.highlightedIndex])
  48372. });
  48373. break;
  48374. case InputChange:
  48375. changes = {
  48376. isOpen: true,
  48377. highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
  48378. inputValue: action.inputValue
  48379. };
  48380. break;
  48381. case FunctionSelectItem:
  48382. changes = {
  48383. selectedItem: action.selectedItem,
  48384. inputValue: props.itemToString(action.selectedItem)
  48385. };
  48386. break;
  48387. case ControlledPropUpdatedSelectedItem:
  48388. changes = {
  48389. inputValue: action.inputValue
  48390. };
  48391. break;
  48392. default:
  48393. return downshiftCommonReducer(state, action, stateChangeTypes$1);
  48394. }
  48395. return extends_extends({}, state, changes);
  48396. }
  48397. /* eslint-enable complexity */
  48398. var _excluded$1 = ["onMouseLeave", "refKey", "ref"],
  48399. _excluded2$1 = ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"],
  48400. _excluded3 = ["onClick", "onPress", "refKey", "ref"],
  48401. _excluded4 = ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "refKey", "ref"],
  48402. _excluded5 = ["refKey", "ref"];
  48403. useCombobox.stateChangeTypes = stateChangeTypes$1;
  48404. function useCombobox(userProps) {
  48405. if (userProps === void 0) {
  48406. userProps = {};
  48407. }
  48408. validatePropTypes$1(userProps, useCombobox); // Props defaults and destructuring.
  48409. var props = extends_extends({}, defaultProps$1, userProps);
  48410. var initialIsOpen = props.initialIsOpen,
  48411. defaultIsOpen = props.defaultIsOpen,
  48412. items = props.items,
  48413. scrollIntoView = props.scrollIntoView,
  48414. environment = props.environment,
  48415. getA11yStatusMessage = props.getA11yStatusMessage,
  48416. getA11ySelectionMessage = props.getA11ySelectionMessage,
  48417. itemToString = props.itemToString; // Initial state depending on controlled props.
  48418. var initialState = getInitialState$1(props);
  48419. var _useControlledReducer = useControlledReducer(downshiftUseComboboxReducer, initialState, props),
  48420. state = _useControlledReducer[0],
  48421. dispatch = _useControlledReducer[1];
  48422. var isOpen = state.isOpen,
  48423. highlightedIndex = state.highlightedIndex,
  48424. selectedItem = state.selectedItem,
  48425. inputValue = state.inputValue; // Element refs.
  48426. var menuRef = (0,external_React_.useRef)(null);
  48427. var itemRefs = (0,external_React_.useRef)({});
  48428. var inputRef = (0,external_React_.useRef)(null);
  48429. var toggleButtonRef = (0,external_React_.useRef)(null);
  48430. var comboboxRef = (0,external_React_.useRef)(null);
  48431. var isInitialMountRef = (0,external_React_.useRef)(true); // prevent id re-generation between renders.
  48432. var elementIds = useElementIds(props); // used to keep track of how many items we had on previous cycle.
  48433. var previousResultCountRef = (0,external_React_.useRef)(); // utility callback to get item element.
  48434. var latest = useLatestRef({
  48435. state: state,
  48436. props: props
  48437. });
  48438. var getItemNodeFromIndex = (0,external_React_.useCallback)(function (index) {
  48439. return itemRefs.current[elementIds.getItemId(index)];
  48440. }, [elementIds]); // Effects.
  48441. // Sets a11y status message on changes in state.
  48442. useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], extends_extends({
  48443. isInitialMount: isInitialMountRef.current,
  48444. previousResultCount: previousResultCountRef.current,
  48445. items: items,
  48446. environment: environment,
  48447. itemToString: itemToString
  48448. }, state)); // Sets a11y status message on changes in selectedItem.
  48449. useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], extends_extends({
  48450. isInitialMount: isInitialMountRef.current,
  48451. previousResultCount: previousResultCountRef.current,
  48452. items: items,
  48453. environment: environment,
  48454. itemToString: itemToString
  48455. }, state)); // Scroll on highlighted item if change comes from keyboard.
  48456. var shouldScrollRef = useScrollIntoView({
  48457. menuElement: menuRef.current,
  48458. highlightedIndex: highlightedIndex,
  48459. isOpen: isOpen,
  48460. itemRefs: itemRefs,
  48461. scrollIntoView: scrollIntoView,
  48462. getItemNodeFromIndex: getItemNodeFromIndex
  48463. });
  48464. useControlPropsValidator({
  48465. isInitialMount: isInitialMountRef.current,
  48466. props: props,
  48467. state: state
  48468. }); // Focus the input on first render if required.
  48469. (0,external_React_.useEffect)(function () {
  48470. var focusOnOpen = initialIsOpen || defaultIsOpen || isOpen;
  48471. if (focusOnOpen && inputRef.current) {
  48472. inputRef.current.focus();
  48473. } // eslint-disable-next-line react-hooks/exhaustive-deps
  48474. }, []);
  48475. (0,external_React_.useEffect)(function () {
  48476. if (isInitialMountRef.current) {
  48477. return;
  48478. }
  48479. previousResultCountRef.current = items.length;
  48480. }); // Add mouse/touch events to document.
  48481. var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [comboboxRef, menuRef, toggleButtonRef], environment, function () {
  48482. dispatch({
  48483. type: InputBlur,
  48484. selectItem: false
  48485. });
  48486. });
  48487. var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getComboboxProps', 'getMenuProps'); // Make initial ref false.
  48488. (0,external_React_.useEffect)(function () {
  48489. isInitialMountRef.current = false;
  48490. }, []); // Reset itemRefs on close.
  48491. (0,external_React_.useEffect)(function () {
  48492. if (!isOpen) {
  48493. itemRefs.current = {};
  48494. }
  48495. }, [isOpen]);
  48496. /* Event handler functions */
  48497. var inputKeyDownHandlers = (0,external_React_.useMemo)(function () {
  48498. return {
  48499. ArrowDown: function ArrowDown(event) {
  48500. event.preventDefault();
  48501. dispatch({
  48502. type: InputKeyDownArrowDown,
  48503. shiftKey: event.shiftKey,
  48504. getItemNodeFromIndex: getItemNodeFromIndex
  48505. });
  48506. },
  48507. ArrowUp: function ArrowUp(event) {
  48508. event.preventDefault();
  48509. dispatch({
  48510. type: InputKeyDownArrowUp,
  48511. shiftKey: event.shiftKey,
  48512. getItemNodeFromIndex: getItemNodeFromIndex
  48513. });
  48514. },
  48515. Home: function Home(event) {
  48516. if (!latest.current.state.isOpen) {
  48517. return;
  48518. }
  48519. event.preventDefault();
  48520. dispatch({
  48521. type: InputKeyDownHome,
  48522. getItemNodeFromIndex: getItemNodeFromIndex
  48523. });
  48524. },
  48525. End: function End(event) {
  48526. if (!latest.current.state.isOpen) {
  48527. return;
  48528. }
  48529. event.preventDefault();
  48530. dispatch({
  48531. type: InputKeyDownEnd,
  48532. getItemNodeFromIndex: getItemNodeFromIndex
  48533. });
  48534. },
  48535. Escape: function Escape() {
  48536. var latestState = latest.current.state;
  48537. if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {
  48538. dispatch({
  48539. type: InputKeyDownEscape
  48540. });
  48541. }
  48542. },
  48543. Enter: function Enter(event) {
  48544. var latestState = latest.current.state; // if closed or no highlighted index, do nothing.
  48545. if (!latestState.isOpen || latestState.highlightedIndex < 0 || event.which === 229 // if IME composing, wait for next Enter keydown event.
  48546. ) {
  48547. return;
  48548. }
  48549. event.preventDefault();
  48550. dispatch({
  48551. type: InputKeyDownEnter,
  48552. getItemNodeFromIndex: getItemNodeFromIndex
  48553. });
  48554. }
  48555. };
  48556. }, [dispatch, latest, getItemNodeFromIndex]); // Getter props.
  48557. var getLabelProps = (0,external_React_.useCallback)(function (labelProps) {
  48558. return extends_extends({
  48559. id: elementIds.labelId,
  48560. htmlFor: elementIds.inputId
  48561. }, labelProps);
  48562. }, [elementIds]);
  48563. var getMenuProps = (0,external_React_.useCallback)(function (_temp, _temp2) {
  48564. var _extends2;
  48565. var _ref = _temp === void 0 ? {} : _temp,
  48566. onMouseLeave = _ref.onMouseLeave,
  48567. _ref$refKey = _ref.refKey,
  48568. refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
  48569. ref = _ref.ref,
  48570. rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref, _excluded$1);
  48571. var _ref2 = _temp2 === void 0 ? {} : _temp2,
  48572. _ref2$suppressRefErro = _ref2.suppressRefError,
  48573. suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;
  48574. setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);
  48575. return extends_extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {
  48576. menuRef.current = menuNode;
  48577. }), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, function () {
  48578. dispatch({
  48579. type: MenuMouseLeave
  48580. });
  48581. }), _extends2), rest);
  48582. }, [dispatch, setGetterPropCallInfo, elementIds]);
  48583. var getItemProps = (0,external_React_.useCallback)(function (_temp3) {
  48584. var _extends3, _ref4;
  48585. var _ref3 = _temp3 === void 0 ? {} : _temp3,
  48586. item = _ref3.item,
  48587. index = _ref3.index,
  48588. _ref3$refKey = _ref3.refKey,
  48589. refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
  48590. ref = _ref3.ref,
  48591. onMouseMove = _ref3.onMouseMove,
  48592. onClick = _ref3.onClick;
  48593. _ref3.onPress;
  48594. var rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref3, _excluded2$1);
  48595. var _latest$current = latest.current,
  48596. latestProps = _latest$current.props,
  48597. latestState = _latest$current.state;
  48598. var itemIndex = getItemIndex(index, item, latestProps.items);
  48599. if (itemIndex < 0) {
  48600. throw new Error('Pass either item or item index in getItemProps!');
  48601. }
  48602. var onSelectKey = 'onClick';
  48603. var customClickHandler = onClick;
  48604. var itemHandleMouseMove = function itemHandleMouseMove() {
  48605. if (index === latestState.highlightedIndex) {
  48606. return;
  48607. }
  48608. shouldScrollRef.current = false;
  48609. dispatch({
  48610. type: ItemMouseMove,
  48611. index: index
  48612. });
  48613. };
  48614. var itemHandleClick = function itemHandleClick() {
  48615. dispatch({
  48616. type: ItemClick,
  48617. index: index
  48618. });
  48619. if (inputRef.current) {
  48620. inputRef.current.focus();
  48621. }
  48622. };
  48623. return extends_extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (itemNode) {
  48624. if (itemNode) {
  48625. itemRefs.current[elementIds.getItemId(itemIndex)] = itemNode;
  48626. }
  48627. }), _extends3.role = 'option', _extends3['aria-selected'] = "" + (itemIndex === latestState.highlightedIndex), _extends3.id = elementIds.getItemId(itemIndex), _extends3), !rest.disabled && (_ref4 = {
  48628. onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove)
  48629. }, _ref4[onSelectKey] = callAllEventHandlers(customClickHandler, itemHandleClick), _ref4), rest);
  48630. }, [dispatch, latest, shouldScrollRef, elementIds]);
  48631. var getToggleButtonProps = (0,external_React_.useCallback)(function (_temp4) {
  48632. var _extends4;
  48633. var _ref5 = _temp4 === void 0 ? {} : _temp4,
  48634. onClick = _ref5.onClick;
  48635. _ref5.onPress;
  48636. var _ref5$refKey = _ref5.refKey,
  48637. refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
  48638. ref = _ref5.ref,
  48639. rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref5, _excluded3);
  48640. var toggleButtonHandleClick = function toggleButtonHandleClick() {
  48641. dispatch({
  48642. type: ToggleButtonClick
  48643. });
  48644. if (!latest.current.state.isOpen && inputRef.current) {
  48645. inputRef.current.focus();
  48646. }
  48647. };
  48648. return extends_extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (toggleButtonNode) {
  48649. toggleButtonRef.current = toggleButtonNode;
  48650. }), _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && extends_extends({}, {
  48651. onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)
  48652. }), rest);
  48653. }, [dispatch, latest, elementIds]);
  48654. var getInputProps = (0,external_React_.useCallback)(function (_temp5, _temp6) {
  48655. var _extends5;
  48656. var _ref6 = _temp5 === void 0 ? {} : _temp5,
  48657. onKeyDown = _ref6.onKeyDown,
  48658. onChange = _ref6.onChange,
  48659. onInput = _ref6.onInput,
  48660. onBlur = _ref6.onBlur;
  48661. _ref6.onChangeText;
  48662. var _ref6$refKey = _ref6.refKey,
  48663. refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,
  48664. ref = _ref6.ref,
  48665. rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref6, _excluded4);
  48666. var _ref7 = _temp6 === void 0 ? {} : _temp6,
  48667. _ref7$suppressRefErro = _ref7.suppressRefError,
  48668. suppressRefError = _ref7$suppressRefErro === void 0 ? false : _ref7$suppressRefErro;
  48669. setGetterPropCallInfo('getInputProps', suppressRefError, refKey, inputRef);
  48670. var latestState = latest.current.state;
  48671. var inputHandleKeyDown = function inputHandleKeyDown(event) {
  48672. var key = normalizeArrowKey(event);
  48673. if (key && inputKeyDownHandlers[key]) {
  48674. inputKeyDownHandlers[key](event);
  48675. }
  48676. };
  48677. var inputHandleChange = function inputHandleChange(event) {
  48678. dispatch({
  48679. type: InputChange,
  48680. inputValue: event.target.value
  48681. });
  48682. };
  48683. var inputHandleBlur = function inputHandleBlur() {
  48684. /* istanbul ignore else */
  48685. if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
  48686. dispatch({
  48687. type: InputBlur,
  48688. selectItem: true
  48689. });
  48690. }
  48691. };
  48692. /* istanbul ignore next (preact) */
  48693. var onChangeKey = 'onChange';
  48694. var eventHandlers = {};
  48695. if (!rest.disabled) {
  48696. var _eventHandlers;
  48697. eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, inputHandleBlur), _eventHandlers);
  48698. }
  48699. return extends_extends((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {
  48700. inputRef.current = inputNode;
  48701. }), _extends5.id = elementIds.inputId, _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5), latestState.isOpen && latestState.highlightedIndex > -1 && {
  48702. 'aria-activedescendant': elementIds.getItemId(latestState.highlightedIndex)
  48703. }, {
  48704. 'aria-labelledby': elementIds.labelId,
  48705. // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
  48706. // revert back since autocomplete="nope" is ignored on latest Chrome and Opera
  48707. autoComplete: 'off',
  48708. value: latestState.inputValue
  48709. }, eventHandlers, rest);
  48710. }, [dispatch, inputKeyDownHandlers, latest, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds]);
  48711. var getComboboxProps = (0,external_React_.useCallback)(function (_temp7, _temp8) {
  48712. var _extends6;
  48713. var _ref8 = _temp7 === void 0 ? {} : _temp7,
  48714. _ref8$refKey = _ref8.refKey,
  48715. refKey = _ref8$refKey === void 0 ? 'ref' : _ref8$refKey,
  48716. ref = _ref8.ref,
  48717. rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref8, _excluded5);
  48718. var _ref9 = _temp8 === void 0 ? {} : _temp8,
  48719. _ref9$suppressRefErro = _ref9.suppressRefError,
  48720. suppressRefError = _ref9$suppressRefErro === void 0 ? false : _ref9$suppressRefErro;
  48721. setGetterPropCallInfo('getComboboxProps', suppressRefError, refKey, comboboxRef);
  48722. return extends_extends((_extends6 = {}, _extends6[refKey] = handleRefs(ref, function (comboboxNode) {
  48723. comboboxRef.current = comboboxNode;
  48724. }), _extends6.role = 'combobox', _extends6['aria-haspopup'] = 'listbox', _extends6['aria-owns'] = elementIds.menuId, _extends6['aria-expanded'] = latest.current.state.isOpen, _extends6), rest);
  48725. }, [latest, setGetterPropCallInfo, elementIds]); // returns
  48726. var toggleMenu = (0,external_React_.useCallback)(function () {
  48727. dispatch({
  48728. type: FunctionToggleMenu
  48729. });
  48730. }, [dispatch]);
  48731. var closeMenu = (0,external_React_.useCallback)(function () {
  48732. dispatch({
  48733. type: FunctionCloseMenu
  48734. });
  48735. }, [dispatch]);
  48736. var openMenu = (0,external_React_.useCallback)(function () {
  48737. dispatch({
  48738. type: FunctionOpenMenu
  48739. });
  48740. }, [dispatch]);
  48741. var setHighlightedIndex = (0,external_React_.useCallback)(function (newHighlightedIndex) {
  48742. dispatch({
  48743. type: FunctionSetHighlightedIndex,
  48744. highlightedIndex: newHighlightedIndex
  48745. });
  48746. }, [dispatch]);
  48747. var selectItem = (0,external_React_.useCallback)(function (newSelectedItem) {
  48748. dispatch({
  48749. type: FunctionSelectItem,
  48750. selectedItem: newSelectedItem
  48751. });
  48752. }, [dispatch]);
  48753. var setInputValue = (0,external_React_.useCallback)(function (newInputValue) {
  48754. dispatch({
  48755. type: FunctionSetInputValue,
  48756. inputValue: newInputValue
  48757. });
  48758. }, [dispatch]);
  48759. var reset = (0,external_React_.useCallback)(function () {
  48760. dispatch({
  48761. type: FunctionReset$1
  48762. });
  48763. }, [dispatch]);
  48764. return {
  48765. // prop getters.
  48766. getItemProps: getItemProps,
  48767. getLabelProps: getLabelProps,
  48768. getMenuProps: getMenuProps,
  48769. getInputProps: getInputProps,
  48770. getComboboxProps: getComboboxProps,
  48771. getToggleButtonProps: getToggleButtonProps,
  48772. // actions.
  48773. toggleMenu: toggleMenu,
  48774. openMenu: openMenu,
  48775. closeMenu: closeMenu,
  48776. setHighlightedIndex: setHighlightedIndex,
  48777. setInputValue: setInputValue,
  48778. selectItem: selectItem,
  48779. reset: reset,
  48780. // state.
  48781. highlightedIndex: highlightedIndex,
  48782. isOpen: isOpen,
  48783. selectedItem: selectedItem,
  48784. inputValue: inputValue
  48785. };
  48786. }
  48787. var defaultStateValues = {
  48788. activeIndex: -1,
  48789. selectedItems: []
  48790. };
  48791. /**
  48792. * Returns the initial value for a state key in the following order:
  48793. * 1. controlled prop, 2. initial prop, 3. default prop, 4. default
  48794. * value from Downshift.
  48795. *
  48796. * @param {Object} props Props passed to the hook.
  48797. * @param {string} propKey Props key to generate the value for.
  48798. * @returns {any} The initial value for that prop.
  48799. */
  48800. function getInitialValue(props, propKey) {
  48801. return getInitialValue$1(props, propKey, defaultStateValues);
  48802. }
  48803. /**
  48804. * Returns the default value for a state key in the following order:
  48805. * 1. controlled prop, 2. default prop, 3. default value from Downshift.
  48806. *
  48807. * @param {Object} props Props passed to the hook.
  48808. * @param {string} propKey Props key to generate the value for.
  48809. * @returns {any} The initial value for that prop.
  48810. */
  48811. function getDefaultValue(props, propKey) {
  48812. return getDefaultValue$1(props, propKey, defaultStateValues);
  48813. }
  48814. /**
  48815. * Gets the initial state based on the provided props. It uses initial, default
  48816. * and controlled props related to state in order to compute the initial value.
  48817. *
  48818. * @param {Object} props Props passed to the hook.
  48819. * @returns {Object} The initial state.
  48820. */
  48821. function getInitialState(props) {
  48822. var activeIndex = getInitialValue(props, 'activeIndex');
  48823. var selectedItems = getInitialValue(props, 'selectedItems');
  48824. return {
  48825. activeIndex: activeIndex,
  48826. selectedItems: selectedItems
  48827. };
  48828. }
  48829. /**
  48830. * Returns true if dropdown keydown operation is permitted. Should not be
  48831. * allowed on keydown with modifier keys (ctrl, alt, shift, meta), on
  48832. * input element with text content that is either highlighted or selection
  48833. * cursor is not at the starting position.
  48834. *
  48835. * @param {KeyboardEvent} event The event from keydown.
  48836. * @returns {boolean} Whether the operation is allowed.
  48837. */
  48838. function isKeyDownOperationPermitted(event) {
  48839. if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {
  48840. return false;
  48841. }
  48842. var element = event.target;
  48843. if (element instanceof HTMLInputElement && // if element is a text input
  48844. element.value !== '' && (element.selectionStart !== 0 || element.selectionEnd !== 0)) {
  48845. return false;
  48846. }
  48847. return true;
  48848. }
  48849. /**
  48850. * Returns a message to be added to aria-live region when item is removed.
  48851. *
  48852. * @param {Object} selectionParameters Parameters required to build the message.
  48853. * @returns {string} The a11y message.
  48854. */
  48855. function getA11yRemovalMessage(selectionParameters) {
  48856. var removedSelectedItem = selectionParameters.removedSelectedItem,
  48857. itemToStringLocal = selectionParameters.itemToString;
  48858. return itemToStringLocal(removedSelectedItem) + " has been removed.";
  48859. }
  48860. var propTypes = {
  48861. selectedItems: (prop_types_default()).array,
  48862. initialSelectedItems: (prop_types_default()).array,
  48863. defaultSelectedItems: (prop_types_default()).array,
  48864. itemToString: (prop_types_default()).func,
  48865. getA11yRemovalMessage: (prop_types_default()).func,
  48866. stateReducer: (prop_types_default()).func,
  48867. activeIndex: (prop_types_default()).number,
  48868. initialActiveIndex: (prop_types_default()).number,
  48869. defaultActiveIndex: (prop_types_default()).number,
  48870. onActiveIndexChange: (prop_types_default()).func,
  48871. onSelectedItemsChange: (prop_types_default()).func,
  48872. keyNavigationNext: (prop_types_default()).string,
  48873. keyNavigationPrevious: (prop_types_default()).string,
  48874. environment: prop_types_default().shape({
  48875. addEventListener: (prop_types_default()).func,
  48876. removeEventListener: (prop_types_default()).func,
  48877. document: prop_types_default().shape({
  48878. getElementById: (prop_types_default()).func,
  48879. activeElement: (prop_types_default()).any,
  48880. body: (prop_types_default()).any
  48881. })
  48882. })
  48883. };
  48884. var defaultProps = {
  48885. itemToString: defaultProps$3.itemToString,
  48886. stateReducer: defaultProps$3.stateReducer,
  48887. environment: defaultProps$3.environment,
  48888. getA11yRemovalMessage: getA11yRemovalMessage,
  48889. keyNavigationNext: 'ArrowRight',
  48890. keyNavigationPrevious: 'ArrowLeft'
  48891. }; // eslint-disable-next-line import/no-mutable-exports
  48892. var validatePropTypes = downshift_esm_noop;
  48893. /* istanbul ignore next */
  48894. if (false) {}
  48895. var SelectedItemClick = false ? 0 : 0;
  48896. var SelectedItemKeyDownDelete = false ? 0 : 1;
  48897. var SelectedItemKeyDownBackspace = false ? 0 : 2;
  48898. var SelectedItemKeyDownNavigationNext = false ? 0 : 3;
  48899. var SelectedItemKeyDownNavigationPrevious = false ? 0 : 4;
  48900. var DropdownKeyDownNavigationPrevious = false ? 0 : 5;
  48901. var DropdownKeyDownBackspace = false ? 0 : 6;
  48902. var DropdownClick = false ? 0 : 7;
  48903. var FunctionAddSelectedItem = false ? 0 : 8;
  48904. var FunctionRemoveSelectedItem = false ? 0 : 9;
  48905. var FunctionSetSelectedItems = false ? 0 : 10;
  48906. var FunctionSetActiveIndex = false ? 0 : 11;
  48907. var FunctionReset = false ? 0 : 12;
  48908. var stateChangeTypes = /*#__PURE__*/Object.freeze({
  48909. __proto__: null,
  48910. SelectedItemClick: SelectedItemClick,
  48911. SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
  48912. SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
  48913. SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
  48914. SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious,
  48915. DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
  48916. DropdownKeyDownBackspace: DropdownKeyDownBackspace,
  48917. DropdownClick: DropdownClick,
  48918. FunctionAddSelectedItem: FunctionAddSelectedItem,
  48919. FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,
  48920. FunctionSetSelectedItems: FunctionSetSelectedItems,
  48921. FunctionSetActiveIndex: FunctionSetActiveIndex,
  48922. FunctionReset: FunctionReset
  48923. });
  48924. /* eslint-disable complexity */
  48925. function downshiftMultipleSelectionReducer(state, action) {
  48926. var type = action.type,
  48927. index = action.index,
  48928. props = action.props,
  48929. selectedItem = action.selectedItem;
  48930. var activeIndex = state.activeIndex,
  48931. selectedItems = state.selectedItems;
  48932. var changes;
  48933. switch (type) {
  48934. case SelectedItemClick:
  48935. changes = {
  48936. activeIndex: index
  48937. };
  48938. break;
  48939. case SelectedItemKeyDownNavigationPrevious:
  48940. changes = {
  48941. activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1
  48942. };
  48943. break;
  48944. case SelectedItemKeyDownNavigationNext:
  48945. changes = {
  48946. activeIndex: activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1
  48947. };
  48948. break;
  48949. case SelectedItemKeyDownBackspace:
  48950. case SelectedItemKeyDownDelete:
  48951. {
  48952. var newActiveIndex = activeIndex;
  48953. if (selectedItems.length === 1) {
  48954. newActiveIndex = -1;
  48955. } else if (activeIndex === selectedItems.length - 1) {
  48956. newActiveIndex = selectedItems.length - 2;
  48957. }
  48958. changes = extends_extends({
  48959. selectedItems: [].concat(selectedItems.slice(0, activeIndex), selectedItems.slice(activeIndex + 1))
  48960. }, {
  48961. activeIndex: newActiveIndex
  48962. });
  48963. break;
  48964. }
  48965. case DropdownKeyDownNavigationPrevious:
  48966. changes = {
  48967. activeIndex: selectedItems.length - 1
  48968. };
  48969. break;
  48970. case DropdownKeyDownBackspace:
  48971. changes = {
  48972. selectedItems: selectedItems.slice(0, selectedItems.length - 1)
  48973. };
  48974. break;
  48975. case FunctionAddSelectedItem:
  48976. changes = {
  48977. selectedItems: [].concat(selectedItems, [selectedItem])
  48978. };
  48979. break;
  48980. case DropdownClick:
  48981. changes = {
  48982. activeIndex: -1
  48983. };
  48984. break;
  48985. case FunctionRemoveSelectedItem:
  48986. {
  48987. var _newActiveIndex = activeIndex;
  48988. var selectedItemIndex = selectedItems.indexOf(selectedItem);
  48989. if (selectedItems.length === 1) {
  48990. _newActiveIndex = -1;
  48991. } else if (selectedItemIndex === selectedItems.length - 1) {
  48992. _newActiveIndex = selectedItems.length - 2;
  48993. }
  48994. changes = extends_extends({
  48995. selectedItems: [].concat(selectedItems.slice(0, selectedItemIndex), selectedItems.slice(selectedItemIndex + 1))
  48996. }, {
  48997. activeIndex: _newActiveIndex
  48998. });
  48999. break;
  49000. }
  49001. case FunctionSetSelectedItems:
  49002. {
  49003. var newSelectedItems = action.selectedItems;
  49004. changes = {
  49005. selectedItems: newSelectedItems
  49006. };
  49007. break;
  49008. }
  49009. case FunctionSetActiveIndex:
  49010. {
  49011. var _newActiveIndex2 = action.activeIndex;
  49012. changes = {
  49013. activeIndex: _newActiveIndex2
  49014. };
  49015. break;
  49016. }
  49017. case FunctionReset:
  49018. changes = {
  49019. activeIndex: getDefaultValue(props, 'activeIndex'),
  49020. selectedItems: getDefaultValue(props, 'selectedItems')
  49021. };
  49022. break;
  49023. default:
  49024. throw new Error('Reducer called without proper action type.');
  49025. }
  49026. return extends_extends({}, state, changes);
  49027. }
  49028. var downshift_esm_excluded = ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"],
  49029. _excluded2 = ["refKey", "ref", "onKeyDown", "onClick", "preventKeyAction"];
  49030. useMultipleSelection.stateChangeTypes = stateChangeTypes;
  49031. function useMultipleSelection(userProps) {
  49032. if (userProps === void 0) {
  49033. userProps = {};
  49034. }
  49035. validatePropTypes(userProps, useMultipleSelection); // Props defaults and destructuring.
  49036. var props = extends_extends({}, defaultProps, userProps);
  49037. var getA11yRemovalMessage = props.getA11yRemovalMessage,
  49038. itemToString = props.itemToString,
  49039. environment = props.environment,
  49040. keyNavigationNext = props.keyNavigationNext,
  49041. keyNavigationPrevious = props.keyNavigationPrevious; // Reducer init.
  49042. var _useControlledReducer = useControlledReducer$1(downshiftMultipleSelectionReducer, getInitialState(props), props),
  49043. state = _useControlledReducer[0],
  49044. dispatch = _useControlledReducer[1];
  49045. var activeIndex = state.activeIndex,
  49046. selectedItems = state.selectedItems; // Refs.
  49047. var isInitialMountRef = (0,external_React_.useRef)(true);
  49048. var dropdownRef = (0,external_React_.useRef)(null);
  49049. var previousSelectedItemsRef = (0,external_React_.useRef)(selectedItems);
  49050. var selectedItemRefs = (0,external_React_.useRef)();
  49051. selectedItemRefs.current = [];
  49052. var latest = useLatestRef({
  49053. state: state,
  49054. props: props
  49055. }); // Effects.
  49056. /* Sets a11y status message on changes in selectedItem. */
  49057. (0,external_React_.useEffect)(function () {
  49058. if (isInitialMountRef.current) {
  49059. return;
  49060. }
  49061. if (selectedItems.length < previousSelectedItemsRef.current.length) {
  49062. var removedSelectedItem = previousSelectedItemsRef.current.find(function (item) {
  49063. return selectedItems.indexOf(item) < 0;
  49064. });
  49065. setStatus(getA11yRemovalMessage({
  49066. itemToString: itemToString,
  49067. resultCount: selectedItems.length,
  49068. removedSelectedItem: removedSelectedItem,
  49069. activeIndex: activeIndex,
  49070. activeSelectedItem: selectedItems[activeIndex]
  49071. }), environment.document);
  49072. }
  49073. previousSelectedItemsRef.current = selectedItems; // eslint-disable-next-line react-hooks/exhaustive-deps
  49074. }, [selectedItems.length]); // Sets focus on active item.
  49075. (0,external_React_.useEffect)(function () {
  49076. if (isInitialMountRef.current) {
  49077. return;
  49078. }
  49079. if (activeIndex === -1 && dropdownRef.current) {
  49080. dropdownRef.current.focus();
  49081. } else if (selectedItemRefs.current[activeIndex]) {
  49082. selectedItemRefs.current[activeIndex].focus();
  49083. }
  49084. }, [activeIndex]);
  49085. useControlPropsValidator({
  49086. isInitialMount: isInitialMountRef.current,
  49087. props: props,
  49088. state: state
  49089. });
  49090. var setGetterPropCallInfo = useGetterPropsCalledChecker('getDropdownProps'); // Make initial ref false.
  49091. (0,external_React_.useEffect)(function () {
  49092. isInitialMountRef.current = false;
  49093. }, []); // Event handler functions.
  49094. var selectedItemKeyDownHandlers = (0,external_React_.useMemo)(function () {
  49095. var _ref;
  49096. return _ref = {}, _ref[keyNavigationPrevious] = function () {
  49097. dispatch({
  49098. type: SelectedItemKeyDownNavigationPrevious
  49099. });
  49100. }, _ref[keyNavigationNext] = function () {
  49101. dispatch({
  49102. type: SelectedItemKeyDownNavigationNext
  49103. });
  49104. }, _ref.Delete = function Delete() {
  49105. dispatch({
  49106. type: SelectedItemKeyDownDelete
  49107. });
  49108. }, _ref.Backspace = function Backspace() {
  49109. dispatch({
  49110. type: SelectedItemKeyDownBackspace
  49111. });
  49112. }, _ref;
  49113. }, [dispatch, keyNavigationNext, keyNavigationPrevious]);
  49114. var dropdownKeyDownHandlers = (0,external_React_.useMemo)(function () {
  49115. var _ref2;
  49116. return _ref2 = {}, _ref2[keyNavigationPrevious] = function (event) {
  49117. if (isKeyDownOperationPermitted(event)) {
  49118. dispatch({
  49119. type: DropdownKeyDownNavigationPrevious
  49120. });
  49121. }
  49122. }, _ref2.Backspace = function Backspace(event) {
  49123. if (isKeyDownOperationPermitted(event)) {
  49124. dispatch({
  49125. type: DropdownKeyDownBackspace
  49126. });
  49127. }
  49128. }, _ref2;
  49129. }, [dispatch, keyNavigationPrevious]); // Getter props.
  49130. var getSelectedItemProps = (0,external_React_.useCallback)(function (_temp) {
  49131. var _extends2;
  49132. var _ref3 = _temp === void 0 ? {} : _temp,
  49133. _ref3$refKey = _ref3.refKey,
  49134. refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
  49135. ref = _ref3.ref,
  49136. onClick = _ref3.onClick,
  49137. onKeyDown = _ref3.onKeyDown,
  49138. selectedItem = _ref3.selectedItem,
  49139. index = _ref3.index,
  49140. rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref3, downshift_esm_excluded);
  49141. var latestState = latest.current.state;
  49142. var itemIndex = getItemIndex(index, selectedItem, latestState.selectedItems);
  49143. if (itemIndex < 0) {
  49144. throw new Error('Pass either selectedItem or index in getSelectedItemProps!');
  49145. }
  49146. var selectedItemHandleClick = function selectedItemHandleClick() {
  49147. dispatch({
  49148. type: SelectedItemClick,
  49149. index: index
  49150. });
  49151. };
  49152. var selectedItemHandleKeyDown = function selectedItemHandleKeyDown(event) {
  49153. var key = normalizeArrowKey(event);
  49154. if (key && selectedItemKeyDownHandlers[key]) {
  49155. selectedItemKeyDownHandlers[key](event);
  49156. }
  49157. };
  49158. return extends_extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (selectedItemNode) {
  49159. if (selectedItemNode) {
  49160. selectedItemRefs.current.push(selectedItemNode);
  49161. }
  49162. }), _extends2.tabIndex = index === latestState.activeIndex ? 0 : -1, _extends2.onClick = callAllEventHandlers(onClick, selectedItemHandleClick), _extends2.onKeyDown = callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown), _extends2), rest);
  49163. }, [dispatch, latest, selectedItemKeyDownHandlers]);
  49164. var getDropdownProps = (0,external_React_.useCallback)(function (_temp2, _temp3) {
  49165. var _extends3;
  49166. var _ref4 = _temp2 === void 0 ? {} : _temp2,
  49167. _ref4$refKey = _ref4.refKey,
  49168. refKey = _ref4$refKey === void 0 ? 'ref' : _ref4$refKey,
  49169. ref = _ref4.ref,
  49170. onKeyDown = _ref4.onKeyDown,
  49171. onClick = _ref4.onClick,
  49172. _ref4$preventKeyActio = _ref4.preventKeyAction,
  49173. preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio,
  49174. rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref4, _excluded2);
  49175. var _ref5 = _temp3 === void 0 ? {} : _temp3,
  49176. _ref5$suppressRefErro = _ref5.suppressRefError,
  49177. suppressRefError = _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro;
  49178. setGetterPropCallInfo('getDropdownProps', suppressRefError, refKey, dropdownRef);
  49179. var dropdownHandleKeyDown = function dropdownHandleKeyDown(event) {
  49180. var key = normalizeArrowKey(event);
  49181. if (key && dropdownKeyDownHandlers[key]) {
  49182. dropdownKeyDownHandlers[key](event);
  49183. }
  49184. };
  49185. var dropdownHandleClick = function dropdownHandleClick() {
  49186. dispatch({
  49187. type: DropdownClick
  49188. });
  49189. };
  49190. return extends_extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (dropdownNode) {
  49191. if (dropdownNode) {
  49192. dropdownRef.current = dropdownNode;
  49193. }
  49194. }), _extends3), !preventKeyAction && {
  49195. onKeyDown: callAllEventHandlers(onKeyDown, dropdownHandleKeyDown),
  49196. onClick: callAllEventHandlers(onClick, dropdownHandleClick)
  49197. }, rest);
  49198. }, [dispatch, dropdownKeyDownHandlers, setGetterPropCallInfo]); // returns
  49199. var addSelectedItem = (0,external_React_.useCallback)(function (selectedItem) {
  49200. dispatch({
  49201. type: FunctionAddSelectedItem,
  49202. selectedItem: selectedItem
  49203. });
  49204. }, [dispatch]);
  49205. var removeSelectedItem = (0,external_React_.useCallback)(function (selectedItem) {
  49206. dispatch({
  49207. type: FunctionRemoveSelectedItem,
  49208. selectedItem: selectedItem
  49209. });
  49210. }, [dispatch]);
  49211. var setSelectedItems = (0,external_React_.useCallback)(function (newSelectedItems) {
  49212. dispatch({
  49213. type: FunctionSetSelectedItems,
  49214. selectedItems: newSelectedItems
  49215. });
  49216. }, [dispatch]);
  49217. var setActiveIndex = (0,external_React_.useCallback)(function (newActiveIndex) {
  49218. dispatch({
  49219. type: FunctionSetActiveIndex,
  49220. activeIndex: newActiveIndex
  49221. });
  49222. }, [dispatch]);
  49223. var reset = (0,external_React_.useCallback)(function () {
  49224. dispatch({
  49225. type: FunctionReset
  49226. });
  49227. }, [dispatch]);
  49228. return {
  49229. getSelectedItemProps: getSelectedItemProps,
  49230. getDropdownProps: getDropdownProps,
  49231. addSelectedItem: addSelectedItem,
  49232. removeSelectedItem: removeSelectedItem,
  49233. setSelectedItems: setSelectedItems,
  49234. setActiveIndex: setActiveIndex,
  49235. reset: reset,
  49236. selectedItems: selectedItems,
  49237. activeIndex: activeIndex
  49238. };
  49239. }
  49240. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-select-control/index.js
  49241. /**
  49242. * External dependencies
  49243. */
  49244. /**
  49245. * WordPress dependencies
  49246. */
  49247. /**
  49248. * Internal dependencies
  49249. */
  49250. const custom_select_control_itemToString = item => item === null || item === void 0 ? void 0 : item.name; // This is needed so that in Windows, where
  49251. // the menu does not necessarily open on
  49252. // key up/down, you can still switch between
  49253. // options with the menu closed.
  49254. const custom_select_control_stateReducer = (_ref, _ref2) => {
  49255. let {
  49256. selectedItem
  49257. } = _ref;
  49258. let {
  49259. type,
  49260. changes,
  49261. props: {
  49262. items
  49263. }
  49264. } = _ref2;
  49265. switch (type) {
  49266. case useSelect.stateChangeTypes.ToggleButtonKeyDownArrowDown:
  49267. // If we already have a selected item, try to select the next one,
  49268. // without circular navigation. Otherwise, select the first item.
  49269. return {
  49270. selectedItem: items[selectedItem ? Math.min(items.indexOf(selectedItem) + 1, items.length - 1) : 0]
  49271. };
  49272. case useSelect.stateChangeTypes.ToggleButtonKeyDownArrowUp:
  49273. // If we already have a selected item, try to select the previous one,
  49274. // without circular navigation. Otherwise, select the last item.
  49275. return {
  49276. selectedItem: items[selectedItem ? Math.max(items.indexOf(selectedItem) - 1, 0) : items.length - 1]
  49277. };
  49278. default:
  49279. return changes;
  49280. }
  49281. };
  49282. function CustomSelectControl(_ref3) {
  49283. var _menuProps$ariaActiv;
  49284. let {
  49285. /** Start opting into the larger default height that will become the default size in a future version. */
  49286. __next36pxDefaultSize = false,
  49287. className,
  49288. hideLabelFromVision,
  49289. label,
  49290. describedBy,
  49291. options: items,
  49292. onChange: onSelectedItemChange,
  49293. value: _selectedItem
  49294. } = _ref3;
  49295. const {
  49296. getLabelProps,
  49297. getToggleButtonProps,
  49298. getMenuProps,
  49299. getItemProps,
  49300. isOpen,
  49301. highlightedIndex,
  49302. selectedItem
  49303. } = useSelect({
  49304. initialSelectedItem: items[0],
  49305. items,
  49306. itemToString: custom_select_control_itemToString,
  49307. onSelectedItemChange,
  49308. ...(typeof _selectedItem !== 'undefined' && _selectedItem !== null ? {
  49309. selectedItem: _selectedItem
  49310. } : undefined),
  49311. stateReducer: custom_select_control_stateReducer
  49312. });
  49313. function getDescribedBy() {
  49314. if (describedBy) {
  49315. return describedBy;
  49316. }
  49317. if (!selectedItem) {
  49318. return (0,external_wp_i18n_namespaceObject.__)('No selection');
  49319. } // translators: %s: The selected option.
  49320. return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Currently selected: %s'), selectedItem.name);
  49321. }
  49322. const menuProps = getMenuProps({
  49323. className: 'components-custom-select-control__menu',
  49324. 'aria-hidden': !isOpen
  49325. });
  49326. const onKeyDownHandler = (0,external_wp_element_namespaceObject.useCallback)(e => {
  49327. var _menuProps$onKeyDown;
  49328. e.stopPropagation();
  49329. menuProps === null || menuProps === void 0 ? void 0 : (_menuProps$onKeyDown = menuProps.onKeyDown) === null || _menuProps$onKeyDown === void 0 ? void 0 : _menuProps$onKeyDown.call(menuProps, e);
  49330. }, [menuProps]); // We need this here, because the null active descendant is not fully ARIA compliant.
  49331. if ((_menuProps$ariaActiv = menuProps['aria-activedescendant']) !== null && _menuProps$ariaActiv !== void 0 && _menuProps$ariaActiv.startsWith('downshift-null')) {
  49332. delete menuProps['aria-activedescendant'];
  49333. }
  49334. return (0,external_wp_element_namespaceObject.createElement)("div", {
  49335. className: classnames_default()('components-custom-select-control', className)
  49336. }, hideLabelFromVision ? (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, extends_extends({
  49337. as: "label"
  49338. }, getLabelProps()), label) :
  49339. /* eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for */
  49340. (0,external_wp_element_namespaceObject.createElement)("label", getLabelProps({
  49341. className: 'components-custom-select-control__label'
  49342. }), label), (0,external_wp_element_namespaceObject.createElement)(build_module_button, getToggleButtonProps({
  49343. // This is needed because some speech recognition software don't support `aria-labelledby`.
  49344. 'aria-label': label,
  49345. 'aria-labelledby': undefined,
  49346. className: classnames_default()('components-custom-select-control__button', {
  49347. 'is-next-36px-default-size': __next36pxDefaultSize
  49348. }),
  49349. isSmall: !__next36pxDefaultSize,
  49350. describedBy: getDescribedBy()
  49351. }), custom_select_control_itemToString(selectedItem), (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  49352. icon: chevron_down,
  49353. className: classnames_default()('components-custom-select-control__button-icon', {
  49354. 'is-next-36px-default-size': __next36pxDefaultSize
  49355. }),
  49356. size: 18
  49357. })), (0,external_wp_element_namespaceObject.createElement)("ul", extends_extends({}, menuProps, {
  49358. onKeyDown: onKeyDownHandler
  49359. }), isOpen && items.map((item, index) => // eslint-disable-next-line react/jsx-key
  49360. (0,external_wp_element_namespaceObject.createElement)("li", getItemProps({
  49361. item,
  49362. index,
  49363. key: item.key,
  49364. className: classnames_default()(item.className, 'components-custom-select-control__item', {
  49365. 'is-highlighted': index === highlightedIndex,
  49366. 'has-hint': !!item.__experimentalHint,
  49367. 'is-next-36px-default-size': __next36pxDefaultSize
  49368. }),
  49369. style: item.style
  49370. }), item.name, item.__experimentalHint && (0,external_wp_element_namespaceObject.createElement)("span", {
  49371. className: "components-custom-select-control__item-hint"
  49372. }, item.__experimentalHint), item === selectedItem && (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  49373. icon: library_check,
  49374. className: "components-custom-select-control__item-icon"
  49375. })))));
  49376. }
  49377. // EXTERNAL MODULE: ./node_modules/react-dates/initialize.js
  49378. var initialize = __webpack_require__(4185);
  49379. // EXTERNAL MODULE: external "moment"
  49380. var external_moment_ = __webpack_require__(6292);
  49381. var external_moment_default = /*#__PURE__*/__webpack_require__.n(external_moment_);
  49382. // EXTERNAL MODULE: ./node_modules/react-dates/lib/components/DayPickerSingleDateController.js
  49383. var DayPickerSingleDateController = __webpack_require__(6302);
  49384. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/utils.js
  49385. /**
  49386. * External dependencies
  49387. */
  49388. /**
  49389. * Create a Moment object from a date string. With no date supplied, default to a Moment
  49390. * object representing now. If a null value is passed, return a null value.
  49391. *
  49392. * @param {?string} date Date representing the currently selected date or null to signify no selection.
  49393. * @return {?moment.Moment} Moment object for selected date or null.
  49394. */
  49395. const getMomentDate = date => {
  49396. if (null === date) {
  49397. return null;
  49398. }
  49399. return date ? external_moment_default()(date) : external_moment_default()();
  49400. };
  49401. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/date.js
  49402. /**
  49403. * External dependencies
  49404. */
  49405. // react-dates doesn't tree-shake correctly, so we import from the individual
  49406. // component here, to avoid including too much of the library
  49407. /**
  49408. * WordPress dependencies
  49409. */
  49410. /**
  49411. * Internal dependencies
  49412. */
  49413. /**
  49414. * Module Constants
  49415. */
  49416. const TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss';
  49417. const ARIAL_LABEL_TIME_FORMAT = 'dddd, LL';
  49418. function DatePickerDay(_ref) {
  49419. let {
  49420. day,
  49421. events = []
  49422. } = _ref;
  49423. const ref = (0,external_wp_element_namespaceObject.useRef)();
  49424. /*
  49425. * a11y hack to make the `There is/are n events` string
  49426. * available speaking for readers,
  49427. * re-defining the aria-label attribute.
  49428. * This attribute is handled by the react-dates component.
  49429. */
  49430. (0,external_wp_element_namespaceObject.useEffect)(() => {
  49431. var _ref$current;
  49432. // Bail when no parent node.
  49433. if (!(ref !== null && ref !== void 0 && (_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.parentNode)) {
  49434. return;
  49435. }
  49436. const {
  49437. parentNode
  49438. } = ref.current;
  49439. const dayAriaLabel = external_moment_default()(day).format(ARIAL_LABEL_TIME_FORMAT);
  49440. if (!events.length) {
  49441. // Set aria-label without event description.
  49442. parentNode.setAttribute('aria-label', dayAriaLabel);
  49443. return;
  49444. }
  49445. const dayWithEventsDescription = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Calendar day format, 2: Calendar event number.
  49446. (0,external_wp_i18n_namespaceObject._n)('%1$s. There is %2$d event.', '%1$s. There are %2$d events.', events.length), dayAriaLabel, events.length);
  49447. parentNode.setAttribute('aria-label', dayWithEventsDescription);
  49448. }, [events.length]);
  49449. return (0,external_wp_element_namespaceObject.createElement)("div", {
  49450. ref: ref,
  49451. className: classnames_default()('components-datetime__date__day', {
  49452. 'has-events': events === null || events === void 0 ? void 0 : events.length
  49453. })
  49454. }, day.format('D'));
  49455. }
  49456. function DatePicker(_ref2) {
  49457. let {
  49458. currentDate,
  49459. onChange,
  49460. events,
  49461. isInvalidDate,
  49462. onMonthPreviewed
  49463. } = _ref2;
  49464. const nodeRef = (0,external_wp_element_namespaceObject.useRef)();
  49465. const onMonthPreviewedHandler = newMonthDate => {
  49466. onMonthPreviewed === null || onMonthPreviewed === void 0 ? void 0 : onMonthPreviewed(newMonthDate.toISOString());
  49467. keepFocusInside();
  49468. };
  49469. /*
  49470. * Todo: We should remove this function ASAP.
  49471. * It is kept because focus is lost when we click on the previous and next month buttons.
  49472. * This focus loss closes the date picker popover.
  49473. * Ideally we should add an upstream commit on react-dates to fix this issue.
  49474. */
  49475. const keepFocusInside = () => {
  49476. if (!nodeRef.current) {
  49477. return;
  49478. }
  49479. const {
  49480. ownerDocument
  49481. } = nodeRef.current;
  49482. const {
  49483. activeElement
  49484. } = ownerDocument; // If focus was lost.
  49485. if (!activeElement || !nodeRef.current.contains(ownerDocument.activeElement)) {
  49486. // Retrieve the focus region div.
  49487. const focusRegion = nodeRef.current.querySelector('.DayPicker_focusRegion');
  49488. if (!focusRegion) {
  49489. return;
  49490. } // Keep the focus on focus region.
  49491. focusRegion.focus();
  49492. }
  49493. };
  49494. const onChangeMoment = newDate => {
  49495. // If currentDate is null, use now as momentTime to designate hours, minutes, seconds.
  49496. const momentDate = currentDate ? external_moment_default()(currentDate) : external_moment_default()();
  49497. const momentTime = {
  49498. hours: momentDate.hours(),
  49499. minutes: momentDate.minutes(),
  49500. seconds: 0
  49501. };
  49502. onChange(newDate.set(momentTime).format(TIMEZONELESS_FORMAT)); // Keep focus on the date picker.
  49503. keepFocusInside();
  49504. };
  49505. const getEventsPerDay = day => {
  49506. if (!(events !== null && events !== void 0 && events.length)) {
  49507. return [];
  49508. }
  49509. return events.filter(eventDay => day.isSame(eventDay.date, 'day'));
  49510. };
  49511. const momentDate = getMomentDate(currentDate);
  49512. return (0,external_wp_element_namespaceObject.createElement)("div", {
  49513. className: "components-datetime__date",
  49514. ref: nodeRef
  49515. }, (0,external_wp_element_namespaceObject.createElement)(DayPickerSingleDateController/* default */.Z, {
  49516. date: momentDate,
  49517. daySize: 30,
  49518. focused: true,
  49519. hideKeyboardShortcutsPanel: true // This is a hack to force the calendar to update on month or year change
  49520. // https://github.com/airbnb/react-dates/issues/240#issuecomment-361776665
  49521. ,
  49522. key: `datepicker-controller-${momentDate ? momentDate.format('MM-YYYY') : 'null'}`,
  49523. noBorder: true,
  49524. numberOfMonths: 1,
  49525. onDateChange: onChangeMoment,
  49526. transitionDuration: 0,
  49527. weekDayFormat: "ddd",
  49528. dayAriaLabelFormat: ARIAL_LABEL_TIME_FORMAT,
  49529. isRTL: (0,external_wp_i18n_namespaceObject.isRTL)(),
  49530. isOutsideRange: date => {
  49531. return isInvalidDate && isInvalidDate(date.toDate());
  49532. },
  49533. onPrevMonthClick: onMonthPreviewedHandler,
  49534. onNextMonthClick: onMonthPreviewedHandler,
  49535. renderDayContents: day => (0,external_wp_element_namespaceObject.createElement)(DatePickerDay, {
  49536. day: day,
  49537. events: getEventsPerDay(day)
  49538. })
  49539. }));
  49540. }
  49541. /* harmony default export */ var date = (DatePicker);
  49542. ;// CONCATENATED MODULE: external ["wp","date"]
  49543. var external_wp_date_namespaceObject = window["wp"]["date"];
  49544. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/timezone.js
  49545. /**
  49546. * WordPress dependencies
  49547. */
  49548. /**
  49549. * Internal dependencies
  49550. */
  49551. /**
  49552. * Displays timezone information when user timezone is different from site timezone.
  49553. */
  49554. const TimeZone = () => {
  49555. const {
  49556. timezone
  49557. } = (0,external_wp_date_namespaceObject.__experimentalGetSettings)(); // Convert timezone offset to hours.
  49558. const userTimezoneOffset = -1 * (new Date().getTimezoneOffset() / 60); // System timezone and user timezone match, nothing needed.
  49559. // Compare as numbers because it comes over as string.
  49560. if (Number(timezone.offset) === userTimezoneOffset) {
  49561. return null;
  49562. }
  49563. const offsetSymbol = timezone.offset >= 0 ? '+' : '';
  49564. const zoneAbbr = '' !== timezone.abbr && isNaN(timezone.abbr) ? timezone.abbr : `UTC${offsetSymbol}${timezone.offset}`;
  49565. const timezoneDetail = 'UTC' === timezone.string ? (0,external_wp_i18n_namespaceObject.__)('Coordinated Universal Time') : `(${zoneAbbr}) ${timezone.string.replace('_', ' ')}`;
  49566. return (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  49567. position: "top center",
  49568. text: timezoneDetail
  49569. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  49570. className: "components-datetime__timezone"
  49571. }, zoneAbbr));
  49572. };
  49573. /* harmony default export */ var timezone = (TimeZone);
  49574. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/time.js
  49575. /**
  49576. * External dependencies
  49577. */
  49578. /**
  49579. * WordPress dependencies
  49580. */
  49581. /**
  49582. * Internal dependencies
  49583. */
  49584. /**
  49585. * Module Constants
  49586. */
  49587. const time_TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss';
  49588. function from12hTo24h(hours, isPm) {
  49589. return isPm ? (hours % 12 + 12) % 24 : hours % 12;
  49590. }
  49591. /**
  49592. * <UpdateOnBlurAsIntegerField>
  49593. * A shared component to parse, validate, and handle remounting of the underlying form field element like <input> and <select>.
  49594. *
  49595. * @param {Object} props Component props.
  49596. * @param {string} props.as Render the component as specific element tag, defaults to "input".
  49597. * @param {number|string} props.value The default value of the component which will be parsed to integer.
  49598. * @param {Function} props.onUpdate Call back when blurred and validated.
  49599. * @param {string} [props.className]
  49600. */
  49601. function UpdateOnBlurAsIntegerField(_ref) {
  49602. let {
  49603. as,
  49604. value,
  49605. onUpdate,
  49606. className,
  49607. ...props
  49608. } = _ref;
  49609. function handleBlur(event) {
  49610. const {
  49611. target
  49612. } = event;
  49613. if (value === target.value) {
  49614. return;
  49615. }
  49616. const parsedValue = parseInt(target.value, 10); // Run basic number validation on the input.
  49617. if (!(0,external_lodash_namespaceObject.isInteger)(parsedValue) || typeof props.max !== 'undefined' && parsedValue > props.max || typeof props.min !== 'undefined' && parsedValue < props.min) {
  49618. // If validation failed, reset the value to the previous valid value.
  49619. target.value = value;
  49620. } else {
  49621. // Otherwise, it's valid, call onUpdate.
  49622. onUpdate(target.name, parsedValue);
  49623. }
  49624. }
  49625. return (0,external_wp_element_namespaceObject.createElement)(as || 'input', {
  49626. // Re-mount the input value to accept the latest value as the defaultValue.
  49627. key: value,
  49628. defaultValue: value,
  49629. onBlur: handleBlur,
  49630. className: classnames_default()('components-datetime__time-field-integer-field', className),
  49631. ...props
  49632. });
  49633. }
  49634. /**
  49635. * <TimePicker>
  49636. *
  49637. * @typedef {Date|string|number} WPValidDateTimeFormat
  49638. *
  49639. * @param {Object} props Component props.
  49640. * @param {boolean} props.is12Hour Should the time picker showed in 12 hour format or 24 hour format.
  49641. * @param {WPValidDateTimeFormat} props.currentTime The initial current time the time picker should render.
  49642. * @param {Function} props.onChange Callback function when the date changed.
  49643. */
  49644. function TimePicker(_ref2) {
  49645. let {
  49646. is12Hour,
  49647. currentTime,
  49648. onChange
  49649. } = _ref2;
  49650. const [date, setDate] = (0,external_wp_element_namespaceObject.useState)(() => // Truncate the date at the minutes, see: #15495.
  49651. external_moment_default()(currentTime).startOf('minutes')); // Reset the state when currentTime changed.
  49652. (0,external_wp_element_namespaceObject.useEffect)(() => {
  49653. setDate(currentTime ? external_moment_default()(currentTime).startOf('minutes') : external_moment_default()());
  49654. }, [currentTime]);
  49655. const {
  49656. day,
  49657. month,
  49658. year,
  49659. minutes,
  49660. hours,
  49661. am
  49662. } = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  49663. day: date.format('DD'),
  49664. month: date.format('MM'),
  49665. year: date.format('YYYY'),
  49666. minutes: date.format('mm'),
  49667. hours: date.format(is12Hour ? 'hh' : 'HH'),
  49668. am: date.format('H') <= 11 ? 'AM' : 'PM'
  49669. }), [date, is12Hour]);
  49670. /**
  49671. * Function that sets the date state and calls the onChange with a new date.
  49672. * The date is truncated at the minutes.
  49673. *
  49674. * @param {Object} newDate The date object.
  49675. */
  49676. function changeDate(newDate) {
  49677. setDate(newDate);
  49678. onChange(newDate.format(time_TIMEZONELESS_FORMAT));
  49679. }
  49680. function update(name, value) {
  49681. // If the 12-hour format is being used and the 'PM' period is selected, then
  49682. // the incoming value (which ranges 1-12) should be increased by 12 to match
  49683. // the expected 24-hour format.
  49684. let adjustedValue = value;
  49685. if (name === 'hours' && is12Hour) {
  49686. adjustedValue = from12hTo24h(value, am === 'PM');
  49687. } // Clone the date and call the specific setter function according to `name`.
  49688. const newDate = date.clone()[name](adjustedValue);
  49689. changeDate(newDate);
  49690. }
  49691. function updateAmPm(value) {
  49692. return () => {
  49693. if (am === value) {
  49694. return;
  49695. }
  49696. const parsedHours = parseInt(hours, 10);
  49697. const newDate = date.clone().hours(from12hTo24h(parsedHours, value === 'PM'));
  49698. changeDate(newDate);
  49699. };
  49700. }
  49701. const dayFormat = (0,external_wp_element_namespaceObject.createElement)("div", {
  49702. className: "components-datetime__time-field components-datetime__time-field-day"
  49703. }, (0,external_wp_element_namespaceObject.createElement)(UpdateOnBlurAsIntegerField, {
  49704. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Day'),
  49705. className: "components-datetime__time-field-day-input",
  49706. type: "number" // The correct function to call in moment.js is "date" not "day".
  49707. ,
  49708. name: "date",
  49709. value: day,
  49710. step: 1,
  49711. min: 1,
  49712. max: 31,
  49713. onUpdate: update
  49714. }));
  49715. const monthFormat = (0,external_wp_element_namespaceObject.createElement)("div", {
  49716. className: "components-datetime__time-field components-datetime__time-field-month"
  49717. }, (0,external_wp_element_namespaceObject.createElement)(UpdateOnBlurAsIntegerField, {
  49718. as: "select",
  49719. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Month'),
  49720. className: "components-datetime__time-field-month-select",
  49721. name: "month",
  49722. value: month // The value starts from 0, so we have to -1 when setting month.
  49723. ,
  49724. onUpdate: (key, value) => update(key, value - 1)
  49725. }, (0,external_wp_element_namespaceObject.createElement)("option", {
  49726. value: "01"
  49727. }, (0,external_wp_i18n_namespaceObject.__)('January')), (0,external_wp_element_namespaceObject.createElement)("option", {
  49728. value: "02"
  49729. }, (0,external_wp_i18n_namespaceObject.__)('February')), (0,external_wp_element_namespaceObject.createElement)("option", {
  49730. value: "03"
  49731. }, (0,external_wp_i18n_namespaceObject.__)('March')), (0,external_wp_element_namespaceObject.createElement)("option", {
  49732. value: "04"
  49733. }, (0,external_wp_i18n_namespaceObject.__)('April')), (0,external_wp_element_namespaceObject.createElement)("option", {
  49734. value: "05"
  49735. }, (0,external_wp_i18n_namespaceObject.__)('May')), (0,external_wp_element_namespaceObject.createElement)("option", {
  49736. value: "06"
  49737. }, (0,external_wp_i18n_namespaceObject.__)('June')), (0,external_wp_element_namespaceObject.createElement)("option", {
  49738. value: "07"
  49739. }, (0,external_wp_i18n_namespaceObject.__)('July')), (0,external_wp_element_namespaceObject.createElement)("option", {
  49740. value: "08"
  49741. }, (0,external_wp_i18n_namespaceObject.__)('August')), (0,external_wp_element_namespaceObject.createElement)("option", {
  49742. value: "09"
  49743. }, (0,external_wp_i18n_namespaceObject.__)('September')), (0,external_wp_element_namespaceObject.createElement)("option", {
  49744. value: "10"
  49745. }, (0,external_wp_i18n_namespaceObject.__)('October')), (0,external_wp_element_namespaceObject.createElement)("option", {
  49746. value: "11"
  49747. }, (0,external_wp_i18n_namespaceObject.__)('November')), (0,external_wp_element_namespaceObject.createElement)("option", {
  49748. value: "12"
  49749. }, (0,external_wp_i18n_namespaceObject.__)('December'))));
  49750. const dayMonthFormat = is12Hour ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, monthFormat, dayFormat) : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, dayFormat, monthFormat);
  49751. return (0,external_wp_element_namespaceObject.createElement)("div", {
  49752. className: classnames_default()('components-datetime__time')
  49753. }, (0,external_wp_element_namespaceObject.createElement)("fieldset", null, (0,external_wp_element_namespaceObject.createElement)("legend", {
  49754. className: "components-datetime__time-legend invisible"
  49755. }, (0,external_wp_i18n_namespaceObject.__)('Date')), (0,external_wp_element_namespaceObject.createElement)("div", {
  49756. className: "components-datetime__time-wrapper"
  49757. }, dayMonthFormat, (0,external_wp_element_namespaceObject.createElement)("div", {
  49758. className: "components-datetime__time-field components-datetime__time-field-year"
  49759. }, (0,external_wp_element_namespaceObject.createElement)(UpdateOnBlurAsIntegerField, {
  49760. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Year'),
  49761. className: "components-datetime__time-field-year-input",
  49762. type: "number",
  49763. name: "year",
  49764. step: 1,
  49765. min: 0,
  49766. max: 9999,
  49767. value: year,
  49768. onUpdate: update
  49769. })))), (0,external_wp_element_namespaceObject.createElement)("fieldset", null, (0,external_wp_element_namespaceObject.createElement)("legend", {
  49770. className: "components-datetime__time-legend invisible"
  49771. }, (0,external_wp_i18n_namespaceObject.__)('Time')), (0,external_wp_element_namespaceObject.createElement)("div", {
  49772. className: "components-datetime__time-wrapper"
  49773. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  49774. className: "components-datetime__time-field components-datetime__time-field-time"
  49775. }, (0,external_wp_element_namespaceObject.createElement)(UpdateOnBlurAsIntegerField, {
  49776. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Hours'),
  49777. className: "components-datetime__time-field-hours-input",
  49778. type: "number",
  49779. name: "hours",
  49780. step: 1,
  49781. min: is12Hour ? 1 : 0,
  49782. max: is12Hour ? 12 : 23,
  49783. value: hours,
  49784. onUpdate: update
  49785. }), (0,external_wp_element_namespaceObject.createElement)("span", {
  49786. className: "components-datetime__time-separator",
  49787. "aria-hidden": "true"
  49788. }, ":"), (0,external_wp_element_namespaceObject.createElement)(UpdateOnBlurAsIntegerField, {
  49789. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Minutes'),
  49790. className: "components-datetime__time-field-minutes-input",
  49791. type: "number",
  49792. name: "minutes",
  49793. step: 1,
  49794. min: 0,
  49795. max: 59,
  49796. value: minutes,
  49797. onUpdate: update
  49798. })), is12Hour && (0,external_wp_element_namespaceObject.createElement)(button_group, {
  49799. className: "components-datetime__time-field components-datetime__time-field-am-pm"
  49800. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  49801. variant: am === 'AM' ? 'primary' : 'secondary',
  49802. onClick: updateAmPm('AM'),
  49803. className: "components-datetime__time-am-button"
  49804. }, (0,external_wp_i18n_namespaceObject.__)('AM')), (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  49805. variant: am === 'PM' ? 'primary' : 'secondary',
  49806. onClick: updateAmPm('PM'),
  49807. className: "components-datetime__time-pm-button"
  49808. }, (0,external_wp_i18n_namespaceObject.__)('PM'))), (0,external_wp_element_namespaceObject.createElement)(timezone, null))));
  49809. }
  49810. /* harmony default export */ var time = (TimePicker);
  49811. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/index.js
  49812. /**
  49813. * External dependencies
  49814. */
  49815. // Needed to initialise the default datepicker styles.
  49816. // See: https://github.com/airbnb/react-dates#initialize
  49817. /**
  49818. * WordPress dependencies
  49819. */
  49820. /**
  49821. * Internal dependencies
  49822. */
  49823. function DateTimePicker(_ref, ref) {
  49824. let {
  49825. currentDate,
  49826. is12Hour,
  49827. isInvalidDate,
  49828. onMonthPreviewed = external_lodash_namespaceObject.noop,
  49829. onChange,
  49830. events
  49831. } = _ref;
  49832. const [calendarHelpIsVisible, setCalendarHelpIsVisible] = (0,external_wp_element_namespaceObject.useState)(false);
  49833. function onClickDescriptionToggle() {
  49834. setCalendarHelpIsVisible(!calendarHelpIsVisible);
  49835. }
  49836. return (0,external_wp_element_namespaceObject.createElement)("div", {
  49837. ref: ref,
  49838. className: "components-datetime"
  49839. }, !calendarHelpIsVisible && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(time, {
  49840. currentTime: currentDate,
  49841. onChange: onChange,
  49842. is12Hour: is12Hour
  49843. }), (0,external_wp_element_namespaceObject.createElement)(date, {
  49844. currentDate: currentDate,
  49845. onChange: onChange,
  49846. isInvalidDate: isInvalidDate,
  49847. events: events,
  49848. onMonthPreviewed: onMonthPreviewed
  49849. })), calendarHelpIsVisible && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  49850. className: "components-datetime__calendar-help"
  49851. }, (0,external_wp_element_namespaceObject.createElement)("h4", null, (0,external_wp_i18n_namespaceObject.__)('Click to Select')), (0,external_wp_element_namespaceObject.createElement)("ul", null, (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_i18n_namespaceObject.__)('Click the right or left arrows to select other months in the past or the future.')), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_i18n_namespaceObject.__)('Click the desired day to select it.'))), (0,external_wp_element_namespaceObject.createElement)("h4", null, (0,external_wp_i18n_namespaceObject.__)('Navigating with a keyboard')), (0,external_wp_element_namespaceObject.createElement)("ul", null, (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)("abbr", {
  49852. "aria-label": (0,external_wp_i18n_namespaceObject._x)('Enter', 'keyboard button')
  49853. }, "\u21B5"), ' '
  49854. /* JSX removes whitespace, but a space is required for screen readers. */
  49855. , (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Select the date in focus.'))), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)("abbr", {
  49856. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Left and Right Arrows')
  49857. }, "\u2190/\u2192"), ' '
  49858. /* JSX removes whitespace, but a space is required for screen readers. */
  49859. , (0,external_wp_i18n_namespaceObject.__)('Move backward (left) or forward (right) by one day.')), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)("abbr", {
  49860. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Up and Down Arrows')
  49861. }, "\u2191/\u2193"), ' '
  49862. /* JSX removes whitespace, but a space is required for screen readers. */
  49863. , (0,external_wp_i18n_namespaceObject.__)('Move backward (up) or forward (down) by one week.')), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)("abbr", {
  49864. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Page Up and Page Down')
  49865. }, (0,external_wp_i18n_namespaceObject.__)('PgUp/PgDn')), ' '
  49866. /* JSX removes whitespace, but a space is required for screen readers. */
  49867. , (0,external_wp_i18n_namespaceObject.__)('Move backward (PgUp) or forward (PgDn) by one month.')), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)("abbr", {
  49868. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Home and End')
  49869. }, (0,external_wp_i18n_namespaceObject.__)('Home/End')), ' '
  49870. /* JSX removes whitespace, but a space is required for screen readers. */
  49871. , (0,external_wp_i18n_namespaceObject.__)('Go to the first (Home) or last (End) day of a week.'))))), (0,external_wp_element_namespaceObject.createElement)("div", {
  49872. className: "components-datetime__buttons"
  49873. }, !calendarHelpIsVisible && currentDate && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  49874. className: "components-datetime__date-reset-button",
  49875. variant: "link",
  49876. onClick: () => onChange(null)
  49877. }, (0,external_wp_i18n_namespaceObject.__)('Reset')), (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  49878. className: "components-datetime__date-help-toggle",
  49879. variant: "link",
  49880. onClick: onClickDescriptionToggle
  49881. }, calendarHelpIsVisible ? (0,external_wp_i18n_namespaceObject.__)('Close') : (0,external_wp_i18n_namespaceObject.__)('Calendar Help'))));
  49882. }
  49883. /* harmony default export */ var date_time = ((0,external_wp_element_namespaceObject.forwardRef)(DateTimePicker));
  49884. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dimension-control/sizes.js
  49885. /**
  49886. * Sizes
  49887. *
  49888. * defines the sizes used in dimension controls
  49889. * all hardcoded `size` values are based on the value of
  49890. * the Sass variable `$block-padding` from
  49891. * `packages/block-editor/src/components/dimension-control/sizes.js`.
  49892. */
  49893. /**
  49894. * WordPress dependencies
  49895. */
  49896. /**
  49897. * Finds the correct size object from the provided sizes
  49898. * table by size slug (eg: `medium`)
  49899. *
  49900. * @param {Array} sizes containing objects for each size definition.
  49901. * @param {string} slug a string representation of the size (eg: `medium`).
  49902. *
  49903. * @return {Object} the matching size definition.
  49904. */
  49905. const findSizeBySlug = (sizes, slug) => sizes.find(size => slug === size.slug);
  49906. /* harmony default export */ var dimension_control_sizes = ([{
  49907. name: (0,external_wp_i18n_namespaceObject._x)('None', 'Size of a UI element'),
  49908. slug: 'none'
  49909. }, {
  49910. name: (0,external_wp_i18n_namespaceObject._x)('Small', 'Size of a UI element'),
  49911. slug: 'small'
  49912. }, {
  49913. name: (0,external_wp_i18n_namespaceObject._x)('Medium', 'Size of a UI element'),
  49914. slug: 'medium'
  49915. }, {
  49916. name: (0,external_wp_i18n_namespaceObject._x)('Large', 'Size of a UI element'),
  49917. slug: 'large'
  49918. }, {
  49919. name: (0,external_wp_i18n_namespaceObject._x)('Extra Large', 'Size of a UI element'),
  49920. slug: 'xlarge'
  49921. }]);
  49922. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dimension-control/index.js
  49923. /**
  49924. * External dependencies
  49925. */
  49926. /**
  49927. * WordPress dependencies
  49928. */
  49929. /**
  49930. * Internal dependencies
  49931. */
  49932. /**
  49933. * Internal dependencies
  49934. */
  49935. function DimensionControl(props) {
  49936. const {
  49937. label,
  49938. value,
  49939. sizes = dimension_control_sizes,
  49940. icon,
  49941. onChange,
  49942. className = ''
  49943. } = props;
  49944. const onChangeSpacingSize = val => {
  49945. const theSize = findSizeBySlug(sizes, val);
  49946. if (!theSize || value === theSize.slug) {
  49947. onChange(undefined);
  49948. } else if ((0,external_lodash_namespaceObject.isFunction)(onChange)) {
  49949. onChange(theSize.slug);
  49950. }
  49951. };
  49952. const formatSizesAsOptions = theSizes => {
  49953. const options = theSizes.map(_ref => {
  49954. let {
  49955. name,
  49956. slug
  49957. } = _ref;
  49958. return {
  49959. label: name,
  49960. value: slug
  49961. };
  49962. });
  49963. return [{
  49964. label: (0,external_wp_i18n_namespaceObject.__)('Default'),
  49965. value: ''
  49966. }].concat(options);
  49967. };
  49968. const selectLabel = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, icon && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  49969. icon: icon
  49970. }), label);
  49971. return (0,external_wp_element_namespaceObject.createElement)(select_control, {
  49972. className: classnames_default()(className, 'block-editor-dimension-control'),
  49973. label: selectLabel,
  49974. hideLabelFromVision: false,
  49975. value: value,
  49976. onChange: onChangeSpacingSize,
  49977. options: formatSizesAsOptions(sizes)
  49978. });
  49979. }
  49980. /* harmony default export */ var dimension_control = (DimensionControl);
  49981. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/disabled/styles/disabled-styles.js
  49982. function disabled_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  49983. /**
  49984. * External dependencies
  49985. */
  49986. const StyledWrapper = emotion_styled_base_browser_esm("div", true ? {
  49987. target: "e1ac3xxk0"
  49988. } : 0)( true ? {
  49989. name: "u2jump",
  49990. styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;}"
  49991. } : 0);
  49992. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/disabled/index.js
  49993. /**
  49994. * External dependencies
  49995. */
  49996. /**
  49997. * WordPress dependencies
  49998. */
  49999. /**
  50000. * Internal dependencies
  50001. */
  50002. const Context = (0,external_wp_element_namespaceObject.createContext)(false);
  50003. const {
  50004. Consumer,
  50005. Provider: disabled_Provider
  50006. } = Context;
  50007. /**
  50008. * Names of control nodes which qualify for disabled behavior.
  50009. *
  50010. * See WHATWG HTML Standard: 4.10.18.5: "Enabling and disabling form controls: the disabled attribute".
  50011. *
  50012. * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#enabling-and-disabling-form-controls:-the-disabled-attribute
  50013. *
  50014. * @type {string[]}
  50015. */
  50016. const DISABLED_ELIGIBLE_NODE_NAMES = ['BUTTON', 'FIELDSET', 'INPUT', 'OPTGROUP', 'OPTION', 'SELECT', 'TEXTAREA'];
  50017. /**
  50018. * @typedef OwnProps
  50019. * @property {string} [className] Classname for the disabled element.
  50020. * @property {import('react').ReactNode} children Children to disable.
  50021. * @property {boolean} [isDisabled=true] Whether to disable the children.
  50022. */
  50023. /**
  50024. * @param {OwnProps & import('react').HTMLAttributes<HTMLDivElement>} props
  50025. * @return {JSX.Element} Element wrapping the children to disable them when isDisabled is true.
  50026. */
  50027. function Disabled(_ref) {
  50028. let {
  50029. className,
  50030. children,
  50031. isDisabled = true,
  50032. ...props
  50033. } = _ref;
  50034. /** @type {import('react').RefObject<HTMLDivElement>} */
  50035. const node = (0,external_wp_element_namespaceObject.useRef)(null);
  50036. const disable = () => {
  50037. if (!node.current) {
  50038. return;
  50039. }
  50040. external_wp_dom_namespaceObject.focus.focusable.find(node.current).forEach(focusable => {
  50041. if ((0,external_lodash_namespaceObject.includes)(DISABLED_ELIGIBLE_NODE_NAMES, focusable.nodeName)) {
  50042. focusable.setAttribute('disabled', '');
  50043. }
  50044. if (focusable.nodeName === 'A') {
  50045. focusable.setAttribute('tabindex', '-1');
  50046. }
  50047. const tabIndex = focusable.getAttribute('tabindex');
  50048. if (tabIndex !== null && tabIndex !== '-1') {
  50049. focusable.removeAttribute('tabindex');
  50050. }
  50051. if (focusable.hasAttribute('contenteditable')) {
  50052. focusable.setAttribute('contenteditable', 'false');
  50053. }
  50054. });
  50055. }; // Debounce re-disable since disabling process itself will incur
  50056. // additional mutations which should be ignored.
  50057. const debouncedDisable = (0,external_wp_element_namespaceObject.useCallback)((0,external_lodash_namespaceObject.debounce)(disable, undefined, {
  50058. leading: true
  50059. }), []);
  50060. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  50061. if (!isDisabled) {
  50062. return;
  50063. }
  50064. disable();
  50065. /** @type {MutationObserver | undefined} */
  50066. let observer;
  50067. if (node.current) {
  50068. observer = new window.MutationObserver(debouncedDisable);
  50069. observer.observe(node.current, {
  50070. childList: true,
  50071. attributes: true,
  50072. subtree: true
  50073. });
  50074. }
  50075. return () => {
  50076. if (observer) {
  50077. observer.disconnect();
  50078. }
  50079. debouncedDisable.cancel();
  50080. };
  50081. }, []);
  50082. if (!isDisabled) {
  50083. return (0,external_wp_element_namespaceObject.createElement)(disabled_Provider, {
  50084. value: false
  50085. }, children);
  50086. }
  50087. return (0,external_wp_element_namespaceObject.createElement)(disabled_Provider, {
  50088. value: true
  50089. }, (0,external_wp_element_namespaceObject.createElement)(StyledWrapper, extends_extends({
  50090. ref: node,
  50091. className: classnames_default()(className, 'components-disabled')
  50092. }, props), children));
  50093. }
  50094. Disabled.Context = Context;
  50095. Disabled.Consumer = Consumer;
  50096. /* harmony default export */ var disabled = (Disabled);
  50097. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/draggable/index.js
  50098. /**
  50099. * WordPress dependencies
  50100. */
  50101. /**
  50102. * External dependencies
  50103. */
  50104. const dragImageClass = 'components-draggable__invisible-drag-image';
  50105. const cloneWrapperClass = 'components-draggable__clone';
  50106. const clonePadding = 0;
  50107. const bodyClass = 'is-dragging-components-draggable';
  50108. /**
  50109. * @typedef RenderProp
  50110. * @property {(event: import('react').DragEvent) => void} onDraggableStart `onDragStart` handler.
  50111. * @property {(event: import('react').DragEvent) => void} onDraggableEnd `onDragEnd` handler.
  50112. */
  50113. /**
  50114. * @typedef Props
  50115. * @property {(props: RenderProp) => JSX.Element | null} children Children.
  50116. * @property {(event: import('react').DragEvent) => void} [onDragStart] Callback when dragging starts.
  50117. * @property {(event: import('react').DragEvent) => void} [onDragOver] Callback when dragging happens over the document.
  50118. * @property {(event: import('react').DragEvent) => void} [onDragEnd] Callback when dragging ends.
  50119. * @property {string} [cloneClassname] Classname for the cloned element.
  50120. * @property {string} [elementId] ID for the element.
  50121. * @property {any} [transferData] Transfer data for the drag event.
  50122. * @property {string} [__experimentalTransferDataType] The transfer data type to set.
  50123. * @property {import('react').ReactNode} __experimentalDragComponent Component to show when dragging.
  50124. */
  50125. /**
  50126. * @param {Props} props
  50127. * @return {JSX.Element} A draggable component.
  50128. */
  50129. function Draggable(_ref) {
  50130. let {
  50131. children,
  50132. onDragStart,
  50133. onDragOver,
  50134. onDragEnd,
  50135. cloneClassname,
  50136. elementId,
  50137. transferData,
  50138. __experimentalTransferDataType: transferDataType = 'text',
  50139. __experimentalDragComponent: dragComponent
  50140. } = _ref;
  50141. /** @type {import('react').MutableRefObject<HTMLDivElement | null>} */
  50142. const dragComponentRef = (0,external_wp_element_namespaceObject.useRef)(null);
  50143. const cleanup = (0,external_wp_element_namespaceObject.useRef)(() => {});
  50144. /**
  50145. * Removes the element clone, resets cursor, and removes drag listener.
  50146. *
  50147. * @param {import('react').DragEvent} event The non-custom DragEvent.
  50148. */
  50149. function end(event) {
  50150. event.preventDefault();
  50151. cleanup.current();
  50152. if (onDragEnd) {
  50153. onDragEnd(event);
  50154. }
  50155. }
  50156. /**
  50157. * This method does a couple of things:
  50158. *
  50159. * - Clones the current element and spawns clone over original element.
  50160. * - Adds a fake temporary drag image to avoid browser defaults.
  50161. * - Sets transfer data.
  50162. * - Adds dragover listener.
  50163. *
  50164. * @param {import('react').DragEvent} event The non-custom DragEvent.
  50165. */
  50166. function start(event) {
  50167. // @ts-ignore We know that ownerDocument does exist on an Element
  50168. const {
  50169. ownerDocument
  50170. } = event.target;
  50171. event.dataTransfer.setData(transferDataType, JSON.stringify(transferData));
  50172. const cloneWrapper = ownerDocument.createElement('div'); // Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.
  50173. cloneWrapper.style.top = 0;
  50174. cloneWrapper.style.left = 0;
  50175. const dragImage = ownerDocument.createElement('div'); // Set a fake drag image to avoid browser defaults. Remove from DOM
  50176. // right after. event.dataTransfer.setDragImage is not supported yet in
  50177. // IE, we need to check for its existence first.
  50178. if ('function' === typeof event.dataTransfer.setDragImage) {
  50179. dragImage.classList.add(dragImageClass);
  50180. ownerDocument.body.appendChild(dragImage);
  50181. event.dataTransfer.setDragImage(dragImage, 0, 0);
  50182. }
  50183. cloneWrapper.classList.add(cloneWrapperClass);
  50184. if (cloneClassname) {
  50185. cloneWrapper.classList.add(cloneClassname);
  50186. }
  50187. let x = 0;
  50188. let y = 0; // If a dragComponent is defined, the following logic will clone the
  50189. // HTML node and inject it into the cloneWrapper.
  50190. if (dragComponentRef.current) {
  50191. // Position dragComponent at the same position as the cursor.
  50192. x = event.clientX;
  50193. y = event.clientY;
  50194. cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`;
  50195. const clonedDragComponent = ownerDocument.createElement('div');
  50196. clonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;
  50197. cloneWrapper.appendChild(clonedDragComponent); // Inject the cloneWrapper into the DOM.
  50198. ownerDocument.body.appendChild(cloneWrapper);
  50199. } else {
  50200. const element = ownerDocument.getElementById(elementId); // Prepare element clone and append to element wrapper.
  50201. const elementRect = element.getBoundingClientRect();
  50202. const elementWrapper = element.parentNode;
  50203. const elementTopOffset = parseInt(elementRect.top, 10);
  50204. const elementLeftOffset = parseInt(elementRect.left, 10);
  50205. cloneWrapper.style.width = `${elementRect.width + clonePadding * 2}px`;
  50206. const clone = element.cloneNode(true);
  50207. clone.id = `clone-${elementId}`; // Position clone right over the original element (20px padding).
  50208. x = elementLeftOffset - clonePadding;
  50209. y = elementTopOffset - clonePadding;
  50210. cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`; // Hack: Remove iFrames as it's causing the embeds drag clone to freeze.
  50211. Array.from(clone.querySelectorAll('iframe')).forEach(child => child.parentNode.removeChild(child));
  50212. cloneWrapper.appendChild(clone); // Inject the cloneWrapper into the DOM.
  50213. elementWrapper.appendChild(cloneWrapper);
  50214. } // Mark the current cursor coordinates.
  50215. let cursorLeft = event.clientX;
  50216. let cursorTop = event.clientY;
  50217. /**
  50218. * @param {import('react').DragEvent<Element>} e
  50219. */
  50220. function over(e) {
  50221. // Skip doing any work if mouse has not moved.
  50222. if (cursorLeft === e.clientX && cursorTop === e.clientY) {
  50223. return;
  50224. }
  50225. const nextX = x + e.clientX - cursorLeft;
  50226. const nextY = y + e.clientY - cursorTop;
  50227. cloneWrapper.style.transform = `translate( ${nextX}px, ${nextY}px )`;
  50228. cursorLeft = e.clientX;
  50229. cursorTop = e.clientY;
  50230. x = nextX;
  50231. y = nextY;
  50232. if (onDragOver) {
  50233. onDragOver(e);
  50234. }
  50235. } // Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,
  50236. // note that browsers may throttle raf below 60fps in certain conditions.
  50237. const throttledDragOver = (0,external_lodash_namespaceObject.throttle)(over, 16);
  50238. ownerDocument.addEventListener('dragover', throttledDragOver); // Update cursor to 'grabbing', document wide.
  50239. ownerDocument.body.classList.add(bodyClass); // Allow the Synthetic Event to be accessed from asynchronous code.
  50240. // https://reactjs.org/docs/events.html#event-pooling
  50241. event.persist();
  50242. /** @type {number | undefined} */
  50243. let timerId;
  50244. if (onDragStart) {
  50245. timerId = setTimeout(() => onDragStart(event));
  50246. }
  50247. cleanup.current = () => {
  50248. // Remove drag clone.
  50249. if (cloneWrapper && cloneWrapper.parentNode) {
  50250. cloneWrapper.parentNode.removeChild(cloneWrapper);
  50251. }
  50252. if (dragImage && dragImage.parentNode) {
  50253. dragImage.parentNode.removeChild(dragImage);
  50254. } // Reset cursor.
  50255. ownerDocument.body.classList.remove(bodyClass);
  50256. ownerDocument.removeEventListener('dragover', throttledDragOver);
  50257. clearTimeout(timerId);
  50258. };
  50259. }
  50260. (0,external_wp_element_namespaceObject.useEffect)(() => () => {
  50261. cleanup.current();
  50262. }, []);
  50263. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, children({
  50264. onDraggableStart: start,
  50265. onDraggableEnd: end
  50266. }), dragComponent && (0,external_wp_element_namespaceObject.createElement)("div", {
  50267. className: "components-draggable-drag-component-root",
  50268. style: {
  50269. display: 'none'
  50270. },
  50271. ref: dragComponentRef
  50272. }, dragComponent));
  50273. }
  50274. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js
  50275. /**
  50276. * WordPress dependencies
  50277. */
  50278. const upload = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  50279. xmlns: "http://www.w3.org/2000/svg",
  50280. viewBox: "0 0 24 24"
  50281. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  50282. d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"
  50283. }));
  50284. /* harmony default export */ var library_upload = (upload);
  50285. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-is-mounted.mjs
  50286. function useIsMounted() {
  50287. var isMounted = (0,external_React_.useRef)(false);
  50288. useIsomorphicLayoutEffect(function () {
  50289. isMounted.current = true;
  50290. return function () {
  50291. isMounted.current = false;
  50292. };
  50293. }, []);
  50294. return isMounted;
  50295. }
  50296. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-force-update.mjs
  50297. function use_force_update_useForceUpdate() {
  50298. var isMounted = useIsMounted();
  50299. var _a = tslib_es6_read((0,external_React_.useState)(0), 2), forcedRenderCount = _a[0], setForcedRenderCount = _a[1];
  50300. var forceRender = (0,external_React_.useCallback)(function () {
  50301. isMounted.current && setForcedRenderCount(forcedRenderCount + 1);
  50302. }, [forcedRenderCount]);
  50303. /**
  50304. * Defer this to the end of the next animation frame in case there are multiple
  50305. * synchronous calls.
  50306. */
  50307. var deferredForceRender = (0,external_React_.useCallback)(function () { return es.postRender(forceRender); }, [forceRender]);
  50308. return [deferredForceRender, forcedRenderCount];
  50309. }
  50310. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs
  50311. var PresenceChild = function (_a) {
  50312. var children = _a.children, initial = _a.initial, isPresent = _a.isPresent, onExitComplete = _a.onExitComplete, custom = _a.custom, presenceAffectsLayout = _a.presenceAffectsLayout;
  50313. var presenceChildren = useConstant(newChildrenMap);
  50314. var id = useId();
  50315. var context = (0,external_React_.useMemo)(function () { return ({
  50316. id: id,
  50317. initial: initial,
  50318. isPresent: isPresent,
  50319. custom: custom,
  50320. onExitComplete: function (childId) {
  50321. var e_1, _a;
  50322. presenceChildren.set(childId, true);
  50323. try {
  50324. for (var _b = __values(presenceChildren.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
  50325. var isComplete = _c.value;
  50326. if (!isComplete)
  50327. return; // can stop searching when any is incomplete
  50328. }
  50329. }
  50330. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  50331. finally {
  50332. try {
  50333. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  50334. }
  50335. finally { if (e_1) throw e_1.error; }
  50336. }
  50337. onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete();
  50338. },
  50339. register: function (childId) {
  50340. presenceChildren.set(childId, false);
  50341. return function () { return presenceChildren.delete(childId); };
  50342. },
  50343. }); },
  50344. /**
  50345. * If the presence of a child affects the layout of the components around it,
  50346. * we want to make a new context value to ensure they get re-rendered
  50347. * so they can detect that layout change.
  50348. */
  50349. presenceAffectsLayout ? undefined : [isPresent]);
  50350. (0,external_React_.useMemo)(function () {
  50351. presenceChildren.forEach(function (_, key) { return presenceChildren.set(key, false); });
  50352. }, [isPresent]);
  50353. /**
  50354. * If there's no `motion` components to fire exit animations, we want to remove this
  50355. * component immediately.
  50356. */
  50357. external_React_.useEffect(function () {
  50358. !isPresent && !presenceChildren.size && (onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete());
  50359. }, [isPresent]);
  50360. return (external_React_.createElement(PresenceContext_PresenceContext.Provider, { value: context }, children));
  50361. };
  50362. function newChildrenMap() {
  50363. return new Map();
  50364. }
  50365. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs
  50366. var getChildKey = function (child) { return child.key || ""; };
  50367. var isDev = "production" !== "production";
  50368. function updateChildLookup(children, allChildren) {
  50369. var seenChildren = isDev ? new Set() : null;
  50370. children.forEach(function (child) {
  50371. var key = getChildKey(child);
  50372. if (isDev && seenChildren && seenChildren.has(key)) {
  50373. console.warn("Children of AnimatePresence require unique keys. \"".concat(key, "\" is a duplicate."));
  50374. seenChildren.add(key);
  50375. }
  50376. allChildren.set(key, child);
  50377. });
  50378. }
  50379. function onlyElements(children) {
  50380. var filtered = [];
  50381. // We use forEach here instead of map as map mutates the component key by preprending `.$`
  50382. external_React_.Children.forEach(children, function (child) {
  50383. if ((0,external_React_.isValidElement)(child))
  50384. filtered.push(child);
  50385. });
  50386. return filtered;
  50387. }
  50388. /**
  50389. * `AnimatePresence` enables the animation of components that have been removed from the tree.
  50390. *
  50391. * When adding/removing more than a single child, every child **must** be given a unique `key` prop.
  50392. *
  50393. * Any `motion` components that have an `exit` property defined will animate out when removed from
  50394. * the tree.
  50395. *
  50396. * ```jsx
  50397. * import { motion, AnimatePresence } from 'framer-motion'
  50398. *
  50399. * export const Items = ({ items }) => (
  50400. * <AnimatePresence>
  50401. * {items.map(item => (
  50402. * <motion.div
  50403. * key={item.id}
  50404. * initial={{ opacity: 0 }}
  50405. * animate={{ opacity: 1 }}
  50406. * exit={{ opacity: 0 }}
  50407. * />
  50408. * ))}
  50409. * </AnimatePresence>
  50410. * )
  50411. * ```
  50412. *
  50413. * You can sequence exit animations throughout a tree using variants.
  50414. *
  50415. * If a child contains multiple `motion` components with `exit` props, it will only unmount the child
  50416. * once all `motion` components have finished animating out. Likewise, any components using
  50417. * `usePresence` all need to call `safeToRemove`.
  50418. *
  50419. * @public
  50420. */
  50421. var AnimatePresence = function (_a) {
  50422. var children = _a.children, custom = _a.custom, _b = _a.initial, initial = _b === void 0 ? true : _b, onExitComplete = _a.onExitComplete, exitBeforeEnter = _a.exitBeforeEnter, _c = _a.presenceAffectsLayout, presenceAffectsLayout = _c === void 0 ? true : _c;
  50423. // We want to force a re-render once all exiting animations have finished. We
  50424. // either use a local forceRender function, or one from a parent context if it exists.
  50425. var _d = tslib_es6_read(use_force_update_useForceUpdate(), 1), forceRender = _d[0];
  50426. var forceRenderLayoutGroup = (0,external_React_.useContext)(LayoutGroupContext).forceRender;
  50427. if (forceRenderLayoutGroup)
  50428. forceRender = forceRenderLayoutGroup;
  50429. var isMounted = useIsMounted();
  50430. // Filter out any children that aren't ReactElements. We can only track ReactElements with a props.key
  50431. var filteredChildren = onlyElements(children);
  50432. var childrenToRender = filteredChildren;
  50433. var exiting = new Set();
  50434. // Keep a living record of the children we're actually rendering so we
  50435. // can diff to figure out which are entering and exiting
  50436. var presentChildren = (0,external_React_.useRef)(childrenToRender);
  50437. // A lookup table to quickly reference components by key
  50438. var allChildren = (0,external_React_.useRef)(new Map()).current;
  50439. // If this is the initial component render, just deal with logic surrounding whether
  50440. // we play onMount animations or not.
  50441. var isInitialRender = (0,external_React_.useRef)(true);
  50442. useIsomorphicLayoutEffect(function () {
  50443. isInitialRender.current = false;
  50444. updateChildLookup(filteredChildren, allChildren);
  50445. presentChildren.current = childrenToRender;
  50446. });
  50447. useUnmountEffect(function () {
  50448. isInitialRender.current = true;
  50449. allChildren.clear();
  50450. exiting.clear();
  50451. });
  50452. if (isInitialRender.current) {
  50453. return (external_React_.createElement(external_React_.Fragment, null, childrenToRender.map(function (child) { return (external_React_.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, initial: initial ? undefined : false, presenceAffectsLayout: presenceAffectsLayout }, child)); })));
  50454. }
  50455. // If this is a subsequent render, deal with entering and exiting children
  50456. childrenToRender = tslib_es6_spreadArray([], tslib_es6_read(childrenToRender), false);
  50457. // Diff the keys of the currently-present and target children to update our
  50458. // exiting list.
  50459. var presentKeys = presentChildren.current.map(getChildKey);
  50460. var targetKeys = filteredChildren.map(getChildKey);
  50461. // Diff the present children with our target children and mark those that are exiting
  50462. var numPresent = presentKeys.length;
  50463. for (var i = 0; i < numPresent; i++) {
  50464. var key = presentKeys[i];
  50465. if (targetKeys.indexOf(key) === -1) {
  50466. exiting.add(key);
  50467. }
  50468. }
  50469. // If we currently have exiting children, and we're deferring rendering incoming children
  50470. // until after all current children have exiting, empty the childrenToRender array
  50471. if (exitBeforeEnter && exiting.size) {
  50472. childrenToRender = [];
  50473. }
  50474. // Loop through all currently exiting components and clone them to overwrite `animate`
  50475. // with any `exit` prop they might have defined.
  50476. exiting.forEach(function (key) {
  50477. // If this component is actually entering again, early return
  50478. if (targetKeys.indexOf(key) !== -1)
  50479. return;
  50480. var child = allChildren.get(key);
  50481. if (!child)
  50482. return;
  50483. var insertionIndex = presentKeys.indexOf(key);
  50484. var onExit = function () {
  50485. allChildren.delete(key);
  50486. exiting.delete(key);
  50487. // Remove this child from the present children
  50488. var removeIndex = presentChildren.current.findIndex(function (presentChild) { return presentChild.key === key; });
  50489. presentChildren.current.splice(removeIndex, 1);
  50490. // Defer re-rendering until all exiting children have indeed left
  50491. if (!exiting.size) {
  50492. presentChildren.current = filteredChildren;
  50493. if (isMounted.current === false)
  50494. return;
  50495. forceRender();
  50496. onExitComplete && onExitComplete();
  50497. }
  50498. };
  50499. childrenToRender.splice(insertionIndex, 0, external_React_.createElement(PresenceChild, { key: getChildKey(child), isPresent: false, onExitComplete: onExit, custom: custom, presenceAffectsLayout: presenceAffectsLayout }, child));
  50500. });
  50501. // Add `MotionContext` even to children that don't need it to ensure we're rendering
  50502. // the same tree between renders
  50503. childrenToRender = childrenToRender.map(function (child) {
  50504. var key = child.key;
  50505. return exiting.has(key) ? (child) : (external_React_.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, presenceAffectsLayout: presenceAffectsLayout }, child));
  50506. });
  50507. if (false) {}
  50508. return (external_React_.createElement(external_React_.Fragment, null, exiting.size
  50509. ? childrenToRender
  50510. : childrenToRender.map(function (child) { return (0,external_React_.cloneElement)(child); })));
  50511. };
  50512. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/drop-zone/index.js
  50513. /**
  50514. * External dependencies
  50515. */
  50516. /**
  50517. * WordPress dependencies
  50518. */
  50519. /**
  50520. * Internal dependencies
  50521. */
  50522. function DropZoneComponent(_ref) {
  50523. let {
  50524. className,
  50525. label,
  50526. onFilesDrop,
  50527. onHTMLDrop,
  50528. onDrop
  50529. } = _ref;
  50530. const [isDraggingOverDocument, setIsDraggingOverDocument] = (0,external_wp_element_namespaceObject.useState)();
  50531. const [isDraggingOverElement, setIsDraggingOverElement] = (0,external_wp_element_namespaceObject.useState)();
  50532. const [type, setType] = (0,external_wp_element_namespaceObject.useState)();
  50533. const ref = (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({
  50534. onDrop(event) {
  50535. const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(event.dataTransfer);
  50536. const html = event.dataTransfer.getData('text/html');
  50537. /**
  50538. * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
  50539. * The order of the checks is important to recognise the HTML drop.
  50540. */
  50541. if (html && onHTMLDrop) {
  50542. onHTMLDrop(html);
  50543. } else if (files.length && onFilesDrop) {
  50544. onFilesDrop(files);
  50545. } else if (onDrop) {
  50546. onDrop(event);
  50547. }
  50548. },
  50549. onDragStart(event) {
  50550. setIsDraggingOverDocument(true);
  50551. let _type = 'default';
  50552. /**
  50553. * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
  50554. * The order of the checks is important to recognise the HTML drop.
  50555. */
  50556. if ((0,external_lodash_namespaceObject.includes)(event.dataTransfer.types, 'text/html')) {
  50557. _type = 'html';
  50558. } else if ( // Check for the types because sometimes the files themselves
  50559. // are only available on drop.
  50560. (0,external_lodash_namespaceObject.includes)(event.dataTransfer.types, 'Files') || (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(event.dataTransfer).length > 0) {
  50561. _type = 'file';
  50562. }
  50563. setType(_type);
  50564. },
  50565. onDragEnd() {
  50566. setIsDraggingOverDocument(false);
  50567. setType();
  50568. },
  50569. onDragEnter() {
  50570. setIsDraggingOverElement(true);
  50571. },
  50572. onDragLeave() {
  50573. setIsDraggingOverElement(false);
  50574. }
  50575. });
  50576. const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  50577. let children;
  50578. const backdrop = {
  50579. hidden: {
  50580. scaleY: 0,
  50581. opacity: 0
  50582. },
  50583. show: {
  50584. scaleY: 1,
  50585. opacity: 1,
  50586. transition: {
  50587. type: 'tween',
  50588. duration: 0.2,
  50589. delay: 0.1,
  50590. delayChildren: 0.2
  50591. }
  50592. },
  50593. exit: {
  50594. scaleY: 1,
  50595. opacity: 0,
  50596. transition: {
  50597. duration: 0.3,
  50598. delayChildren: 0
  50599. }
  50600. }
  50601. };
  50602. const foreground = {
  50603. hidden: {
  50604. opacity: 0,
  50605. scale: 0.75
  50606. },
  50607. show: {
  50608. opacity: 1,
  50609. scale: 1
  50610. },
  50611. exit: {
  50612. opacity: 0,
  50613. scale: 0.9
  50614. }
  50615. };
  50616. if (isDraggingOverElement) {
  50617. children = (0,external_wp_element_namespaceObject.createElement)(motion.div, {
  50618. variants: backdrop,
  50619. initial: disableMotion ? 'show' : 'hidden',
  50620. animate: "show",
  50621. exit: disableMotion ? 'show' : 'exit',
  50622. className: "components-drop-zone__content"
  50623. }, (0,external_wp_element_namespaceObject.createElement)(motion.div, {
  50624. variants: foreground
  50625. }, (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  50626. icon: library_upload,
  50627. className: "components-drop-zone__content-icon"
  50628. }), (0,external_wp_element_namespaceObject.createElement)("span", {
  50629. className: "components-drop-zone__content-text"
  50630. }, label ? label : (0,external_wp_i18n_namespaceObject.__)('Drop files to upload'))));
  50631. }
  50632. const classes = classnames_default()('components-drop-zone', className, {
  50633. 'is-active': (isDraggingOverDocument || isDraggingOverElement) && (type === 'file' && onFilesDrop || type === 'html' && onHTMLDrop || type === 'default' && onDrop),
  50634. 'is-dragging-over-document': isDraggingOverDocument,
  50635. 'is-dragging-over-element': isDraggingOverElement,
  50636. [`is-dragging-${type}`]: !!type
  50637. });
  50638. return (0,external_wp_element_namespaceObject.createElement)("div", {
  50639. ref: ref,
  50640. className: classes
  50641. }, disableMotion ? children : (0,external_wp_element_namespaceObject.createElement)(AnimatePresence, null, children));
  50642. }
  50643. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/drop-zone/provider.js
  50644. /**
  50645. * WordPress dependencies
  50646. */
  50647. function DropZoneProvider(_ref) {
  50648. let {
  50649. children
  50650. } = _ref;
  50651. external_wp_deprecated_default()('wp.components.DropZoneProvider', {
  50652. since: '5.8',
  50653. hint: 'wp.component.DropZone no longer needs a provider. wp.components.DropZoneProvider is safe to remove from your code.'
  50654. });
  50655. return children;
  50656. }
  50657. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/swatch.js
  50658. /**
  50659. * WordPress dependencies
  50660. */
  50661. const swatch = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  50662. xmlns: "http://www.w3.org/2000/svg",
  50663. viewBox: "0 0 24 24"
  50664. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  50665. d: "M5 17.7c.4.5.8.9 1.2 1.2l1.1-1.4c-.4-.3-.7-.6-1-1L5 17.7zM5 6.3l1.4 1.1c.3-.4.6-.7 1-1L6.3 5c-.5.4-.9.8-1.3 1.3zm.1 7.8l-1.7.5c.2.6.4 1.1.7 1.6l1.5-.8c-.2-.4-.4-.8-.5-1.3zM4.8 12v-.7L3 11.1v1.8l1.7-.2c.1-.2.1-.5.1-.7zm3 7.9c.5.3 1.1.5 1.6.7l.5-1.7c-.5-.1-.9-.3-1.3-.5l-.8 1.5zM19 6.3c-.4-.5-.8-.9-1.2-1.2l-1.1 1.4c.4.3.7.6 1 1L19 6.3zm-.1 3.6l1.7-.5c-.2-.6-.4-1.1-.7-1.6l-1.5.8c.2.4.4.8.5 1.3zM5.6 8.6l-1.5-.8c-.3.5-.5 1-.7 1.6l1.7.5c.1-.5.3-.9.5-1.3zm2.2-4.5l.8 1.5c.4-.2.8-.4 1.3-.5l-.5-1.7c-.6.2-1.1.4-1.6.7zm8.8 13.5l1.1 1.4c.5-.4.9-.8 1.2-1.2l-1.4-1.1c-.2.3-.5.6-.9.9zm1.8-2.2l1.5.8c.3-.5.5-1.1.7-1.6l-1.7-.5c-.1.5-.3.9-.5 1.3zm2.6-4.3l-1.7.2v1.4l1.7.2V12v-.9zM11.1 3l.2 1.7h1.4l.2-1.7h-1.8zm3 2.1c.5.1.9.3 1.3.5l.8-1.5c-.5-.3-1.1-.5-1.6-.7l-.5 1.7zM12 19.2h-.7l-.2 1.8h1.8l-.2-1.7c-.2-.1-.5-.1-.7-.1zm2.1-.3l.5 1.7c.6-.2 1.1-.4 1.6-.7l-.8-1.5c-.4.2-.8.4-1.3.5z"
  50666. }));
  50667. /* harmony default export */ var library_swatch = (swatch);
  50668. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/swatch/index.js
  50669. /**
  50670. * WordPress dependencies
  50671. */
  50672. /**
  50673. * Internal dependencies
  50674. */
  50675. function Swatch(_ref) {
  50676. let {
  50677. fill
  50678. } = _ref;
  50679. return fill ? (0,external_wp_element_namespaceObject.createElement)("span", {
  50680. className: "components-swatch",
  50681. style: {
  50682. background: fill
  50683. }
  50684. }) : (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  50685. icon: library_swatch
  50686. });
  50687. }
  50688. /* harmony default export */ var build_module_swatch = (Swatch);
  50689. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/utils.js
  50690. /**
  50691. * External dependencies
  50692. */
  50693. k([names]);
  50694. /**
  50695. * Object representation for a color.
  50696. *
  50697. * @typedef {Object} RGBColor
  50698. * @property {number} r Red component of the color in the range [0,1].
  50699. * @property {number} g Green component of the color in the range [0,1].
  50700. * @property {number} b Blue component of the color in the range [0,1].
  50701. */
  50702. /**
  50703. * Calculate the brightest and darkest values from a color palette.
  50704. *
  50705. * @param {Object[]} palette Color palette for the theme.
  50706. *
  50707. * @return {string[]} Tuple of the darkest color and brightest color.
  50708. */
  50709. function getDefaultColors(palette) {
  50710. // A default dark and light color are required.
  50711. if (!palette || palette.length < 2) return ['#000', '#fff'];
  50712. return palette.map(_ref => {
  50713. let {
  50714. color
  50715. } = _ref;
  50716. return {
  50717. color,
  50718. brightness: w(color).brightness()
  50719. };
  50720. }).reduce((_ref2, current) => {
  50721. let [min, max] = _ref2;
  50722. return [current.brightness <= min.brightness ? current : min, current.brightness >= max.brightness ? current : max];
  50723. }, [{
  50724. brightness: 1
  50725. }, {
  50726. brightness: 0
  50727. }]).map(_ref3 => {
  50728. let {
  50729. color
  50730. } = _ref3;
  50731. return color;
  50732. });
  50733. }
  50734. /**
  50735. * Generate a duotone gradient from a list of colors.
  50736. *
  50737. * @param {string[]} colors CSS color strings.
  50738. * @param {string} angle CSS gradient angle.
  50739. *
  50740. * @return {string} CSS gradient string for the duotone swatch.
  50741. */
  50742. function getGradientFromCSSColors() {
  50743. let colors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  50744. let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '90deg';
  50745. const l = 100 / colors.length;
  50746. const stops = colors.map((c, i) => `${c} ${i * l}%, ${c} ${(i + 1) * l}%`).join(', ');
  50747. return `linear-gradient( ${angle}, ${stops} )`;
  50748. }
  50749. /**
  50750. * Convert a color array to an array of color stops.
  50751. *
  50752. * @param {string[]} colors CSS colors array
  50753. *
  50754. * @return {Object[]} Color stop information.
  50755. */
  50756. function getColorStopsFromColors(colors) {
  50757. return colors.map((color, i) => ({
  50758. position: i * 100 / (colors.length - 1),
  50759. color
  50760. }));
  50761. }
  50762. /**
  50763. * Convert a color stop array to an array colors.
  50764. *
  50765. * @param {Object[]} colorStops Color stop information.
  50766. *
  50767. * @return {string[]} CSS colors array.
  50768. */
  50769. function getColorsFromColorStops() {
  50770. let colorStops = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  50771. return colorStops.map(_ref4 => {
  50772. let {
  50773. color
  50774. } = _ref4;
  50775. return color;
  50776. });
  50777. }
  50778. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/duotone-swatch.js
  50779. /**
  50780. * Internal dependencies
  50781. */
  50782. function DuotoneSwatch(_ref) {
  50783. let {
  50784. values
  50785. } = _ref;
  50786. return (0,external_wp_element_namespaceObject.createElement)(build_module_swatch, {
  50787. fill: values && getGradientFromCSSColors(values, '135deg')
  50788. });
  50789. }
  50790. /* harmony default export */ var duotone_swatch = (DuotoneSwatch);
  50791. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-list-picker/index.js
  50792. /**
  50793. * WordPress dependencies
  50794. */
  50795. /**
  50796. * Internal dependencies
  50797. */
  50798. function ColorOption(_ref) {
  50799. let {
  50800. label,
  50801. value,
  50802. colors,
  50803. disableCustomColors,
  50804. enableAlpha,
  50805. onChange
  50806. } = _ref;
  50807. const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false);
  50808. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  50809. className: "components-color-list-picker__swatch-button",
  50810. icon: (0,external_wp_element_namespaceObject.createElement)(build_module_swatch, {
  50811. fill: value
  50812. }),
  50813. onClick: () => setIsOpen(prev => !prev)
  50814. }, label), isOpen && (0,external_wp_element_namespaceObject.createElement)(ColorPalette, {
  50815. className: "components-color-list-picker__color-picker",
  50816. colors: colors,
  50817. value: value,
  50818. clearable: false,
  50819. onChange: onChange,
  50820. disableCustomColors: disableCustomColors,
  50821. enableAlpha: enableAlpha
  50822. }));
  50823. }
  50824. function ColorListPicker(_ref2) {
  50825. let {
  50826. colors,
  50827. labels,
  50828. value = [],
  50829. disableCustomColors,
  50830. enableAlpha,
  50831. onChange
  50832. } = _ref2;
  50833. return (0,external_wp_element_namespaceObject.createElement)("div", {
  50834. className: "components-color-list-picker"
  50835. }, labels.map((label, index) => (0,external_wp_element_namespaceObject.createElement)(ColorOption, {
  50836. key: index,
  50837. label: label,
  50838. value: value[index],
  50839. colors: colors,
  50840. disableCustomColors: disableCustomColors,
  50841. enableAlpha: enableAlpha,
  50842. onChange: newColor => {
  50843. const newColors = value.slice();
  50844. newColors[index] = newColor;
  50845. onChange(newColors);
  50846. }
  50847. })));
  50848. }
  50849. /* harmony default export */ var color_list_picker = (ColorListPicker);
  50850. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/custom-duotone-bar.js
  50851. /**
  50852. * Internal dependencies
  50853. */
  50854. const PLACEHOLDER_VALUES = ['#333', '#CCC'];
  50855. function CustomDuotoneBar(_ref) {
  50856. let {
  50857. value,
  50858. onChange
  50859. } = _ref;
  50860. const hasGradient = !!value;
  50861. const values = hasGradient ? value : PLACEHOLDER_VALUES;
  50862. const background = getGradientFromCSSColors(values);
  50863. const controlPoints = getColorStopsFromColors(values);
  50864. return (0,external_wp_element_namespaceObject.createElement)(CustomGradientBar, {
  50865. disableInserter: true,
  50866. background: background,
  50867. hasGradient: hasGradient,
  50868. value: controlPoints,
  50869. onChange: newColorStops => {
  50870. const newValue = getColorsFromColorStops(newColorStops);
  50871. onChange(newValue);
  50872. }
  50873. });
  50874. }
  50875. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/duotone-picker.js
  50876. /**
  50877. * External dependencies
  50878. */
  50879. /**
  50880. * WordPress dependencies
  50881. */
  50882. /**
  50883. * Internal dependencies
  50884. */
  50885. function DuotonePicker(_ref) {
  50886. let {
  50887. clearable = true,
  50888. colorPalette,
  50889. duotonePalette,
  50890. disableCustomColors,
  50891. disableCustomDuotone,
  50892. value,
  50893. onChange
  50894. } = _ref;
  50895. const [defaultDark, defaultLight] = (0,external_wp_element_namespaceObject.useMemo)(() => getDefaultColors(colorPalette), [colorPalette]);
  50896. return (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker, {
  50897. options: duotonePalette.map(_ref2 => {
  50898. let {
  50899. colors,
  50900. slug,
  50901. name
  50902. } = _ref2;
  50903. const style = {
  50904. background: getGradientFromCSSColors(colors, '135deg'),
  50905. color: 'transparent'
  50906. };
  50907. const tooltipText = name !== null && name !== void 0 ? name : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: duotone code e.g: "dark-grayscale" or "7f7f7f-ffffff".
  50908. (0,external_wp_i18n_namespaceObject.__)('Duotone code: %s'), slug);
  50909. const label = name ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the option e.g: "Dark grayscale".
  50910. (0,external_wp_i18n_namespaceObject.__)('Duotone: %s'), name) : tooltipText;
  50911. const isSelected = (0,external_lodash_namespaceObject.isEqual)(colors, value);
  50912. return (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.Option, {
  50913. key: slug,
  50914. value: colors,
  50915. isSelected: isSelected,
  50916. "aria-label": label,
  50917. tooltipText: tooltipText,
  50918. style: style,
  50919. onClick: () => {
  50920. onChange(isSelected ? undefined : colors);
  50921. }
  50922. });
  50923. }),
  50924. actions: !!clearable && (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.ButtonAction, {
  50925. onClick: () => onChange(undefined)
  50926. }, (0,external_wp_i18n_namespaceObject.__)('Clear'))
  50927. }, !disableCustomColors && !disableCustomDuotone && (0,external_wp_element_namespaceObject.createElement)(CustomDuotoneBar, {
  50928. value: value,
  50929. onChange: onChange
  50930. }), !disableCustomDuotone && (0,external_wp_element_namespaceObject.createElement)(color_list_picker, {
  50931. labels: [(0,external_wp_i18n_namespaceObject.__)('Shadows'), (0,external_wp_i18n_namespaceObject.__)('Highlights')],
  50932. colors: colorPalette,
  50933. value: value,
  50934. disableCustomColors: disableCustomColors,
  50935. enableAlpha: true,
  50936. onChange: newColors => {
  50937. if (!newColors[0]) {
  50938. newColors[0] = defaultDark;
  50939. }
  50940. if (!newColors[1]) {
  50941. newColors[1] = defaultLight;
  50942. }
  50943. const newValue = newColors.length >= 2 ? newColors : undefined;
  50944. onChange(newValue);
  50945. }
  50946. }));
  50947. }
  50948. /* harmony default export */ var duotone_picker = (DuotonePicker);
  50949. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
  50950. /**
  50951. * WordPress dependencies
  50952. */
  50953. const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  50954. xmlns: "http://www.w3.org/2000/svg",
  50955. viewBox: "0 0 24 24"
  50956. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  50957. d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"
  50958. }));
  50959. /* harmony default export */ var library_external = (external);
  50960. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/external-link/styles/external-link-styles.js
  50961. function external_link_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  50962. /**
  50963. * External dependencies
  50964. */
  50965. /**
  50966. * WordPress dependencies
  50967. */
  50968. const StyledIcon = /*#__PURE__*/emotion_styled_base_browser_esm(icons_build_module_icon, true ? {
  50969. target: "etxm6pv0"
  50970. } : 0)( true ? {
  50971. name: "rvs7bx",
  50972. styles: "width:1em;height:1em;margin:0;vertical-align:middle;fill:currentColor"
  50973. } : 0);
  50974. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/external-link/index.js
  50975. /**
  50976. * External dependencies
  50977. */
  50978. /**
  50979. * WordPress dependencies
  50980. */
  50981. /**
  50982. * Internal dependencies
  50983. */
  50984. function ExternalLink(_ref, ref) {
  50985. let {
  50986. href,
  50987. children,
  50988. className,
  50989. rel = '',
  50990. ...additionalProps
  50991. } = _ref;
  50992. rel = (0,external_lodash_namespaceObject.uniq)((0,external_lodash_namespaceObject.compact)([...rel.split(' '), 'external', 'noreferrer', 'noopener'])).join(' ');
  50993. const classes = classnames_default()('components-external-link', className);
  50994. return (
  50995. /* eslint-disable react/jsx-no-target-blank */
  50996. (0,external_wp_element_namespaceObject.createElement)("a", extends_extends({}, additionalProps, {
  50997. className: classes,
  50998. href: href,
  50999. target: "_blank",
  51000. rel: rel,
  51001. ref: ref
  51002. }), children, (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  51003. as: "span"
  51004. },
  51005. /* translators: accessibility text */
  51006. (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')), (0,external_wp_element_namespaceObject.createElement)(StyledIcon, {
  51007. icon: library_external,
  51008. className: "components-external-link__icon"
  51009. }))
  51010. /* eslint-enable react/jsx-no-target-blank */
  51011. );
  51012. }
  51013. /* harmony default export */ var external_link = ((0,external_wp_element_namespaceObject.forwardRef)(ExternalLink));
  51014. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-26bb1730.js
  51015. // Automatically generated
  51016. var POPOVER_STATE_KEYS = ["baseId", "unstable_idCountRef", "visible", "animated", "animating", "setBaseId", "show", "hide", "toggle", "setVisible", "setAnimated", "stopAnimation", "modal", "unstable_disclosureRef", "setModal", "unstable_referenceRef", "unstable_popoverRef", "unstable_arrowRef", "unstable_popoverStyles", "unstable_arrowStyles", "unstable_originalPlacement", "unstable_update", "placement", "place"];
  51017. var POPOVER_KEYS = POPOVER_STATE_KEYS;
  51018. var POPOVER_ARROW_KEYS = [].concat(POPOVER_KEYS, ["size"]);
  51019. var POPOVER_BACKDROP_KEYS = POPOVER_KEYS;
  51020. var POPOVER_DISCLOSURE_KEYS = POPOVER_BACKDROP_KEYS;
  51021. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-ed7b48af.js
  51022. // Automatically generated
  51023. var DIALOG_STATE_KEYS = ["baseId", "unstable_idCountRef", "visible", "animated", "animating", "setBaseId", "show", "hide", "toggle", "setVisible", "setAnimated", "stopAnimation", "modal", "unstable_disclosureRef", "setModal"];
  51024. var DIALOG_KEYS = [].concat(DIALOG_STATE_KEYS, ["hideOnEsc", "hideOnClickOutside", "preventBodyScroll", "unstable_initialFocusRef", "unstable_finalFocusRef", "unstable_orphan", "unstable_autoFocusOnShow", "unstable_autoFocusOnHide"]);
  51025. var DIALOG_BACKDROP_KEYS = DIALOG_STATE_KEYS;
  51026. var DIALOG_DISCLOSURE_KEYS = DIALOG_BACKDROP_KEYS;
  51027. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Button/Button.js
  51028. // Automatically generated
  51029. var BUTTON_KEYS = [];
  51030. var useButton = createHook({
  51031. name: "Button",
  51032. compose: useClickable,
  51033. keys: BUTTON_KEYS,
  51034. useProps: function useProps(_, _ref) {
  51035. var htmlRef = _ref.ref,
  51036. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["ref"]);
  51037. var ref = (0,external_React_.useRef)(null);
  51038. var _React$useState = (0,external_React_.useState)(undefined),
  51039. role = _React$useState[0],
  51040. setRole = _React$useState[1];
  51041. var _React$useState2 = (0,external_React_.useState)("button"),
  51042. type = _React$useState2[0],
  51043. setType = _React$useState2[1];
  51044. (0,external_React_.useEffect)(function () {
  51045. var element = ref.current;
  51046. if (!element) {
  51047. false ? 0 : void 0;
  51048. return;
  51049. }
  51050. if (!isButton(element)) {
  51051. if (element.tagName !== "A") {
  51052. setRole("button");
  51053. }
  51054. setType(undefined);
  51055. }
  51056. }, []);
  51057. return _objectSpread2({
  51058. ref: useForkRef(ref, htmlRef),
  51059. role: role,
  51060. type: type
  51061. }, htmlProps);
  51062. }
  51063. });
  51064. var Button_Button = createComponent({
  51065. as: "button",
  51066. memo: true,
  51067. useHook: useButton
  51068. });
  51069. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Disclosure/Disclosure.js
  51070. var useDisclosure = createHook({
  51071. name: "Disclosure",
  51072. compose: useButton,
  51073. keys: DISCLOSURE_KEYS,
  51074. useProps: function useProps(options, _ref) {
  51075. var htmlOnClick = _ref.onClick,
  51076. ariaControls = _ref["aria-controls"],
  51077. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["onClick", "aria-controls"]);
  51078. var onClickRef = useLiveRef(htmlOnClick);
  51079. var controls = ariaControls ? ariaControls + " " + options.baseId : options.baseId;
  51080. var onClick = (0,external_React_.useCallback)(function (event) {
  51081. var _onClickRef$current, _options$toggle;
  51082. (_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
  51083. if (event.defaultPrevented) return;
  51084. (_options$toggle = options.toggle) === null || _options$toggle === void 0 ? void 0 : _options$toggle.call(options);
  51085. }, [options.toggle]);
  51086. return _objectSpread2({
  51087. "aria-expanded": !!options.visible,
  51088. "aria-controls": controls,
  51089. onClick: onClick
  51090. }, htmlProps);
  51091. }
  51092. });
  51093. var Disclosure = createComponent({
  51094. as: "button",
  51095. memo: true,
  51096. useHook: useDisclosure
  51097. });
  51098. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Dialog/DialogDisclosure.js
  51099. var useDialogDisclosure = createHook({
  51100. name: "DialogDisclosure",
  51101. compose: useDisclosure,
  51102. keys: DIALOG_DISCLOSURE_KEYS,
  51103. useProps: function useProps(options, _ref) {
  51104. var htmlRef = _ref.ref,
  51105. htmlOnClick = _ref.onClick,
  51106. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["ref", "onClick"]);
  51107. var ref = (0,external_React_.useRef)(null);
  51108. var onClickRef = useLiveRef(htmlOnClick);
  51109. var _React$useState = (0,external_React_.useState)(false),
  51110. expanded = _React$useState[0],
  51111. setExpanded = _React$useState[1];
  51112. var disclosureRef = options.unstable_disclosureRef; // aria-expanded may be used for styling purposes, so we useLayoutEffect
  51113. useIsomorphicEffect(function () {
  51114. var element = ref.current;
  51115. false ? 0 : void 0;
  51116. if (disclosureRef && !disclosureRef.current) {
  51117. disclosureRef.current = element;
  51118. }
  51119. var isCurrentDisclosure = !(disclosureRef !== null && disclosureRef !== void 0 && disclosureRef.current) || disclosureRef.current === element;
  51120. setExpanded(!!options.visible && isCurrentDisclosure);
  51121. }, [options.visible, disclosureRef]);
  51122. var onClick = (0,external_React_.useCallback)(function (event) {
  51123. var _onClickRef$current;
  51124. (_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
  51125. if (event.defaultPrevented) return;
  51126. if (disclosureRef) {
  51127. disclosureRef.current = event.currentTarget;
  51128. }
  51129. }, [disclosureRef]);
  51130. return _objectSpread2({
  51131. ref: useForkRef(ref, htmlRef),
  51132. "aria-haspopup": "dialog",
  51133. "aria-expanded": expanded,
  51134. onClick: onClick
  51135. }, htmlProps);
  51136. }
  51137. });
  51138. var DialogDisclosure = createComponent({
  51139. as: "button",
  51140. memo: true,
  51141. useHook: useDialogDisclosure
  51142. });
  51143. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Popover/PopoverDisclosure.js
  51144. var usePopoverDisclosure = createHook({
  51145. name: "PopoverDisclosure",
  51146. compose: useDialogDisclosure,
  51147. keys: POPOVER_DISCLOSURE_KEYS,
  51148. useProps: function useProps(options, _ref) {
  51149. var htmlRef = _ref.ref,
  51150. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["ref"]);
  51151. return _objectSpread2({
  51152. ref: useForkRef(options.unstable_referenceRef, htmlRef)
  51153. }, htmlProps);
  51154. }
  51155. });
  51156. var PopoverDisclosure = createComponent({
  51157. as: "button",
  51158. memo: true,
  51159. useHook: usePopoverDisclosure
  51160. });
  51161. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flyout/context.js
  51162. /**
  51163. * WordPress dependencies
  51164. */
  51165. /**
  51166. * @type {import('react').Context<import('./types').Context>}
  51167. */
  51168. const FlyoutContext = (0,external_wp_element_namespaceObject.createContext)({});
  51169. const useFlyoutContext = () => (0,external_wp_element_namespaceObject.useContext)(FlyoutContext);
  51170. // EXTERNAL MODULE: ./node_modules/react-resize-aware/dist/index.js
  51171. var react_resize_aware_dist = __webpack_require__(235);
  51172. var react_resize_aware_dist_default = /*#__PURE__*/__webpack_require__.n(react_resize_aware_dist);
  51173. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flyout/utils.js
  51174. /**
  51175. * External dependencies
  51176. */
  51177. /**
  51178. * WordPress dependencies
  51179. */
  51180. /**
  51181. *
  51182. * @param { { onResize?: () => any } } onResize
  51183. */
  51184. function useFlyoutResizeUpdater(_ref) {
  51185. let {
  51186. onResize
  51187. } = _ref;
  51188. const [resizeListener, sizes] = react_resize_aware_dist_default()();
  51189. (0,external_wp_compose_namespaceObject.useIsomorphicLayoutEffect)(() => {
  51190. onResize === null || onResize === void 0 ? void 0 : onResize();
  51191. }, [sizes.width, sizes.height]);
  51192. return resizeListener;
  51193. }
  51194. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/useUpdateEffect.js
  51195. /**
  51196. * A `React.useEffect` that will not run on the first render.
  51197. */
  51198. function useUpdateEffect_useUpdateEffect(effect, deps) {
  51199. var mounted = (0,external_React_.useRef)(false);
  51200. (0,external_React_.useEffect)(function () {
  51201. if (mounted.current) {
  51202. return effect();
  51203. }
  51204. mounted.current = true;
  51205. return undefined;
  51206. }, deps);
  51207. }
  51208. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/removeIndexFromArray.js
  51209. /**
  51210. * Immutably removes an index from an array.
  51211. *
  51212. * @example
  51213. * import { removeIndexFromArray } from "reakit-utils";
  51214. *
  51215. * removeIndexFromArray(["a", "b", "c"], 1); // ["a", "c"]
  51216. *
  51217. * @returns {Array} A new array without the item in the passed index.
  51218. */
  51219. function removeIndexFromArray(array, index) {
  51220. if (index === -1) return array;
  51221. return [].concat(array.slice(0, index), array.slice(index + 1));
  51222. }
  51223. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/removeItemFromArray.js
  51224. /**
  51225. * Immutably removes an item from an array.
  51226. *
  51227. * @example
  51228. * import { removeItemFromArray } from "reakit-utils";
  51229. *
  51230. * removeItemFromArray(["a", "b", "c"], "b"); // ["a", "c"]
  51231. *
  51232. * // This only works by reference
  51233. * const obj = {};
  51234. * removeItemFromArray([obj], {}); // [obj]
  51235. * removeItemFromArray([obj], obj); // []
  51236. *
  51237. * @returns {Array} A new array without the passed item.
  51238. */
  51239. function removeItemFromArray_removeItemFromArray(array, item) {
  51240. var index = array.indexOf(item);
  51241. return removeIndexFromArray(array, index);
  51242. }
  51243. ;// CONCATENATED MODULE: ./node_modules/reakit/es/MenuContext-6af6cf92.js
  51244. var MenuContext = /*#__PURE__*/(0,external_React_.createContext)(null);
  51245. function useMenuContext(menuRef, role, options) {
  51246. var orphan = "unstable_orphan" in options && options.unstable_orphan;
  51247. var parent = useContext(MenuContext);
  51248. var _React$useState = useState([]),
  51249. children = _React$useState[0],
  51250. setChildren = _React$useState[1];
  51251. var _ref = parent || {},
  51252. addChildToParent = _ref.addChild,
  51253. removeChildFromParent = _ref.removeChild;
  51254. var addChild = useCallback(function (ref) {
  51255. return setChildren(function (refs) {
  51256. return [].concat(refs, [ref]);
  51257. });
  51258. }, []);
  51259. var removeChild = useCallback(function (ref) {
  51260. return setChildren(function (refs) {
  51261. return removeItemFromArray(refs, ref);
  51262. });
  51263. }, []); // If it's a nested menu, add it to parent
  51264. useEffect(function () {
  51265. if (!addChildToParent || orphan) return undefined;
  51266. addChildToParent(menuRef);
  51267. return function () {
  51268. removeChildFromParent === null || removeChildFromParent === void 0 ? void 0 : removeChildFromParent(menuRef);
  51269. };
  51270. }, [menuRef, addChildToParent, removeChildFromParent, orphan]);
  51271. var providerValue = useMemo(function () {
  51272. return {
  51273. orientation: options.orientation,
  51274. next: options.next,
  51275. previous: options.previous,
  51276. ref: menuRef,
  51277. role: role,
  51278. parent: parent,
  51279. children: children,
  51280. addChild: addChild,
  51281. removeChild: removeChild
  51282. };
  51283. }, [options.orientation, options.next, options.previous, menuRef, role, parent, children, addChild, removeChild]);
  51284. var wrapElement = useCallback(function (element) {
  51285. return /*#__PURE__*/createElement(MenuContext.Provider, {
  51286. value: providerValue
  51287. }, element);
  51288. }, [providerValue]);
  51289. return wrapElement;
  51290. }
  51291. ;// CONCATENATED MODULE: ./node_modules/body-scroll-lock/lib/bodyScrollLock.esm.js
  51292. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  51293. // Older browsers don't support event options, feature detect it.
  51294. // Adopted and modified solution from Bohdan Didukh (2017)
  51295. // https://stackoverflow.com/questions/41594997/ios-10-safari-prevent-scrolling-behind-a-fixed-overlay-and-maintain-scroll-posi
  51296. var hasPassiveEvents = false;
  51297. if (typeof window !== 'undefined') {
  51298. var passiveTestOptions = {
  51299. get passive() {
  51300. hasPassiveEvents = true;
  51301. return undefined;
  51302. }
  51303. };
  51304. window.addEventListener('testPassive', null, passiveTestOptions);
  51305. window.removeEventListener('testPassive', null, passiveTestOptions);
  51306. }
  51307. var isIosDevice = typeof window !== 'undefined' && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === 'MacIntel' && window.navigator.maxTouchPoints > 1);
  51308. var locks = [];
  51309. var documentListenerAdded = false;
  51310. var initialClientY = -1;
  51311. var previousBodyOverflowSetting = void 0;
  51312. var previousBodyPaddingRight = void 0;
  51313. // returns true if `el` should be allowed to receive touchmove events.
  51314. var allowTouchMove = function allowTouchMove(el) {
  51315. return locks.some(function (lock) {
  51316. if (lock.options.allowTouchMove && lock.options.allowTouchMove(el)) {
  51317. return true;
  51318. }
  51319. return false;
  51320. });
  51321. };
  51322. var preventDefault = function preventDefault(rawEvent) {
  51323. var e = rawEvent || window.event;
  51324. // For the case whereby consumers adds a touchmove event listener to document.
  51325. // Recall that we do document.addEventListener('touchmove', preventDefault, { passive: false })
  51326. // in disableBodyScroll - so if we provide this opportunity to allowTouchMove, then
  51327. // the touchmove event on document will break.
  51328. if (allowTouchMove(e.target)) {
  51329. return true;
  51330. }
  51331. // Do not prevent if the event has more than one touch (usually meaning this is a multi touch gesture like pinch to zoom).
  51332. if (e.touches.length > 1) return true;
  51333. if (e.preventDefault) e.preventDefault();
  51334. return false;
  51335. };
  51336. var setOverflowHidden = function setOverflowHidden(options) {
  51337. // If previousBodyPaddingRight is already set, don't set it again.
  51338. if (previousBodyPaddingRight === undefined) {
  51339. var _reserveScrollBarGap = !!options && options.reserveScrollBarGap === true;
  51340. var scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
  51341. if (_reserveScrollBarGap && scrollBarGap > 0) {
  51342. previousBodyPaddingRight = document.body.style.paddingRight;
  51343. document.body.style.paddingRight = scrollBarGap + 'px';
  51344. }
  51345. }
  51346. // If previousBodyOverflowSetting is already set, don't set it again.
  51347. if (previousBodyOverflowSetting === undefined) {
  51348. previousBodyOverflowSetting = document.body.style.overflow;
  51349. document.body.style.overflow = 'hidden';
  51350. }
  51351. };
  51352. var restoreOverflowSetting = function restoreOverflowSetting() {
  51353. if (previousBodyPaddingRight !== undefined) {
  51354. document.body.style.paddingRight = previousBodyPaddingRight;
  51355. // Restore previousBodyPaddingRight to undefined so setOverflowHidden knows it
  51356. // can be set again.
  51357. previousBodyPaddingRight = undefined;
  51358. }
  51359. if (previousBodyOverflowSetting !== undefined) {
  51360. document.body.style.overflow = previousBodyOverflowSetting;
  51361. // Restore previousBodyOverflowSetting to undefined
  51362. // so setOverflowHidden knows it can be set again.
  51363. previousBodyOverflowSetting = undefined;
  51364. }
  51365. };
  51366. // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
  51367. var isTargetElementTotallyScrolled = function isTargetElementTotallyScrolled(targetElement) {
  51368. return targetElement ? targetElement.scrollHeight - targetElement.scrollTop <= targetElement.clientHeight : false;
  51369. };
  51370. var handleScroll = function handleScroll(event, targetElement) {
  51371. var clientY = event.targetTouches[0].clientY - initialClientY;
  51372. if (allowTouchMove(event.target)) {
  51373. return false;
  51374. }
  51375. if (targetElement && targetElement.scrollTop === 0 && clientY > 0) {
  51376. // element is at the top of its scroll.
  51377. return preventDefault(event);
  51378. }
  51379. if (isTargetElementTotallyScrolled(targetElement) && clientY < 0) {
  51380. // element is at the bottom of its scroll.
  51381. return preventDefault(event);
  51382. }
  51383. event.stopPropagation();
  51384. return true;
  51385. };
  51386. var disableBodyScroll = function disableBodyScroll(targetElement, options) {
  51387. // targetElement must be provided
  51388. if (!targetElement) {
  51389. // eslint-disable-next-line no-console
  51390. console.error('disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.');
  51391. return;
  51392. }
  51393. // disableBodyScroll must not have been called on this targetElement before
  51394. if (locks.some(function (lock) {
  51395. return lock.targetElement === targetElement;
  51396. })) {
  51397. return;
  51398. }
  51399. var lock = {
  51400. targetElement: targetElement,
  51401. options: options || {}
  51402. };
  51403. locks = [].concat(_toConsumableArray(locks), [lock]);
  51404. if (isIosDevice) {
  51405. targetElement.ontouchstart = function (event) {
  51406. if (event.targetTouches.length === 1) {
  51407. // detect single touch.
  51408. initialClientY = event.targetTouches[0].clientY;
  51409. }
  51410. };
  51411. targetElement.ontouchmove = function (event) {
  51412. if (event.targetTouches.length === 1) {
  51413. // detect single touch.
  51414. handleScroll(event, targetElement);
  51415. }
  51416. };
  51417. if (!documentListenerAdded) {
  51418. document.addEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);
  51419. documentListenerAdded = true;
  51420. }
  51421. } else {
  51422. setOverflowHidden(options);
  51423. }
  51424. };
  51425. var clearAllBodyScrollLocks = function clearAllBodyScrollLocks() {
  51426. if (isIosDevice) {
  51427. // Clear all locks ontouchstart/ontouchmove handlers, and the references.
  51428. locks.forEach(function (lock) {
  51429. lock.targetElement.ontouchstart = null;
  51430. lock.targetElement.ontouchmove = null;
  51431. });
  51432. if (documentListenerAdded) {
  51433. document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);
  51434. documentListenerAdded = false;
  51435. }
  51436. // Reset initial clientY.
  51437. initialClientY = -1;
  51438. } else {
  51439. restoreOverflowSetting();
  51440. }
  51441. locks = [];
  51442. };
  51443. var enableBodyScroll = function enableBodyScroll(targetElement) {
  51444. if (!targetElement) {
  51445. // eslint-disable-next-line no-console
  51446. console.error('enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.');
  51447. return;
  51448. }
  51449. locks = locks.filter(function (lock) {
  51450. return lock.targetElement !== targetElement;
  51451. });
  51452. if (isIosDevice) {
  51453. targetElement.ontouchstart = null;
  51454. targetElement.ontouchmove = null;
  51455. if (documentListenerAdded && locks.length === 0) {
  51456. document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);
  51457. documentListenerAdded = false;
  51458. }
  51459. } else if (!locks.length) {
  51460. restoreOverflowSetting();
  51461. }
  51462. };
  51463. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/closest.js
  51464. /**
  51465. * Ponyfill for `Element.prototype.closest`
  51466. *
  51467. * @example
  51468. * import { closest } from "reakit-utils";
  51469. *
  51470. * closest(document.getElementById("id"), "div");
  51471. * // same as
  51472. * document.getElementById("id").closest("div");
  51473. */
  51474. function closest_closest(element, selectors) {
  51475. if ("closest" in element) return element.closest(selectors);
  51476. do {
  51477. if (matches(element, selectors)) return element;
  51478. element = element.parentElement || element.parentNode;
  51479. } while (element !== null && element.nodeType === 1);
  51480. return null;
  51481. }
  51482. ;// CONCATENATED MODULE: ./node_modules/reakit/es/DialogBackdropContext-8775f78b.js
  51483. var DialogBackdropContext = /*#__PURE__*/(0,external_React_.createContext)(undefined);
  51484. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isEmpty.js
  51485. /**
  51486. * Checks whether `arg` is empty or not.
  51487. *
  51488. * @example
  51489. * import { isEmpty } from "reakit-utils";
  51490. *
  51491. * isEmpty([]); // true
  51492. * isEmpty(["a"]); // false
  51493. * isEmpty({}); // true
  51494. * isEmpty({ a: "a" }); // false
  51495. * isEmpty(); // true
  51496. * isEmpty(null); // true
  51497. * isEmpty(undefined); // true
  51498. * isEmpty(""); // true
  51499. */
  51500. function isEmpty(arg) {
  51501. if (Array.isArray(arg)) return !arg.length;
  51502. if (isObject_isObject(arg)) return !Object.keys(arg).length;
  51503. if (arg == null) return true;
  51504. if (arg === "") return true;
  51505. return false;
  51506. }
  51507. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Dialog/Dialog.js
  51508. function useDisclosureRef(dialogRef, options) {
  51509. var ref = (0,external_React_.useRef)(null);
  51510. var animating = !!(options.animated && options.animating);
  51511. (0,external_React_.useEffect)(function () {
  51512. if (options.visible || animating) return undefined; // We get the last focused element before the dialog opens, so we can move
  51513. // focus back to it when the dialog closes.
  51514. var onFocus = function onFocus(event) {
  51515. var target = event.target;
  51516. if ("focus" in target) {
  51517. ref.current = target;
  51518. if (options.unstable_disclosureRef) {
  51519. options.unstable_disclosureRef.current = target;
  51520. }
  51521. }
  51522. };
  51523. var document = getDocument(dialogRef.current);
  51524. document.addEventListener("focusin", onFocus);
  51525. return function () {
  51526. return document.removeEventListener("focusin", onFocus);
  51527. };
  51528. }, [options.visible, animating, options.unstable_disclosureRef, dialogRef]);
  51529. (0,external_React_.useEffect)(function () {
  51530. var _options$unstable_dis;
  51531. if (!options.visible || animating) return undefined; // Safari and Firefox on MacOS don't focus on buttons on mouse down.
  51532. // Instead, they focus on the closest focusable parent (ultimately, the
  51533. // body element). This works around that by preventing that behavior and
  51534. // forcing focus on the disclosure button. Otherwise, we wouldn't be able
  51535. // to close the dialog by clicking again on the disclosure.
  51536. var onMouseDown = function onMouseDown(event) {
  51537. var element = event.currentTarget;
  51538. if (!isButton(element)) return;
  51539. event.preventDefault();
  51540. element.focus();
  51541. };
  51542. var disclosure = ((_options$unstable_dis = options.unstable_disclosureRef) === null || _options$unstable_dis === void 0 ? void 0 : _options$unstable_dis.current) || ref.current;
  51543. disclosure === null || disclosure === void 0 ? void 0 : disclosure.addEventListener("mousedown", onMouseDown);
  51544. return function () {
  51545. return disclosure === null || disclosure === void 0 ? void 0 : disclosure.removeEventListener("mousedown", onMouseDown);
  51546. };
  51547. }, [options.visible, animating, options.unstable_disclosureRef]);
  51548. return options.unstable_disclosureRef || ref;
  51549. }
  51550. function usePreventBodyScroll(targetRef, options) {
  51551. var shouldPrevent = Boolean(options.preventBodyScroll && options.visible);
  51552. (0,external_React_.useEffect)(function () {
  51553. var element = targetRef.current;
  51554. if (!element || !shouldPrevent) return undefined;
  51555. disableBodyScroll(element, {
  51556. reserveScrollBarGap: true
  51557. });
  51558. return function () {
  51559. return enableBodyScroll(element);
  51560. };
  51561. }, [targetRef, shouldPrevent]);
  51562. }
  51563. function useFocusOnShow(dialogRef, nestedDialogs, options) {
  51564. var initialFocusRef = options.unstable_initialFocusRef;
  51565. var shouldFocus = options.visible && options.unstable_autoFocusOnShow;
  51566. var animating = !!(options.animated && options.animating);
  51567. useUpdateEffect_useUpdateEffect(function () {
  51568. var dialog = dialogRef.current;
  51569. false ? 0 : void 0;
  51570. if (!shouldFocus) return;
  51571. if (!dialog) return;
  51572. if (animating) return; // If there're nested open dialogs, let them handle focus
  51573. if (nestedDialogs.some(function (child) {
  51574. return child.current && !child.current.hidden;
  51575. })) {
  51576. return;
  51577. }
  51578. if (initialFocusRef !== null && initialFocusRef !== void 0 && initialFocusRef.current) {
  51579. initialFocusRef.current.focus({
  51580. preventScroll: true
  51581. });
  51582. } else {
  51583. var tabbable = getFirstTabbableIn(dialog, true);
  51584. var isActive = function isActive() {
  51585. return hasFocusWithin(dialog);
  51586. };
  51587. if (tabbable) {
  51588. ensureFocus(tabbable, {
  51589. preventScroll: true,
  51590. isActive: isActive
  51591. });
  51592. } else {
  51593. ensureFocus(dialog, {
  51594. preventScroll: true,
  51595. isActive: isActive
  51596. });
  51597. false ? 0 : void 0;
  51598. }
  51599. }
  51600. }, [dialogRef, shouldFocus, animating, nestedDialogs, initialFocusRef]);
  51601. }
  51602. function usePortalRef(dialogRef, options) {
  51603. var portalRef = (0,external_React_.useRef)(null);
  51604. (0,external_React_.useEffect)(function () {
  51605. var dialog = dialogRef.current;
  51606. if (!dialog || !options.visible) return;
  51607. portalRef.current = closest_closest(dialog, Portal.__selector);
  51608. }, [dialogRef, options.visible]);
  51609. return portalRef;
  51610. }
  51611. function removeFromDOM(element) {
  51612. if (element.parentNode == null) return;
  51613. element.parentNode.removeChild(element);
  51614. }
  51615. var focusTrapClassName = "__reakit-focus-trap";
  51616. function isFocusTrap(element) {
  51617. var _element$classList;
  51618. return (_element$classList = element.classList) === null || _element$classList === void 0 ? void 0 : _element$classList.contains(focusTrapClassName);
  51619. }
  51620. function useFocusTrap(dialogRef, visibleModals, options) {
  51621. var portalRef = usePortalRef(dialogRef, options);
  51622. var shouldTrap = options.visible && options.modal;
  51623. var beforeElement = (0,external_React_.useRef)(null);
  51624. var afterElement = (0,external_React_.useRef)(null); // Create before and after elements
  51625. // https://github.com/w3c/aria-practices/issues/545
  51626. (0,external_React_.useEffect)(function () {
  51627. if (!shouldTrap) return undefined;
  51628. var portal = portalRef.current;
  51629. if (!portal) {
  51630. false ? 0 : void 0;
  51631. return undefined;
  51632. }
  51633. if (!beforeElement.current) {
  51634. var document = getDocument(portal);
  51635. beforeElement.current = document.createElement("div");
  51636. beforeElement.current.className = focusTrapClassName;
  51637. beforeElement.current.tabIndex = 0;
  51638. beforeElement.current.style.position = "fixed";
  51639. beforeElement.current.setAttribute("aria-hidden", "true");
  51640. }
  51641. if (!afterElement.current) {
  51642. afterElement.current = beforeElement.current.cloneNode();
  51643. }
  51644. portal.insertAdjacentElement("beforebegin", beforeElement.current);
  51645. portal.insertAdjacentElement("afterend", afterElement.current);
  51646. return function () {
  51647. if (beforeElement.current) removeFromDOM(beforeElement.current);
  51648. if (afterElement.current) removeFromDOM(afterElement.current);
  51649. };
  51650. }, [portalRef, shouldTrap]); // Focus trap
  51651. (0,external_React_.useEffect)(function () {
  51652. var before = beforeElement.current;
  51653. var after = afterElement.current;
  51654. if (!shouldTrap || !before || !after) return undefined;
  51655. var handleFocus = function handleFocus(event) {
  51656. var dialog = dialogRef.current;
  51657. if (!dialog || visibleModals.length) return;
  51658. event.preventDefault();
  51659. var isAfter = event.target === after;
  51660. var tabbable = isAfter ? getFirstTabbableIn(dialog) : getLastTabbableIn(dialog);
  51661. if (tabbable) {
  51662. tabbable.focus();
  51663. } else {
  51664. // fallback to dialog
  51665. dialog.focus();
  51666. }
  51667. };
  51668. before.addEventListener("focus", handleFocus);
  51669. after.addEventListener("focus", handleFocus);
  51670. return function () {
  51671. before.removeEventListener("focus", handleFocus);
  51672. after.removeEventListener("focus", handleFocus);
  51673. };
  51674. }, [dialogRef, visibleModals, shouldTrap]);
  51675. }
  51676. function hidByFocusingAnotherElement(dialogRef) {
  51677. var dialog = dialogRef.current;
  51678. if (!dialog) return false;
  51679. var activeElement = getActiveElement_getActiveElement(dialog);
  51680. if (!activeElement) return false;
  51681. if (contains(dialog, activeElement)) return false;
  51682. if (isTabbable(activeElement)) return true;
  51683. if (activeElement.getAttribute("data-dialog") === "true") return true;
  51684. return false;
  51685. }
  51686. function useFocusOnHide(dialogRef, disclosureRef, options) {
  51687. var shouldFocus = options.unstable_autoFocusOnHide && !options.visible;
  51688. var animating = !!(options.animated && options.animating);
  51689. useUpdateEffect_useUpdateEffect(function () {
  51690. var _options$unstable_fin;
  51691. if (!shouldFocus) return;
  51692. if (animating) return; // Hide was triggered by a click/focus on a tabbable element outside
  51693. // the dialog or on another dialog. We won't change focus then.
  51694. if (hidByFocusingAnotherElement(dialogRef)) {
  51695. return;
  51696. }
  51697. var finalFocusEl = ((_options$unstable_fin = options.unstable_finalFocusRef) === null || _options$unstable_fin === void 0 ? void 0 : _options$unstable_fin.current) || disclosureRef.current;
  51698. if (finalFocusEl) {
  51699. if (finalFocusEl.id) {
  51700. var document = getDocument(finalFocusEl);
  51701. var compositeElement = document.querySelector("[aria-activedescendant='" + finalFocusEl.id + "']");
  51702. if (compositeElement) {
  51703. ensureFocus(compositeElement);
  51704. return;
  51705. }
  51706. }
  51707. ensureFocus(finalFocusEl);
  51708. return;
  51709. }
  51710. false ? 0 : void 0;
  51711. }, [shouldFocus, animating, dialogRef, disclosureRef]);
  51712. }
  51713. var DialogContext = /*#__PURE__*/(0,external_React_.createContext)({});
  51714. function useNestedDialogs(dialogRef, options) {
  51715. var context = (0,external_React_.useContext)(DialogContext);
  51716. var _React$useState = (0,external_React_.useState)([]),
  51717. dialogs = _React$useState[0],
  51718. setDialogs = _React$useState[1];
  51719. var _React$useState2 = (0,external_React_.useState)(dialogs),
  51720. visibleModals = _React$useState2[0],
  51721. setVisibleModals = _React$useState2[1];
  51722. var addDialog = (0,external_React_.useCallback)(function (ref) {
  51723. var _context$addDialog;
  51724. (_context$addDialog = context.addDialog) === null || _context$addDialog === void 0 ? void 0 : _context$addDialog.call(context, ref);
  51725. setDialogs(function (prevDialogs) {
  51726. return [].concat(prevDialogs, [ref]);
  51727. });
  51728. }, [context.addDialog]);
  51729. var removeDialog = (0,external_React_.useCallback)(function (ref) {
  51730. var _context$removeDialog;
  51731. (_context$removeDialog = context.removeDialog) === null || _context$removeDialog === void 0 ? void 0 : _context$removeDialog.call(context, ref);
  51732. setDialogs(function (prevDialogs) {
  51733. return removeItemFromArray_removeItemFromArray(prevDialogs, ref);
  51734. });
  51735. }, [context.removeDialog]);
  51736. var showDialog = (0,external_React_.useCallback)(function (ref) {
  51737. var _context$showDialog;
  51738. (_context$showDialog = context.showDialog) === null || _context$showDialog === void 0 ? void 0 : _context$showDialog.call(context, ref);
  51739. setVisibleModals(function (prevDialogs) {
  51740. return [].concat(prevDialogs, [ref]);
  51741. });
  51742. }, [context.showDialog]);
  51743. var hideDialog = (0,external_React_.useCallback)(function (ref) {
  51744. var _context$hideDialog;
  51745. (_context$hideDialog = context.hideDialog) === null || _context$hideDialog === void 0 ? void 0 : _context$hideDialog.call(context, ref);
  51746. setVisibleModals(function (prevDialogs) {
  51747. return removeItemFromArray_removeItemFromArray(prevDialogs, ref);
  51748. });
  51749. }, [context.hideDialog]); // If it's a nested dialog, add it to context
  51750. (0,external_React_.useEffect)(function () {
  51751. var _context$addDialog2;
  51752. if (options.unstable_orphan) return undefined;
  51753. (_context$addDialog2 = context.addDialog) === null || _context$addDialog2 === void 0 ? void 0 : _context$addDialog2.call(context, dialogRef);
  51754. return function () {
  51755. var _context$removeDialog2;
  51756. (_context$removeDialog2 = context.removeDialog) === null || _context$removeDialog2 === void 0 ? void 0 : _context$removeDialog2.call(context, dialogRef);
  51757. };
  51758. }, [options.unstable_orphan, context.addDialog, dialogRef, context.removeDialog]);
  51759. (0,external_React_.useEffect)(function () {
  51760. var _context$showDialog2;
  51761. if (options.unstable_orphan) return undefined;
  51762. if (!options.modal) return undefined;
  51763. if (!options.visible) return undefined;
  51764. (_context$showDialog2 = context.showDialog) === null || _context$showDialog2 === void 0 ? void 0 : _context$showDialog2.call(context, dialogRef);
  51765. return function () {
  51766. var _context$hideDialog2;
  51767. (_context$hideDialog2 = context.hideDialog) === null || _context$hideDialog2 === void 0 ? void 0 : _context$hideDialog2.call(context, dialogRef);
  51768. };
  51769. }, [options.unstable_orphan, options.modal, options.visible, context.showDialog, dialogRef, context.hideDialog]); // Close all nested dialogs when parent dialog closes
  51770. (0,external_React_.useEffect)(function () {
  51771. if (context.visible === false && options.visible && !options.unstable_orphan) {
  51772. var _options$hide;
  51773. (_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);
  51774. }
  51775. }, [context.visible, options.visible, options.hide, options.unstable_orphan]); // Provider
  51776. var providerValue = (0,external_React_.useMemo)(function () {
  51777. return {
  51778. visible: options.visible,
  51779. addDialog: addDialog,
  51780. removeDialog: removeDialog,
  51781. showDialog: showDialog,
  51782. hideDialog: hideDialog
  51783. };
  51784. }, [options.visible, addDialog, removeDialog, showDialog, hideDialog]);
  51785. var wrap = (0,external_React_.useCallback)(function (element) {
  51786. return /*#__PURE__*/(0,external_React_.createElement)(DialogContext.Provider, {
  51787. value: providerValue
  51788. }, element);
  51789. }, [providerValue]);
  51790. return {
  51791. dialogs: dialogs,
  51792. visibleModals: visibleModals,
  51793. wrap: wrap
  51794. };
  51795. }
  51796. function dialogContains(target) {
  51797. return function (dialogRef) {
  51798. var dialog = dialogRef.current;
  51799. if (!dialog) return false;
  51800. if (contains(dialog, target)) return true;
  51801. var document = getDocument(dialog);
  51802. var backdrop = document.querySelector("[data-dialog-ref=\"" + dialog.id + "\"]");
  51803. if (backdrop) {
  51804. return contains(backdrop, target);
  51805. }
  51806. return false;
  51807. };
  51808. }
  51809. function isDisclosure(target, disclosure) {
  51810. return contains(disclosure, target);
  51811. }
  51812. function isInDocument(target) {
  51813. var document = getDocument(target);
  51814. if (target.tagName === "HTML") {
  51815. return true;
  51816. }
  51817. return contains(document.body, target);
  51818. }
  51819. function useEventListenerOutside(containerRef, disclosureRef, nestedDialogs, eventType, listener, shouldListen, capture) {
  51820. var listenerRef = useLiveRef(listener);
  51821. (0,external_React_.useEffect)(function () {
  51822. if (!shouldListen) return undefined;
  51823. var onEvent = function onEvent(event) {
  51824. if (!listenerRef.current) return;
  51825. var container = containerRef.current;
  51826. var disclosure = disclosureRef.current;
  51827. var target = event.target;
  51828. if (!container) {
  51829. false ? 0 : void 0;
  51830. return;
  51831. } // When an element is unmounted right after it receives focus, the focus
  51832. // event is triggered after that, when the element isn't part of the
  51833. // current document anymore. So we ignore it.
  51834. if (!isInDocument(target)) return; // Event inside dialog
  51835. if (contains(container, target)) return; // Event on disclosure
  51836. if (disclosure && isDisclosure(target, disclosure)) return; // Event inside a nested dialog or focus trap
  51837. if (isFocusTrap(target) || nestedDialogs.some(dialogContains(target))) {
  51838. return;
  51839. }
  51840. listenerRef.current(event);
  51841. };
  51842. var document = getDocument(containerRef.current);
  51843. document.addEventListener(eventType, onEvent, capture);
  51844. return function () {
  51845. return document.removeEventListener(eventType, onEvent, capture);
  51846. };
  51847. }, [containerRef, disclosureRef, nestedDialogs, eventType, shouldListen, listenerRef]);
  51848. }
  51849. function useMouseDownRef(dialogRef, options) {
  51850. var mouseDownRef = (0,external_React_.useRef)();
  51851. (0,external_React_.useEffect)(function () {
  51852. if (!options.visible) return undefined;
  51853. if (!options.hideOnClickOutside) return undefined;
  51854. var document = getDocument(dialogRef.current);
  51855. var onMouseDown = function onMouseDown(event) {
  51856. mouseDownRef.current = event.target;
  51857. };
  51858. document.addEventListener("mousedown", onMouseDown);
  51859. return function () {
  51860. return document.removeEventListener("mousedown", onMouseDown);
  51861. };
  51862. }, [options.visible, options.hideOnClickOutside, dialogRef]);
  51863. return mouseDownRef;
  51864. }
  51865. function useHideOnClickOutside(dialogRef, disclosureRef, nestedDialogs, options) {
  51866. var mouseDownRef = useMouseDownRef(dialogRef, options);
  51867. useEventListenerOutside(dialogRef, disclosureRef, nestedDialogs, "click", function (event) {
  51868. // Make sure the element that has been clicked is the same that last
  51869. // triggered the mousedown event. This prevents the dialog from closing
  51870. // by dragging the cursor (for example, selecting some text inside the
  51871. // dialog and releasing the mouse outside of it).
  51872. if (mouseDownRef.current === event.target) {
  51873. var _options$hide;
  51874. (_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);
  51875. }
  51876. }, options.visible && options.hideOnClickOutside);
  51877. useEventListenerOutside(dialogRef, disclosureRef, nestedDialogs, "focusin", function (event) {
  51878. var document = getDocument(dialogRef.current); // Fix for https://github.com/reakit/reakit/issues/619
  51879. // On IE11, calling element.blur() triggers the focus event on
  51880. // document.body, so we make sure to ignore it as well.
  51881. if (event.target !== document && event.target !== document.body) {
  51882. var _options$hide2;
  51883. (_options$hide2 = options.hide) === null || _options$hide2 === void 0 ? void 0 : _options$hide2.call(options);
  51884. }
  51885. }, options.visible && options.hideOnClickOutside);
  51886. }
  51887. function useDisableHoverOutside(portalRef, nestedDialogs, options) {
  51888. var useEvent = function useEvent(eventType) {
  51889. return useEventListenerOutside(portalRef, {
  51890. current: null
  51891. }, nestedDialogs, eventType, function (event) {
  51892. event.stopPropagation();
  51893. event.preventDefault();
  51894. }, options.visible && options.modal, true);
  51895. };
  51896. useEvent("mouseover");
  51897. useEvent("mousemove");
  51898. useEvent("mouseout");
  51899. }
  51900. /**
  51901. * When the focused child gets removed from the DOM, we make sure to move focus
  51902. * to the dialog.
  51903. */
  51904. function useFocusOnChildUnmount(dialogRef, options) {
  51905. (0,external_React_.useEffect)(function () {
  51906. var dialog = dialogRef.current;
  51907. if (!options.visible || !dialog) return undefined;
  51908. var observer = new MutationObserver(function (mutations) {
  51909. var target = mutations[0].target; // If target is not this dialog, then this observer was triggered by a
  51910. // nested dialog, so we just ignore it here and let the nested dialog
  51911. // handle it there.
  51912. if (target !== dialog) return;
  51913. var document = getDocument(dialog);
  51914. var activeElement = getActiveElement_getActiveElement(dialog); // We can check if the current focused element is the document body. On
  51915. // IE 11, it's an empty object when the current document is in a frame or
  51916. // iframe.
  51917. if (activeElement === document.body || isEmpty(activeElement)) {
  51918. dialog.focus();
  51919. }
  51920. });
  51921. observer.observe(dialog, {
  51922. childList: true,
  51923. subtree: true
  51924. });
  51925. return function () {
  51926. observer.disconnect();
  51927. };
  51928. }, [options.visible, dialogRef]);
  51929. }
  51930. function isActualElement(element) {
  51931. return element && element.tagName && element.tagName !== "HTML" && element !== getDocument(element).body;
  51932. }
  51933. function useFocusOnBlur(dialogRef, options) {
  51934. var _React$useReducer = (0,external_React_.useReducer)(function (n) {
  51935. return n + 1;
  51936. }, 0),
  51937. blurred = _React$useReducer[0],
  51938. scheduleFocus = _React$useReducer[1];
  51939. useIsomorphicEffect(function () {
  51940. var dialog = dialogRef.current;
  51941. if (!options.visible) return;
  51942. if (!blurred) return; // After blur, if the active element isn't an actual element, this probably
  51943. // means that element.blur() was called on an element inside the dialog.
  51944. // In this case, the browser will automatically focus the body element.
  51945. // So we move focus back to the dialog.
  51946. if (!isActualElement(getActiveElement_getActiveElement(dialog))) {
  51947. false ? 0 : void 0;
  51948. dialog === null || dialog === void 0 ? void 0 : dialog.focus();
  51949. }
  51950. }, [blurred, dialogRef]);
  51951. var onBlur = (0,external_React_.useCallback)(function (event) {
  51952. if (!options.visible) return;
  51953. var nextActiveElement = getNextActiveElementOnBlur(event);
  51954. if (!isActualElement(nextActiveElement)) {
  51955. scheduleFocus();
  51956. }
  51957. }, [options.visible]);
  51958. return onBlur;
  51959. }
  51960. var useDialog = createHook({
  51961. name: "Dialog",
  51962. compose: useDisclosureContent,
  51963. keys: DIALOG_KEYS,
  51964. useOptions: function useOptions(_ref) {
  51965. var _ref$modal = _ref.modal,
  51966. modal = _ref$modal === void 0 ? true : _ref$modal,
  51967. _ref$hideOnEsc = _ref.hideOnEsc,
  51968. hideOnEsc = _ref$hideOnEsc === void 0 ? true : _ref$hideOnEsc,
  51969. _ref$hideOnClickOutsi = _ref.hideOnClickOutside,
  51970. hideOnClickOutside = _ref$hideOnClickOutsi === void 0 ? true : _ref$hideOnClickOutsi,
  51971. _ref$preventBodyScrol = _ref.preventBodyScroll,
  51972. preventBodyScroll = _ref$preventBodyScrol === void 0 ? modal : _ref$preventBodyScrol,
  51973. _ref$unstable_autoFoc = _ref.unstable_autoFocusOnShow,
  51974. unstable_autoFocusOnShow = _ref$unstable_autoFoc === void 0 ? true : _ref$unstable_autoFoc,
  51975. _ref$unstable_autoFoc2 = _ref.unstable_autoFocusOnHide,
  51976. unstable_autoFocusOnHide = _ref$unstable_autoFoc2 === void 0 ? true : _ref$unstable_autoFoc2,
  51977. unstable_orphan = _ref.unstable_orphan,
  51978. options = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["modal", "hideOnEsc", "hideOnClickOutside", "preventBodyScroll", "unstable_autoFocusOnShow", "unstable_autoFocusOnHide", "unstable_orphan"]);
  51979. return _objectSpread2({
  51980. modal: modal,
  51981. hideOnEsc: hideOnEsc,
  51982. hideOnClickOutside: hideOnClickOutside,
  51983. preventBodyScroll: modal && preventBodyScroll,
  51984. unstable_autoFocusOnShow: unstable_autoFocusOnShow,
  51985. unstable_autoFocusOnHide: unstable_autoFocusOnHide,
  51986. unstable_orphan: modal && unstable_orphan
  51987. }, options);
  51988. },
  51989. useProps: function useProps(options, _ref2) {
  51990. var htmlRef = _ref2.ref,
  51991. htmlOnKeyDown = _ref2.onKeyDown,
  51992. htmlOnBlur = _ref2.onBlur,
  51993. htmlWrapElement = _ref2.wrapElement,
  51994. tabIndex = _ref2.tabIndex,
  51995. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref2, ["ref", "onKeyDown", "onBlur", "wrapElement", "tabIndex"]);
  51996. var dialog = (0,external_React_.useRef)(null);
  51997. var backdrop = (0,external_React_.useContext)(DialogBackdropContext);
  51998. var hasBackdrop = backdrop && backdrop === options.baseId;
  51999. var disclosure = useDisclosureRef(dialog, options);
  52000. var onKeyDownRef = useLiveRef(htmlOnKeyDown);
  52001. var onBlurRef = useLiveRef(htmlOnBlur);
  52002. var focusOnBlur = useFocusOnBlur(dialog, options);
  52003. var _useNestedDialogs = useNestedDialogs(dialog, options),
  52004. dialogs = _useNestedDialogs.dialogs,
  52005. visibleModals = _useNestedDialogs.visibleModals,
  52006. wrap = _useNestedDialogs.wrap; // VoiceOver/Safari accepts only one `aria-modal` container, so if there
  52007. // are visible child modals, then we don't want to set aria-modal on the
  52008. // parent modal (this component).
  52009. var modal = options.modal && !visibleModals.length ? true : undefined;
  52010. usePreventBodyScroll(dialog, options);
  52011. useFocusTrap(dialog, visibleModals, options);
  52012. useFocusOnChildUnmount(dialog, options);
  52013. useFocusOnShow(dialog, dialogs, options);
  52014. useFocusOnHide(dialog, disclosure, options);
  52015. useHideOnClickOutside(dialog, disclosure, dialogs, options);
  52016. useDisableHoverOutside(dialog, dialogs, options);
  52017. var onKeyDown = (0,external_React_.useCallback)(function (event) {
  52018. var _onKeyDownRef$current;
  52019. (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
  52020. if (event.defaultPrevented) return;
  52021. if (event.key !== "Escape") return;
  52022. if (!options.hideOnEsc) return;
  52023. if (!options.hide) {
  52024. false ? 0 : void 0;
  52025. return;
  52026. }
  52027. event.stopPropagation();
  52028. options.hide();
  52029. }, [options.hideOnEsc, options.hide]);
  52030. var onBlur = (0,external_React_.useCallback)(function (event) {
  52031. var _onBlurRef$current;
  52032. (_onBlurRef$current = onBlurRef.current) === null || _onBlurRef$current === void 0 ? void 0 : _onBlurRef$current.call(onBlurRef, event);
  52033. focusOnBlur(event);
  52034. }, [focusOnBlur]);
  52035. var wrapElement = (0,external_React_.useCallback)(function (element) {
  52036. element = wrap(element);
  52037. if (options.modal && !hasBackdrop) {
  52038. element = /*#__PURE__*/(0,external_React_.createElement)(Portal, null, element);
  52039. }
  52040. if (htmlWrapElement) {
  52041. element = htmlWrapElement(element);
  52042. }
  52043. return (
  52044. /*#__PURE__*/
  52045. // Prevents Menu > Dialog > Menu to behave as a sub menu
  52046. (0,external_React_.createElement)(MenuContext.Provider, {
  52047. value: null
  52048. }, element)
  52049. );
  52050. }, [wrap, options.modal, hasBackdrop, htmlWrapElement]);
  52051. return _objectSpread2({
  52052. ref: useForkRef(dialog, htmlRef),
  52053. role: "dialog",
  52054. tabIndex: tabIndex != null ? tabIndex : -1,
  52055. "aria-modal": modal,
  52056. "data-dialog": true,
  52057. onKeyDown: onKeyDown,
  52058. onBlur: onBlur,
  52059. wrapElement: wrapElement
  52060. }, htmlProps);
  52061. }
  52062. });
  52063. var Dialog = createComponent({
  52064. as: "div",
  52065. useHook: useDialog,
  52066. useCreateElement: function useCreateElement$1(type, props, children) {
  52067. false ? 0 : void 0;
  52068. return useCreateElement(type, props, children);
  52069. }
  52070. });
  52071. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Popover/Popover.js
  52072. var usePopover = createHook({
  52073. name: "Popover",
  52074. compose: useDialog,
  52075. keys: POPOVER_KEYS,
  52076. useOptions: function useOptions(_ref) {
  52077. var _ref$modal = _ref.modal,
  52078. modal = _ref$modal === void 0 ? false : _ref$modal,
  52079. options = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["modal"]);
  52080. return _objectSpread2({
  52081. modal: modal
  52082. }, options);
  52083. },
  52084. useProps: function useProps(options, _ref2) {
  52085. var htmlRef = _ref2.ref,
  52086. htmlStyle = _ref2.style,
  52087. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref2, ["ref", "style"]);
  52088. return _objectSpread2({
  52089. ref: useForkRef(options.unstable_popoverRef, htmlRef),
  52090. style: _objectSpread2(_objectSpread2({}, options.unstable_popoverStyles), htmlStyle)
  52091. }, htmlProps);
  52092. }
  52093. });
  52094. var Popover_Popover = createComponent({
  52095. as: "div",
  52096. useHook: usePopover,
  52097. useCreateElement: function useCreateElement$1(type, props, children) {
  52098. false ? 0 : void 0;
  52099. return useCreateElement(type, props, children);
  52100. }
  52101. });
  52102. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flyout/styles.js
  52103. /**
  52104. * External dependencies
  52105. */
  52106. // eslint-disable-next-line no-restricted-imports
  52107. /**
  52108. * Internal dependencies
  52109. */
  52110. const FlyoutContentView = /*#__PURE__*/emotion_styled_base_browser_esm(Popover_Popover, true ? {
  52111. target: "e1vtu5161"
  52112. } : 0)("z-index:", Flyout, ";box-sizing:border-box;opacity:0;outline:none;position:relative;transform-origin:center center;transition:opacity ", config_values.transitionDurationFastest, " linear;width:100%;&[data-enter]{opacity:1;}&::before,&::after{display:none;}" + ( true ? "" : 0));
  52113. const CardView = /*#__PURE__*/emotion_styled_base_browser_esm(card_component, true ? {
  52114. target: "e1vtu5160"
  52115. } : 0)(card_body_component.selector, "{max-height:80vh;}" + ( true ? "" : 0));
  52116. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flyout/flyout-content/component.js
  52117. /**
  52118. * Internal dependencies
  52119. */
  52120. /**
  52121. *
  52122. * @param {import('../../ui/context').WordPressComponentProps<import('../types').ContentProps, 'div', false>} props
  52123. * @param {import('react').ForwardedRef<any>} forwardedRef forwardedRef
  52124. */
  52125. function FlyoutContent(props, forwardedRef) {
  52126. const {
  52127. children,
  52128. elevation,
  52129. maxWidth,
  52130. style = {},
  52131. ...otherProps
  52132. } = useContextSystem(props, 'FlyoutContent');
  52133. const {
  52134. label,
  52135. flyoutState
  52136. } = useFlyoutContext();
  52137. if (!flyoutState) {
  52138. throw new Error('`FlyoutContent` must only be used inside a `Flyout`.');
  52139. }
  52140. const showContent = flyoutState.visible || flyoutState.animating;
  52141. return (0,external_wp_element_namespaceObject.createElement)(FlyoutContentView, extends_extends({
  52142. "aria-label": label // maxWidth is applied via inline styles in order to avoid the `React does
  52143. // not recognize the maxWidth prop on a DOM element` error that comes from
  52144. // passing `maxWidth` as a prop to `FlyoutContentView`
  52145. ,
  52146. style: {
  52147. maxWidth,
  52148. ...style
  52149. }
  52150. }, otherProps, flyoutState), showContent && (0,external_wp_element_namespaceObject.createElement)(CardView, {
  52151. elevation: elevation,
  52152. ref: forwardedRef
  52153. }, children));
  52154. }
  52155. const ConnectedFlyoutContent = contextConnect(FlyoutContent, 'FlyoutContent');
  52156. /* harmony default export */ var flyout_content_component = (ConnectedFlyoutContent);
  52157. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flyout/flyout/hook.js
  52158. /**
  52159. * External dependencies
  52160. */
  52161. // eslint-disable-next-line no-restricted-imports
  52162. /**
  52163. * Internal dependencies
  52164. */
  52165. /**
  52166. * @param {import('../../ui/context').WordPressComponentProps<import('../types').Props, 'div', false>} props
  52167. */
  52168. function useFlyout(props) {
  52169. const {
  52170. animated = true,
  52171. animationDuration = 160,
  52172. baseId,
  52173. elevation = 5,
  52174. id,
  52175. maxWidth = 360,
  52176. placement,
  52177. state,
  52178. visible,
  52179. ...otherProps
  52180. } = useContextSystem(props, 'Flyout');
  52181. const _flyoutState = usePopoverState({
  52182. animated: animated ? animationDuration : undefined,
  52183. baseId: baseId || id,
  52184. placement,
  52185. visible,
  52186. ...otherProps
  52187. });
  52188. const flyoutState = state || _flyoutState;
  52189. return { ...otherProps,
  52190. elevation,
  52191. maxWidth,
  52192. flyoutState
  52193. };
  52194. }
  52195. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flyout/flyout/component.js
  52196. /**
  52197. * External dependencies
  52198. */
  52199. // eslint-disable-next-line no-restricted-imports
  52200. /**
  52201. * WordPress dependencies
  52202. */
  52203. /**
  52204. * Internal dependencies
  52205. */
  52206. /**
  52207. *
  52208. * @param {import('../../ui/context').WordPressComponentProps<import('../types').Props, 'div', false>} props
  52209. * @param {import('react').ForwardedRef<any>} forwardedRef
  52210. */
  52211. function component_Flyout(props, forwardedRef) {
  52212. const {
  52213. children,
  52214. elevation,
  52215. label,
  52216. maxWidth,
  52217. onVisibleChange,
  52218. trigger,
  52219. flyoutState,
  52220. ...otherProps
  52221. } = useFlyout(props);
  52222. const resizeListener = useFlyoutResizeUpdater({
  52223. onResize: flyoutState.unstable_update
  52224. });
  52225. const uniqueId = `flyout-${flyoutState.baseId}`;
  52226. const labelId = label || uniqueId;
  52227. const contextProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  52228. label: labelId,
  52229. flyoutState
  52230. }), [labelId, flyoutState]);
  52231. const triggerContent = (0,external_wp_element_namespaceObject.useCallback)(triggerProps => {
  52232. return (0,external_wp_element_namespaceObject.cloneElement)(trigger, triggerProps);
  52233. }, [trigger]);
  52234. use_update_effect(() => {
  52235. onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(flyoutState.visible);
  52236. }, [flyoutState.visible]);
  52237. return (0,external_wp_element_namespaceObject.createElement)(FlyoutContext.Provider, {
  52238. value: contextProps
  52239. }, trigger && (0,external_wp_element_namespaceObject.createElement)(PopoverDisclosure, extends_extends({}, flyoutState, {
  52240. ref: trigger.ref
  52241. }, trigger.props), triggerContent), (0,external_wp_element_namespaceObject.createElement)(Portal, null, (0,external_wp_element_namespaceObject.createElement)(flyout_content_component, extends_extends({
  52242. ref: forwardedRef
  52243. }, otherProps, {
  52244. elevation: elevation,
  52245. maxWidth: maxWidth
  52246. }), resizeListener, children)));
  52247. }
  52248. /**
  52249. * `Flyout` is a component to render a floating content modal.
  52250. * It is similar in purpose to a tooltip, but renders content of any sort,
  52251. * not only simple text.
  52252. *
  52253. * @example
  52254. * ```jsx
  52255. * import { Button, __experimentalFlyout as Flyout, __experimentalText as } from '@wordpress/components';
  52256. *
  52257. * function Example() {
  52258. * return (
  52259. * <Flyout trigger={ <Button>Show/Hide content</Button> }>
  52260. * <Text>Code is Poetry</Text>
  52261. * </Flyout>
  52262. * );
  52263. * }
  52264. * ```
  52265. */
  52266. const ConnectedFlyout = contextConnect(component_Flyout, 'Flyout');
  52267. /* harmony default export */ var flyout_component = (ConnectedFlyout);
  52268. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/styles/focal-point-picker-style.js
  52269. function focal_point_picker_style_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  52270. /**
  52271. * External dependencies
  52272. */
  52273. /**
  52274. * Internal dependencies
  52275. */
  52276. const MediaWrapper = emotion_styled_base_browser_esm("div", true ? {
  52277. target: "e11wezi78"
  52278. } : 0)( true ? {
  52279. name: "1g31405",
  52280. styles: "background-color:transparent;box-sizing:border-box;text-align:center;width:100%"
  52281. } : 0);
  52282. const MediaContainer = emotion_styled_base_browser_esm("div", true ? {
  52283. target: "e11wezi77"
  52284. } : 0)( true ? {
  52285. name: "v0nrlz",
  52286. styles: "align-items:center;box-sizing:border-box;box-shadow:0 0 0 1px rgba( 0, 0, 0, 0.2 );cursor:pointer;display:inline-flex;justify-content:center;margin:auto;position:relative;height:100%;img,video{box-sizing:border-box;display:block;height:auto;margin:0;max-height:100%;max-width:100%;pointer-events:none;user-select:none;width:auto;}"
  52287. } : 0);
  52288. const MediaPlaceholder = emotion_styled_base_browser_esm("div", true ? {
  52289. target: "e11wezi76"
  52290. } : 0)("background:", COLORS.lightGray[300], ";box-sizing:border-box;height:170px;max-width:280px;min-width:200px;width:100%;" + ( true ? "" : 0));
  52291. const focal_point_picker_style_UnitControl = /*#__PURE__*/emotion_styled_base_browser_esm(unit_control, true ? {
  52292. target: "e11wezi75"
  52293. } : 0)( true ? {
  52294. name: "1pzk433",
  52295. styles: "width:100px"
  52296. } : 0);
  52297. const ControlWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  52298. target: "e11wezi74"
  52299. } : 0)( true ? {
  52300. name: "ox4xcy",
  52301. styles: "max-width:320px;padding:1em 0"
  52302. } : 0);
  52303. const GridView = emotion_styled_base_browser_esm("div", true ? {
  52304. target: "e11wezi73"
  52305. } : 0)("box-sizing:border-box;left:50%;opacity:0;overflow:hidden;pointer-events:none;position:absolute;top:50%;transform:translate3d( -50%, -50%, 0 );transition:opacity 120ms linear;z-index:1;", _ref => {
  52306. let {
  52307. isActive
  52308. } = _ref;
  52309. return isActive && `
  52310. opacity: 1;
  52311. `;
  52312. }, ";" + ( true ? "" : 0));
  52313. const GridLine = emotion_styled_base_browser_esm("div", true ? {
  52314. target: "e11wezi72"
  52315. } : 0)( true ? {
  52316. name: "1sy4ch9",
  52317. styles: "box-sizing:border-box;background:white;box-shadow:0 0 2px rgba( 0, 0, 0, 0.6 );position:absolute;opacity:0.4;transform:translateZ( 0 )"
  52318. } : 0);
  52319. const GridLineX = /*#__PURE__*/emotion_styled_base_browser_esm(GridLine, true ? {
  52320. target: "e11wezi71"
  52321. } : 0)( true ? {
  52322. name: "1qp910y",
  52323. styles: "height:1px;left:0;right:0"
  52324. } : 0);
  52325. const GridLineY = /*#__PURE__*/emotion_styled_base_browser_esm(GridLine, true ? {
  52326. target: "e11wezi70"
  52327. } : 0)( true ? {
  52328. name: "1oz3zka",
  52329. styles: "width:1px;top:0;bottom:0"
  52330. } : 0);
  52331. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/utils.js
  52332. const INITIAL_BOUNDS = {
  52333. top: 0,
  52334. left: 0,
  52335. bottom: 0,
  52336. right: 0,
  52337. width: 0,
  52338. height: 0
  52339. };
  52340. const VIDEO_EXTENSIONS = ['avi', 'mpg', 'mpeg', 'mov', 'mp4', 'm4v', 'ogg', 'ogv', 'webm', 'wmv'];
  52341. /**
  52342. * Gets the extension of a file name.
  52343. *
  52344. * @param {string} filename The file name.
  52345. * @return {string} The extension of the file name.
  52346. */
  52347. function getExtension() {
  52348. let filename = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  52349. const parts = filename.split('.');
  52350. return parts[parts.length - 1];
  52351. }
  52352. /**
  52353. * Checks if a file is a video.
  52354. *
  52355. * @param {string} filename The file name.
  52356. * @return {boolean} Whether the file is a video.
  52357. */
  52358. function isVideoType() {
  52359. let filename = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  52360. if (!filename) return false;
  52361. return VIDEO_EXTENSIONS.includes(getExtension(filename));
  52362. }
  52363. /**
  52364. * Transforms a fraction value to a percentage value.
  52365. *
  52366. * @param {number} fraction The fraction value.
  52367. * @return {number} A percentage value.
  52368. */
  52369. function fractionToPercentage(fraction) {
  52370. return Math.round(fraction * 100);
  52371. }
  52372. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/controls.js
  52373. /**
  52374. * External dependencies
  52375. */
  52376. /**
  52377. * WordPress dependencies
  52378. */
  52379. /**
  52380. * Internal dependencies
  52381. */
  52382. const TEXTCONTROL_MIN = 0;
  52383. const TEXTCONTROL_MAX = 100;
  52384. function FocalPointPickerControls(_ref) {
  52385. let {
  52386. onChange = external_lodash_namespaceObject.noop,
  52387. percentages = {
  52388. x: 0.5,
  52389. y: 0.5
  52390. }
  52391. } = _ref;
  52392. const valueX = fractionToPercentage(percentages.x);
  52393. const valueY = fractionToPercentage(percentages.y);
  52394. const handleChange = (value, axis) => {
  52395. const num = parseInt(value, 10);
  52396. if (!isNaN(num)) {
  52397. onChange({ ...percentages,
  52398. [axis]: num / 100
  52399. });
  52400. }
  52401. };
  52402. return (0,external_wp_element_namespaceObject.createElement)(ControlWrapper, {
  52403. className: "focal-point-picker__controls"
  52404. }, (0,external_wp_element_namespaceObject.createElement)(controls_UnitControl, {
  52405. label: (0,external_wp_i18n_namespaceObject.__)('Left'),
  52406. value: [valueX, '%'].join(''),
  52407. onChange: next => handleChange(next, 'x'),
  52408. dragDirection: "e"
  52409. }), (0,external_wp_element_namespaceObject.createElement)(controls_UnitControl, {
  52410. label: (0,external_wp_i18n_namespaceObject.__)('Top'),
  52411. value: [valueY, '%'].join(''),
  52412. onChange: next => handleChange(next, 'y'),
  52413. dragDirection: "s"
  52414. }));
  52415. }
  52416. function controls_UnitControl(props) {
  52417. return (0,external_wp_element_namespaceObject.createElement)(focal_point_picker_style_UnitControl, extends_extends({
  52418. className: "focal-point-picker__controls-position-unit-control",
  52419. labelPosition: "top",
  52420. max: TEXTCONTROL_MAX,
  52421. min: TEXTCONTROL_MIN,
  52422. units: [{
  52423. value: '%',
  52424. label: '%'
  52425. }]
  52426. }, props));
  52427. }
  52428. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/styles/focal-point-style.js
  52429. function focal_point_style_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  52430. /**
  52431. * External dependencies
  52432. */
  52433. /**
  52434. * WordPress dependencies
  52435. */
  52436. /**
  52437. * Internal dependencies
  52438. */
  52439. const FocalPointWrapper = emotion_styled_base_browser_esm("div", true ? {
  52440. target: "eas61re3"
  52441. } : 0)("background-color:transparent;box-sizing:border-box;cursor:grab;height:30px;margin:-15px 0 0 -15px;opacity:0.8;position:absolute;user-select:none;width:30px;will-change:transform;z-index:10000;", _ref => {
  52442. let {
  52443. isDragging
  52444. } = _ref;
  52445. return isDragging && 'cursor: grabbing;';
  52446. }, ";" + ( true ? "" : 0));
  52447. const PointerIconSVG = /*#__PURE__*/emotion_styled_base_browser_esm(external_wp_primitives_namespaceObject.SVG, true ? {
  52448. target: "eas61re2"
  52449. } : 0)( true ? {
  52450. name: "qkx60y",
  52451. styles: "display:block;height:100%;left:0;position:absolute;top:0;width:100%"
  52452. } : 0);
  52453. const PointerIconPathOutline = /*#__PURE__*/emotion_styled_base_browser_esm(external_wp_primitives_namespaceObject.Path, true ? {
  52454. target: "eas61re1"
  52455. } : 0)( true ? {
  52456. name: "1b3qpiw",
  52457. styles: "fill:white"
  52458. } : 0);
  52459. const PointerIconPathFill = /*#__PURE__*/emotion_styled_base_browser_esm(external_wp_primitives_namespaceObject.Path, true ? {
  52460. target: "eas61re0"
  52461. } : 0)("fill:", COLORS.blue.wordpress[700], ";fill:", COLORS.ui.theme, ";" + ( true ? "" : 0));
  52462. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/focal-point.js
  52463. /**
  52464. * Internal dependencies
  52465. */
  52466. /**
  52467. * External dependencies
  52468. */
  52469. function FocalPoint(_ref) {
  52470. let {
  52471. coordinates = {
  52472. left: '50%',
  52473. top: '50%'
  52474. },
  52475. ...props
  52476. } = _ref;
  52477. const classes = classnames_default()('components-focal-point-picker__icon_container');
  52478. const style = {
  52479. left: coordinates.left,
  52480. top: coordinates.top
  52481. };
  52482. return (0,external_wp_element_namespaceObject.createElement)(FocalPointWrapper, extends_extends({}, props, {
  52483. className: classes,
  52484. style: style
  52485. }), (0,external_wp_element_namespaceObject.createElement)(PointerIconSVG, {
  52486. className: "components-focal-point-picker__icon",
  52487. xmlns: "http://www.w3.org/2000/svg",
  52488. viewBox: "0 0 30 30"
  52489. }, (0,external_wp_element_namespaceObject.createElement)(PointerIconPathOutline, {
  52490. className: "components-focal-point-picker__icon-outline",
  52491. d: "M15 1C7.3 1 1 7.3 1 15s6.3 14 14 14 14-6.3 14-14S22.7 1 15 1zm0 22c-4.4 0-8-3.6-8-8s3.6-8 8-8 8 3.6 8 8-3.6 8-8 8z"
  52492. }), (0,external_wp_element_namespaceObject.createElement)(PointerIconPathFill, {
  52493. className: "components-focal-point-picker__icon-fill",
  52494. d: "M15 3C8.4 3 3 8.4 3 15s5.4 12 12 12 12-5.4 12-12S21.6 3 15 3zm0 22C9.5 25 5 20.5 5 15S9.5 5 15 5s10 4.5 10 10-4.5 10-10 10z"
  52495. })));
  52496. }
  52497. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/grid.js
  52498. /**
  52499. * WordPress dependencies
  52500. */
  52501. /**
  52502. * Internal dependencies
  52503. */
  52504. const {
  52505. clearTimeout: grid_clearTimeout,
  52506. setTimeout: grid_setTimeout
  52507. } = typeof window !== 'undefined' ? window : {};
  52508. function FocalPointPickerGrid(_ref) {
  52509. let {
  52510. bounds = {},
  52511. value,
  52512. ...props
  52513. } = _ref;
  52514. const animationProps = useRevealAnimation(value);
  52515. const style = {
  52516. width: bounds.width,
  52517. height: bounds.height
  52518. };
  52519. return (0,external_wp_element_namespaceObject.createElement)(GridView, extends_extends({}, props, animationProps, {
  52520. className: "components-focal-point-picker__grid",
  52521. style: style
  52522. }), (0,external_wp_element_namespaceObject.createElement)(GridLineX, {
  52523. style: {
  52524. top: '33%'
  52525. }
  52526. }), (0,external_wp_element_namespaceObject.createElement)(GridLineX, {
  52527. style: {
  52528. top: '66%'
  52529. }
  52530. }), (0,external_wp_element_namespaceObject.createElement)(GridLineY, {
  52531. style: {
  52532. left: '33%'
  52533. }
  52534. }), (0,external_wp_element_namespaceObject.createElement)(GridLineY, {
  52535. style: {
  52536. left: '66%'
  52537. }
  52538. }));
  52539. }
  52540. /**
  52541. * Custom hook that renders the "flash" animation whenever the value changes.
  52542. *
  52543. * @param {string} value Value of (box) side.
  52544. */
  52545. function useRevealAnimation(value) {
  52546. const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false);
  52547. use_update_effect(() => {
  52548. setIsActive(true);
  52549. const timeout = grid_setTimeout(() => {
  52550. setIsActive(false);
  52551. }, 600);
  52552. return () => grid_clearTimeout(timeout);
  52553. }, [value]);
  52554. return {
  52555. isActive
  52556. };
  52557. }
  52558. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/media.js
  52559. /**
  52560. * External dependencies
  52561. */
  52562. /**
  52563. * WordPress dependencies
  52564. */
  52565. /**
  52566. * Internal dependencies
  52567. */
  52568. function media_Media(_ref) {
  52569. let {
  52570. alt,
  52571. autoPlay,
  52572. src,
  52573. onLoad = external_lodash_namespaceObject.noop,
  52574. mediaRef,
  52575. // Exposing muted prop for test rendering purposes
  52576. // https://github.com/testing-library/react-testing-library/issues/470
  52577. muted = true,
  52578. ...props
  52579. } = _ref;
  52580. if (!src) {
  52581. return (0,external_wp_element_namespaceObject.createElement)(MediaPlaceholderElement, {
  52582. className: "components-focal-point-picker__media components-focal-point-picker__media--placeholder",
  52583. onLoad: onLoad,
  52584. mediaRef: mediaRef
  52585. });
  52586. }
  52587. const isVideo = isVideoType(src);
  52588. return isVideo ? (0,external_wp_element_namespaceObject.createElement)("video", extends_extends({}, props, {
  52589. autoPlay: autoPlay,
  52590. className: "components-focal-point-picker__media components-focal-point-picker__media--video",
  52591. loop: true,
  52592. muted: muted,
  52593. onLoadedData: onLoad,
  52594. ref: mediaRef,
  52595. src: src
  52596. })) : (0,external_wp_element_namespaceObject.createElement)("img", extends_extends({}, props, {
  52597. alt: alt,
  52598. className: "components-focal-point-picker__media components-focal-point-picker__media--image",
  52599. onLoad: onLoad,
  52600. ref: mediaRef,
  52601. src: src
  52602. }));
  52603. }
  52604. function MediaPlaceholderElement(_ref2) {
  52605. let {
  52606. mediaRef,
  52607. onLoad = external_lodash_namespaceObject.noop,
  52608. ...props
  52609. } = _ref2;
  52610. const onLoadRef = (0,external_wp_element_namespaceObject.useRef)(onLoad);
  52611. /**
  52612. * This async callback mimics the onLoad (img) / onLoadedData (video) callback
  52613. * for media elements. It is used in the main <FocalPointPicker /> component
  52614. * to calculate the dimensions + boundaries for positioning.
  52615. */
  52616. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  52617. window.requestAnimationFrame(() => {
  52618. onLoadRef.current();
  52619. });
  52620. }, []);
  52621. return (0,external_wp_element_namespaceObject.createElement)(MediaPlaceholder, extends_extends({
  52622. ref: mediaRef
  52623. }, props));
  52624. }
  52625. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/index.js
  52626. /**
  52627. * External dependencies
  52628. */
  52629. /**
  52630. * WordPress dependencies
  52631. */
  52632. /**
  52633. * Internal dependencies
  52634. */
  52635. class FocalPointPicker extends external_wp_element_namespaceObject.Component {
  52636. constructor(props) {
  52637. super(...arguments);
  52638. this.state = {
  52639. isDragging: false,
  52640. bounds: INITIAL_BOUNDS,
  52641. percentages: props.value
  52642. };
  52643. this.containerRef = (0,external_wp_element_namespaceObject.createRef)();
  52644. this.mediaRef = (0,external_wp_element_namespaceObject.createRef)();
  52645. this.onMouseDown = this.startDrag.bind(this);
  52646. this.onMouseUp = this.stopDrag.bind(this);
  52647. this.onKeyDown = this.onKeyDown.bind(this);
  52648. this.onMouseMove = this.doDrag.bind(this);
  52649. this.ifDraggingStop = () => {
  52650. if (this.state.isDragging) {
  52651. this.stopDrag();
  52652. }
  52653. };
  52654. this.onChangeAtControls = value => {
  52655. this.updateValue(value, () => {
  52656. this.props.onChange(this.state.percentages);
  52657. });
  52658. };
  52659. this.updateBounds = this.updateBounds.bind(this);
  52660. this.updateValue = this.updateValue.bind(this);
  52661. }
  52662. componentDidMount() {
  52663. const {
  52664. defaultView
  52665. } = this.containerRef.current.ownerDocument;
  52666. defaultView.addEventListener('resize', this.updateBounds);
  52667. /*
  52668. * Set initial bound values.
  52669. *
  52670. * This is necessary for Safari:
  52671. * https://github.com/WordPress/gutenberg/issues/25814
  52672. */
  52673. this.updateBounds();
  52674. }
  52675. componentDidUpdate(prevProps) {
  52676. if (prevProps.url !== this.props.url) {
  52677. this.ifDraggingStop();
  52678. }
  52679. /*
  52680. * Handles cases where the incoming value changes.
  52681. * An example is the values resetting based on an UNDO action.
  52682. */
  52683. const {
  52684. isDragging,
  52685. percentages: {
  52686. x,
  52687. y
  52688. }
  52689. } = this.state;
  52690. const {
  52691. value
  52692. } = this.props;
  52693. if (!isDragging && (value.x !== x || value.y !== y)) {
  52694. this.setState({
  52695. percentages: this.props.value
  52696. });
  52697. }
  52698. }
  52699. componentWillUnmount() {
  52700. const {
  52701. defaultView
  52702. } = this.containerRef.current.ownerDocument;
  52703. defaultView.removeEventListener('resize', this.updateBounds);
  52704. this.ifDraggingStop();
  52705. }
  52706. calculateBounds() {
  52707. const bounds = INITIAL_BOUNDS;
  52708. if (!this.mediaRef.current) {
  52709. return bounds;
  52710. } // Prevent division by zero when updateBounds runs in componentDidMount
  52711. if (this.mediaRef.current.clientWidth === 0 || this.mediaRef.current.clientHeight === 0) {
  52712. return bounds;
  52713. }
  52714. const dimensions = {
  52715. width: this.mediaRef.current.clientWidth,
  52716. height: this.mediaRef.current.clientHeight
  52717. };
  52718. const pickerDimensions = this.pickerDimensions();
  52719. const widthRatio = pickerDimensions.width / dimensions.width;
  52720. const heightRatio = pickerDimensions.height / dimensions.height;
  52721. if (heightRatio >= widthRatio) {
  52722. bounds.width = bounds.right = pickerDimensions.width;
  52723. bounds.height = dimensions.height * widthRatio;
  52724. bounds.top = (pickerDimensions.height - bounds.height) / 2;
  52725. bounds.bottom = bounds.top + bounds.height;
  52726. } else {
  52727. bounds.height = bounds.bottom = pickerDimensions.height;
  52728. bounds.width = dimensions.width * heightRatio;
  52729. bounds.left = (pickerDimensions.width - bounds.width) / 2;
  52730. bounds.right = bounds.left + bounds.width;
  52731. }
  52732. return bounds;
  52733. }
  52734. updateValue() {
  52735. var _this$props$resolvePo, _this$props$resolvePo2, _this$props;
  52736. let nextValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  52737. let callback = arguments.length > 1 ? arguments[1] : undefined;
  52738. const resolvedValue = (_this$props$resolvePo = (_this$props$resolvePo2 = (_this$props = this.props).resolvePoint) === null || _this$props$resolvePo2 === void 0 ? void 0 : _this$props$resolvePo2.call(_this$props, nextValue)) !== null && _this$props$resolvePo !== void 0 ? _this$props$resolvePo : nextValue;
  52739. const {
  52740. x,
  52741. y
  52742. } = resolvedValue;
  52743. const nextPercentage = {
  52744. x: parseFloat(x).toFixed(2),
  52745. y: parseFloat(y).toFixed(2)
  52746. };
  52747. this.setState({
  52748. percentages: nextPercentage
  52749. }, callback);
  52750. }
  52751. updateBounds() {
  52752. this.setState({
  52753. bounds: this.calculateBounds()
  52754. });
  52755. }
  52756. startDrag(event) {
  52757. var _this$props$onDragSta, _this$props2;
  52758. event.persist();
  52759. this.containerRef.current.focus();
  52760. this.setState({
  52761. isDragging: true
  52762. });
  52763. const {
  52764. ownerDocument
  52765. } = this.containerRef.current;
  52766. ownerDocument.addEventListener('mouseup', this.onMouseUp);
  52767. ownerDocument.addEventListener('mousemove', this.onMouseMove);
  52768. const value = this.getValueFromPoint({
  52769. x: event.pageX,
  52770. y: event.pageY
  52771. }, event.shiftKey);
  52772. this.updateValue(value);
  52773. (_this$props$onDragSta = (_this$props2 = this.props).onDragStart) === null || _this$props$onDragSta === void 0 ? void 0 : _this$props$onDragSta.call(_this$props2, value, event);
  52774. }
  52775. stopDrag(event) {
  52776. var _this$props$onDragEnd, _this$props3;
  52777. const {
  52778. ownerDocument
  52779. } = this.containerRef.current;
  52780. ownerDocument.removeEventListener('mouseup', this.onMouseUp);
  52781. ownerDocument.removeEventListener('mousemove', this.onMouseMove);
  52782. this.setState({
  52783. isDragging: false
  52784. }, () => {
  52785. this.props.onChange(this.state.percentages);
  52786. });
  52787. (_this$props$onDragEnd = (_this$props3 = this.props).onDragEnd) === null || _this$props$onDragEnd === void 0 ? void 0 : _this$props$onDragEnd.call(_this$props3, event);
  52788. }
  52789. onKeyDown(event) {
  52790. const {
  52791. keyCode,
  52792. shiftKey
  52793. } = event;
  52794. if (![external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT].includes(keyCode)) return;
  52795. event.preventDefault();
  52796. const next = { ...this.state.percentages
  52797. };
  52798. const step = shiftKey ? 0.1 : 0.01;
  52799. const delta = keyCode === external_wp_keycodes_namespaceObject.UP || keyCode === external_wp_keycodes_namespaceObject.LEFT ? -1 * step : step;
  52800. const axis = keyCode === external_wp_keycodes_namespaceObject.UP || keyCode === external_wp_keycodes_namespaceObject.DOWN ? 'y' : 'x';
  52801. const value = parseFloat(next[axis]) + delta;
  52802. next[axis] = roundClamp(value, 0, 1, step);
  52803. this.updateValue(next, () => {
  52804. this.props.onChange(this.state.percentages);
  52805. });
  52806. }
  52807. doDrag(event) {
  52808. var _this$props$onDrag, _this$props4;
  52809. // Prevents text-selection when dragging.
  52810. event.preventDefault();
  52811. const value = this.getValueFromPoint({
  52812. x: event.pageX,
  52813. y: event.pageY
  52814. }, event.shiftKey);
  52815. this.updateValue(value);
  52816. (_this$props$onDrag = (_this$props4 = this.props).onDrag) === null || _this$props$onDrag === void 0 ? void 0 : _this$props$onDrag.call(_this$props4, value, event);
  52817. }
  52818. getValueFromPoint(point, byTenths) {
  52819. const {
  52820. bounds
  52821. } = this.state;
  52822. const pickerDimensions = this.pickerDimensions();
  52823. const relativePoint = {
  52824. left: point.x - pickerDimensions.left,
  52825. top: point.y - pickerDimensions.top
  52826. };
  52827. const left = Math.max(bounds.left, Math.min(relativePoint.left, bounds.right));
  52828. const top = Math.max(bounds.top, Math.min(relativePoint.top, bounds.bottom));
  52829. let nextX = (left - bounds.left) / (pickerDimensions.width - bounds.left * 2);
  52830. let nextY = (top - bounds.top) / (pickerDimensions.height - bounds.top * 2); // Enables holding shift to jump values by 10%
  52831. const step = byTenths ? 0.1 : 0.01;
  52832. nextX = roundClamp(nextX, 0, 1, step);
  52833. nextY = roundClamp(nextY, 0, 1, step);
  52834. return {
  52835. x: nextX,
  52836. y: nextY
  52837. };
  52838. }
  52839. pickerDimensions() {
  52840. const containerNode = this.containerRef.current;
  52841. if (!containerNode) {
  52842. return {
  52843. width: 0,
  52844. height: 0,
  52845. left: 0,
  52846. top: 0
  52847. };
  52848. }
  52849. const {
  52850. clientHeight,
  52851. clientWidth
  52852. } = containerNode;
  52853. const {
  52854. top,
  52855. left
  52856. } = containerNode.getBoundingClientRect();
  52857. return {
  52858. width: clientWidth,
  52859. height: clientHeight,
  52860. top: top + document.body.scrollTop,
  52861. left
  52862. };
  52863. }
  52864. iconCoordinates() {
  52865. const {
  52866. bounds,
  52867. percentages: {
  52868. x,
  52869. y
  52870. }
  52871. } = this.state;
  52872. if (bounds.left === undefined || bounds.top === undefined) {
  52873. return {
  52874. left: '50%',
  52875. top: '50%'
  52876. };
  52877. }
  52878. const {
  52879. width,
  52880. height
  52881. } = this.pickerDimensions();
  52882. return {
  52883. left: x * (width - bounds.left * 2) + bounds.left,
  52884. top: y * (height - bounds.top * 2) + bounds.top
  52885. };
  52886. }
  52887. render() {
  52888. const {
  52889. autoPlay,
  52890. className,
  52891. help,
  52892. instanceId,
  52893. label,
  52894. url
  52895. } = this.props;
  52896. const {
  52897. bounds,
  52898. isDragging,
  52899. percentages
  52900. } = this.state;
  52901. const iconCoordinates = this.iconCoordinates();
  52902. const classes = classnames_default()('components-focal-point-picker-control', className);
  52903. const id = `inspector-focal-point-picker-control-${instanceId}`;
  52904. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  52905. label: label,
  52906. id: id,
  52907. help: help,
  52908. className: classes
  52909. }, (0,external_wp_element_namespaceObject.createElement)(MediaWrapper, {
  52910. className: "components-focal-point-picker-wrapper"
  52911. }, (0,external_wp_element_namespaceObject.createElement)(MediaContainer, {
  52912. className: "components-focal-point-picker",
  52913. onKeyDown: this.onKeyDown,
  52914. onMouseDown: this.onMouseDown,
  52915. onBlur: this.ifDraggingStop,
  52916. ref: this.containerRef,
  52917. role: "button",
  52918. tabIndex: "-1"
  52919. }, (0,external_wp_element_namespaceObject.createElement)(FocalPointPickerGrid, {
  52920. bounds: bounds,
  52921. value: percentages.x + percentages.y
  52922. }), (0,external_wp_element_namespaceObject.createElement)(media_Media, {
  52923. alt: (0,external_wp_i18n_namespaceObject.__)('Media preview'),
  52924. autoPlay: autoPlay,
  52925. mediaRef: this.mediaRef,
  52926. onLoad: this.updateBounds,
  52927. src: url
  52928. }), (0,external_wp_element_namespaceObject.createElement)(FocalPoint, {
  52929. coordinates: iconCoordinates,
  52930. isDragging: isDragging
  52931. }))), (0,external_wp_element_namespaceObject.createElement)(FocalPointPickerControls, {
  52932. percentages: percentages,
  52933. onChange: this.onChangeAtControls
  52934. }));
  52935. }
  52936. }
  52937. FocalPointPicker.defaultProps = {
  52938. autoPlay: true,
  52939. value: {
  52940. x: 0.5,
  52941. y: 0.5
  52942. },
  52943. url: null
  52944. };
  52945. /* harmony default export */ var focal_point_picker = ((0,external_wp_compose_namespaceObject.withInstanceId)(FocalPointPicker));
  52946. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focusable-iframe/index.js
  52947. /**
  52948. * WordPress dependencies
  52949. */
  52950. function FocusableIframe(_ref) {
  52951. let {
  52952. iframeRef,
  52953. ...props
  52954. } = _ref;
  52955. const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([iframeRef, (0,external_wp_compose_namespaceObject.useFocusableIframe)()]);
  52956. external_wp_deprecated_default()('wp.components.FocusableIframe', {
  52957. since: '5.9',
  52958. alternative: 'wp.compose.useFocusableIframe'
  52959. }); // Disable reason: The rendered iframe is a pass-through component,
  52960. // assigning props inherited from the rendering parent. It's the
  52961. // responsibility of the parent to assign a title.
  52962. // eslint-disable-next-line jsx-a11y/iframe-has-title
  52963. return (0,external_wp_element_namespaceObject.createElement)("iframe", extends_extends({
  52964. ref: ref
  52965. }, props));
  52966. }
  52967. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Radio/RadioState.js
  52968. function useRadioState(initialState) {
  52969. if (initialState === void 0) {
  52970. initialState = {};
  52971. }
  52972. var _useSealedState = useSealedState(initialState),
  52973. initialValue = _useSealedState.state,
  52974. _useSealedState$loop = _useSealedState.loop,
  52975. loop = _useSealedState$loop === void 0 ? true : _useSealedState$loop,
  52976. sealed = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_useSealedState, ["state", "loop"]);
  52977. var _React$useState = (0,external_React_.useState)(initialValue),
  52978. state = _React$useState[0],
  52979. setState = _React$useState[1];
  52980. var composite = useCompositeState(_objectSpread2(_objectSpread2({}, sealed), {}, {
  52981. loop: loop
  52982. }));
  52983. return _objectSpread2(_objectSpread2({}, composite), {}, {
  52984. state: state,
  52985. setState: setState
  52986. });
  52987. }
  52988. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-d251e56b.js
  52989. // Automatically generated
  52990. var RADIO_STATE_KEYS = ["baseId", "unstable_idCountRef", "unstable_virtual", "rtl", "orientation", "items", "groups", "currentId", "loop", "wrap", "shift", "unstable_moves", "unstable_hasActiveWidget", "unstable_includesBaseElement", "state", "setBaseId", "registerItem", "unregisterItem", "registerGroup", "unregisterGroup", "move", "next", "previous", "up", "down", "first", "last", "sort", "unstable_setVirtual", "setRTL", "setOrientation", "setCurrentId", "setLoop", "setWrap", "setShift", "reset", "unstable_setIncludesBaseElement", "unstable_setHasActiveWidget", "setState"];
  52991. var RADIO_KEYS = [].concat(RADIO_STATE_KEYS, ["value", "checked", "unstable_checkOnFocus"]);
  52992. var RADIO_GROUP_KEYS = RADIO_STATE_KEYS;
  52993. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Radio/RadioGroup.js
  52994. var useRadioGroup = createHook({
  52995. name: "RadioGroup",
  52996. compose: useComposite,
  52997. keys: RADIO_GROUP_KEYS,
  52998. useProps: function useProps(_, htmlProps) {
  52999. return _objectSpread2({
  53000. role: "radiogroup"
  53001. }, htmlProps);
  53002. }
  53003. });
  53004. var RadioGroup = createComponent({
  53005. as: "div",
  53006. useHook: useRadioGroup,
  53007. useCreateElement: function useCreateElement$1(type, props, children) {
  53008. false ? 0 : void 0;
  53009. return useCreateElement(type, props, children);
  53010. }
  53011. });
  53012. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/styles.js
  53013. function toggle_group_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  53014. /**
  53015. * External dependencies
  53016. */
  53017. /**
  53018. * Internal dependencies
  53019. */
  53020. const ToggleGroupControl = /*#__PURE__*/emotion_react_browser_esm_css("background:", COLORS.ui.background, ";border:1px solid;border-color:", COLORS.ui.border, ";border-radius:", config_values.controlBorderRadius, ";display:inline-flex;min-height:", config_values.controlHeight, ";min-width:0;padding:2px;position:relative;transition:transform ", config_values.transitionDurationFastest, " linear;", reduceMotion('transition'), " &:hover{border-color:", COLORS.ui.borderHover, ";}&:focus-within{border-color:", COLORS.ui.borderFocus, ";box-shadow:", config_values.controlBoxShadowFocus, ";outline:none;z-index:1;}" + ( true ? "" : 0), true ? "" : 0);
  53021. const toggle_group_control_styles_block = true ? {
  53022. name: "7whenc",
  53023. styles: "display:flex;width:100%"
  53024. } : 0;
  53025. const BackdropView = emotion_styled_base_browser_esm("div", true ? {
  53026. target: "eakva830"
  53027. } : 0)("background:", COLORS.gray[900], ";border-radius:", config_values.controlBorderRadius, ";box-shadow:", config_values.toggleGroupControlBackdropBoxShadow, ";left:0;position:absolute;top:2px;bottom:2px;transition:transform ", config_values.transitionDurationFast, " ease;", reduceMotion('transition'), " z-index:1;" + ( true ? "" : 0));
  53028. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js
  53029. /**
  53030. * WordPress dependencies
  53031. */
  53032. /**
  53033. * Internal dependencies
  53034. */
  53035. function ToggleGroupControlBackdrop(_ref) {
  53036. let {
  53037. containerRef,
  53038. containerWidth,
  53039. isAdaptiveWidth,
  53040. state
  53041. } = _ref;
  53042. const [left, setLeft] = (0,external_wp_element_namespaceObject.useState)(0);
  53043. const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(0);
  53044. const [canAnimate, setCanAnimate] = (0,external_wp_element_namespaceObject.useState)(false);
  53045. const [renderBackdrop, setRenderBackdrop] = (0,external_wp_element_namespaceObject.useState)(false);
  53046. (0,external_wp_element_namespaceObject.useEffect)(() => {
  53047. const containerNode = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
  53048. if (!containerNode) return;
  53049. /**
  53050. * Workaround for Reakit
  53051. */
  53052. const targetNode = containerNode.querySelector(`[data-value="${state}"]`);
  53053. setRenderBackdrop(!!targetNode);
  53054. if (!targetNode) {
  53055. return;
  53056. }
  53057. const computeDimensions = () => {
  53058. const {
  53059. width: offsetWidth,
  53060. x
  53061. } = targetNode.getBoundingClientRect();
  53062. const {
  53063. x: parentX
  53064. } = containerNode.getBoundingClientRect();
  53065. const borderWidth = 1;
  53066. const offsetLeft = x - parentX - borderWidth;
  53067. setLeft(offsetLeft);
  53068. setWidth(offsetWidth);
  53069. }; // Fix to make the component appear as expected inside popovers.
  53070. // If the targetNode width is 0 it means the element was not yet rendered we should allow
  53071. // some time for the render to happen.
  53072. // requestAnimationFrame instead of setTimeout with a small time does not seems to work.
  53073. const dimensionsRequestId = window.setTimeout(computeDimensions, 100);
  53074. let animationRequestId;
  53075. if (!canAnimate) {
  53076. animationRequestId = window.requestAnimationFrame(() => {
  53077. setCanAnimate(true);
  53078. });
  53079. }
  53080. return () => {
  53081. window.clearTimeout(dimensionsRequestId);
  53082. window.cancelAnimationFrame(animationRequestId);
  53083. };
  53084. }, [canAnimate, containerRef, containerWidth, state, isAdaptiveWidth]);
  53085. if (!renderBackdrop) {
  53086. return null;
  53087. }
  53088. return (0,external_wp_element_namespaceObject.createElement)(BackdropView, {
  53089. role: "presentation",
  53090. style: {
  53091. transform: `translateX(${left}px)`,
  53092. transition: canAnimate ? undefined : 'none',
  53093. width
  53094. }
  53095. });
  53096. }
  53097. /* harmony default export */ var toggle_group_control_backdrop = ((0,external_wp_element_namespaceObject.memo)(ToggleGroupControlBackdrop));
  53098. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/context.js
  53099. /**
  53100. * WordPress dependencies
  53101. */
  53102. /**
  53103. * Internal dependencies
  53104. */
  53105. const ToggleGroupControlContext = (0,external_wp_element_namespaceObject.createContext)({});
  53106. const useToggleGroupControlContext = () => (0,external_wp_element_namespaceObject.useContext)(ToggleGroupControlContext);
  53107. /* harmony default export */ var toggle_group_control_context = (ToggleGroupControlContext);
  53108. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/component.js
  53109. /**
  53110. * External dependencies
  53111. */
  53112. // eslint-disable-next-line no-restricted-imports
  53113. /**
  53114. * WordPress dependencies
  53115. */
  53116. /**
  53117. * Internal dependencies
  53118. */
  53119. const toggle_group_control_component_noop = () => {};
  53120. function component_ToggleGroupControl(props, forwardedRef) {
  53121. const {
  53122. className,
  53123. isAdaptiveWidth = false,
  53124. isBlock = false,
  53125. label,
  53126. hideLabelFromVision = false,
  53127. help,
  53128. onChange = toggle_group_control_component_noop,
  53129. value,
  53130. children,
  53131. ...otherProps
  53132. } = useContextSystem(props, 'ToggleGroupControl');
  53133. const cx = useCx();
  53134. const containerRef = (0,external_wp_element_namespaceObject.useRef)();
  53135. const [resizeListener, sizes] = react_resize_aware_dist_default()();
  53136. const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(component_ToggleGroupControl, 'toggle-group-control').toString();
  53137. const radio = useRadioState({
  53138. baseId,
  53139. state: value
  53140. });
  53141. const previousValue = (0,external_wp_compose_namespaceObject.usePrevious)(value); // Propagate radio.state change.
  53142. use_update_effect(() => {
  53143. // Avoid calling onChange if radio state changed
  53144. // from incoming value.
  53145. if (previousValue !== radio.state) {
  53146. onChange(radio.state);
  53147. }
  53148. }, [radio.state]); // Sync incoming value with radio.state.
  53149. use_update_effect(() => {
  53150. if (value !== radio.state) {
  53151. radio.setState(value);
  53152. }
  53153. }, [value]);
  53154. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(ToggleGroupControl, isBlock && toggle_group_control_styles_block, 'medium', className), [className, cx, isBlock]);
  53155. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  53156. help: help
  53157. }, (0,external_wp_element_namespaceObject.createElement)(toggle_group_control_context.Provider, {
  53158. value: { ...radio,
  53159. isBlock: !isAdaptiveWidth
  53160. }
  53161. }, !hideLabelFromVision && (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)(base_control.VisualLabel, null, label)), (0,external_wp_element_namespaceObject.createElement)(RadioGroup, extends_extends({}, radio, {
  53162. "aria-label": label,
  53163. as: component,
  53164. className: classes
  53165. }, otherProps, {
  53166. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([containerRef, forwardedRef])
  53167. }), resizeListener, (0,external_wp_element_namespaceObject.createElement)(toggle_group_control_backdrop, extends_extends({}, radio, {
  53168. containerRef: containerRef,
  53169. containerWidth: sizes.width,
  53170. isAdaptiveWidth: isAdaptiveWidth
  53171. })), children)));
  53172. }
  53173. /**
  53174. * `ToggleGroupControl` is a form component that lets users choose options
  53175. * represented in horizontal segments. To render options for this control use
  53176. * `ToggleGroupControlOption` component.
  53177. *
  53178. * Only use this control when you know for sure the labels of items inside won't
  53179. * wrap. For items with longer labels, you can consider a `SelectControl` or a
  53180. * `CustomSelectControl` component instead.
  53181. *
  53182. * @example
  53183. * ```jsx
  53184. * import {
  53185. * __experimentalToggleGroupControl as ToggleGroupControl,
  53186. * __experimentalToggleGroupControlOption as ToggleGroupControlOption,
  53187. * } from '@wordpress/components';
  53188. *
  53189. * function Example() {
  53190. * return (
  53191. * <ToggleGroupControl label="my label" value="vertical" isBlock>
  53192. * <ToggleGroupControlOption value="horizontal" label="Horizontal" />
  53193. * <ToggleGroupControlOption value="vertical" label="Vertical" />
  53194. * </ToggleGroupControl>
  53195. * );
  53196. * }
  53197. * ```
  53198. */
  53199. const ConnectedToggleGroupControl = contextConnect(component_ToggleGroupControl, 'ToggleGroupControl');
  53200. /* harmony default export */ var toggle_group_control_component = (ConnectedToggleGroupControl);
  53201. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Radio/Radio.js
  53202. function getChecked(options) {
  53203. if (typeof options.checked !== "undefined") {
  53204. return options.checked;
  53205. }
  53206. return typeof options.value !== "undefined" && options.state === options.value;
  53207. }
  53208. function useInitialChecked(options) {
  53209. var _React$useState = (0,external_React_.useState)(function () {
  53210. return getChecked(options);
  53211. }),
  53212. initialChecked = _React$useState[0];
  53213. var _React$useState2 = (0,external_React_.useState)(options.currentId),
  53214. initialCurrentId = _React$useState2[0];
  53215. var id = options.id,
  53216. setCurrentId = options.setCurrentId;
  53217. (0,external_React_.useEffect)(function () {
  53218. if (initialChecked && id && initialCurrentId !== id) {
  53219. setCurrentId === null || setCurrentId === void 0 ? void 0 : setCurrentId(id);
  53220. }
  53221. }, [initialChecked, id, setCurrentId, initialCurrentId]);
  53222. }
  53223. function fireChange(element, onChange) {
  53224. var event = createEvent(element, "change");
  53225. Object.defineProperties(event, {
  53226. type: {
  53227. value: "change"
  53228. },
  53229. target: {
  53230. value: element
  53231. },
  53232. currentTarget: {
  53233. value: element
  53234. }
  53235. });
  53236. onChange === null || onChange === void 0 ? void 0 : onChange(event);
  53237. }
  53238. var useRadio = createHook({
  53239. name: "Radio",
  53240. compose: useCompositeItem,
  53241. keys: RADIO_KEYS,
  53242. useOptions: function useOptions(_ref, _ref2) {
  53243. var _options$value;
  53244. var value = _ref2.value,
  53245. checked = _ref2.checked;
  53246. var _ref$unstable_clickOn = _ref.unstable_clickOnEnter,
  53247. unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? false : _ref$unstable_clickOn,
  53248. _ref$unstable_checkOn = _ref.unstable_checkOnFocus,
  53249. unstable_checkOnFocus = _ref$unstable_checkOn === void 0 ? true : _ref$unstable_checkOn,
  53250. options = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref, ["unstable_clickOnEnter", "unstable_checkOnFocus"]);
  53251. return _objectSpread2(_objectSpread2({
  53252. checked: checked,
  53253. unstable_clickOnEnter: unstable_clickOnEnter,
  53254. unstable_checkOnFocus: unstable_checkOnFocus
  53255. }, options), {}, {
  53256. value: (_options$value = options.value) != null ? _options$value : value
  53257. });
  53258. },
  53259. useProps: function useProps(options, _ref3) {
  53260. var htmlRef = _ref3.ref,
  53261. htmlOnChange = _ref3.onChange,
  53262. htmlOnClick = _ref3.onClick,
  53263. htmlProps = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_ref3, ["ref", "onChange", "onClick"]);
  53264. var ref = (0,external_React_.useRef)(null);
  53265. var _React$useState3 = (0,external_React_.useState)(true),
  53266. isNativeRadio = _React$useState3[0],
  53267. setIsNativeRadio = _React$useState3[1];
  53268. var checked = getChecked(options);
  53269. var isCurrentItemRef = useLiveRef(options.currentId === options.id);
  53270. var onChangeRef = useLiveRef(htmlOnChange);
  53271. var onClickRef = useLiveRef(htmlOnClick);
  53272. useInitialChecked(options);
  53273. (0,external_React_.useEffect)(function () {
  53274. var element = ref.current;
  53275. if (!element) {
  53276. false ? 0 : void 0;
  53277. return;
  53278. }
  53279. if (element.tagName !== "INPUT" || element.type !== "radio") {
  53280. setIsNativeRadio(false);
  53281. }
  53282. }, []);
  53283. var onChange = (0,external_React_.useCallback)(function (event) {
  53284. var _onChangeRef$current, _options$setState;
  53285. (_onChangeRef$current = onChangeRef.current) === null || _onChangeRef$current === void 0 ? void 0 : _onChangeRef$current.call(onChangeRef, event);
  53286. if (event.defaultPrevented) return;
  53287. if (options.disabled) return;
  53288. (_options$setState = options.setState) === null || _options$setState === void 0 ? void 0 : _options$setState.call(options, options.value);
  53289. }, [options.disabled, options.setState, options.value]);
  53290. var onClick = (0,external_React_.useCallback)(function (event) {
  53291. var _onClickRef$current;
  53292. (_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
  53293. if (event.defaultPrevented) return;
  53294. if (isNativeRadio) return;
  53295. fireChange(event.currentTarget, onChange);
  53296. }, [onChange, isNativeRadio]);
  53297. (0,external_React_.useEffect)(function () {
  53298. var element = ref.current;
  53299. if (!element) return;
  53300. if (options.unstable_moves && isCurrentItemRef.current && options.unstable_checkOnFocus) {
  53301. fireChange(element, onChange);
  53302. }
  53303. }, [options.unstable_moves, options.unstable_checkOnFocus, onChange]);
  53304. return _objectSpread2({
  53305. ref: useForkRef(ref, htmlRef),
  53306. role: !isNativeRadio ? "radio" : undefined,
  53307. type: isNativeRadio ? "radio" : undefined,
  53308. value: isNativeRadio ? options.value : undefined,
  53309. name: isNativeRadio ? options.baseId : undefined,
  53310. "aria-checked": checked,
  53311. checked: checked,
  53312. onChange: onChange,
  53313. onClick: onClick
  53314. }, htmlProps);
  53315. }
  53316. });
  53317. var Radio = createComponent({
  53318. as: "input",
  53319. memo: true,
  53320. useHook: useRadio
  53321. });
  53322. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/styles.js
  53323. function toggle_group_control_option_base_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  53324. /**
  53325. * External dependencies
  53326. */
  53327. /**
  53328. * Internal dependencies
  53329. */
  53330. const LabelView = emotion_styled_base_browser_esm("div", true ? {
  53331. target: "et6ln9s1"
  53332. } : 0)( true ? {
  53333. name: "sln1fl",
  53334. styles: "display:inline-flex;max-width:100%;min-width:0;position:relative"
  53335. } : 0);
  53336. const labelBlock = true ? {
  53337. name: "82a6rk",
  53338. styles: "flex:1"
  53339. } : 0;
  53340. const buttonView = /*#__PURE__*/emotion_react_browser_esm_css("align-items:center;appearance:none;background:transparent;border:none;border-radius:", config_values.controlBorderRadius, ";color:", COLORS.gray[700], ";fill:currentColor;cursor:pointer;display:flex;font-family:inherit;height:100%;justify-content:center;line-height:100%;outline:none;padding:0 12px;position:relative;text-align:center;transition:background ", config_values.transitionDurationFast, " linear,color ", config_values.transitionDurationFast, " linear,font-weight 60ms linear;", reduceMotion('transition'), " user-select:none;width:100%;z-index:2;&::-moz-focus-inner{border:0;}&:active{background:", config_values.toggleGroupControlBackgroundColor, ";}" + ( true ? "" : 0), true ? "" : 0);
  53341. const buttonActive = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.white, ";&:active{background:transparent;}" + ( true ? "" : 0), true ? "" : 0);
  53342. const ButtonContentView = emotion_styled_base_browser_esm("div", true ? {
  53343. target: "et6ln9s0"
  53344. } : 0)("font-size:", config_values.fontSize, ";line-height:1;" + ( true ? "" : 0));
  53345. const separatorActive = true ? {
  53346. name: "1qsuvl4",
  53347. styles: "background:transparent"
  53348. } : 0;
  53349. const medium = /*#__PURE__*/emotion_react_browser_esm_css("min-height:", config_values.controlHeight, ";" + ( true ? "" : 0), true ? "" : 0);
  53350. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/component.js
  53351. /**
  53352. * External dependencies
  53353. */
  53354. // eslint-disable-next-line no-restricted-imports
  53355. /**
  53356. * WordPress dependencies
  53357. */
  53358. /**
  53359. * Internal dependencies
  53360. */
  53361. const {
  53362. ButtonContentView: component_ButtonContentView,
  53363. LabelView: component_LabelView
  53364. } = toggle_group_control_option_base_styles_namespaceObject;
  53365. const WithToolTip = _ref => {
  53366. let {
  53367. showTooltip,
  53368. text,
  53369. children
  53370. } = _ref;
  53371. if (showTooltip && text) {
  53372. return (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  53373. text: text,
  53374. position: "top center"
  53375. }, children);
  53376. }
  53377. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, children);
  53378. };
  53379. function ToggleGroupControlOptionBase(props, forwardedRef) {
  53380. const toggleGroupControlContext = useToggleGroupControlContext();
  53381. const id = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleGroupControlOptionBase, toggleGroupControlContext.baseId || 'toggle-group-control-option-base');
  53382. const buttonProps = useContextSystem({ ...props,
  53383. id
  53384. }, 'ToggleGroupControlOptionBase');
  53385. const {
  53386. className,
  53387. isBlock = false,
  53388. value,
  53389. children,
  53390. showTooltip = false,
  53391. ...radioProps
  53392. } = { ...toggleGroupControlContext,
  53393. ...buttonProps
  53394. };
  53395. const isActive = radioProps.state === value;
  53396. const cx = useCx();
  53397. const labelViewClasses = cx(isBlock && labelBlock);
  53398. const classes = cx(buttonView, className, isActive && buttonActive);
  53399. return (0,external_wp_element_namespaceObject.createElement)(component_LabelView, {
  53400. className: labelViewClasses,
  53401. "data-active": isActive
  53402. }, (0,external_wp_element_namespaceObject.createElement)(WithToolTip, {
  53403. showTooltip: showTooltip,
  53404. text: radioProps['aria-label']
  53405. }, (0,external_wp_element_namespaceObject.createElement)(Radio, extends_extends({}, radioProps, {
  53406. as: "button",
  53407. "aria-label": radioProps['aria-label'],
  53408. className: classes,
  53409. "data-value": value,
  53410. ref: forwardedRef,
  53411. value: value
  53412. }), (0,external_wp_element_namespaceObject.createElement)(component_ButtonContentView, null, children))));
  53413. }
  53414. /**
  53415. * `ToggleGroupControlOptionBase` is a form component and is meant to be used as an internal,
  53416. * generic component for any children of `ToggleGroupControl`.
  53417. *
  53418. * @example
  53419. * ```jsx
  53420. * import {
  53421. * __experimentalToggleGroupControl as ToggleGroupControl,
  53422. * __experimentalToggleGroupControlOptionBase as ToggleGroupControlOptionBase,
  53423. * } from '@wordpress/components';
  53424. *
  53425. * function Example() {
  53426. * return (
  53427. * <ToggleGroupControl label="my label" value="vertical" isBlock>
  53428. * <ToggleGroupControlOption value="horizontal" label="Horizontal" />
  53429. * <ToggleGroupControlOption value="vertical" label="Vertical" />
  53430. * </ToggleGroupControl>
  53431. * );
  53432. * }
  53433. * ```
  53434. */
  53435. const ConnectedToggleGroupControlOptionBase = contextConnect(ToggleGroupControlOptionBase, 'ToggleGroupControlOptionBase');
  53436. /* harmony default export */ var toggle_group_control_option_base_component = (ConnectedToggleGroupControlOptionBase);
  53437. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option/component.js
  53438. /**
  53439. * Internal dependencies
  53440. */
  53441. function ToggleGroupControlOption(props) {
  53442. const {
  53443. label,
  53444. ...restProps
  53445. } = props;
  53446. const optionLabel = restProps['aria-label'] || label;
  53447. return (0,external_wp_element_namespaceObject.createElement)(toggle_group_control_option_base_component, extends_extends({}, restProps, {
  53448. "aria-label": optionLabel
  53449. }), label);
  53450. }
  53451. /**
  53452. * `ToggleGroupControlOption` is a form component and is meant to be used as a
  53453. * child of `ToggleGroupControl`.
  53454. *
  53455. * @example
  53456. * ```jsx
  53457. * import {
  53458. * __experimentalToggleGroupControl as ToggleGroupControl,
  53459. * __experimentalToggleGroupControlOption as ToggleGroupControlOption,
  53460. * } from '@wordpress/components';
  53461. *
  53462. * function Example() {
  53463. * return (
  53464. * <ToggleGroupControl label="my label" value="vertical" isBlock>
  53465. * <ToggleGroupControlOption value="horizontal" label="Horizontal" />
  53466. * <ToggleGroupControlOption value="vertical" label="Vertical" />
  53467. * </ToggleGroupControl>
  53468. * );
  53469. * }
  53470. * ```
  53471. */
  53472. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/utils.js
  53473. /**
  53474. * WordPress dependencies
  53475. */
  53476. const DEFAULT_FONT_SIZE = 'default';
  53477. const DEFAULT_FONT_SIZE_OPTION = {
  53478. slug: DEFAULT_FONT_SIZE,
  53479. name: (0,external_wp_i18n_namespaceObject.__)('Default')
  53480. };
  53481. const CUSTOM_FONT_SIZE = 'custom';
  53482. const CUSTOM_FONT_SIZE_OPTION = {
  53483. slug: CUSTOM_FONT_SIZE,
  53484. name: (0,external_wp_i18n_namespaceObject.__)('Custom')
  53485. };
  53486. /**
  53487. * In case we have at most five font sizes, where at least one the them
  53488. * contain a complex css value(clamp, var, etc..) show a incremental sequence
  53489. * of numbers as a label of the font size. We do this because complex css values
  53490. * cannot be caluclated properly and the incremental sequence of numbers as labels
  53491. * can help the user better mentally map the different available font sizes.
  53492. */
  53493. const FONT_SIZES_ALIASES = ['1', '2', '3', '4', '5'];
  53494. /**
  53495. * Helper util to split a font size to its numeric value
  53496. * and its `unit`, if exists.
  53497. *
  53498. * @param {string|number} size Font size.
  53499. * @return {[number, string]} An array with the numeric value and the unit if exists.
  53500. */
  53501. function splitValueAndUnitFromSize(size) {
  53502. const [numericValue, unit] = `${size}`.match(/[\d\.]+|\D+/g);
  53503. if (!isNaN(parseFloat(numericValue)) && isFinite(numericValue)) {
  53504. return [numericValue, unit];
  53505. }
  53506. return [];
  53507. }
  53508. /**
  53509. * Some themes use css vars for their font sizes, so until we
  53510. * have the way of calculating them don't display them.
  53511. *
  53512. * @param {string|number} value The value that is checked.
  53513. * @return {boolean} Whether the value is a simple css value.
  53514. */
  53515. function isSimpleCssValue(value) {
  53516. const sizeRegex = /^[\d\.]+(px|em|rem|vw|vh|%)?$/i;
  53517. return sizeRegex.test(value);
  53518. }
  53519. /**
  53520. * Return font size options in the proper format depending
  53521. * on the currently used control (select, toggle group).
  53522. *
  53523. * @param {boolean} useSelectControl Whether to use a select control.
  53524. * @param {Object[]} optionsArray Array of available font sizes objects.
  53525. * @param {*} disableCustomFontSizes Flag that indicates if custom font sizes are disabled.
  53526. * @param {boolean} optionsContainComplexCssValues Whether font sizes contain at least one complex css value(clamp, var, etc..).
  53527. * @return {Object[]|null} Array of font sizes in proper format for the used control.
  53528. */
  53529. function getFontSizeOptions(useSelectControl, optionsArray, disableCustomFontSizes, optionsContainComplexCssValues) {
  53530. if (disableCustomFontSizes && !optionsArray.length) {
  53531. return null;
  53532. }
  53533. return useSelectControl ? getSelectOptions(optionsArray, disableCustomFontSizes) : getToggleGroupOptions(optionsArray, optionsContainComplexCssValues);
  53534. }
  53535. function getSelectOptions(optionsArray, disableCustomFontSizes) {
  53536. const options = [DEFAULT_FONT_SIZE_OPTION, ...optionsArray, ...(disableCustomFontSizes ? [] : [CUSTOM_FONT_SIZE_OPTION])];
  53537. return options.map(_ref => {
  53538. let {
  53539. slug,
  53540. name,
  53541. size
  53542. } = _ref;
  53543. return {
  53544. key: slug,
  53545. name,
  53546. size,
  53547. __experimentalHint: size && isSimpleCssValue(size) && parseFloat(size)
  53548. };
  53549. });
  53550. }
  53551. function getToggleGroupOptions(optionsArray, optionsContainComplexCssValues) {
  53552. return optionsArray.map((_ref2, index) => {
  53553. let {
  53554. slug,
  53555. size,
  53556. name
  53557. } = _ref2;
  53558. let label = optionsContainComplexCssValues ? FONT_SIZES_ALIASES[index] : size;
  53559. if (!optionsContainComplexCssValues && typeof size === 'string') {
  53560. const [numericValue] = splitValueAndUnitFromSize(size);
  53561. label = numericValue;
  53562. }
  53563. return {
  53564. key: slug,
  53565. value: size,
  53566. label,
  53567. name
  53568. };
  53569. });
  53570. }
  53571. function getSelectedOption(fontSizes, value) {
  53572. if (!value) {
  53573. return DEFAULT_FONT_SIZE_OPTION;
  53574. }
  53575. return fontSizes.find(font => font.size === value) || CUSTOM_FONT_SIZE_OPTION;
  53576. }
  53577. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/index.js
  53578. /**
  53579. * WordPress dependencies
  53580. */
  53581. /**
  53582. * Internal dependencies
  53583. */
  53584. function FontSizePicker(_ref, ref) {
  53585. var _fontSizes$, _value$endsWith;
  53586. let {
  53587. fallbackFontSize,
  53588. fontSizes = [],
  53589. disableCustomFontSizes = false,
  53590. onChange,
  53591. value,
  53592. withSlider = false,
  53593. withReset = true
  53594. } = _ref;
  53595. const hasUnits = [typeof value, typeof (fontSizes === null || fontSizes === void 0 ? void 0 : (_fontSizes$ = fontSizes[0]) === null || _fontSizes$ === void 0 ? void 0 : _fontSizes$.size)].includes('string');
  53596. const noUnitsValue = !hasUnits ? value : parseInt(value);
  53597. const isPixelValue = typeof value === 'number' || (value === null || value === void 0 ? void 0 : (_value$endsWith = value.endsWith) === null || _value$endsWith === void 0 ? void 0 : _value$endsWith.call(value, 'px'));
  53598. const units = useCustomUnits({
  53599. availableUnits: ['px', 'em', 'rem']
  53600. });
  53601. /**
  53602. * The main font size UI displays a toggle group when the presets are less
  53603. * than six and a select control when they are more.
  53604. */
  53605. const fontSizesContainComplexValues = fontSizes.some(_ref2 => {
  53606. let {
  53607. size
  53608. } = _ref2;
  53609. return !isSimpleCssValue(size);
  53610. });
  53611. const shouldUseSelectControl = fontSizes.length > 5;
  53612. const options = (0,external_wp_element_namespaceObject.useMemo)(() => getFontSizeOptions(shouldUseSelectControl, fontSizes, disableCustomFontSizes, fontSizesContainComplexValues), [shouldUseSelectControl, fontSizes, disableCustomFontSizes, fontSizesContainComplexValues]);
  53613. const selectedOption = getSelectedOption(fontSizes, value);
  53614. const isCustomValue = selectedOption.slug === CUSTOM_FONT_SIZE;
  53615. const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)(!disableCustomFontSizes && isCustomValue);
  53616. const headerHint = (0,external_wp_element_namespaceObject.useMemo)(() => {
  53617. if (showCustomValueControl) {
  53618. return `(${(0,external_wp_i18n_namespaceObject.__)('Custom')})`;
  53619. } // If we have a custom value that is not available in the font sizes,
  53620. // show it as a hint as long as it's a simple CSS value.
  53621. if (isCustomValue) {
  53622. return isSimpleCssValue(value) && `(${value})`;
  53623. }
  53624. if (shouldUseSelectControl) {
  53625. return isSimpleCssValue(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.size) && `(${selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.size})`;
  53626. } // Calculate the `hint` for toggle group control.
  53627. let hint = selectedOption.name;
  53628. if (!fontSizesContainComplexValues && typeof selectedOption.size === 'string') {
  53629. const [, unit] = splitValueAndUnitFromSize(selectedOption.size);
  53630. hint += `(${unit})`;
  53631. }
  53632. return hint;
  53633. }, [showCustomValueControl, selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.slug, value, isCustomValue, fontSizesContainComplexValues]);
  53634. if (!options) {
  53635. return null;
  53636. } // This is used for select control only. We need to add support
  53637. // for ToggleGroupControl.
  53638. const currentFontSizeSR = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font size.
  53639. (0,external_wp_i18n_namespaceObject.__)('Currently selected font size: %s'), selectedOption.name);
  53640. const baseClassName = 'components-font-size-picker';
  53641. return (0,external_wp_element_namespaceObject.createElement)("fieldset", extends_extends({
  53642. className: baseClassName
  53643. }, ref ? {} : {
  53644. ref
  53645. }), (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  53646. as: "legend"
  53647. }, (0,external_wp_i18n_namespaceObject.__)('Font size')), (0,external_wp_element_namespaceObject.createElement)(flex_component, {
  53648. justify: "space-between",
  53649. className: `${baseClassName}__header`
  53650. }, (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_i18n_namespaceObject.__)('Size'), headerHint && (0,external_wp_element_namespaceObject.createElement)("span", {
  53651. className: `${baseClassName}__header__hint`
  53652. }, headerHint)), !disableCustomFontSizes && (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  53653. label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)('Use size preset') : (0,external_wp_i18n_namespaceObject.__)('Set custom size'),
  53654. icon: library_settings,
  53655. onClick: () => {
  53656. setShowCustomValueControl(!showCustomValueControl);
  53657. },
  53658. isPressed: showCustomValueControl,
  53659. isSmall: true
  53660. }))), (0,external_wp_element_namespaceObject.createElement)("div", {
  53661. className: `${baseClassName}__controls`
  53662. }, !!fontSizes.length && shouldUseSelectControl && !showCustomValueControl && (0,external_wp_element_namespaceObject.createElement)(CustomSelectControl, {
  53663. className: `${baseClassName}__select`,
  53664. label: (0,external_wp_i18n_namespaceObject.__)('Font size'),
  53665. hideLabelFromVision: true,
  53666. describedBy: currentFontSizeSR,
  53667. options: options,
  53668. value: options.find(option => option.key === selectedOption.slug),
  53669. onChange: _ref3 => {
  53670. let {
  53671. selectedItem
  53672. } = _ref3;
  53673. onChange(hasUnits ? selectedItem.size : Number(selectedItem.size));
  53674. if (selectedItem.key === CUSTOM_FONT_SIZE) {
  53675. setShowCustomValueControl(true);
  53676. }
  53677. }
  53678. }), !shouldUseSelectControl && !showCustomValueControl && (0,external_wp_element_namespaceObject.createElement)(toggle_group_control_component, {
  53679. label: (0,external_wp_i18n_namespaceObject.__)('Font size'),
  53680. hideLabelFromVision: true,
  53681. value: value,
  53682. onChange: newValue => {
  53683. onChange(hasUnits ? newValue : Number(newValue));
  53684. },
  53685. isBlock: true
  53686. }, options.map(option => (0,external_wp_element_namespaceObject.createElement)(ToggleGroupControlOption, {
  53687. key: option.key,
  53688. value: option.value,
  53689. label: option.label,
  53690. "aria-label": option.name,
  53691. showTooltip: true
  53692. }))), !withSlider && !disableCustomFontSizes && showCustomValueControl && (0,external_wp_element_namespaceObject.createElement)(flex_component, {
  53693. justify: "space-between",
  53694. className: `${baseClassName}__custom-size-control`
  53695. }, (0,external_wp_element_namespaceObject.createElement)(flex_item_component, {
  53696. isBlock: true
  53697. }, (0,external_wp_element_namespaceObject.createElement)(unit_control, {
  53698. label: (0,external_wp_i18n_namespaceObject.__)('Custom'),
  53699. labelPosition: "top",
  53700. hideLabelFromVision: true,
  53701. value: value,
  53702. onChange: nextSize => {
  53703. if (0 === parseFloat(nextSize) || !nextSize) {
  53704. onChange(undefined);
  53705. } else {
  53706. onChange(hasUnits ? nextSize : parseInt(nextSize, 10));
  53707. }
  53708. },
  53709. units: hasUnits ? units : []
  53710. })), withReset && (0,external_wp_element_namespaceObject.createElement)(flex_item_component, {
  53711. isBlock: true
  53712. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  53713. className: "components-color-palette__clear",
  53714. disabled: value === undefined,
  53715. onClick: () => {
  53716. onChange(undefined);
  53717. },
  53718. isSmall: true,
  53719. variant: "secondary"
  53720. }, (0,external_wp_i18n_namespaceObject.__)('Reset'))))), withSlider && (0,external_wp_element_namespaceObject.createElement)(range_control, {
  53721. className: `${baseClassName}__custom-input`,
  53722. label: (0,external_wp_i18n_namespaceObject.__)('Custom Size'),
  53723. value: isPixelValue && noUnitsValue || '',
  53724. initialPosition: fallbackFontSize,
  53725. onChange: newValue => {
  53726. onChange(hasUnits ? newValue + 'px' : newValue);
  53727. },
  53728. min: 12,
  53729. max: 100
  53730. }));
  53731. }
  53732. /* harmony default export */ var font_size_picker = ((0,external_wp_element_namespaceObject.forwardRef)(FontSizePicker));
  53733. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-file-upload/index.js
  53734. /**
  53735. * WordPress dependencies
  53736. */
  53737. /**
  53738. * Internal dependencies
  53739. */
  53740. function FormFileUpload(_ref) {
  53741. let {
  53742. accept,
  53743. children,
  53744. multiple = false,
  53745. onChange,
  53746. onClick,
  53747. render,
  53748. ...props
  53749. } = _ref;
  53750. const ref = (0,external_wp_element_namespaceObject.useRef)();
  53751. const openFileDialog = () => {
  53752. ref.current.click();
  53753. };
  53754. const ui = render ? render({
  53755. openFileDialog
  53756. }) : (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  53757. onClick: openFileDialog
  53758. }, props), children);
  53759. return (0,external_wp_element_namespaceObject.createElement)("div", {
  53760. className: "components-form-file-upload"
  53761. }, ui, (0,external_wp_element_namespaceObject.createElement)("input", {
  53762. type: "file",
  53763. ref: ref,
  53764. multiple: multiple,
  53765. style: {
  53766. display: 'none'
  53767. },
  53768. accept: accept,
  53769. onChange: onChange,
  53770. onClick: onClick,
  53771. "data-testid": "form-file-upload-input"
  53772. }));
  53773. }
  53774. /* harmony default export */ var form_file_upload = (FormFileUpload);
  53775. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-toggle/index.js
  53776. /**
  53777. * External dependencies
  53778. */
  53779. function FormToggle(_ref) {
  53780. let {
  53781. className,
  53782. checked,
  53783. id,
  53784. disabled,
  53785. onChange = external_lodash_namespaceObject.noop,
  53786. ...props
  53787. } = _ref;
  53788. const wrapperClasses = classnames_default()('components-form-toggle', className, {
  53789. 'is-checked': checked,
  53790. 'is-disabled': disabled
  53791. });
  53792. return (0,external_wp_element_namespaceObject.createElement)("span", {
  53793. className: wrapperClasses
  53794. }, (0,external_wp_element_namespaceObject.createElement)("input", extends_extends({
  53795. className: "components-form-toggle__input",
  53796. id: id,
  53797. type: "checkbox",
  53798. checked: checked,
  53799. onChange: onChange,
  53800. disabled: disabled
  53801. }, props)), (0,external_wp_element_namespaceObject.createElement)("span", {
  53802. className: "components-form-toggle__track"
  53803. }), (0,external_wp_element_namespaceObject.createElement)("span", {
  53804. className: "components-form-toggle__thumb"
  53805. }));
  53806. }
  53807. /* harmony default export */ var form_toggle = (FormToggle);
  53808. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/token.js
  53809. /**
  53810. * External dependencies
  53811. */
  53812. /**
  53813. * WordPress dependencies
  53814. */
  53815. /**
  53816. * Internal dependencies
  53817. */
  53818. function Token(_ref) {
  53819. let {
  53820. value,
  53821. status,
  53822. title,
  53823. displayTransform,
  53824. isBorderless = false,
  53825. disabled = false,
  53826. onClickRemove = external_lodash_namespaceObject.noop,
  53827. onMouseEnter,
  53828. onMouseLeave,
  53829. messages,
  53830. termPosition,
  53831. termsCount
  53832. } = _ref;
  53833. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Token);
  53834. const tokenClasses = classnames_default()('components-form-token-field__token', {
  53835. 'is-error': 'error' === status,
  53836. 'is-success': 'success' === status,
  53837. 'is-validating': 'validating' === status,
  53838. 'is-borderless': isBorderless,
  53839. 'is-disabled': disabled
  53840. });
  53841. const onClick = () => onClickRemove({
  53842. value
  53843. });
  53844. const transformedValue = displayTransform(value);
  53845. const termPositionAndCount = (0,external_wp_i18n_namespaceObject.sprintf)(
  53846. /* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */
  53847. (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s of %3$s)'), transformedValue, termPosition, termsCount);
  53848. return (0,external_wp_element_namespaceObject.createElement)("span", {
  53849. className: tokenClasses,
  53850. onMouseEnter: onMouseEnter,
  53851. onMouseLeave: onMouseLeave,
  53852. title: title
  53853. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  53854. className: "components-form-token-field__token-text",
  53855. id: `components-form-token-field__token-text-${instanceId}`
  53856. }, (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  53857. as: "span"
  53858. }, termPositionAndCount), (0,external_wp_element_namespaceObject.createElement)("span", {
  53859. "aria-hidden": "true"
  53860. }, transformedValue)), (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  53861. className: "components-form-token-field__remove-token",
  53862. icon: close_small,
  53863. onClick: !disabled && onClick,
  53864. label: messages.remove,
  53865. "aria-describedby": `components-form-token-field__token-text-${instanceId}`
  53866. }));
  53867. }
  53868. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-spoken-messages/index.js
  53869. /**
  53870. * WordPress dependencies
  53871. */
  53872. /**
  53873. * A Higher Order Component used to be provide speak and debounced speak
  53874. * functions.
  53875. *
  53876. * @see https://developer.wordpress.org/block-editor/packages/packages-a11y/#speak
  53877. *
  53878. * @param {WPComponent} Component The component to be wrapped.
  53879. *
  53880. * @return {WPComponent} The wrapped component.
  53881. */
  53882. /* harmony default export */ var with_spoken_messages = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(Component => props => (0,external_wp_element_namespaceObject.createElement)(Component, extends_extends({}, props, {
  53883. speak: external_wp_a11y_namespaceObject.speak,
  53884. debouncedSpeak: (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500)
  53885. })), 'withSpokenMessages'));
  53886. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/index.js
  53887. /**
  53888. * External dependencies
  53889. */
  53890. /**
  53891. * WordPress dependencies
  53892. */
  53893. /**
  53894. * Internal dependencies
  53895. */
  53896. const initialState = {
  53897. incompleteTokenValue: '',
  53898. inputOffsetFromEnd: 0,
  53899. isActive: false,
  53900. isExpanded: false,
  53901. selectedSuggestionIndex: -1,
  53902. selectedSuggestionScroll: false
  53903. };
  53904. class FormTokenField extends external_wp_element_namespaceObject.Component {
  53905. constructor() {
  53906. super(...arguments);
  53907. this.state = initialState;
  53908. this.onKeyDown = this.onKeyDown.bind(this);
  53909. this.onKeyPress = this.onKeyPress.bind(this);
  53910. this.onFocus = this.onFocus.bind(this);
  53911. this.onBlur = this.onBlur.bind(this);
  53912. this.deleteTokenBeforeInput = this.deleteTokenBeforeInput.bind(this);
  53913. this.deleteTokenAfterInput = this.deleteTokenAfterInput.bind(this);
  53914. this.addCurrentToken = this.addCurrentToken.bind(this);
  53915. this.onContainerTouched = this.onContainerTouched.bind(this);
  53916. this.renderToken = this.renderToken.bind(this);
  53917. this.onTokenClickRemove = this.onTokenClickRemove.bind(this);
  53918. this.onSuggestionHovered = this.onSuggestionHovered.bind(this);
  53919. this.onSuggestionSelected = this.onSuggestionSelected.bind(this);
  53920. this.onInputChange = this.onInputChange.bind(this);
  53921. this.bindInput = this.bindInput.bind(this);
  53922. this.bindTokensAndInput = this.bindTokensAndInput.bind(this);
  53923. this.updateSuggestions = this.updateSuggestions.bind(this);
  53924. }
  53925. componentDidUpdate(prevProps) {
  53926. // Make sure to focus the input when the isActive state is true.
  53927. if (this.state.isActive && !this.input.hasFocus()) {
  53928. this.input.focus();
  53929. }
  53930. const {
  53931. suggestions,
  53932. value
  53933. } = this.props;
  53934. const suggestionsDidUpdate = !external_wp_isShallowEqual_default()(suggestions, prevProps.suggestions);
  53935. if (suggestionsDidUpdate || value !== prevProps.value) {
  53936. this.updateSuggestions(suggestionsDidUpdate);
  53937. }
  53938. }
  53939. static getDerivedStateFromProps(props, state) {
  53940. if (!props.disabled || !state.isActive) {
  53941. return null;
  53942. }
  53943. return {
  53944. isActive: false,
  53945. incompleteTokenValue: ''
  53946. };
  53947. }
  53948. bindInput(ref) {
  53949. this.input = ref;
  53950. }
  53951. bindTokensAndInput(ref) {
  53952. this.tokensAndInput = ref;
  53953. }
  53954. onFocus(event) {
  53955. const {
  53956. __experimentalExpandOnFocus
  53957. } = this.props; // If focus is on the input or on the container, set the isActive state to true.
  53958. if (this.input.hasFocus() || event.target === this.tokensAndInput) {
  53959. this.setState({
  53960. isActive: true,
  53961. isExpanded: !!__experimentalExpandOnFocus || this.state.isExpanded
  53962. });
  53963. } else {
  53964. /*
  53965. * Otherwise, focus is on one of the token "remove" buttons and we
  53966. * set the isActive state to false to prevent the input to be
  53967. * re-focused, see componentDidUpdate().
  53968. */
  53969. this.setState({
  53970. isActive: false
  53971. });
  53972. }
  53973. if ('function' === typeof this.props.onFocus) {
  53974. this.props.onFocus(event);
  53975. }
  53976. }
  53977. onBlur() {
  53978. if (this.inputHasValidValue()) {
  53979. this.setState({
  53980. isActive: false
  53981. });
  53982. } else {
  53983. this.setState(initialState);
  53984. }
  53985. }
  53986. onKeyDown(event) {
  53987. let preventDefault = false;
  53988. if (event.defaultPrevented) {
  53989. return;
  53990. }
  53991. switch (event.keyCode) {
  53992. case external_wp_keycodes_namespaceObject.BACKSPACE:
  53993. preventDefault = this.handleDeleteKey(this.deleteTokenBeforeInput);
  53994. break;
  53995. case external_wp_keycodes_namespaceObject.ENTER:
  53996. preventDefault = this.addCurrentToken();
  53997. break;
  53998. case external_wp_keycodes_namespaceObject.LEFT:
  53999. preventDefault = this.handleLeftArrowKey();
  54000. break;
  54001. case external_wp_keycodes_namespaceObject.UP:
  54002. preventDefault = this.handleUpArrowKey();
  54003. break;
  54004. case external_wp_keycodes_namespaceObject.RIGHT:
  54005. preventDefault = this.handleRightArrowKey();
  54006. break;
  54007. case external_wp_keycodes_namespaceObject.DOWN:
  54008. preventDefault = this.handleDownArrowKey();
  54009. break;
  54010. case external_wp_keycodes_namespaceObject.DELETE:
  54011. preventDefault = this.handleDeleteKey(this.deleteTokenAfterInput);
  54012. break;
  54013. case external_wp_keycodes_namespaceObject.SPACE:
  54014. if (this.props.tokenizeOnSpace) {
  54015. preventDefault = this.addCurrentToken();
  54016. }
  54017. break;
  54018. case external_wp_keycodes_namespaceObject.ESCAPE:
  54019. preventDefault = this.handleEscapeKey(event);
  54020. break;
  54021. default:
  54022. break;
  54023. }
  54024. if (preventDefault) {
  54025. event.preventDefault();
  54026. }
  54027. }
  54028. onKeyPress(event) {
  54029. let preventDefault = false;
  54030. switch (event.charCode) {
  54031. case 44:
  54032. // Comma.
  54033. preventDefault = this.handleCommaKey();
  54034. break;
  54035. default:
  54036. break;
  54037. }
  54038. if (preventDefault) {
  54039. event.preventDefault();
  54040. }
  54041. }
  54042. onContainerTouched(event) {
  54043. // Prevent clicking/touching the tokensAndInput container from blurring
  54044. // the input and adding the current token.
  54045. if (event.target === this.tokensAndInput && this.state.isActive) {
  54046. event.preventDefault();
  54047. }
  54048. }
  54049. onTokenClickRemove(event) {
  54050. this.deleteToken(event.value);
  54051. this.input.focus();
  54052. }
  54053. onSuggestionHovered(suggestion) {
  54054. const index = this.getMatchingSuggestions().indexOf(suggestion);
  54055. if (index >= 0) {
  54056. this.setState({
  54057. selectedSuggestionIndex: index,
  54058. selectedSuggestionScroll: false
  54059. });
  54060. }
  54061. }
  54062. onSuggestionSelected(suggestion) {
  54063. this.addNewToken(suggestion);
  54064. }
  54065. onInputChange(event) {
  54066. const text = event.value;
  54067. const separator = this.props.tokenizeOnSpace ? /[ ,\t]+/ : /[,\t]+/;
  54068. const items = text.split(separator);
  54069. const tokenValue = (0,external_lodash_namespaceObject.last)(items) || '';
  54070. if (items.length > 1) {
  54071. this.addNewTokens(items.slice(0, -1));
  54072. }
  54073. this.setState({
  54074. incompleteTokenValue: tokenValue
  54075. }, this.updateSuggestions);
  54076. this.props.onInputChange(tokenValue);
  54077. }
  54078. handleDeleteKey(deleteToken) {
  54079. let preventDefault = false;
  54080. if (this.input.hasFocus() && this.isInputEmpty()) {
  54081. deleteToken();
  54082. preventDefault = true;
  54083. }
  54084. return preventDefault;
  54085. }
  54086. handleLeftArrowKey() {
  54087. let preventDefault = false;
  54088. if (this.isInputEmpty()) {
  54089. this.moveInputBeforePreviousToken();
  54090. preventDefault = true;
  54091. }
  54092. return preventDefault;
  54093. }
  54094. handleRightArrowKey() {
  54095. let preventDefault = false;
  54096. if (this.isInputEmpty()) {
  54097. this.moveInputAfterNextToken();
  54098. preventDefault = true;
  54099. }
  54100. return preventDefault;
  54101. }
  54102. handleUpArrowKey() {
  54103. this.setState((state, props) => ({
  54104. selectedSuggestionIndex: (state.selectedSuggestionIndex === 0 ? this.getMatchingSuggestions(state.incompleteTokenValue, props.suggestions, props.value, props.maxSuggestions, props.saveTransform).length : state.selectedSuggestionIndex) - 1,
  54105. selectedSuggestionScroll: true
  54106. }));
  54107. return true; // PreventDefault.
  54108. }
  54109. handleDownArrowKey() {
  54110. this.setState((state, props) => ({
  54111. selectedSuggestionIndex: (state.selectedSuggestionIndex + 1) % this.getMatchingSuggestions(state.incompleteTokenValue, props.suggestions, props.value, props.maxSuggestions, props.saveTransform).length,
  54112. selectedSuggestionScroll: true
  54113. }));
  54114. return true; // PreventDefault.
  54115. }
  54116. handleEscapeKey(event) {
  54117. this.setState({
  54118. incompleteTokenValue: event.target.value,
  54119. isExpanded: false,
  54120. selectedSuggestionIndex: -1,
  54121. selectedSuggestionScroll: false
  54122. });
  54123. return true; // PreventDefault.
  54124. }
  54125. handleCommaKey() {
  54126. if (this.inputHasValidValue()) {
  54127. this.addNewToken(this.state.incompleteTokenValue);
  54128. }
  54129. return true; // PreventDefault.
  54130. }
  54131. moveInputToIndex(index) {
  54132. this.setState((state, props) => ({
  54133. inputOffsetFromEnd: props.value.length - Math.max(index, -1) - 1
  54134. }));
  54135. }
  54136. moveInputBeforePreviousToken() {
  54137. this.setState((state, props) => ({
  54138. inputOffsetFromEnd: Math.min(state.inputOffsetFromEnd + 1, props.value.length)
  54139. }));
  54140. }
  54141. moveInputAfterNextToken() {
  54142. this.setState(state => ({
  54143. inputOffsetFromEnd: Math.max(state.inputOffsetFromEnd - 1, 0)
  54144. }));
  54145. }
  54146. deleteTokenBeforeInput() {
  54147. const index = this.getIndexOfInput() - 1;
  54148. if (index > -1) {
  54149. this.deleteToken(this.props.value[index]);
  54150. }
  54151. }
  54152. deleteTokenAfterInput() {
  54153. const index = this.getIndexOfInput();
  54154. if (index < this.props.value.length) {
  54155. this.deleteToken(this.props.value[index]); // Update input offset since it's the offset from the last token.
  54156. this.moveInputToIndex(index);
  54157. }
  54158. }
  54159. addCurrentToken() {
  54160. let preventDefault = false;
  54161. const selectedSuggestion = this.getSelectedSuggestion();
  54162. if (selectedSuggestion) {
  54163. this.addNewToken(selectedSuggestion);
  54164. preventDefault = true;
  54165. } else if (this.inputHasValidValue()) {
  54166. this.addNewToken(this.state.incompleteTokenValue);
  54167. preventDefault = true;
  54168. }
  54169. return preventDefault;
  54170. }
  54171. addNewTokens(tokens) {
  54172. const tokensToAdd = (0,external_lodash_namespaceObject.uniq)(tokens.map(this.props.saveTransform).filter(Boolean).filter(token => !this.valueContainsToken(token)));
  54173. if (tokensToAdd.length > 0) {
  54174. const newValue = (0,external_lodash_namespaceObject.clone)(this.props.value);
  54175. newValue.splice.apply(newValue, [this.getIndexOfInput(), 0].concat(tokensToAdd));
  54176. this.props.onChange(newValue);
  54177. }
  54178. }
  54179. addNewToken(token) {
  54180. const {
  54181. __experimentalExpandOnFocus,
  54182. __experimentalValidateInput
  54183. } = this.props;
  54184. if (!__experimentalValidateInput(token)) {
  54185. this.props.speak(this.props.messages.__experimentalInvalid, 'assertive');
  54186. return;
  54187. }
  54188. this.addNewTokens([token]);
  54189. this.props.speak(this.props.messages.added, 'assertive');
  54190. this.setState({
  54191. incompleteTokenValue: '',
  54192. selectedSuggestionIndex: -1,
  54193. selectedSuggestionScroll: false,
  54194. isExpanded: !__experimentalExpandOnFocus
  54195. });
  54196. if (this.state.isActive) {
  54197. this.input.focus();
  54198. }
  54199. }
  54200. deleteToken(token) {
  54201. const newTokens = this.props.value.filter(item => {
  54202. return this.getTokenValue(item) !== this.getTokenValue(token);
  54203. });
  54204. this.props.onChange(newTokens);
  54205. this.props.speak(this.props.messages.removed, 'assertive');
  54206. }
  54207. getTokenValue(token) {
  54208. if ('object' === typeof token) {
  54209. return token.value;
  54210. }
  54211. return token;
  54212. }
  54213. getMatchingSuggestions() {
  54214. let searchValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.state.incompleteTokenValue;
  54215. let suggestions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.props.suggestions;
  54216. let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.props.value;
  54217. let maxSuggestions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.props.maxSuggestions;
  54218. let saveTransform = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.props.saveTransform;
  54219. let match = saveTransform(searchValue);
  54220. const startsWithMatch = [];
  54221. const containsMatch = [];
  54222. if (match.length === 0) {
  54223. suggestions = (0,external_lodash_namespaceObject.difference)(suggestions, value);
  54224. } else {
  54225. match = match.toLocaleLowerCase();
  54226. (0,external_lodash_namespaceObject.each)(suggestions, suggestion => {
  54227. const index = suggestion.toLocaleLowerCase().indexOf(match);
  54228. if (value.indexOf(suggestion) === -1) {
  54229. if (index === 0) {
  54230. startsWithMatch.push(suggestion);
  54231. } else if (index > 0) {
  54232. containsMatch.push(suggestion);
  54233. }
  54234. }
  54235. });
  54236. suggestions = startsWithMatch.concat(containsMatch);
  54237. }
  54238. return (0,external_lodash_namespaceObject.take)(suggestions, maxSuggestions);
  54239. }
  54240. getSelectedSuggestion() {
  54241. if (this.state.selectedSuggestionIndex !== -1) {
  54242. return this.getMatchingSuggestions()[this.state.selectedSuggestionIndex];
  54243. }
  54244. }
  54245. valueContainsToken(token) {
  54246. return (0,external_lodash_namespaceObject.some)(this.props.value, item => {
  54247. return this.getTokenValue(token) === this.getTokenValue(item);
  54248. });
  54249. }
  54250. getIndexOfInput() {
  54251. return this.props.value.length - this.state.inputOffsetFromEnd;
  54252. }
  54253. isInputEmpty() {
  54254. return this.state.incompleteTokenValue.length === 0;
  54255. }
  54256. inputHasValidValue() {
  54257. return this.props.saveTransform(this.state.incompleteTokenValue).length > 0;
  54258. }
  54259. updateSuggestions() {
  54260. let resetSelectedSuggestion = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  54261. const {
  54262. __experimentalExpandOnFocus
  54263. } = this.props;
  54264. const {
  54265. incompleteTokenValue
  54266. } = this.state;
  54267. const inputHasMinimumChars = incompleteTokenValue.trim().length > 1;
  54268. const matchingSuggestions = this.getMatchingSuggestions(incompleteTokenValue);
  54269. const hasMatchingSuggestions = matchingSuggestions.length > 0;
  54270. const newState = {
  54271. isExpanded: __experimentalExpandOnFocus || inputHasMinimumChars && hasMatchingSuggestions
  54272. };
  54273. if (resetSelectedSuggestion) {
  54274. newState.selectedSuggestionIndex = -1;
  54275. newState.selectedSuggestionScroll = false;
  54276. }
  54277. this.setState(newState);
  54278. if (inputHasMinimumChars) {
  54279. const {
  54280. debouncedSpeak
  54281. } = this.props;
  54282. const message = hasMatchingSuggestions ? (0,external_wp_i18n_namespaceObject.sprintf)(
  54283. /* translators: %d: number of results. */
  54284. (0,external_wp_i18n_namespaceObject._n)('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', matchingSuggestions.length), matchingSuggestions.length) : (0,external_wp_i18n_namespaceObject.__)('No results.');
  54285. debouncedSpeak(message, 'assertive');
  54286. }
  54287. }
  54288. renderTokensAndInput() {
  54289. const components = (0,external_lodash_namespaceObject.map)(this.props.value, this.renderToken);
  54290. components.splice(this.getIndexOfInput(), 0, this.renderInput());
  54291. return components;
  54292. }
  54293. renderToken(token, index, tokens) {
  54294. const value = this.getTokenValue(token);
  54295. const status = token.status ? token.status : undefined;
  54296. const termPosition = index + 1;
  54297. const termsCount = tokens.length;
  54298. return (0,external_wp_element_namespaceObject.createElement)(Token, {
  54299. key: 'token-' + value,
  54300. value: value,
  54301. status: status,
  54302. title: token.title,
  54303. displayTransform: this.props.displayTransform,
  54304. onClickRemove: this.onTokenClickRemove,
  54305. isBorderless: token.isBorderless || this.props.isBorderless,
  54306. onMouseEnter: token.onMouseEnter,
  54307. onMouseLeave: token.onMouseLeave,
  54308. disabled: 'error' !== status && this.props.disabled,
  54309. messages: this.props.messages,
  54310. termsCount: termsCount,
  54311. termPosition: termPosition
  54312. });
  54313. }
  54314. renderInput() {
  54315. const {
  54316. autoCapitalize,
  54317. autoComplete,
  54318. maxLength,
  54319. placeholder,
  54320. value,
  54321. instanceId
  54322. } = this.props;
  54323. let props = {
  54324. instanceId,
  54325. autoCapitalize,
  54326. autoComplete,
  54327. placeholder: value.length === 0 ? placeholder : '',
  54328. ref: this.bindInput,
  54329. key: 'input',
  54330. disabled: this.props.disabled,
  54331. value: this.state.incompleteTokenValue,
  54332. onBlur: this.onBlur,
  54333. isExpanded: this.state.isExpanded,
  54334. selectedSuggestionIndex: this.state.selectedSuggestionIndex
  54335. };
  54336. if (!(maxLength && value.length >= maxLength)) {
  54337. props = { ...props,
  54338. onChange: this.onInputChange
  54339. };
  54340. }
  54341. return (0,external_wp_element_namespaceObject.createElement)(token_input, props);
  54342. }
  54343. render() {
  54344. const {
  54345. disabled,
  54346. label = (0,external_wp_i18n_namespaceObject.__)('Add item'),
  54347. instanceId,
  54348. className,
  54349. __experimentalShowHowTo
  54350. } = this.props;
  54351. const {
  54352. isExpanded
  54353. } = this.state;
  54354. const classes = classnames_default()(className, 'components-form-token-field__input-container', {
  54355. 'is-active': this.state.isActive,
  54356. 'is-disabled': disabled
  54357. });
  54358. let tokenFieldProps = {
  54359. className: 'components-form-token-field',
  54360. tabIndex: '-1'
  54361. };
  54362. const matchingSuggestions = this.getMatchingSuggestions();
  54363. if (!disabled) {
  54364. tokenFieldProps = Object.assign({}, tokenFieldProps, {
  54365. onKeyDown: this.onKeyDown,
  54366. onKeyPress: this.onKeyPress,
  54367. onFocus: this.onFocus
  54368. });
  54369. } // Disable reason: There is no appropriate role which describes the
  54370. // input container intended accessible usability.
  54371. // TODO: Refactor click detection to use blur to stop propagation.
  54372. /* eslint-disable jsx-a11y/no-static-element-interactions */
  54373. return (0,external_wp_element_namespaceObject.createElement)("div", tokenFieldProps, (0,external_wp_element_namespaceObject.createElement)("label", {
  54374. htmlFor: `components-form-token-input-${instanceId}`,
  54375. className: "components-form-token-field__label"
  54376. }, label), (0,external_wp_element_namespaceObject.createElement)("div", {
  54377. ref: this.bindTokensAndInput,
  54378. className: classes,
  54379. tabIndex: "-1",
  54380. onMouseDown: this.onContainerTouched,
  54381. onTouchStart: this.onContainerTouched
  54382. }, this.renderTokensAndInput(), isExpanded && (0,external_wp_element_namespaceObject.createElement)(suggestions_list, {
  54383. instanceId: instanceId,
  54384. match: this.props.saveTransform(this.state.incompleteTokenValue),
  54385. displayTransform: this.props.displayTransform,
  54386. suggestions: matchingSuggestions,
  54387. selectedIndex: this.state.selectedSuggestionIndex,
  54388. scrollIntoView: this.state.selectedSuggestionScroll,
  54389. onHover: this.onSuggestionHovered,
  54390. onSelect: this.onSuggestionSelected
  54391. })), __experimentalShowHowTo && (0,external_wp_element_namespaceObject.createElement)("p", {
  54392. id: `components-form-token-suggestions-howto-${instanceId}`,
  54393. className: "components-form-token-field__help"
  54394. }, this.props.tokenizeOnSpace ? (0,external_wp_i18n_namespaceObject.__)('Separate with commas, spaces, or the Enter key.') : (0,external_wp_i18n_namespaceObject.__)('Separate with commas or the Enter key.')));
  54395. /* eslint-enable jsx-a11y/no-static-element-interactions */
  54396. }
  54397. }
  54398. FormTokenField.defaultProps = {
  54399. suggestions: Object.freeze([]),
  54400. maxSuggestions: 100,
  54401. value: Object.freeze([]),
  54402. displayTransform: external_lodash_namespaceObject.identity,
  54403. saveTransform: token => token.trim(),
  54404. onChange: () => {},
  54405. onInputChange: () => {},
  54406. isBorderless: false,
  54407. disabled: false,
  54408. tokenizeOnSpace: false,
  54409. messages: {
  54410. added: (0,external_wp_i18n_namespaceObject.__)('Item added.'),
  54411. removed: (0,external_wp_i18n_namespaceObject.__)('Item removed.'),
  54412. remove: (0,external_wp_i18n_namespaceObject.__)('Remove item'),
  54413. __experimentalInvalid: (0,external_wp_i18n_namespaceObject.__)('Invalid item')
  54414. },
  54415. __experimentalExpandOnFocus: false,
  54416. __experimentalValidateInput: () => true,
  54417. __experimentalShowHowTo: true
  54418. };
  54419. /* harmony default export */ var form_token_field = (with_spoken_messages((0,external_wp_compose_namespaceObject.withInstanceId)(FormTokenField)));
  54420. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/icons.js
  54421. /**
  54422. * WordPress dependencies
  54423. */
  54424. const PageControlIcon = _ref => {
  54425. let {
  54426. isSelected
  54427. } = _ref;
  54428. return (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  54429. width: "8",
  54430. height: "8",
  54431. fill: "none",
  54432. xmlns: "http://www.w3.org/2000/svg"
  54433. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Circle, {
  54434. cx: "4",
  54435. cy: "4",
  54436. r: "4",
  54437. fill: isSelected ? '#419ECD' : '#E1E3E6'
  54438. }));
  54439. };
  54440. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/page-control.js
  54441. /**
  54442. * External dependencies
  54443. */
  54444. /**
  54445. * WordPress dependencies
  54446. */
  54447. /**
  54448. * Internal dependencies
  54449. */
  54450. function PageControl(_ref) {
  54451. let {
  54452. currentPage,
  54453. numberOfPages,
  54454. setCurrentPage
  54455. } = _ref;
  54456. return (0,external_wp_element_namespaceObject.createElement)("ul", {
  54457. className: "components-guide__page-control",
  54458. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Guide controls')
  54459. }, (0,external_lodash_namespaceObject.times)(numberOfPages, page => (0,external_wp_element_namespaceObject.createElement)("li", {
  54460. key: page // Set aria-current="step" on the active page, see https://www.w3.org/TR/wai-aria-1.1/#aria-current
  54461. ,
  54462. "aria-current": page === currentPage ? 'step' : undefined
  54463. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  54464. key: page,
  54465. icon: (0,external_wp_element_namespaceObject.createElement)(PageControlIcon, {
  54466. isSelected: page === currentPage
  54467. }),
  54468. "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
  54469. /* translators: 1: current page number 2: total number of pages */
  54470. (0,external_wp_i18n_namespaceObject.__)('Page %1$d of %2$d'), page + 1, numberOfPages),
  54471. onClick: () => setCurrentPage(page)
  54472. }))));
  54473. }
  54474. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/index.js
  54475. /**
  54476. * External dependencies
  54477. */
  54478. /**
  54479. * WordPress dependencies
  54480. */
  54481. /**
  54482. * Internal dependencies
  54483. */
  54484. function Guide(_ref) {
  54485. let {
  54486. children,
  54487. className,
  54488. contentLabel,
  54489. finishButtonText,
  54490. onFinish,
  54491. pages = []
  54492. } = _ref;
  54493. const guideContainer = (0,external_wp_element_namespaceObject.useRef)();
  54494. const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(0);
  54495. (0,external_wp_element_namespaceObject.useEffect)(() => {
  54496. if (external_wp_element_namespaceObject.Children.count(children)) {
  54497. external_wp_deprecated_default()('Passing children to <Guide>', {
  54498. since: '5.5',
  54499. alternative: 'the `pages` prop'
  54500. });
  54501. }
  54502. }, [children]);
  54503. (0,external_wp_element_namespaceObject.useEffect)(() => {
  54504. var _focus$tabbable$find, _focus$tabbable$find$;
  54505. // Each time we change the current page, start from the first element of the page.
  54506. // This also solves any focus loss that can happen.
  54507. (_focus$tabbable$find = external_wp_dom_namespaceObject.focus.tabbable.find(guideContainer.current)) === null || _focus$tabbable$find === void 0 ? void 0 : (_focus$tabbable$find$ = _focus$tabbable$find[0]) === null || _focus$tabbable$find$ === void 0 ? void 0 : _focus$tabbable$find$.focus();
  54508. }, [currentPage]);
  54509. if (external_wp_element_namespaceObject.Children.count(children)) {
  54510. pages = external_wp_element_namespaceObject.Children.map(children, child => ({
  54511. content: child
  54512. }));
  54513. }
  54514. const canGoBack = currentPage > 0;
  54515. const canGoForward = currentPage < pages.length - 1;
  54516. const goBack = () => {
  54517. if (canGoBack) {
  54518. setCurrentPage(currentPage - 1);
  54519. }
  54520. };
  54521. const goForward = () => {
  54522. if (canGoForward) {
  54523. setCurrentPage(currentPage + 1);
  54524. }
  54525. };
  54526. if (pages.length === 0) {
  54527. return null;
  54528. }
  54529. return (0,external_wp_element_namespaceObject.createElement)(modal, {
  54530. className: classnames_default()('components-guide', className),
  54531. contentLabel: contentLabel,
  54532. onRequestClose: onFinish,
  54533. onKeyDown: event => {
  54534. if (event.keyCode === external_wp_keycodes_namespaceObject.LEFT) {
  54535. goBack();
  54536. } else if (event.keyCode === external_wp_keycodes_namespaceObject.RIGHT) {
  54537. goForward();
  54538. }
  54539. },
  54540. ref: guideContainer
  54541. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  54542. className: "components-guide__container"
  54543. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  54544. className: "components-guide__page"
  54545. }, pages[currentPage].image, pages.length > 1 && (0,external_wp_element_namespaceObject.createElement)(PageControl, {
  54546. currentPage: currentPage,
  54547. numberOfPages: pages.length,
  54548. setCurrentPage: setCurrentPage
  54549. }), pages[currentPage].content), (0,external_wp_element_namespaceObject.createElement)("div", {
  54550. className: "components-guide__footer"
  54551. }, canGoBack && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  54552. className: "components-guide__back-button",
  54553. onClick: goBack
  54554. }, (0,external_wp_i18n_namespaceObject.__)('Previous')), canGoForward && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  54555. className: "components-guide__forward-button",
  54556. onClick: goForward
  54557. }, (0,external_wp_i18n_namespaceObject.__)('Next')), !canGoForward && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  54558. className: "components-guide__finish-button",
  54559. onClick: onFinish
  54560. }, finishButtonText || (0,external_wp_i18n_namespaceObject.__)('Finish')))));
  54561. }
  54562. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/page.js
  54563. /**
  54564. * WordPress dependencies
  54565. */
  54566. function GuidePage(props) {
  54567. (0,external_wp_element_namespaceObject.useEffect)(() => {
  54568. external_wp_deprecated_default()('<GuidePage>', {
  54569. since: '5.5',
  54570. alternative: 'the `pages` prop in <Guide>'
  54571. });
  54572. }, []);
  54573. return (0,external_wp_element_namespaceObject.createElement)("div", props);
  54574. }
  54575. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/button/deprecated.js
  54576. // @ts-nocheck
  54577. /**
  54578. * WordPress dependencies
  54579. */
  54580. /**
  54581. * Internal dependencies
  54582. */
  54583. function IconButton(_ref, ref) {
  54584. let {
  54585. labelPosition,
  54586. size,
  54587. tooltip,
  54588. label,
  54589. ...props
  54590. } = _ref;
  54591. external_wp_deprecated_default()('wp.components.IconButton', {
  54592. since: '5.4',
  54593. alternative: 'wp.components.Button',
  54594. version: '6.2'
  54595. });
  54596. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({}, props, {
  54597. ref: ref,
  54598. tooltipPosition: labelPosition,
  54599. iconSize: size,
  54600. showTooltip: tooltip !== undefined ? !!tooltip : undefined,
  54601. label: tooltip || label
  54602. }));
  54603. }
  54604. /* harmony default export */ var deprecated = ((0,external_wp_element_namespaceObject.forwardRef)(IconButton));
  54605. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/item/hook.js
  54606. /**
  54607. * External dependencies
  54608. */
  54609. /**
  54610. * WordPress dependencies
  54611. */
  54612. /**
  54613. * Internal dependencies
  54614. */
  54615. function hook_useItem(props) {
  54616. const {
  54617. as: asProp,
  54618. className,
  54619. onClick,
  54620. role = 'listitem',
  54621. size: sizeProp,
  54622. ...otherProps
  54623. } = useContextSystem(props, 'Item');
  54624. const {
  54625. spacedAround,
  54626. size: contextSize
  54627. } = useItemGroupContext();
  54628. const size = sizeProp || contextSize;
  54629. const as = asProp || (typeof onClick !== 'undefined' ? 'button' : 'div');
  54630. const cx = useCx();
  54631. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(as === 'button' && unstyledButton, itemSizes[size] || itemSizes.medium, item, spacedAround && styles_spacedAround, className), [as, className, cx, size, spacedAround]);
  54632. const wrapperClassName = cx(itemWrapper);
  54633. return {
  54634. as,
  54635. className: classes,
  54636. onClick,
  54637. wrapperClassName,
  54638. role,
  54639. ...otherProps
  54640. };
  54641. }
  54642. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/item/component.js
  54643. /**
  54644. * External dependencies
  54645. */
  54646. /**
  54647. * Internal dependencies
  54648. */
  54649. function component_Item(props, forwardedRef) {
  54650. const {
  54651. role,
  54652. wrapperClassName,
  54653. ...otherProps
  54654. } = hook_useItem(props);
  54655. return (0,external_wp_element_namespaceObject.createElement)("div", {
  54656. role: role,
  54657. className: wrapperClassName
  54658. }, (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  54659. ref: forwardedRef
  54660. })));
  54661. }
  54662. /* harmony default export */ var item_component = (contextConnect(component_Item, 'Item'));
  54663. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/keyboard-shortcuts/index.js
  54664. /**
  54665. * External dependencies
  54666. */
  54667. /**
  54668. * WordPress dependencies
  54669. */
  54670. function KeyboardShortcut(_ref) {
  54671. let {
  54672. target,
  54673. callback,
  54674. shortcut,
  54675. bindGlobal,
  54676. eventName
  54677. } = _ref;
  54678. (0,external_wp_compose_namespaceObject.useKeyboardShortcut)(shortcut, callback, {
  54679. bindGlobal,
  54680. target,
  54681. eventName
  54682. });
  54683. return null;
  54684. }
  54685. function KeyboardShortcuts(_ref2) {
  54686. let {
  54687. children,
  54688. shortcuts,
  54689. bindGlobal,
  54690. eventName
  54691. } = _ref2;
  54692. const target = (0,external_wp_element_namespaceObject.useRef)();
  54693. const element = (0,external_lodash_namespaceObject.map)(shortcuts, (callback, shortcut) => (0,external_wp_element_namespaceObject.createElement)(KeyboardShortcut, {
  54694. key: shortcut,
  54695. shortcut: shortcut,
  54696. callback: callback,
  54697. bindGlobal: bindGlobal,
  54698. eventName: eventName,
  54699. target: target
  54700. })); // Render as non-visual if there are no children pressed. Keyboard
  54701. // events will be bound to the document instead.
  54702. if (!external_wp_element_namespaceObject.Children.count(children)) {
  54703. return element;
  54704. }
  54705. return (0,external_wp_element_namespaceObject.createElement)("div", {
  54706. ref: target
  54707. }, element, children);
  54708. }
  54709. /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
  54710. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/menu-group/index.js
  54711. // @ts-nocheck
  54712. /**
  54713. * External dependencies
  54714. */
  54715. /**
  54716. * WordPress dependencies
  54717. */
  54718. function MenuGroup(props) {
  54719. const {
  54720. children,
  54721. className = '',
  54722. label,
  54723. hideSeparator
  54724. } = props;
  54725. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(MenuGroup);
  54726. if (!external_wp_element_namespaceObject.Children.count(children)) {
  54727. return null;
  54728. }
  54729. const labelId = `components-menu-group-label-${instanceId}`;
  54730. const classNames = classnames_default()(className, 'components-menu-group', {
  54731. 'has-hidden-separator': hideSeparator
  54732. });
  54733. return (0,external_wp_element_namespaceObject.createElement)("div", {
  54734. className: classNames
  54735. }, label && (0,external_wp_element_namespaceObject.createElement)("div", {
  54736. className: "components-menu-group__label",
  54737. id: labelId,
  54738. "aria-hidden": "true"
  54739. }, label), (0,external_wp_element_namespaceObject.createElement)("div", {
  54740. role: "group",
  54741. "aria-labelledby": label ? labelId : null
  54742. }, children));
  54743. }
  54744. /* harmony default export */ var menu_group = (MenuGroup);
  54745. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/menu-item/index.js
  54746. // @ts-nocheck
  54747. /**
  54748. * External dependencies
  54749. */
  54750. /**
  54751. * WordPress dependencies
  54752. */
  54753. /**
  54754. * Internal dependencies
  54755. */
  54756. function MenuItem(props, ref) {
  54757. let {
  54758. children,
  54759. info,
  54760. className,
  54761. icon,
  54762. iconPosition = 'right',
  54763. shortcut,
  54764. isSelected,
  54765. role = 'menuitem',
  54766. ...buttonProps
  54767. } = props;
  54768. className = classnames_default()('components-menu-item__button', className);
  54769. if (info) {
  54770. children = (0,external_wp_element_namespaceObject.createElement)("span", {
  54771. className: "components-menu-item__info-wrapper"
  54772. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  54773. className: "components-menu-item__item"
  54774. }, children), (0,external_wp_element_namespaceObject.createElement)("span", {
  54775. className: "components-menu-item__info"
  54776. }, info));
  54777. }
  54778. if (icon && !(0,external_lodash_namespaceObject.isString)(icon)) {
  54779. icon = (0,external_wp_element_namespaceObject.cloneElement)(icon, {
  54780. className: classnames_default()('components-menu-items__item-icon', {
  54781. 'has-icon-right': iconPosition === 'right'
  54782. })
  54783. });
  54784. }
  54785. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  54786. ref: ref // Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked
  54787. ,
  54788. "aria-checked": role === 'menuitemcheckbox' || role === 'menuitemradio' ? isSelected : undefined,
  54789. role: role,
  54790. icon: iconPosition === 'left' ? icon : undefined,
  54791. className: className
  54792. }, buttonProps), (0,external_wp_element_namespaceObject.createElement)("span", {
  54793. className: "components-menu-item__item"
  54794. }, children), (0,external_wp_element_namespaceObject.createElement)(build_module_shortcut, {
  54795. className: "components-menu-item__shortcut",
  54796. shortcut: shortcut
  54797. }), icon && iconPosition === 'right' && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  54798. icon: icon
  54799. }));
  54800. }
  54801. /* harmony default export */ var menu_item = ((0,external_wp_element_namespaceObject.forwardRef)(MenuItem));
  54802. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/menu-items-choice/index.js
  54803. /**
  54804. * External dependencies
  54805. */
  54806. /**
  54807. * WordPress dependencies
  54808. */
  54809. /**
  54810. * Internal dependencies
  54811. */
  54812. function MenuItemsChoice(_ref) {
  54813. let {
  54814. choices = [],
  54815. onHover = external_lodash_namespaceObject.noop,
  54816. onSelect,
  54817. value
  54818. } = _ref;
  54819. return choices.map(item => {
  54820. const isSelected = value === item.value;
  54821. return (0,external_wp_element_namespaceObject.createElement)(menu_item, {
  54822. key: item.value,
  54823. role: "menuitemradio",
  54824. icon: isSelected && library_check,
  54825. info: item.info,
  54826. isSelected: isSelected,
  54827. shortcut: item.shortcut,
  54828. className: "components-menu-items-choice",
  54829. onClick: () => {
  54830. if (!isSelected) {
  54831. onSelect(item.value);
  54832. }
  54833. },
  54834. onMouseEnter: () => onHover(item.value),
  54835. onMouseLeave: () => onHover(null),
  54836. "aria-label": item['aria-label']
  54837. }, item.label);
  54838. });
  54839. }
  54840. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigable-container/tabbable.js
  54841. // @ts-nocheck
  54842. /**
  54843. * WordPress dependencies
  54844. */
  54845. /**
  54846. * Internal dependencies
  54847. */
  54848. function TabbableContainer(_ref, ref) {
  54849. let {
  54850. eventToOffset,
  54851. ...props
  54852. } = _ref;
  54853. const innerEventToOffset = evt => {
  54854. const {
  54855. keyCode,
  54856. shiftKey
  54857. } = evt;
  54858. if (external_wp_keycodes_namespaceObject.TAB === keyCode) {
  54859. return shiftKey ? -1 : 1;
  54860. } // Allow custom handling of keys besides Tab.
  54861. //
  54862. // By default, TabbableContainer will move focus forward on Tab and
  54863. // backward on Shift+Tab. The handler below will be used for all other
  54864. // events. The semantics for `eventToOffset`'s return
  54865. // values are the following:
  54866. //
  54867. // - +1: move focus forward
  54868. // - -1: move focus backward
  54869. // - 0: don't move focus, but acknowledge event and thus stop it
  54870. // - undefined: do nothing, let the event propagate.
  54871. if (eventToOffset) {
  54872. return eventToOffset(evt);
  54873. }
  54874. };
  54875. return (0,external_wp_element_namespaceObject.createElement)(container, extends_extends({
  54876. ref: ref,
  54877. stopNavigationEvents: true,
  54878. onlyBrowserTabstops: true,
  54879. eventToOffset: innerEventToOffset
  54880. }, props));
  54881. }
  54882. /* harmony default export */ var tabbable = ((0,external_wp_element_namespaceObject.forwardRef)(TabbableContainer));
  54883. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/constants.js
  54884. const ROOT_MENU = 'root';
  54885. const SEARCH_FOCUS_DELAY = 100;
  54886. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/context.js
  54887. /**
  54888. * External dependencies
  54889. */
  54890. /**
  54891. * WordPress dependencies
  54892. */
  54893. /**
  54894. * Internal dependencies
  54895. */
  54896. const NavigationContext = (0,external_wp_element_namespaceObject.createContext)({
  54897. activeItem: undefined,
  54898. activeMenu: ROOT_MENU,
  54899. setActiveMenu: external_lodash_namespaceObject.noop,
  54900. isMenuEmpty: external_lodash_namespaceObject.noop,
  54901. navigationTree: {
  54902. items: {},
  54903. getItem: external_lodash_namespaceObject.noop,
  54904. addItem: external_lodash_namespaceObject.noop,
  54905. removeItem: external_lodash_namespaceObject.noop,
  54906. menus: {},
  54907. getMenu: external_lodash_namespaceObject.noop,
  54908. addMenu: external_lodash_namespaceObject.noop,
  54909. removeMenu: external_lodash_namespaceObject.noop,
  54910. childMenu: {},
  54911. traverseMenu: external_lodash_namespaceObject.noop,
  54912. isMenuEmpty: external_lodash_namespaceObject.noop
  54913. }
  54914. });
  54915. const useNavigationContext = () => (0,external_wp_element_namespaceObject.useContext)(NavigationContext);
  54916. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
  54917. /**
  54918. * WordPress dependencies
  54919. */
  54920. const search = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  54921. xmlns: "http://www.w3.org/2000/svg",
  54922. viewBox: "0 0 24 24"
  54923. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  54924. d: "M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"
  54925. }));
  54926. /* harmony default export */ var library_search = (search);
  54927. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-combined-ref.js
  54928. /**
  54929. * WordPress dependencies
  54930. */
  54931. /**
  54932. * External dependencies
  54933. */
  54934. function useCombinedRef() {
  54935. for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
  54936. refs[_key] = arguments[_key];
  54937. }
  54938. const targetRef = (0,external_wp_element_namespaceObject.useRef)(null);
  54939. (0,external_wp_element_namespaceObject.useEffect)(() => {
  54940. refs.forEach(ref => {
  54941. if (!ref) return;
  54942. if (typeof ref === 'function') {
  54943. ref(targetRef.current);
  54944. } else {
  54945. ref.current = targetRef.current;
  54946. }
  54947. });
  54948. }, [refs]);
  54949. return targetRef;
  54950. }
  54951. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/search-control/index.js
  54952. /**
  54953. * External dependencies
  54954. */
  54955. /**
  54956. * WordPress dependencies
  54957. */
  54958. /**
  54959. * Internal dependencies
  54960. */
  54961. function SearchControl(_ref, ref) {
  54962. let {
  54963. className,
  54964. onChange,
  54965. onKeyDown,
  54966. value,
  54967. label,
  54968. placeholder = (0,external_wp_i18n_namespaceObject.__)('Search'),
  54969. hideLabelFromVision = true,
  54970. help,
  54971. onClose
  54972. } = _ref;
  54973. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(SearchControl);
  54974. const searchInput = useCombinedRef(ref);
  54975. const id = `components-search-control-${instanceId}`;
  54976. const renderRightButton = () => {
  54977. if (onClose) {
  54978. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  54979. icon: close_small,
  54980. label: (0,external_wp_i18n_namespaceObject.__)('Close search'),
  54981. onClick: onClose
  54982. });
  54983. }
  54984. if (!!value) {
  54985. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  54986. icon: close_small,
  54987. label: (0,external_wp_i18n_namespaceObject.__)('Reset search'),
  54988. onClick: () => {
  54989. onChange('');
  54990. searchInput.current.focus();
  54991. }
  54992. });
  54993. }
  54994. return (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  54995. icon: library_search
  54996. });
  54997. };
  54998. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  54999. label: label,
  55000. id: id,
  55001. hideLabelFromVision: hideLabelFromVision,
  55002. help: help,
  55003. className: classnames_default()(className, 'components-search-control')
  55004. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  55005. className: "components-search-control__input-wrapper"
  55006. }, (0,external_wp_element_namespaceObject.createElement)("input", {
  55007. ref: searchInput,
  55008. className: "components-search-control__input",
  55009. id: id,
  55010. type: "search",
  55011. placeholder: placeholder,
  55012. onChange: event => onChange(event.target.value),
  55013. onKeyDown: onKeyDown,
  55014. autoComplete: "off",
  55015. value: value || ''
  55016. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  55017. className: "components-search-control__icon"
  55018. }, renderRightButton())));
  55019. }
  55020. /* harmony default export */ var search_control = ((0,external_wp_element_namespaceObject.forwardRef)(SearchControl));
  55021. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/styles/navigation-styles.js
  55022. function navigation_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  55023. /**
  55024. * External dependencies
  55025. */
  55026. /**
  55027. * WordPress dependencies
  55028. */
  55029. /**
  55030. * Internal dependencies
  55031. */
  55032. const NavigationUI = emotion_styled_base_browser_esm("div", true ? {
  55033. target: "ejwewyf11"
  55034. } : 0)("width:100%;box-sizing:border-box;padding:0 ", space(4), ";overflow:hidden;" + ( true ? "" : 0));
  55035. const MenuUI = emotion_styled_base_browser_esm("div", true ? {
  55036. target: "ejwewyf10"
  55037. } : 0)("margin-top:", space(6), ";margin-bottom:", space(6), ";display:flex;flex-direction:column;ul{padding:0;margin:0;list-style:none;}.components-navigation__back-button{margin-bottom:", space(6), ";}.components-navigation__group+.components-navigation__group{margin-top:", space(6), ";}" + ( true ? "" : 0));
  55038. const MenuBackButtonUI = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
  55039. target: "ejwewyf9"
  55040. } : 0)( true ? {
  55041. name: "26l0q2",
  55042. styles: "&.is-tertiary{color:inherit;opacity:0.7;&:hover:not( :disabled ){opacity:1;box-shadow:none;color:inherit;}&:active:not( :disabled ){background:transparent;opacity:1;color:inherit;}}"
  55043. } : 0);
  55044. const MenuTitleUI = emotion_styled_base_browser_esm("div", true ? {
  55045. target: "ejwewyf8"
  55046. } : 0)( true ? {
  55047. name: "1aubja5",
  55048. styles: "overflow:hidden;width:100%"
  55049. } : 0);
  55050. const MenuTitleActionsUI = emotion_styled_base_browser_esm("span", true ? {
  55051. target: "ejwewyf7"
  55052. } : 0)("height:", space(6), ";.components-button.is-small{color:inherit;opacity:0.7;margin-right:", space(1), ";padding:0;&:active:not( :disabled ){background:none;opacity:1;color:inherit;}&:hover:not( :disabled ){box-shadow:none;opacity:1;color:inherit;}}" + ( true ? "" : 0));
  55053. const MenuTitleSearchUI = /*#__PURE__*/emotion_styled_base_browser_esm(search_control, true ? {
  55054. target: "ejwewyf6"
  55055. } : 0)( true ? {
  55056. name: "za3n3e",
  55057. styles: "input[type='search'].components-search-control__input{margin:0;background:#303030;color:#fff;&:focus{background:#434343;color:#fff;}&::placeholder{color:rgba( 255, 255, 255, 0.6 );}}svg{fill:white;}.components-button.has-icon{padding:0;min-width:auto;}"
  55058. } : 0);
  55059. const GroupTitleUI = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? {
  55060. target: "ejwewyf5"
  55061. } : 0)("min-height:", space(12), ";align-items:center;color:inherit;display:flex;justify-content:space-between;margin-bottom:", space(2), ";padding:", () => (0,external_wp_i18n_namespaceObject.isRTL)() ? `${space(1)} ${space(4)} ${space(1)} ${space(2)}` : `${space(1)} ${space(2)} ${space(1)} ${space(4)}`, ";" + ( true ? "" : 0));
  55062. const ItemBaseUI = emotion_styled_base_browser_esm("li", true ? {
  55063. target: "ejwewyf4"
  55064. } : 0)("border-radius:2px;color:inherit;margin-bottom:0;>button,>a.components-button,>a{width:100%;color:inherit;opacity:0.7;padding:", space(2), " ", space(4), ";", rtl({
  55065. textAlign: 'left'
  55066. }, {
  55067. textAlign: 'right'
  55068. }), " &:hover,&:focus:not( [aria-disabled='true'] ):active,&:active:not( [aria-disabled='true'] ):active{color:inherit;opacity:1;}}&.is-active{background-color:", UI.theme, ";color:", BASE.white, ";>button,>a{color:", BASE.white, ";opacity:1;}}>svg path{color:", G2.lightGray.ui, ";}" + ( true ? "" : 0));
  55069. const ItemUI = emotion_styled_base_browser_esm("div", true ? {
  55070. target: "ejwewyf3"
  55071. } : 0)("display:flex;align-items:center;height:auto;min-height:40px;margin:0;padding:", space(1.5), " ", space(4), ";font-weight:400;line-height:20px;width:100%;color:inherit;opacity:0.7;" + ( true ? "" : 0));
  55072. const ItemIconUI = emotion_styled_base_browser_esm("span", true ? {
  55073. target: "ejwewyf2"
  55074. } : 0)("display:flex;margin-right:", space(2), ";" + ( true ? "" : 0));
  55075. const ItemBadgeUI = emotion_styled_base_browser_esm("span", true ? {
  55076. target: "ejwewyf1"
  55077. } : 0)("margin-left:", () => (0,external_wp_i18n_namespaceObject.isRTL)() ? '0' : space(2), ";margin-right:", () => (0,external_wp_i18n_namespaceObject.isRTL)() ? space(2) : '0', ";display:inline-flex;padding:", space(1), " ", space(3), ";border-radius:2px;animation:fade-in 250ms ease-out;@keyframes fade-in{from{opacity:0;}to{opacity:1;}}", reduceMotion('animation'), ";" + ( true ? "" : 0));
  55078. const ItemTitleUI = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? {
  55079. target: "ejwewyf0"
  55080. } : 0)(() => (0,external_wp_i18n_namespaceObject.isRTL)() ? 'margin-left: auto;' : 'margin-right: auto;', " font-size:14px;line-height:20px;color:inherit;" + ( true ? "" : 0));
  55081. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/use-navigation-tree-nodes.js
  55082. /**
  55083. * External dependencies
  55084. */
  55085. /**
  55086. * WordPress dependencies
  55087. */
  55088. const useNavigationTreeNodes = () => {
  55089. const [nodes, setNodes] = (0,external_wp_element_namespaceObject.useState)({});
  55090. const getNode = key => nodes[key];
  55091. const addNode = (key, value) => setNodes(original => ({ ...original,
  55092. [key]: (0,external_lodash_namespaceObject.omit)(value, 'children')
  55093. }));
  55094. const removeNode = key => setNodes(original => (0,external_lodash_namespaceObject.omit)(original, key));
  55095. return {
  55096. nodes,
  55097. getNode,
  55098. addNode,
  55099. removeNode
  55100. };
  55101. };
  55102. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/use-create-navigation-tree.js
  55103. /**
  55104. * WordPress dependencies
  55105. */
  55106. /**
  55107. * Internal dependencies
  55108. */
  55109. const useCreateNavigationTree = () => {
  55110. const {
  55111. nodes: items,
  55112. getNode: getItem,
  55113. addNode: addItem,
  55114. removeNode: removeItem
  55115. } = useNavigationTreeNodes();
  55116. const {
  55117. nodes: menus,
  55118. getNode: getMenu,
  55119. addNode: addMenu,
  55120. removeNode: removeMenu
  55121. } = useNavigationTreeNodes();
  55122. /**
  55123. * Stores direct nested menus of menus
  55124. * This makes it easy to traverse menu tree
  55125. *
  55126. * Key is the menu prop of the menu
  55127. * Value is an array of menu keys
  55128. */
  55129. const [childMenu, setChildMenu] = (0,external_wp_element_namespaceObject.useState)({});
  55130. const getChildMenu = menu => childMenu[menu] || [];
  55131. const traverseMenu = (startMenu, callback) => {
  55132. const visited = [];
  55133. let queue = [startMenu];
  55134. let current;
  55135. while (queue.length > 0) {
  55136. current = getMenu(queue.shift());
  55137. if (!current || visited.includes(current.menu)) {
  55138. continue;
  55139. }
  55140. visited.push(current.menu);
  55141. queue = [...queue, ...getChildMenu(current.menu)];
  55142. if (callback(current) === false) {
  55143. break;
  55144. }
  55145. }
  55146. };
  55147. const isMenuEmpty = menuToCheck => {
  55148. let isEmpty = true;
  55149. traverseMenu(menuToCheck, current => {
  55150. if (!current.isEmpty) {
  55151. isEmpty = false;
  55152. return false;
  55153. }
  55154. });
  55155. return isEmpty;
  55156. };
  55157. return {
  55158. items,
  55159. getItem,
  55160. addItem,
  55161. removeItem,
  55162. menus,
  55163. getMenu,
  55164. addMenu: (key, value) => {
  55165. setChildMenu(state => {
  55166. const newState = { ...state
  55167. };
  55168. if (!newState[value.parentMenu]) {
  55169. newState[value.parentMenu] = [];
  55170. }
  55171. newState[value.parentMenu].push(key);
  55172. return newState;
  55173. });
  55174. addMenu(key, value);
  55175. },
  55176. removeMenu,
  55177. childMenu,
  55178. traverseMenu,
  55179. isMenuEmpty
  55180. };
  55181. };
  55182. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/index.js
  55183. /**
  55184. * External dependencies
  55185. */
  55186. /**
  55187. * WordPress dependencies
  55188. */
  55189. /**
  55190. * Internal dependencies
  55191. */
  55192. function Navigation(_ref) {
  55193. let {
  55194. activeItem,
  55195. activeMenu = ROOT_MENU,
  55196. children,
  55197. className,
  55198. onActivateMenu = external_lodash_namespaceObject.noop
  55199. } = _ref;
  55200. const [menu, setMenu] = (0,external_wp_element_namespaceObject.useState)(activeMenu);
  55201. const [slideOrigin, setSlideOrigin] = (0,external_wp_element_namespaceObject.useState)();
  55202. const navigationTree = useCreateNavigationTree();
  55203. const defaultSlideOrigin = (0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left';
  55204. const setActiveMenu = function (menuId) {
  55205. let slideInOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultSlideOrigin;
  55206. if (!navigationTree.getMenu(menuId)) {
  55207. return;
  55208. }
  55209. setSlideOrigin(slideInOrigin);
  55210. setMenu(menuId);
  55211. onActivateMenu(menuId);
  55212. }; // Used to prevent the sliding animation on mount
  55213. const isMounted = (0,external_wp_element_namespaceObject.useRef)(false);
  55214. (0,external_wp_element_namespaceObject.useEffect)(() => {
  55215. if (!isMounted.current) {
  55216. isMounted.current = true;
  55217. }
  55218. }, []);
  55219. (0,external_wp_element_namespaceObject.useEffect)(() => {
  55220. if (activeMenu !== menu) {
  55221. setActiveMenu(activeMenu);
  55222. }
  55223. }, [activeMenu]);
  55224. const context = {
  55225. activeItem,
  55226. activeMenu: menu,
  55227. setActiveMenu,
  55228. navigationTree
  55229. };
  55230. const classes = classnames_default()('components-navigation', className);
  55231. const animateClassName = getAnimateClassName({
  55232. type: 'slide-in',
  55233. origin: slideOrigin
  55234. });
  55235. return (0,external_wp_element_namespaceObject.createElement)(NavigationUI, {
  55236. className: classes
  55237. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  55238. key: menu,
  55239. className: classnames_default()({
  55240. [animateClassName]: isMounted.current && slideOrigin
  55241. })
  55242. }, (0,external_wp_element_namespaceObject.createElement)(NavigationContext.Provider, {
  55243. value: context
  55244. }, children)));
  55245. }
  55246. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
  55247. /**
  55248. * WordPress dependencies
  55249. */
  55250. const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  55251. xmlns: "http://www.w3.org/2000/svg",
  55252. viewBox: "0 0 24 24"
  55253. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  55254. d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
  55255. }));
  55256. /* harmony default export */ var chevron_right = (chevronRight);
  55257. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
  55258. /**
  55259. * WordPress dependencies
  55260. */
  55261. const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  55262. xmlns: "http://www.w3.org/2000/svg",
  55263. viewBox: "0 0 24 24"
  55264. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  55265. d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
  55266. }));
  55267. /* harmony default export */ var chevron_left = (chevronLeft);
  55268. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/back-button/index.js
  55269. /**
  55270. * External dependencies
  55271. */
  55272. /**
  55273. * WordPress dependencies
  55274. */
  55275. /**
  55276. * Internal dependencies
  55277. */
  55278. function NavigationBackButton(_ref, ref) {
  55279. var _navigationTree$getMe;
  55280. let {
  55281. backButtonLabel,
  55282. className,
  55283. href,
  55284. onClick,
  55285. parentMenu
  55286. } = _ref;
  55287. const {
  55288. setActiveMenu,
  55289. navigationTree
  55290. } = useNavigationContext();
  55291. const classes = classnames_default()('components-navigation__back-button', className);
  55292. const parentMenuTitle = (_navigationTree$getMe = navigationTree.getMenu(parentMenu)) === null || _navigationTree$getMe === void 0 ? void 0 : _navigationTree$getMe.title;
  55293. const handleOnClick = event => {
  55294. if (typeof onClick === 'function') {
  55295. onClick(event);
  55296. }
  55297. const animationDirection = (0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right';
  55298. if (parentMenu && !event.defaultPrevented) {
  55299. setActiveMenu(parentMenu, animationDirection);
  55300. }
  55301. };
  55302. const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left;
  55303. return (0,external_wp_element_namespaceObject.createElement)(MenuBackButtonUI, {
  55304. className: classes,
  55305. href: href,
  55306. variant: "tertiary",
  55307. ref: ref,
  55308. onClick: handleOnClick
  55309. }, (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  55310. icon: icon
  55311. }), backButtonLabel || parentMenuTitle || (0,external_wp_i18n_namespaceObject.__)('Back'));
  55312. }
  55313. /* harmony default export */ var back_button = ((0,external_wp_element_namespaceObject.forwardRef)(NavigationBackButton));
  55314. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/group/context.js
  55315. /**
  55316. * WordPress dependencies
  55317. */
  55318. const NavigationGroupContext = (0,external_wp_element_namespaceObject.createContext)({
  55319. group: undefined
  55320. });
  55321. const useNavigationGroupContext = () => (0,external_wp_element_namespaceObject.useContext)(NavigationGroupContext);
  55322. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/group/index.js
  55323. /**
  55324. * External dependencies
  55325. */
  55326. /**
  55327. * WordPress dependencies
  55328. */
  55329. /**
  55330. * Internal dependencies
  55331. */
  55332. function NavigationGroup(_ref) {
  55333. let {
  55334. children,
  55335. className,
  55336. title
  55337. } = _ref;
  55338. const [groupId] = (0,external_wp_element_namespaceObject.useState)((0,external_lodash_namespaceObject.uniqueId)('group-'));
  55339. const {
  55340. navigationTree: {
  55341. items
  55342. }
  55343. } = useNavigationContext();
  55344. const context = {
  55345. group: groupId
  55346. }; // Keep the children rendered to make sure invisible items are included in the navigation tree.
  55347. if (!(0,external_lodash_namespaceObject.find)(items, {
  55348. group: groupId,
  55349. _isVisible: true
  55350. })) {
  55351. return (0,external_wp_element_namespaceObject.createElement)(NavigationGroupContext.Provider, {
  55352. value: context
  55353. }, children);
  55354. }
  55355. const groupTitleId = `components-navigation__group-title-${groupId}`;
  55356. const classes = classnames_default()('components-navigation__group', className);
  55357. return (0,external_wp_element_namespaceObject.createElement)(NavigationGroupContext.Provider, {
  55358. value: context
  55359. }, (0,external_wp_element_namespaceObject.createElement)("li", {
  55360. className: classes
  55361. }, title && (0,external_wp_element_namespaceObject.createElement)(GroupTitleUI, {
  55362. className: "components-navigation__group-title",
  55363. id: groupTitleId,
  55364. level: 3
  55365. }, title), (0,external_wp_element_namespaceObject.createElement)("ul", {
  55366. "aria-labelledby": groupTitleId,
  55367. role: "group"
  55368. }, children)));
  55369. }
  55370. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/base-content.js
  55371. /**
  55372. * Internal dependencies
  55373. */
  55374. function NavigationItemBaseContent(props) {
  55375. const {
  55376. badge,
  55377. title
  55378. } = props;
  55379. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, title && (0,external_wp_element_namespaceObject.createElement)(ItemTitleUI, {
  55380. className: "components-navigation__item-title",
  55381. variant: "body.small",
  55382. as: "span"
  55383. }, title), badge && (0,external_wp_element_namespaceObject.createElement)(ItemBadgeUI, {
  55384. className: "components-navigation__item-badge"
  55385. }, badge));
  55386. }
  55387. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/context.js
  55388. /**
  55389. * WordPress dependencies
  55390. */
  55391. const NavigationMenuContext = (0,external_wp_element_namespaceObject.createContext)({
  55392. menu: undefined,
  55393. search: ''
  55394. });
  55395. const useNavigationMenuContext = () => (0,external_wp_element_namespaceObject.useContext)(NavigationMenuContext);
  55396. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/utils.js
  55397. /**
  55398. * External dependencies
  55399. */
  55400. // @see packages/block-editor/src/components/inserter/search-items.js
  55401. const normalizeInput = input => (0,external_lodash_namespaceObject.deburr)(input).replace(/^\//, '').toLowerCase();
  55402. const normalizedSearch = (title, search) => -1 !== normalizeInput(title).indexOf(normalizeInput(search));
  55403. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/use-navigation-tree-item.js
  55404. /**
  55405. * WordPress dependencies
  55406. */
  55407. /**
  55408. * Internal dependencies
  55409. */
  55410. const useNavigationTreeItem = (itemId, props) => {
  55411. const {
  55412. activeMenu,
  55413. navigationTree: {
  55414. addItem,
  55415. removeItem
  55416. }
  55417. } = useNavigationContext();
  55418. const {
  55419. group
  55420. } = useNavigationGroupContext();
  55421. const {
  55422. menu,
  55423. search
  55424. } = useNavigationMenuContext();
  55425. (0,external_wp_element_namespaceObject.useEffect)(() => {
  55426. const isMenuActive = activeMenu === menu;
  55427. const isItemVisible = !search || normalizedSearch(props.title, search);
  55428. addItem(itemId, { ...props,
  55429. group,
  55430. menu,
  55431. _isVisible: isMenuActive && isItemVisible
  55432. });
  55433. return () => {
  55434. removeItem(itemId);
  55435. };
  55436. }, [activeMenu, search]);
  55437. };
  55438. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/base.js
  55439. /**
  55440. * External dependencies
  55441. */
  55442. /**
  55443. * WordPress dependencies
  55444. */
  55445. /**
  55446. * Internal dependencies
  55447. */
  55448. function NavigationItemBase(props) {
  55449. var _navigationTree$getIt;
  55450. const {
  55451. children,
  55452. className,
  55453. ...restProps
  55454. } = props;
  55455. const [itemId] = (0,external_wp_element_namespaceObject.useState)((0,external_lodash_namespaceObject.uniqueId)('item-'));
  55456. useNavigationTreeItem(itemId, props);
  55457. const {
  55458. navigationTree
  55459. } = useNavigationContext();
  55460. if (!((_navigationTree$getIt = navigationTree.getItem(itemId)) !== null && _navigationTree$getIt !== void 0 && _navigationTree$getIt._isVisible)) {
  55461. return null;
  55462. }
  55463. const classes = classnames_default()('components-navigation__item', className);
  55464. return (0,external_wp_element_namespaceObject.createElement)(ItemBaseUI, extends_extends({
  55465. className: classes
  55466. }, restProps), children);
  55467. }
  55468. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/index.js
  55469. /**
  55470. * External dependencies
  55471. */
  55472. /**
  55473. * WordPress dependencies
  55474. */
  55475. /**
  55476. * Internal dependencies
  55477. */
  55478. function NavigationItem(props) {
  55479. const {
  55480. badge,
  55481. children,
  55482. className,
  55483. href,
  55484. item,
  55485. navigateToMenu,
  55486. onClick = external_lodash_namespaceObject.noop,
  55487. title,
  55488. icon,
  55489. hideIfTargetMenuEmpty,
  55490. isText,
  55491. ...restProps
  55492. } = props;
  55493. const {
  55494. activeItem,
  55495. setActiveMenu,
  55496. navigationTree: {
  55497. isMenuEmpty
  55498. }
  55499. } = useNavigationContext(); // If hideIfTargetMenuEmpty prop is true
  55500. // And the menu we are supposed to navigate to
  55501. // Is marked as empty, then we skip rendering the item.
  55502. if (hideIfTargetMenuEmpty && navigateToMenu && isMenuEmpty(navigateToMenu)) {
  55503. return null;
  55504. }
  55505. const isActive = item && activeItem === item;
  55506. const classes = classnames_default()(className, {
  55507. 'is-active': isActive
  55508. });
  55509. const onItemClick = event => {
  55510. if (navigateToMenu) {
  55511. setActiveMenu(navigateToMenu);
  55512. }
  55513. onClick(event);
  55514. };
  55515. const navigationIcon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right;
  55516. const baseProps = children ? props : { ...props,
  55517. onClick: undefined
  55518. };
  55519. const itemProps = isText ? restProps : {
  55520. as: build_module_button,
  55521. href,
  55522. onClick: onItemClick,
  55523. 'aria-current': isActive ? 'page' : undefined,
  55524. ...restProps
  55525. };
  55526. return (0,external_wp_element_namespaceObject.createElement)(NavigationItemBase, extends_extends({}, baseProps, {
  55527. className: classes
  55528. }), children || (0,external_wp_element_namespaceObject.createElement)(ItemUI, itemProps, icon && (0,external_wp_element_namespaceObject.createElement)(ItemIconUI, null, (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  55529. icon: icon
  55530. })), (0,external_wp_element_namespaceObject.createElement)(NavigationItemBaseContent, {
  55531. title: title,
  55532. badge: badge
  55533. }), navigateToMenu && (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  55534. icon: navigationIcon
  55535. })));
  55536. }
  55537. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/use-navigation-tree-menu.js
  55538. /**
  55539. * WordPress dependencies
  55540. */
  55541. /**
  55542. * Internal dependencies
  55543. */
  55544. const useNavigationTreeMenu = props => {
  55545. const {
  55546. navigationTree: {
  55547. addMenu,
  55548. removeMenu
  55549. }
  55550. } = useNavigationContext();
  55551. const key = props.menu || ROOT_MENU;
  55552. (0,external_wp_element_namespaceObject.useEffect)(() => {
  55553. addMenu(key, { ...props,
  55554. menu: key
  55555. });
  55556. return () => {
  55557. removeMenu(key);
  55558. };
  55559. }, []);
  55560. };
  55561. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/menu-title-search.js
  55562. /**
  55563. * External dependencies
  55564. */
  55565. /**
  55566. * WordPress dependencies
  55567. */
  55568. /**
  55569. * Internal dependencies
  55570. */
  55571. function MenuTitleSearch(_ref) {
  55572. let {
  55573. debouncedSpeak,
  55574. onCloseSearch,
  55575. onSearch,
  55576. search,
  55577. title
  55578. } = _ref;
  55579. const {
  55580. navigationTree: {
  55581. items
  55582. }
  55583. } = useNavigationContext();
  55584. const {
  55585. menu
  55586. } = useNavigationMenuContext();
  55587. const inputRef = (0,external_wp_element_namespaceObject.useRef)(); // Wait for the slide-in animation to complete before autofocusing the input.
  55588. // This prevents scrolling to the input during the animation.
  55589. (0,external_wp_element_namespaceObject.useEffect)(() => {
  55590. const delayedFocus = setTimeout(() => {
  55591. inputRef.current.focus();
  55592. }, SEARCH_FOCUS_DELAY);
  55593. return () => {
  55594. clearTimeout(delayedFocus);
  55595. };
  55596. }, []);
  55597. (0,external_wp_element_namespaceObject.useEffect)(() => {
  55598. if (!search) {
  55599. return;
  55600. }
  55601. const count = (0,external_lodash_namespaceObject.filter)(items, '_isVisible').length;
  55602. const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
  55603. /* translators: %d: number of results. */
  55604. (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count);
  55605. debouncedSpeak(resultsFoundMessage);
  55606. }, [items, search]);
  55607. const onClose = () => {
  55608. onSearch('');
  55609. onCloseSearch();
  55610. };
  55611. function onKeyDown(event) {
  55612. if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
  55613. event.preventDefault();
  55614. onClose();
  55615. }
  55616. }
  55617. const inputId = `components-navigation__menu-title-search-${menu}`;
  55618. const placeholder = (0,external_wp_i18n_namespaceObject.sprintf)(
  55619. /* translators: placeholder for menu search box. %s: menu title */
  55620. (0,external_wp_i18n_namespaceObject.__)('Search %s'), title === null || title === void 0 ? void 0 : title.toLowerCase()).trim();
  55621. return (0,external_wp_element_namespaceObject.createElement)("div", {
  55622. className: "components-navigation__menu-title-search"
  55623. }, (0,external_wp_element_namespaceObject.createElement)(MenuTitleSearchUI, {
  55624. autoComplete: "off",
  55625. className: "components-navigation__menu-search-input",
  55626. id: inputId,
  55627. onChange: value => onSearch(value),
  55628. onKeyDown: onKeyDown,
  55629. placeholder: placeholder,
  55630. onClose: onClose,
  55631. ref: inputRef,
  55632. type: "search",
  55633. value: search
  55634. }));
  55635. }
  55636. /* harmony default export */ var menu_title_search = (with_spoken_messages(MenuTitleSearch));
  55637. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/menu-title.js
  55638. /**
  55639. * WordPress dependencies
  55640. */
  55641. /**
  55642. * Internal dependencies
  55643. */
  55644. function NavigationMenuTitle(_ref) {
  55645. let {
  55646. hasSearch,
  55647. onSearch,
  55648. search,
  55649. title,
  55650. titleAction
  55651. } = _ref;
  55652. const [isSearching, setIsSearching] = (0,external_wp_element_namespaceObject.useState)(false);
  55653. const {
  55654. menu
  55655. } = useNavigationMenuContext();
  55656. const searchButtonRef = (0,external_wp_element_namespaceObject.useRef)();
  55657. if (!title) {
  55658. return null;
  55659. }
  55660. const onCloseSearch = () => {
  55661. setIsSearching(false); // Wait for the slide-in animation to complete before focusing the search button.
  55662. // eslint-disable-next-line @wordpress/react-no-unsafe-timeout
  55663. setTimeout(() => {
  55664. searchButtonRef.current.focus();
  55665. }, SEARCH_FOCUS_DELAY);
  55666. };
  55667. const menuTitleId = `components-navigation__menu-title-${menu}`;
  55668. /* translators: search button label for menu search box. %s: menu title */
  55669. const searchButtonLabel = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Search in %s'), title);
  55670. return (0,external_wp_element_namespaceObject.createElement)(MenuTitleUI, {
  55671. className: "components-navigation__menu-title"
  55672. }, !isSearching && (0,external_wp_element_namespaceObject.createElement)(GroupTitleUI, {
  55673. as: "h2",
  55674. className: "components-navigation__menu-title-heading",
  55675. level: 3
  55676. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  55677. id: menuTitleId
  55678. }, title), (hasSearch || titleAction) && (0,external_wp_element_namespaceObject.createElement)(MenuTitleActionsUI, null, titleAction, hasSearch && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  55679. isSmall: true,
  55680. variant: "tertiary",
  55681. label: searchButtonLabel,
  55682. onClick: () => setIsSearching(true),
  55683. ref: searchButtonRef
  55684. }, (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  55685. icon: library_search
  55686. })))), isSearching && (0,external_wp_element_namespaceObject.createElement)("div", {
  55687. className: getAnimateClassName({
  55688. type: 'slide-in',
  55689. origin: 'left'
  55690. })
  55691. }, (0,external_wp_element_namespaceObject.createElement)(menu_title_search, {
  55692. onCloseSearch: onCloseSearch,
  55693. onSearch: onSearch,
  55694. search: search,
  55695. title: title
  55696. })));
  55697. }
  55698. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/search-no-results-found.js
  55699. /**
  55700. * External dependencies
  55701. */
  55702. /**
  55703. * WordPress dependencies
  55704. */
  55705. /**
  55706. * Internal dependencies
  55707. */
  55708. function NavigationSearchNoResultsFound(_ref) {
  55709. let {
  55710. search
  55711. } = _ref;
  55712. const {
  55713. navigationTree: {
  55714. items
  55715. }
  55716. } = useNavigationContext();
  55717. const resultsCount = (0,external_lodash_namespaceObject.filter)(items, '_isVisible').length;
  55718. if (!search || !!resultsCount) {
  55719. return null;
  55720. }
  55721. return (0,external_wp_element_namespaceObject.createElement)(ItemBaseUI, null, (0,external_wp_element_namespaceObject.createElement)(ItemUI, null, (0,external_wp_i18n_namespaceObject.__)('No results found.'), " "));
  55722. }
  55723. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/index.js
  55724. /**
  55725. * External dependencies
  55726. */
  55727. /**
  55728. * WordPress dependencies
  55729. */
  55730. /**
  55731. * Internal dependencies
  55732. */
  55733. function NavigationMenu(props) {
  55734. const {
  55735. backButtonLabel,
  55736. children,
  55737. className,
  55738. hasSearch,
  55739. menu = ROOT_MENU,
  55740. onBackButtonClick,
  55741. onSearch: setControlledSearch,
  55742. parentMenu,
  55743. search: controlledSearch,
  55744. isSearchDebouncing,
  55745. title,
  55746. titleAction
  55747. } = props;
  55748. const [uncontrolledSearch, setUncontrolledSearch] = (0,external_wp_element_namespaceObject.useState)('');
  55749. useNavigationTreeMenu(props);
  55750. const {
  55751. activeMenu
  55752. } = useNavigationContext();
  55753. const context = {
  55754. menu,
  55755. search: uncontrolledSearch
  55756. }; // Keep the children rendered to make sure invisible items are included in the navigation tree.
  55757. if (activeMenu !== menu) {
  55758. return (0,external_wp_element_namespaceObject.createElement)(NavigationMenuContext.Provider, {
  55759. value: context
  55760. }, children);
  55761. }
  55762. const isControlledSearch = !!setControlledSearch;
  55763. const search = isControlledSearch ? controlledSearch : uncontrolledSearch;
  55764. const onSearch = isControlledSearch ? setControlledSearch : setUncontrolledSearch;
  55765. const menuTitleId = `components-navigation__menu-title-${menu}`;
  55766. const classes = classnames_default()('components-navigation__menu', className);
  55767. return (0,external_wp_element_namespaceObject.createElement)(NavigationMenuContext.Provider, {
  55768. value: context
  55769. }, (0,external_wp_element_namespaceObject.createElement)(MenuUI, {
  55770. className: classes
  55771. }, (parentMenu || onBackButtonClick) && (0,external_wp_element_namespaceObject.createElement)(back_button, {
  55772. backButtonLabel: backButtonLabel,
  55773. parentMenu: parentMenu,
  55774. onClick: onBackButtonClick
  55775. }), title && (0,external_wp_element_namespaceObject.createElement)(NavigationMenuTitle, {
  55776. hasSearch: hasSearch,
  55777. onSearch: onSearch,
  55778. search: search,
  55779. title: title,
  55780. titleAction: titleAction
  55781. }), (0,external_wp_element_namespaceObject.createElement)(navigable_container_menu, null, (0,external_wp_element_namespaceObject.createElement)("ul", {
  55782. "aria-labelledby": menuTitleId
  55783. }, children, search && !isSearchDebouncing && (0,external_wp_element_namespaceObject.createElement)(NavigationSearchNoResultsFound, {
  55784. search: search
  55785. })))));
  55786. }
  55787. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/context.js
  55788. /**
  55789. * WordPress dependencies
  55790. */
  55791. /**
  55792. * Internal dependencies
  55793. */
  55794. const initialContextValue = {
  55795. location: {},
  55796. goTo: () => {},
  55797. goBack: () => {}
  55798. };
  55799. const NavigatorContext = (0,external_wp_element_namespaceObject.createContext)(initialContextValue);
  55800. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-provider/component.js
  55801. function component_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  55802. /**
  55803. * External dependencies
  55804. */
  55805. /**
  55806. * WordPress dependencies
  55807. */
  55808. /**
  55809. * Internal dependencies
  55810. */
  55811. var component_ref = true ? {
  55812. name: "15bx5k",
  55813. styles: "overflow-x:hidden"
  55814. } : 0;
  55815. function NavigatorProvider(props, forwardedRef) {
  55816. const {
  55817. initialPath,
  55818. children,
  55819. className,
  55820. ...otherProps
  55821. } = useContextSystem(props, 'NavigatorProvider');
  55822. const [locationHistory, setLocationHistory] = (0,external_wp_element_namespaceObject.useState)([{
  55823. path: initialPath
  55824. }]);
  55825. const goTo = (0,external_wp_element_namespaceObject.useCallback)(function (path) {
  55826. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  55827. setLocationHistory([...locationHistory, { ...options,
  55828. path,
  55829. isBack: false
  55830. }]);
  55831. }, [locationHistory]);
  55832. const goBack = (0,external_wp_element_namespaceObject.useCallback)(() => {
  55833. if (locationHistory.length > 1) {
  55834. setLocationHistory([...locationHistory.slice(0, -2), { ...locationHistory[locationHistory.length - 2],
  55835. isBack: true
  55836. }]);
  55837. }
  55838. }, [locationHistory]);
  55839. const navigatorContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  55840. location: { ...locationHistory[locationHistory.length - 1],
  55841. isInitial: locationHistory.length === 1
  55842. },
  55843. goTo,
  55844. goBack
  55845. }), [locationHistory, goTo, goBack]);
  55846. const cx = useCx();
  55847. const classes = (0,external_wp_element_namespaceObject.useMemo)( // Prevents horizontal overflow while animating screen transitions.
  55848. () => cx(component_ref, className), [className, cx]);
  55849. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  55850. ref: forwardedRef,
  55851. className: classes
  55852. }, otherProps), (0,external_wp_element_namespaceObject.createElement)(NavigatorContext.Provider, {
  55853. value: navigatorContextValue
  55854. }, children));
  55855. }
  55856. /**
  55857. * The `NavigatorProvider` component allows rendering nested views/panels/menus
  55858. * (via the `NavigatorScreen` component and navigate between these different
  55859. * view (via the `NavigatorButton` and `NavigatorBackButton` components or the
  55860. * `useNavigator` hook).
  55861. *
  55862. * @example
  55863. * ```jsx
  55864. * import {
  55865. * __experimentalNavigatorProvider as NavigatorProvider,
  55866. * __experimentalNavigatorScreen as NavigatorScreen,
  55867. * __experimentalNavigatorButton as NavigatorButton,
  55868. * __experimentalNavigatorBackButton as NavigatorBackButton,
  55869. * } from '@wordpress/components';
  55870. *
  55871. * const MyNavigation = () => (
  55872. * <NavigatorProvider initialPath="/">
  55873. * <NavigatorScreen path="/">
  55874. * <p>This is the home screen.</p>
  55875. * <NavigatorButton path="/child">
  55876. * Navigate to child screen.
  55877. * </NavigatorButton>
  55878. * </NavigatorScreen>
  55879. *
  55880. * <NavigatorScreen path="/child">
  55881. * <p>This is the child screen.</p>
  55882. * <NavigatorBackButton>
  55883. * Go back
  55884. * </NavigatorBackButton>
  55885. * </NavigatorScreen>
  55886. * </NavigatorProvider>
  55887. * );
  55888. * ```
  55889. */
  55890. const ConnectedNavigatorProvider = contextConnect(NavigatorProvider, 'NavigatorProvider');
  55891. /* harmony default export */ var navigator_provider_component = (ConnectedNavigatorProvider);
  55892. ;// CONCATENATED MODULE: external ["wp","escapeHtml"]
  55893. var external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"];
  55894. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-screen/component.js
  55895. function navigator_screen_component_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  55896. /**
  55897. * External dependencies
  55898. */
  55899. // eslint-disable-next-line no-restricted-imports
  55900. /**
  55901. * WordPress dependencies
  55902. */
  55903. /**
  55904. * Internal dependencies
  55905. */
  55906. const animationEnterDelay = 0;
  55907. const animationEnterDuration = 0.14;
  55908. const animationExitDuration = 0.14;
  55909. const animationExitDelay = 0; // Props specific to `framer-motion` can't be currently passed to `NavigatorScreen`,
  55910. // as some of them would overlap with HTML props (e.g. `onAnimationStart`, ...)
  55911. var navigator_screen_component_ref = true ? {
  55912. name: "14x3t6z",
  55913. styles: "overflow-x:auto;max-height:100%"
  55914. } : 0;
  55915. function NavigatorScreen(props, forwardedRef) {
  55916. const {
  55917. children,
  55918. className,
  55919. path,
  55920. ...otherProps
  55921. } = useContextSystem(props, 'NavigatorScreen');
  55922. const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  55923. const {
  55924. location
  55925. } = (0,external_wp_element_namespaceObject.useContext)(NavigatorContext);
  55926. const isMatch = location.path === (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(path);
  55927. const wrapperRef = (0,external_wp_element_namespaceObject.useRef)(null);
  55928. const previousLocation = (0,external_wp_compose_namespaceObject.usePrevious)(location);
  55929. const cx = useCx();
  55930. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(navigator_screen_component_ref, className), [className, cx]); // Focus restoration
  55931. const isInitialLocation = location.isInitial && !location.isBack;
  55932. (0,external_wp_element_namespaceObject.useEffect)(() => {
  55933. // Only attempt to restore focus:
  55934. // - if the current location is not the initial one (to avoid moving focus on page load)
  55935. // - when the screen becomes visible
  55936. // - if the wrapper ref has been assigned
  55937. if (isInitialLocation || !isMatch || !wrapperRef.current) {
  55938. return;
  55939. }
  55940. let elementToFocus = null; // When navigating back, if a selector is provided, use it to look for the
  55941. // target element (assumed to be a node inside the current NavigatorScreen)
  55942. if (location.isBack && previousLocation !== null && previousLocation !== void 0 && previousLocation.focusTargetSelector) {
  55943. elementToFocus = wrapperRef.current.querySelector(previousLocation.focusTargetSelector);
  55944. } // If the previous query didn't run or find any element to focus, fallback
  55945. // to the first tabbable element in the screen (or the screen itself).
  55946. if (!elementToFocus) {
  55947. const firstTabbable = external_wp_dom_namespaceObject.focus.tabbable.find(wrapperRef.current)[0];
  55948. elementToFocus = firstTabbable !== null && firstTabbable !== void 0 ? firstTabbable : wrapperRef.current;
  55949. }
  55950. elementToFocus.focus();
  55951. }, [isInitialLocation, isMatch]);
  55952. const mergedWrapperRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([forwardedRef, wrapperRef]);
  55953. if (!isMatch) {
  55954. return null;
  55955. }
  55956. if (prefersReducedMotion) {
  55957. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  55958. ref: mergedWrapperRef,
  55959. className: classes
  55960. }, otherProps), children);
  55961. }
  55962. const animate = {
  55963. opacity: 1,
  55964. transition: {
  55965. delay: animationEnterDelay,
  55966. duration: animationEnterDuration,
  55967. ease: 'easeInOut'
  55968. },
  55969. x: 0
  55970. };
  55971. const initial = {
  55972. opacity: 0,
  55973. x: (0,external_wp_i18n_namespaceObject.isRTL)() && location.isBack || !(0,external_wp_i18n_namespaceObject.isRTL)() && !location.isBack ? 50 : -50
  55974. };
  55975. const exit = {
  55976. delay: animationExitDelay,
  55977. opacity: 0,
  55978. x: !(0,external_wp_i18n_namespaceObject.isRTL)() && location.isBack || (0,external_wp_i18n_namespaceObject.isRTL)() && !location.isBack ? 50 : -50,
  55979. transition: {
  55980. duration: animationExitDuration,
  55981. ease: 'easeInOut'
  55982. }
  55983. };
  55984. const animatedProps = {
  55985. animate,
  55986. exit,
  55987. initial
  55988. };
  55989. return (0,external_wp_element_namespaceObject.createElement)(motion.div, extends_extends({
  55990. ref: mergedWrapperRef,
  55991. className: classes
  55992. }, otherProps, animatedProps), children);
  55993. }
  55994. /**
  55995. * The `NavigatorScreen` component represents a single view/screen/panel and
  55996. * should be used in combination with the `NavigatorProvider`, the
  55997. * `NavigatorButton` and the `NavigatorBackButton` components (or the `useNavigator`
  55998. * hook).
  55999. *
  56000. * @example
  56001. * ```jsx
  56002. * import {
  56003. * __experimentalNavigatorProvider as NavigatorProvider,
  56004. * __experimentalNavigatorScreen as NavigatorScreen,
  56005. * __experimentalNavigatorButton as NavigatorButton,
  56006. * __experimentalNavigatorBackButton as NavigatorBackButton,
  56007. * } from '@wordpress/components';
  56008. *
  56009. * const MyNavigation = () => (
  56010. * <NavigatorProvider initialPath="/">
  56011. * <NavigatorScreen path="/">
  56012. * <p>This is the home screen.</p>
  56013. * <NavigatorButton path="/child">
  56014. * Navigate to child screen.
  56015. * </NavigatorButton>
  56016. * </NavigatorScreen>
  56017. *
  56018. * <NavigatorScreen path="/child">
  56019. * <p>This is the child screen.</p>
  56020. * <NavigatorBackButton>
  56021. * Go back
  56022. * </NavigatorBackButton>
  56023. * </NavigatorScreen>
  56024. * </NavigatorProvider>
  56025. * );
  56026. * ```
  56027. */
  56028. const ConnectedNavigatorScreen = contextConnect(NavigatorScreen, 'NavigatorScreen');
  56029. /* harmony default export */ var navigator_screen_component = (ConnectedNavigatorScreen);
  56030. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/use-navigator.js
  56031. /**
  56032. * WordPress dependencies
  56033. */
  56034. /**
  56035. * Internal dependencies
  56036. */
  56037. /**
  56038. * Retrieves a `navigator` instance.
  56039. */
  56040. function useNavigator() {
  56041. const {
  56042. location,
  56043. goTo,
  56044. goBack
  56045. } = (0,external_wp_element_namespaceObject.useContext)(NavigatorContext);
  56046. return {
  56047. location,
  56048. goTo,
  56049. goBack
  56050. };
  56051. }
  56052. /* harmony default export */ var use_navigator = (useNavigator);
  56053. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-button/hook.js
  56054. /**
  56055. * WordPress dependencies
  56056. */
  56057. /**
  56058. * Internal dependencies
  56059. */
  56060. /**
  56061. * Internal dependencies
  56062. */
  56063. const cssSelectorForAttribute = (attrName, attrValue) => `[${attrName}="${attrValue}"]`;
  56064. function useNavigatorButton(props) {
  56065. const {
  56066. path,
  56067. onClick,
  56068. as = build_module_button,
  56069. attributeName = 'id',
  56070. ...otherProps
  56071. } = useContextSystem(props, 'NavigatorButton');
  56072. const escapedPath = (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(path);
  56073. const {
  56074. goTo
  56075. } = use_navigator();
  56076. const handleClick = (0,external_wp_element_namespaceObject.useCallback)(e => {
  56077. e.preventDefault();
  56078. goTo(escapedPath, {
  56079. focusTargetSelector: cssSelectorForAttribute(attributeName, escapedPath)
  56080. });
  56081. onClick === null || onClick === void 0 ? void 0 : onClick(e);
  56082. }, [goTo, onClick]);
  56083. return {
  56084. as,
  56085. onClick: handleClick,
  56086. ...otherProps,
  56087. [attributeName]: escapedPath
  56088. };
  56089. }
  56090. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-button/component.js
  56091. /**
  56092. * External dependencies
  56093. */
  56094. /**
  56095. * Internal dependencies
  56096. */
  56097. function NavigatorButton(props, forwardedRef) {
  56098. const navigatorButtonProps = useNavigatorButton(props);
  56099. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  56100. ref: forwardedRef
  56101. }, navigatorButtonProps));
  56102. }
  56103. /**
  56104. * The `NavigatorButton` component can be used to navigate to a screen and should
  56105. * be used in combination with the `NavigatorProvider`, the `NavigatorScreen`
  56106. * and the `NavigatorBackButton` components (or the `useNavigator` hook).
  56107. *
  56108. * @example
  56109. * ```jsx
  56110. * import {
  56111. * __experimentalNavigatorProvider as NavigatorProvider,
  56112. * __experimentalNavigatorScreen as NavigatorScreen,
  56113. * __experimentalNavigatorButton as NavigatorButton,
  56114. * __experimentalNavigatorBackButton as NavigatorBackButton,
  56115. * } from '@wordpress/components';
  56116. *
  56117. * const MyNavigation = () => (
  56118. * <NavigatorProvider initialPath="/">
  56119. * <NavigatorScreen path="/">
  56120. * <p>This is the home screen.</p>
  56121. * <NavigatorButton path="/child">
  56122. * Navigate to child screen.
  56123. * </NavigatorButton>
  56124. * </NavigatorScreen>
  56125. *
  56126. * <NavigatorScreen path="/child">
  56127. * <p>This is the child screen.</p>
  56128. * <NavigatorBackButton>
  56129. * Go back
  56130. * </NavigatorBackButton>
  56131. * </NavigatorScreen>
  56132. * </NavigatorProvider>
  56133. * );
  56134. * ```
  56135. */
  56136. const ConnectedNavigatorButton = contextConnect(NavigatorButton, 'NavigatorButton');
  56137. /* harmony default export */ var navigator_button_component = (ConnectedNavigatorButton);
  56138. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-back-button/hook.js
  56139. /**
  56140. * WordPress dependencies
  56141. */
  56142. /**
  56143. * Internal dependencies
  56144. */
  56145. /**
  56146. * Internal dependencies
  56147. */
  56148. function useNavigatorBackButton(props) {
  56149. const {
  56150. onClick,
  56151. as = build_module_button,
  56152. ...otherProps
  56153. } = useContextSystem(props, 'NavigatorBackButton');
  56154. const {
  56155. goBack
  56156. } = use_navigator();
  56157. const handleClick = (0,external_wp_element_namespaceObject.useCallback)(e => {
  56158. e.preventDefault();
  56159. goBack();
  56160. onClick === null || onClick === void 0 ? void 0 : onClick(e);
  56161. }, [goBack, onClick]);
  56162. return {
  56163. as,
  56164. onClick: handleClick,
  56165. ...otherProps
  56166. };
  56167. }
  56168. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-back-button/component.js
  56169. /**
  56170. * External dependencies
  56171. */
  56172. /**
  56173. * Internal dependencies
  56174. */
  56175. function NavigatorBackButton(props, forwardedRef) {
  56176. const navigatorBackButtonProps = useNavigatorBackButton(props);
  56177. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  56178. ref: forwardedRef
  56179. }, navigatorBackButtonProps));
  56180. }
  56181. /**
  56182. * The `NavigatorBackButton` component can be used to navigate to a screen and
  56183. * should be used in combination with the `NavigatorProvider`, the
  56184. * `NavigatorScreen` and the `NavigatorButton` components (or the `useNavigator`
  56185. * hook).
  56186. *
  56187. * @example
  56188. * ```jsx
  56189. * import {
  56190. * __experimentalNavigatorProvider as NavigatorProvider,
  56191. * __experimentalNavigatorScreen as NavigatorScreen,
  56192. * __experimentalNavigatorButton as NavigatorButton,
  56193. * __experimentalNavigatorBackButton as NavigatorBackButton,
  56194. * } from '@wordpress/components';
  56195. *
  56196. * const MyNavigation = () => (
  56197. * <NavigatorProvider initialPath="/">
  56198. * <NavigatorScreen path="/">
  56199. * <p>This is the home screen.</p>
  56200. * <NavigatorButton path="/child">
  56201. * Navigate to child screen.
  56202. * </NavigatorButton>
  56203. * </NavigatorScreen>
  56204. *
  56205. * <NavigatorScreen path="/child">
  56206. * <p>This is the child screen.</p>
  56207. * <NavigatorBackButton>
  56208. * Go back
  56209. * </NavigatorBackButton>
  56210. * </NavigatorScreen>
  56211. * </NavigatorProvider>
  56212. * );
  56213. * ```
  56214. */
  56215. const ConnectedNavigatorBackButton = contextConnect(NavigatorBackButton, 'NavigatorBackButton');
  56216. /* harmony default export */ var navigator_back_button_component = (ConnectedNavigatorBackButton);
  56217. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/notice/index.js
  56218. /**
  56219. * External dependencies
  56220. */
  56221. /**
  56222. * WordPress dependencies
  56223. */
  56224. /**
  56225. * Internal dependencies
  56226. */
  56227. /** @typedef {import('@wordpress/element').WPElement} WPElement */
  56228. /**
  56229. * Custom hook which announces the message with the given politeness, if a
  56230. * valid message is provided.
  56231. *
  56232. * @param {string|WPElement} [message] Message to announce.
  56233. * @param {'polite'|'assertive'} politeness Politeness to announce.
  56234. */
  56235. function useSpokenMessage(message, politeness) {
  56236. const spokenMessage = typeof message === 'string' ? message : (0,external_wp_element_namespaceObject.renderToString)(message);
  56237. (0,external_wp_element_namespaceObject.useEffect)(() => {
  56238. if (spokenMessage) {
  56239. (0,external_wp_a11y_namespaceObject.speak)(spokenMessage, politeness);
  56240. }
  56241. }, [spokenMessage, politeness]);
  56242. }
  56243. /**
  56244. * Given a notice status, returns an assumed default politeness for the status.
  56245. * Defaults to 'assertive'.
  56246. *
  56247. * @param {string} [status] Notice status.
  56248. *
  56249. * @return {'polite'|'assertive'} Notice politeness.
  56250. */
  56251. function getDefaultPoliteness(status) {
  56252. switch (status) {
  56253. case 'success':
  56254. case 'warning':
  56255. case 'info':
  56256. return 'polite';
  56257. case 'error':
  56258. default:
  56259. return 'assertive';
  56260. }
  56261. }
  56262. function Notice(_ref) {
  56263. let {
  56264. className,
  56265. status = 'info',
  56266. children,
  56267. spokenMessage = children,
  56268. onRemove = external_lodash_namespaceObject.noop,
  56269. isDismissible = true,
  56270. actions = [],
  56271. politeness = getDefaultPoliteness(status),
  56272. __unstableHTML,
  56273. // onDismiss is a callback executed when the notice is dismissed.
  56274. // It is distinct from onRemove, which _looks_ like a callback but is
  56275. // actually the function to call to remove the notice from the UI.
  56276. onDismiss = external_lodash_namespaceObject.noop
  56277. } = _ref;
  56278. useSpokenMessage(spokenMessage, politeness);
  56279. const classes = classnames_default()(className, 'components-notice', 'is-' + status, {
  56280. 'is-dismissible': isDismissible
  56281. });
  56282. if (__unstableHTML) {
  56283. children = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, children);
  56284. }
  56285. const onDismissNotice = event => {
  56286. var _event$preventDefault;
  56287. event === null || event === void 0 ? void 0 : (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 ? void 0 : _event$preventDefault.call(event);
  56288. onDismiss();
  56289. onRemove();
  56290. };
  56291. return (0,external_wp_element_namespaceObject.createElement)("div", {
  56292. className: classes
  56293. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  56294. className: "components-notice__content"
  56295. }, children, (0,external_wp_element_namespaceObject.createElement)("div", {
  56296. className: "components-notice__actions"
  56297. }, actions.map((_ref2, index) => {
  56298. let {
  56299. className: buttonCustomClasses,
  56300. label,
  56301. isPrimary,
  56302. variant,
  56303. noDefaultClasses = false,
  56304. onClick,
  56305. url
  56306. } = _ref2;
  56307. let computedVariant = variant;
  56308. if (variant !== 'primary' && !noDefaultClasses) {
  56309. computedVariant = !url ? 'secondary' : 'link';
  56310. }
  56311. if (typeof computedVariant === 'undefined' && isPrimary) {
  56312. computedVariant = 'primary';
  56313. }
  56314. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  56315. key: index,
  56316. href: url,
  56317. variant: computedVariant,
  56318. onClick: url ? undefined : onClick,
  56319. className: classnames_default()('components-notice__action', buttonCustomClasses)
  56320. }, label);
  56321. }))), isDismissible && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  56322. className: "components-notice__dismiss",
  56323. icon: library_close,
  56324. label: (0,external_wp_i18n_namespaceObject.__)('Dismiss this notice'),
  56325. onClick: onDismissNotice,
  56326. showTooltip: false
  56327. }));
  56328. }
  56329. /* harmony default export */ var build_module_notice = (Notice);
  56330. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/notice/list.js
  56331. /**
  56332. * External dependencies
  56333. */
  56334. /**
  56335. * Internal dependencies
  56336. */
  56337. /**
  56338. * Renders a list of notices.
  56339. *
  56340. * @param {Object} $0 Props passed to the component.
  56341. * @param {Array} $0.notices Array of notices to render.
  56342. * @param {Function} $0.onRemove Function called when a notice should be removed / dismissed.
  56343. * @param {Object} $0.className Name of the class used by the component.
  56344. * @param {Object} $0.children Array of children to be rendered inside the notice list.
  56345. *
  56346. * @return {Object} The rendered notices list.
  56347. */
  56348. function NoticeList(_ref) {
  56349. let {
  56350. notices,
  56351. onRemove = external_lodash_namespaceObject.noop,
  56352. className,
  56353. children
  56354. } = _ref;
  56355. const removeNotice = id => () => onRemove(id);
  56356. className = classnames_default()('components-notice-list', className);
  56357. return (0,external_wp_element_namespaceObject.createElement)("div", {
  56358. className: className
  56359. }, children, [...notices].reverse().map(notice => (0,external_wp_element_namespaceObject.createElement)(build_module_notice, extends_extends({}, (0,external_lodash_namespaceObject.omit)(notice, ['content']), {
  56360. key: notice.id,
  56361. onRemove: removeNotice(notice.id)
  56362. }), notice.content)));
  56363. }
  56364. /* harmony default export */ var list = (NoticeList);
  56365. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/header.js
  56366. function PanelHeader(_ref) {
  56367. let {
  56368. label,
  56369. children
  56370. } = _ref;
  56371. return (0,external_wp_element_namespaceObject.createElement)("div", {
  56372. className: "components-panel__header"
  56373. }, label && (0,external_wp_element_namespaceObject.createElement)("h2", null, label), children);
  56374. }
  56375. /* harmony default export */ var panel_header = (PanelHeader);
  56376. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/index.js
  56377. /**
  56378. * External dependencies
  56379. */
  56380. /**
  56381. * WordPress dependencies
  56382. */
  56383. /**
  56384. * Internal dependencies
  56385. */
  56386. function Panel(_ref, ref) {
  56387. let {
  56388. header,
  56389. className,
  56390. children
  56391. } = _ref;
  56392. const classNames = classnames_default()(className, 'components-panel');
  56393. return (0,external_wp_element_namespaceObject.createElement)("div", {
  56394. className: classNames,
  56395. ref: ref
  56396. }, header && (0,external_wp_element_namespaceObject.createElement)(panel_header, {
  56397. label: header
  56398. }), children);
  56399. }
  56400. /* harmony default export */ var panel = ((0,external_wp_element_namespaceObject.forwardRef)(Panel));
  56401. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js
  56402. /**
  56403. * WordPress dependencies
  56404. */
  56405. const chevronUp = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  56406. viewBox: "0 0 24 24",
  56407. xmlns: "http://www.w3.org/2000/svg"
  56408. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  56409. d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"
  56410. }));
  56411. /* harmony default export */ var chevron_up = (chevronUp);
  56412. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/body.js
  56413. /**
  56414. * External dependencies
  56415. */
  56416. /**
  56417. * WordPress dependencies
  56418. */
  56419. /**
  56420. * Internal dependencies
  56421. */
  56422. function PanelBody(_ref, ref) {
  56423. let {
  56424. buttonProps = {},
  56425. children,
  56426. className,
  56427. icon,
  56428. initialOpen,
  56429. onToggle = external_lodash_namespaceObject.noop,
  56430. opened,
  56431. title,
  56432. scrollAfterOpen = true
  56433. } = _ref;
  56434. const [isOpened, setIsOpened] = use_controlled_state(opened, {
  56435. initial: initialOpen === undefined ? true : initialOpen
  56436. });
  56437. const nodeRef = (0,external_wp_element_namespaceObject.useRef)(); // Defaults to 'smooth' scrolling
  56438. // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
  56439. const scrollBehavior = (0,external_wp_compose_namespaceObject.useReducedMotion)() ? 'auto' : 'smooth';
  56440. const handleOnToggle = event => {
  56441. event.preventDefault();
  56442. const next = !isOpened;
  56443. setIsOpened(next);
  56444. onToggle(next);
  56445. }; // Ref is used so that the effect does not re-run upon scrollAfterOpen changing value.
  56446. const scrollAfterOpenRef = (0,external_wp_element_namespaceObject.useRef)();
  56447. scrollAfterOpenRef.current = scrollAfterOpen; // Runs after initial render.
  56448. use_update_effect(() => {
  56449. var _nodeRef$current;
  56450. if (isOpened && scrollAfterOpenRef.current && (_nodeRef$current = nodeRef.current) !== null && _nodeRef$current !== void 0 && _nodeRef$current.scrollIntoView) {
  56451. /*
  56452. * Scrolls the content into view when visible.
  56453. * This improves the UX when there are multiple stacking <PanelBody />
  56454. * components in a scrollable container.
  56455. */
  56456. nodeRef.current.scrollIntoView({
  56457. inline: 'nearest',
  56458. block: 'nearest',
  56459. behavior: scrollBehavior
  56460. });
  56461. }
  56462. }, [isOpened, scrollBehavior]);
  56463. const classes = classnames_default()('components-panel__body', className, {
  56464. 'is-opened': isOpened
  56465. });
  56466. return (0,external_wp_element_namespaceObject.createElement)("div", {
  56467. className: classes,
  56468. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([nodeRef, ref])
  56469. }, (0,external_wp_element_namespaceObject.createElement)(PanelBodyTitle, extends_extends({
  56470. icon: icon,
  56471. isOpened: isOpened,
  56472. onClick: handleOnToggle,
  56473. title: title
  56474. }, buttonProps)), typeof children === 'function' ? children({
  56475. opened: isOpened
  56476. }) : isOpened && children);
  56477. }
  56478. const PanelBodyTitle = (0,external_wp_element_namespaceObject.forwardRef)((_ref2, ref) => {
  56479. let {
  56480. isOpened,
  56481. icon,
  56482. title,
  56483. ...props
  56484. } = _ref2;
  56485. if (!title) return null;
  56486. return (0,external_wp_element_namespaceObject.createElement)("h2", {
  56487. className: "components-panel__body-title"
  56488. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  56489. className: "components-panel__body-toggle",
  56490. "aria-expanded": isOpened,
  56491. ref: ref
  56492. }, props), (0,external_wp_element_namespaceObject.createElement)("span", {
  56493. "aria-hidden": "true"
  56494. }, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  56495. className: "components-panel__arrow",
  56496. icon: isOpened ? chevron_up : chevron_down
  56497. })), title, icon && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  56498. icon: icon,
  56499. className: "components-panel__icon",
  56500. size: 20
  56501. })));
  56502. });
  56503. const body_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(PanelBody);
  56504. body_ForwardedComponent.displayName = 'PanelBody';
  56505. /* harmony default export */ var body = (body_ForwardedComponent);
  56506. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/row.js
  56507. /**
  56508. * External dependencies
  56509. */
  56510. /**
  56511. * WordPress dependencies
  56512. */
  56513. const PanelRow = (0,external_wp_element_namespaceObject.forwardRef)((_ref, ref) => {
  56514. let {
  56515. className,
  56516. children
  56517. } = _ref;
  56518. return (0,external_wp_element_namespaceObject.createElement)("div", {
  56519. className: classnames_default()('components-panel__row', className),
  56520. ref: ref
  56521. }, children);
  56522. });
  56523. /* harmony default export */ var row = (PanelRow);
  56524. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/placeholder/index.js
  56525. /**
  56526. * External dependencies
  56527. */
  56528. /**
  56529. * WordPress dependencies
  56530. */
  56531. /**
  56532. * Internal dependencies
  56533. */
  56534. /**
  56535. * Renders a placeholder. Normally used by blocks to render their empty state.
  56536. *
  56537. * @param {Object} props The component props.
  56538. * @param {WPIcon} props.icon An icon rendered before the label.
  56539. * @param {WPElement} props.children Children to be rendered.
  56540. * @param {string} props.label Title of the placeholder.
  56541. * @param {string} props.instructions Instructions of the placeholder.
  56542. * @param {string} props.className Class to set on the container div.
  56543. * @param {Object} props.notices A rendered notices list.
  56544. * @param {Object} props.preview Preview to be rendered in the placeholder.
  56545. * @param {boolean} props.isColumnLayout Whether a column layout should be used.
  56546. *
  56547. * @return {Object} The rendered placeholder.
  56548. */
  56549. function Placeholder(_ref) {
  56550. let {
  56551. icon,
  56552. children,
  56553. label,
  56554. instructions,
  56555. className,
  56556. notices,
  56557. preview,
  56558. isColumnLayout,
  56559. ...additionalProps
  56560. } = _ref;
  56561. const [resizeListener, {
  56562. width
  56563. }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); // Since `useResizeObserver` will report a width of `null` until after the
  56564. // first render, avoid applying any modifier classes until width is known.
  56565. let modifierClassNames;
  56566. if (typeof width === 'number') {
  56567. modifierClassNames = {
  56568. 'is-large': width >= 480,
  56569. 'is-medium': width >= 160 && width < 480,
  56570. 'is-small': width < 160
  56571. };
  56572. }
  56573. const classes = classnames_default()('components-placeholder', className, modifierClassNames);
  56574. const fieldsetClasses = classnames_default()('components-placeholder__fieldset', {
  56575. 'is-column-layout': isColumnLayout
  56576. });
  56577. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({}, additionalProps, {
  56578. className: classes
  56579. }), resizeListener, notices, preview && (0,external_wp_element_namespaceObject.createElement)("div", {
  56580. className: "components-placeholder__preview"
  56581. }, preview), (0,external_wp_element_namespaceObject.createElement)("div", {
  56582. className: "components-placeholder__label"
  56583. }, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  56584. icon: icon
  56585. }), label), (0,external_wp_element_namespaceObject.createElement)("fieldset", {
  56586. className: fieldsetClasses
  56587. }, !!instructions && (0,external_wp_element_namespaceObject.createElement)("legend", {
  56588. className: "components-placeholder__instructions"
  56589. }, instructions), children));
  56590. }
  56591. /* harmony default export */ var placeholder = (Placeholder);
  56592. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/terms.js
  56593. /**
  56594. * External dependencies
  56595. */
  56596. /**
  56597. * Returns terms in a tree form.
  56598. *
  56599. * @param {Array} flatTerms Array of terms in flat format.
  56600. *
  56601. * @return {Array} Array of terms in tree format.
  56602. */
  56603. function buildTermsTree(flatTerms) {
  56604. const flatTermsWithParentAndChildren = flatTerms.map(term => {
  56605. return {
  56606. children: [],
  56607. parent: null,
  56608. ...term
  56609. };
  56610. });
  56611. const termsByParent = (0,external_lodash_namespaceObject.groupBy)(flatTermsWithParentAndChildren, 'parent');
  56612. if (termsByParent.null && termsByParent.null.length) {
  56613. return flatTermsWithParentAndChildren;
  56614. }
  56615. const fillWithChildren = terms => {
  56616. return terms.map(term => {
  56617. const children = termsByParent[term.id];
  56618. return { ...term,
  56619. children: children && children.length ? fillWithChildren(children) : []
  56620. };
  56621. });
  56622. };
  56623. return fillWithChildren(termsByParent['0'] || []);
  56624. }
  56625. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-select/index.js
  56626. /**
  56627. * External dependencies
  56628. */
  56629. /**
  56630. * WordPress dependencies
  56631. */
  56632. /**
  56633. * Internal dependencies
  56634. */
  56635. function tree_select_getSelectOptions(tree) {
  56636. let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  56637. return (0,external_lodash_namespaceObject.flatMap)(tree, treeNode => [{
  56638. value: treeNode.id,
  56639. label: (0,external_lodash_namespaceObject.repeat)('\u00A0', level * 3) + (0,external_lodash_namespaceObject.unescape)(treeNode.name)
  56640. }, ...tree_select_getSelectOptions(treeNode.children || [], level + 1)]);
  56641. }
  56642. function TreeSelect(_ref) {
  56643. let {
  56644. label,
  56645. noOptionLabel,
  56646. onChange,
  56647. selectedId,
  56648. tree,
  56649. ...props
  56650. } = _ref;
  56651. const options = (0,external_wp_element_namespaceObject.useMemo)(() => {
  56652. return (0,external_lodash_namespaceObject.compact)([noOptionLabel && {
  56653. value: '',
  56654. label: noOptionLabel
  56655. }, ...tree_select_getSelectOptions(tree)]);
  56656. }, [noOptionLabel, tree]);
  56657. return (0,external_wp_element_namespaceObject.createElement)(select_control, extends_extends({
  56658. label,
  56659. options,
  56660. onChange,
  56661. value: selectedId
  56662. }, props));
  56663. }
  56664. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/category-select.js
  56665. /**
  56666. * Internal dependencies
  56667. */
  56668. /**
  56669. * WordPress dependencies
  56670. */
  56671. function CategorySelect(_ref) {
  56672. let {
  56673. label,
  56674. noOptionLabel,
  56675. categoriesList,
  56676. selectedCategoryId,
  56677. onChange,
  56678. ...props
  56679. } = _ref;
  56680. const termsTree = (0,external_wp_element_namespaceObject.useMemo)(() => {
  56681. return buildTermsTree(categoriesList);
  56682. }, [categoriesList]);
  56683. return (0,external_wp_element_namespaceObject.createElement)(TreeSelect, extends_extends({
  56684. label,
  56685. noOptionLabel,
  56686. onChange,
  56687. tree: termsTree,
  56688. selectedId: selectedCategoryId
  56689. }, props));
  56690. }
  56691. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/author-select.js
  56692. /**
  56693. * Internal dependencies
  56694. */
  56695. function AuthorSelect(_ref) {
  56696. let {
  56697. label,
  56698. noOptionLabel,
  56699. authorList,
  56700. selectedAuthorId,
  56701. onChange
  56702. } = _ref;
  56703. if (!authorList) return null;
  56704. const termsTree = buildTermsTree(authorList);
  56705. return (0,external_wp_element_namespaceObject.createElement)(TreeSelect, {
  56706. label,
  56707. noOptionLabel,
  56708. onChange,
  56709. tree: termsTree,
  56710. selectedId: selectedAuthorId
  56711. });
  56712. }
  56713. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/index.js
  56714. /**
  56715. * WordPress dependencies
  56716. */
  56717. /**
  56718. * Internal dependencies
  56719. */
  56720. const DEFAULT_MIN_ITEMS = 1;
  56721. const DEFAULT_MAX_ITEMS = 100;
  56722. const MAX_CATEGORIES_SUGGESTIONS = 20;
  56723. function QueryControls(_ref) {
  56724. let {
  56725. authorList,
  56726. selectedAuthorId,
  56727. categoriesList,
  56728. selectedCategoryId,
  56729. categorySuggestions,
  56730. selectedCategories,
  56731. numberOfItems,
  56732. order,
  56733. orderBy,
  56734. maxItems = DEFAULT_MAX_ITEMS,
  56735. minItems = DEFAULT_MIN_ITEMS,
  56736. onCategoryChange,
  56737. onAuthorChange,
  56738. onNumberOfItemsChange,
  56739. onOrderChange,
  56740. onOrderByChange
  56741. } = _ref;
  56742. return [onOrderChange && onOrderByChange && (0,external_wp_element_namespaceObject.createElement)(select_control, {
  56743. key: "query-controls-order-select",
  56744. label: (0,external_wp_i18n_namespaceObject.__)('Order by'),
  56745. value: `${orderBy}/${order}`,
  56746. options: [{
  56747. label: (0,external_wp_i18n_namespaceObject.__)('Newest to oldest'),
  56748. value: 'date/desc'
  56749. }, {
  56750. label: (0,external_wp_i18n_namespaceObject.__)('Oldest to newest'),
  56751. value: 'date/asc'
  56752. }, {
  56753. /* translators: label for ordering posts by title in ascending order */
  56754. label: (0,external_wp_i18n_namespaceObject.__)('A → Z'),
  56755. value: 'title/asc'
  56756. }, {
  56757. /* translators: label for ordering posts by title in descending order */
  56758. label: (0,external_wp_i18n_namespaceObject.__)('Z → A'),
  56759. value: 'title/desc'
  56760. }],
  56761. onChange: value => {
  56762. const [newOrderBy, newOrder] = value.split('/');
  56763. if (newOrder !== order) {
  56764. onOrderChange(newOrder);
  56765. }
  56766. if (newOrderBy !== orderBy) {
  56767. onOrderByChange(newOrderBy);
  56768. }
  56769. }
  56770. }), categoriesList && onCategoryChange && (0,external_wp_element_namespaceObject.createElement)(CategorySelect, {
  56771. key: "query-controls-category-select",
  56772. categoriesList: categoriesList,
  56773. label: (0,external_wp_i18n_namespaceObject.__)('Category'),
  56774. noOptionLabel: (0,external_wp_i18n_namespaceObject.__)('All'),
  56775. selectedCategoryId: selectedCategoryId,
  56776. onChange: onCategoryChange
  56777. }), categorySuggestions && onCategoryChange && (0,external_wp_element_namespaceObject.createElement)(form_token_field, {
  56778. key: "query-controls-categories-select",
  56779. label: (0,external_wp_i18n_namespaceObject.__)('Categories'),
  56780. value: selectedCategories && selectedCategories.map(item => ({
  56781. id: item.id,
  56782. value: item.name || item.value
  56783. })),
  56784. suggestions: Object.keys(categorySuggestions),
  56785. onChange: onCategoryChange,
  56786. maxSuggestions: MAX_CATEGORIES_SUGGESTIONS
  56787. }), onAuthorChange && (0,external_wp_element_namespaceObject.createElement)(AuthorSelect, {
  56788. key: "query-controls-author-select",
  56789. authorList: authorList,
  56790. label: (0,external_wp_i18n_namespaceObject.__)('Author'),
  56791. noOptionLabel: (0,external_wp_i18n_namespaceObject.__)('All'),
  56792. selectedAuthorId: selectedAuthorId,
  56793. onChange: onAuthorChange
  56794. }), onNumberOfItemsChange && (0,external_wp_element_namespaceObject.createElement)(range_control, {
  56795. key: "query-controls-range-control",
  56796. label: (0,external_wp_i18n_namespaceObject.__)('Number of items'),
  56797. value: numberOfItems,
  56798. onChange: onNumberOfItemsChange,
  56799. min: minItems,
  56800. max: maxItems,
  56801. required: true
  56802. })];
  56803. }
  56804. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-context/index.js
  56805. /**
  56806. * WordPress dependencies
  56807. */
  56808. const RadioContext = (0,external_wp_element_namespaceObject.createContext)({
  56809. state: null,
  56810. setState: () => {}
  56811. });
  56812. /* harmony default export */ var radio_context = (RadioContext);
  56813. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio/index.js
  56814. /**
  56815. * External dependencies
  56816. */
  56817. /**
  56818. * WordPress dependencies
  56819. */
  56820. /**
  56821. * Internal dependencies
  56822. */
  56823. function radio_Radio(_ref, ref) {
  56824. let {
  56825. children,
  56826. value,
  56827. ...props
  56828. } = _ref;
  56829. const radioContext = (0,external_wp_element_namespaceObject.useContext)(radio_context);
  56830. const checked = radioContext.state === value;
  56831. return (0,external_wp_element_namespaceObject.createElement)(Radio, extends_extends({
  56832. ref: ref,
  56833. as: build_module_button,
  56834. variant: checked ? 'primary' : 'secondary',
  56835. value: value
  56836. }, radioContext, props), children || value);
  56837. }
  56838. /* harmony default export */ var build_module_radio = ((0,external_wp_element_namespaceObject.forwardRef)(radio_Radio));
  56839. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-group/index.js
  56840. /**
  56841. * External dependencies
  56842. */
  56843. /**
  56844. * WordPress dependencies
  56845. */
  56846. /**
  56847. * Internal dependencies
  56848. */
  56849. function radio_group_RadioGroup(_ref, ref) {
  56850. let {
  56851. label,
  56852. checked,
  56853. defaultChecked,
  56854. disabled,
  56855. onChange,
  56856. ...props
  56857. } = _ref;
  56858. const radioState = useRadioState({
  56859. state: defaultChecked,
  56860. baseId: props.id
  56861. });
  56862. const radioContext = { ...radioState,
  56863. disabled,
  56864. // Controlled or uncontrolled.
  56865. state: checked !== null && checked !== void 0 ? checked : radioState.state,
  56866. setState: onChange !== null && onChange !== void 0 ? onChange : radioState.setState
  56867. };
  56868. return (0,external_wp_element_namespaceObject.createElement)(radio_context.Provider, {
  56869. value: radioContext
  56870. }, (0,external_wp_element_namespaceObject.createElement)(RadioGroup, extends_extends({
  56871. ref: ref,
  56872. as: button_group,
  56873. "aria-label": label
  56874. }, radioState, props)));
  56875. }
  56876. /* harmony default export */ var radio_group = ((0,external_wp_element_namespaceObject.forwardRef)(radio_group_RadioGroup));
  56877. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-control/index.js
  56878. /**
  56879. * External dependencies
  56880. */
  56881. /**
  56882. * WordPress dependencies
  56883. */
  56884. /**
  56885. * Internal dependencies
  56886. */
  56887. function RadioControl(_ref) {
  56888. let {
  56889. label,
  56890. className,
  56891. selected,
  56892. help,
  56893. onChange,
  56894. hideLabelFromVision,
  56895. options = [],
  56896. ...props
  56897. } = _ref;
  56898. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(RadioControl);
  56899. const id = `inspector-radio-control-${instanceId}`;
  56900. const onChangeValue = event => onChange(event.target.value);
  56901. return !(0,external_lodash_namespaceObject.isEmpty)(options) && (0,external_wp_element_namespaceObject.createElement)(base_control, {
  56902. label: label,
  56903. id: id,
  56904. hideLabelFromVision: hideLabelFromVision,
  56905. help: help,
  56906. className: classnames_default()(className, 'components-radio-control')
  56907. }, options.map((option, index) => (0,external_wp_element_namespaceObject.createElement)("div", {
  56908. key: `${id}-${index}`,
  56909. className: "components-radio-control__option"
  56910. }, (0,external_wp_element_namespaceObject.createElement)("input", extends_extends({
  56911. id: `${id}-${index}`,
  56912. className: "components-radio-control__input",
  56913. type: "radio",
  56914. name: id,
  56915. value: option.value,
  56916. onChange: onChangeValue,
  56917. checked: option.value === selected,
  56918. "aria-describedby": !!help ? `${id}__help` : undefined
  56919. }, props)), (0,external_wp_element_namespaceObject.createElement)("label", {
  56920. htmlFor: `${id}-${index}`
  56921. }, option.label))));
  56922. }
  56923. ;// CONCATENATED MODULE: ./node_modules/re-resizable/lib/resizer.js
  56924. var resizer_extends = (undefined && undefined.__extends) || (function () {
  56925. var extendStatics = function (d, b) {
  56926. extendStatics = Object.setPrototypeOf ||
  56927. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  56928. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  56929. return extendStatics(d, b);
  56930. };
  56931. return function (d, b) {
  56932. extendStatics(d, b);
  56933. function __() { this.constructor = d; }
  56934. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  56935. };
  56936. })();
  56937. var resizer_assign = (undefined && undefined.__assign) || function () {
  56938. resizer_assign = Object.assign || function(t) {
  56939. for (var s, i = 1, n = arguments.length; i < n; i++) {
  56940. s = arguments[i];
  56941. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  56942. t[p] = s[p];
  56943. }
  56944. return t;
  56945. };
  56946. return resizer_assign.apply(this, arguments);
  56947. };
  56948. var rowSizeBase = {
  56949. width: '100%',
  56950. height: '10px',
  56951. top: '0px',
  56952. left: '0px',
  56953. cursor: 'row-resize',
  56954. };
  56955. var colSizeBase = {
  56956. width: '10px',
  56957. height: '100%',
  56958. top: '0px',
  56959. left: '0px',
  56960. cursor: 'col-resize',
  56961. };
  56962. var edgeBase = {
  56963. width: '20px',
  56964. height: '20px',
  56965. position: 'absolute',
  56966. };
  56967. var styles = {
  56968. top: resizer_assign(resizer_assign({}, rowSizeBase), { top: '-5px' }),
  56969. right: resizer_assign(resizer_assign({}, colSizeBase), { left: undefined, right: '-5px' }),
  56970. bottom: resizer_assign(resizer_assign({}, rowSizeBase), { top: undefined, bottom: '-5px' }),
  56971. left: resizer_assign(resizer_assign({}, colSizeBase), { left: '-5px' }),
  56972. topRight: resizer_assign(resizer_assign({}, edgeBase), { right: '-10px', top: '-10px', cursor: 'ne-resize' }),
  56973. bottomRight: resizer_assign(resizer_assign({}, edgeBase), { right: '-10px', bottom: '-10px', cursor: 'se-resize' }),
  56974. bottomLeft: resizer_assign(resizer_assign({}, edgeBase), { left: '-10px', bottom: '-10px', cursor: 'sw-resize' }),
  56975. topLeft: resizer_assign(resizer_assign({}, edgeBase), { left: '-10px', top: '-10px', cursor: 'nw-resize' }),
  56976. };
  56977. var Resizer = /** @class */ (function (_super) {
  56978. resizer_extends(Resizer, _super);
  56979. function Resizer() {
  56980. var _this = _super !== null && _super.apply(this, arguments) || this;
  56981. _this.onMouseDown = function (e) {
  56982. _this.props.onResizeStart(e, _this.props.direction);
  56983. };
  56984. _this.onTouchStart = function (e) {
  56985. _this.props.onResizeStart(e, _this.props.direction);
  56986. };
  56987. return _this;
  56988. }
  56989. Resizer.prototype.render = function () {
  56990. return (external_React_.createElement("div", { className: this.props.className || '', style: resizer_assign(resizer_assign({ position: 'absolute', userSelect: 'none' }, styles[this.props.direction]), (this.props.replaceStyles || {})), onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart }, this.props.children));
  56991. };
  56992. return Resizer;
  56993. }(external_React_.PureComponent));
  56994. ;// CONCATENATED MODULE: ./node_modules/re-resizable/lib/index.js
  56995. var lib_extends = (undefined && undefined.__extends) || (function () {
  56996. var extendStatics = function (d, b) {
  56997. extendStatics = Object.setPrototypeOf ||
  56998. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  56999. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  57000. return extendStatics(d, b);
  57001. };
  57002. return function (d, b) {
  57003. extendStatics(d, b);
  57004. function __() { this.constructor = d; }
  57005. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  57006. };
  57007. })();
  57008. var lib_assign = (undefined && undefined.__assign) || function () {
  57009. lib_assign = Object.assign || function(t) {
  57010. for (var s, i = 1, n = arguments.length; i < n; i++) {
  57011. s = arguments[i];
  57012. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  57013. t[p] = s[p];
  57014. }
  57015. return t;
  57016. };
  57017. return lib_assign.apply(this, arguments);
  57018. };
  57019. var DEFAULT_SIZE = {
  57020. width: 'auto',
  57021. height: 'auto',
  57022. };
  57023. var lib_clamp = function (n, min, max) { return Math.max(Math.min(n, max), min); };
  57024. var snap = function (n, size) { return Math.round(n / size) * size; };
  57025. var hasDirection = function (dir, target) {
  57026. return new RegExp(dir, 'i').test(target);
  57027. };
  57028. // INFO: In case of window is a Proxy and does not porxy Events correctly, use isTouchEvent & isMouseEvent to distinguish event type instead of `instanceof`.
  57029. var lib_isTouchEvent = function (event) {
  57030. return Boolean(event.touches && event.touches.length);
  57031. };
  57032. var lib_isMouseEvent = function (event) {
  57033. return Boolean((event.clientX || event.clientX === 0) &&
  57034. (event.clientY || event.clientY === 0));
  57035. };
  57036. var findClosestSnap = function (n, snapArray, snapGap) {
  57037. if (snapGap === void 0) { snapGap = 0; }
  57038. var closestGapIndex = snapArray.reduce(function (prev, curr, index) { return (Math.abs(curr - n) < Math.abs(snapArray[prev] - n) ? index : prev); }, 0);
  57039. var gap = Math.abs(snapArray[closestGapIndex] - n);
  57040. return snapGap === 0 || gap < snapGap ? snapArray[closestGapIndex] : n;
  57041. };
  57042. var getStringSize = function (n) {
  57043. n = n.toString();
  57044. if (n === 'auto') {
  57045. return n;
  57046. }
  57047. if (n.endsWith('px')) {
  57048. return n;
  57049. }
  57050. if (n.endsWith('%')) {
  57051. return n;
  57052. }
  57053. if (n.endsWith('vh')) {
  57054. return n;
  57055. }
  57056. if (n.endsWith('vw')) {
  57057. return n;
  57058. }
  57059. if (n.endsWith('vmax')) {
  57060. return n;
  57061. }
  57062. if (n.endsWith('vmin')) {
  57063. return n;
  57064. }
  57065. return n + "px";
  57066. };
  57067. var getPixelSize = function (size, parentSize, innerWidth, innerHeight) {
  57068. if (size && typeof size === 'string') {
  57069. if (size.endsWith('px')) {
  57070. return Number(size.replace('px', ''));
  57071. }
  57072. if (size.endsWith('%')) {
  57073. var ratio = Number(size.replace('%', '')) / 100;
  57074. return parentSize * ratio;
  57075. }
  57076. if (size.endsWith('vw')) {
  57077. var ratio = Number(size.replace('vw', '')) / 100;
  57078. return innerWidth * ratio;
  57079. }
  57080. if (size.endsWith('vh')) {
  57081. var ratio = Number(size.replace('vh', '')) / 100;
  57082. return innerHeight * ratio;
  57083. }
  57084. }
  57085. return size;
  57086. };
  57087. var calculateNewMax = function (parentSize, innerWidth, innerHeight, maxWidth, maxHeight, minWidth, minHeight) {
  57088. maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth, innerHeight);
  57089. maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth, innerHeight);
  57090. minWidth = getPixelSize(minWidth, parentSize.width, innerWidth, innerHeight);
  57091. minHeight = getPixelSize(minHeight, parentSize.height, innerWidth, innerHeight);
  57092. return {
  57093. maxWidth: typeof maxWidth === 'undefined' ? undefined : Number(maxWidth),
  57094. maxHeight: typeof maxHeight === 'undefined' ? undefined : Number(maxHeight),
  57095. minWidth: typeof minWidth === 'undefined' ? undefined : Number(minWidth),
  57096. minHeight: typeof minHeight === 'undefined' ? undefined : Number(minHeight),
  57097. };
  57098. };
  57099. var definedProps = [
  57100. 'as',
  57101. 'style',
  57102. 'className',
  57103. 'grid',
  57104. 'snap',
  57105. 'bounds',
  57106. 'boundsByDirection',
  57107. 'size',
  57108. 'defaultSize',
  57109. 'minWidth',
  57110. 'minHeight',
  57111. 'maxWidth',
  57112. 'maxHeight',
  57113. 'lockAspectRatio',
  57114. 'lockAspectRatioExtraWidth',
  57115. 'lockAspectRatioExtraHeight',
  57116. 'enable',
  57117. 'handleStyles',
  57118. 'handleClasses',
  57119. 'handleWrapperStyle',
  57120. 'handleWrapperClass',
  57121. 'children',
  57122. 'onResizeStart',
  57123. 'onResize',
  57124. 'onResizeStop',
  57125. 'handleComponent',
  57126. 'scale',
  57127. 'resizeRatio',
  57128. 'snapGap',
  57129. ];
  57130. // HACK: This class is used to calculate % size.
  57131. var baseClassName = '__resizable_base__';
  57132. var Resizable = /** @class */ (function (_super) {
  57133. lib_extends(Resizable, _super);
  57134. function Resizable(props) {
  57135. var _this = _super.call(this, props) || this;
  57136. _this.ratio = 1;
  57137. _this.resizable = null;
  57138. // For parent boundary
  57139. _this.parentLeft = 0;
  57140. _this.parentTop = 0;
  57141. // For boundary
  57142. _this.resizableLeft = 0;
  57143. _this.resizableRight = 0;
  57144. _this.resizableTop = 0;
  57145. _this.resizableBottom = 0;
  57146. // For target boundary
  57147. _this.targetLeft = 0;
  57148. _this.targetTop = 0;
  57149. _this.appendBase = function () {
  57150. if (!_this.resizable || !_this.window) {
  57151. return null;
  57152. }
  57153. var parent = _this.parentNode;
  57154. if (!parent) {
  57155. return null;
  57156. }
  57157. var element = _this.window.document.createElement('div');
  57158. element.style.width = '100%';
  57159. element.style.height = '100%';
  57160. element.style.position = 'absolute';
  57161. element.style.transform = 'scale(0, 0)';
  57162. element.style.left = '0';
  57163. element.style.flex = '0 0 100%';
  57164. if (element.classList) {
  57165. element.classList.add(baseClassName);
  57166. }
  57167. else {
  57168. element.className += baseClassName;
  57169. }
  57170. parent.appendChild(element);
  57171. return element;
  57172. };
  57173. _this.removeBase = function (base) {
  57174. var parent = _this.parentNode;
  57175. if (!parent) {
  57176. return;
  57177. }
  57178. parent.removeChild(base);
  57179. };
  57180. _this.ref = function (c) {
  57181. if (c) {
  57182. _this.resizable = c;
  57183. }
  57184. };
  57185. _this.state = {
  57186. isResizing: false,
  57187. width: typeof (_this.propsSize && _this.propsSize.width) === 'undefined'
  57188. ? 'auto'
  57189. : _this.propsSize && _this.propsSize.width,
  57190. height: typeof (_this.propsSize && _this.propsSize.height) === 'undefined'
  57191. ? 'auto'
  57192. : _this.propsSize && _this.propsSize.height,
  57193. direction: 'right',
  57194. original: {
  57195. x: 0,
  57196. y: 0,
  57197. width: 0,
  57198. height: 0,
  57199. },
  57200. backgroundStyle: {
  57201. height: '100%',
  57202. width: '100%',
  57203. backgroundColor: 'rgba(0,0,0,0)',
  57204. cursor: 'auto',
  57205. opacity: 0,
  57206. position: 'fixed',
  57207. zIndex: 9999,
  57208. top: '0',
  57209. left: '0',
  57210. bottom: '0',
  57211. right: '0',
  57212. },
  57213. flexBasis: undefined,
  57214. };
  57215. _this.onResizeStart = _this.onResizeStart.bind(_this);
  57216. _this.onMouseMove = _this.onMouseMove.bind(_this);
  57217. _this.onMouseUp = _this.onMouseUp.bind(_this);
  57218. return _this;
  57219. }
  57220. Object.defineProperty(Resizable.prototype, "parentNode", {
  57221. get: function () {
  57222. if (!this.resizable) {
  57223. return null;
  57224. }
  57225. return this.resizable.parentNode;
  57226. },
  57227. enumerable: false,
  57228. configurable: true
  57229. });
  57230. Object.defineProperty(Resizable.prototype, "window", {
  57231. get: function () {
  57232. if (!this.resizable) {
  57233. return null;
  57234. }
  57235. if (!this.resizable.ownerDocument) {
  57236. return null;
  57237. }
  57238. return this.resizable.ownerDocument.defaultView;
  57239. },
  57240. enumerable: false,
  57241. configurable: true
  57242. });
  57243. Object.defineProperty(Resizable.prototype, "propsSize", {
  57244. get: function () {
  57245. return this.props.size || this.props.defaultSize || DEFAULT_SIZE;
  57246. },
  57247. enumerable: false,
  57248. configurable: true
  57249. });
  57250. Object.defineProperty(Resizable.prototype, "size", {
  57251. get: function () {
  57252. var width = 0;
  57253. var height = 0;
  57254. if (this.resizable && this.window) {
  57255. var orgWidth = this.resizable.offsetWidth;
  57256. var orgHeight = this.resizable.offsetHeight;
  57257. // HACK: Set position `relative` to get parent size.
  57258. // This is because when re-resizable set `absolute`, I can not get base width correctly.
  57259. var orgPosition = this.resizable.style.position;
  57260. if (orgPosition !== 'relative') {
  57261. this.resizable.style.position = 'relative';
  57262. }
  57263. // INFO: Use original width or height if set auto.
  57264. width = this.resizable.style.width !== 'auto' ? this.resizable.offsetWidth : orgWidth;
  57265. height = this.resizable.style.height !== 'auto' ? this.resizable.offsetHeight : orgHeight;
  57266. // Restore original position
  57267. this.resizable.style.position = orgPosition;
  57268. }
  57269. return { width: width, height: height };
  57270. },
  57271. enumerable: false,
  57272. configurable: true
  57273. });
  57274. Object.defineProperty(Resizable.prototype, "sizeStyle", {
  57275. get: function () {
  57276. var _this = this;
  57277. var size = this.props.size;
  57278. var getSize = function (key) {
  57279. if (typeof _this.state[key] === 'undefined' || _this.state[key] === 'auto') {
  57280. return 'auto';
  57281. }
  57282. if (_this.propsSize && _this.propsSize[key] && _this.propsSize[key].toString().endsWith('%')) {
  57283. if (_this.state[key].toString().endsWith('%')) {
  57284. return _this.state[key].toString();
  57285. }
  57286. var parentSize = _this.getParentSize();
  57287. var value = Number(_this.state[key].toString().replace('px', ''));
  57288. var percent = (value / parentSize[key]) * 100;
  57289. return percent + "%";
  57290. }
  57291. return getStringSize(_this.state[key]);
  57292. };
  57293. var width = size && typeof size.width !== 'undefined' && !this.state.isResizing
  57294. ? getStringSize(size.width)
  57295. : getSize('width');
  57296. var height = size && typeof size.height !== 'undefined' && !this.state.isResizing
  57297. ? getStringSize(size.height)
  57298. : getSize('height');
  57299. return { width: width, height: height };
  57300. },
  57301. enumerable: false,
  57302. configurable: true
  57303. });
  57304. Resizable.prototype.getParentSize = function () {
  57305. if (!this.parentNode) {
  57306. if (!this.window) {
  57307. return { width: 0, height: 0 };
  57308. }
  57309. return { width: this.window.innerWidth, height: this.window.innerHeight };
  57310. }
  57311. var base = this.appendBase();
  57312. if (!base) {
  57313. return { width: 0, height: 0 };
  57314. }
  57315. // INFO: To calculate parent width with flex layout
  57316. var wrapChanged = false;
  57317. var wrap = this.parentNode.style.flexWrap;
  57318. if (wrap !== 'wrap') {
  57319. wrapChanged = true;
  57320. this.parentNode.style.flexWrap = 'wrap';
  57321. // HACK: Use relative to get parent padding size
  57322. }
  57323. base.style.position = 'relative';
  57324. base.style.minWidth = '100%';
  57325. base.style.minHeight = '100%';
  57326. var size = {
  57327. width: base.offsetWidth,
  57328. height: base.offsetHeight,
  57329. };
  57330. if (wrapChanged) {
  57331. this.parentNode.style.flexWrap = wrap;
  57332. }
  57333. this.removeBase(base);
  57334. return size;
  57335. };
  57336. Resizable.prototype.bindEvents = function () {
  57337. if (this.window) {
  57338. this.window.addEventListener('mouseup', this.onMouseUp);
  57339. this.window.addEventListener('mousemove', this.onMouseMove);
  57340. this.window.addEventListener('mouseleave', this.onMouseUp);
  57341. this.window.addEventListener('touchmove', this.onMouseMove, {
  57342. capture: true,
  57343. passive: false,
  57344. });
  57345. this.window.addEventListener('touchend', this.onMouseUp);
  57346. }
  57347. };
  57348. Resizable.prototype.unbindEvents = function () {
  57349. if (this.window) {
  57350. this.window.removeEventListener('mouseup', this.onMouseUp);
  57351. this.window.removeEventListener('mousemove', this.onMouseMove);
  57352. this.window.removeEventListener('mouseleave', this.onMouseUp);
  57353. this.window.removeEventListener('touchmove', this.onMouseMove, true);
  57354. this.window.removeEventListener('touchend', this.onMouseUp);
  57355. }
  57356. };
  57357. Resizable.prototype.componentDidMount = function () {
  57358. if (!this.resizable || !this.window) {
  57359. return;
  57360. }
  57361. var computedStyle = this.window.getComputedStyle(this.resizable);
  57362. this.setState({
  57363. width: this.state.width || this.size.width,
  57364. height: this.state.height || this.size.height,
  57365. flexBasis: computedStyle.flexBasis !== 'auto' ? computedStyle.flexBasis : undefined,
  57366. });
  57367. };
  57368. Resizable.prototype.componentWillUnmount = function () {
  57369. if (this.window) {
  57370. this.unbindEvents();
  57371. }
  57372. };
  57373. Resizable.prototype.createSizeForCssProperty = function (newSize, kind) {
  57374. var propsSize = this.propsSize && this.propsSize[kind];
  57375. return this.state[kind] === 'auto' &&
  57376. this.state.original[kind] === newSize &&
  57377. (typeof propsSize === 'undefined' || propsSize === 'auto')
  57378. ? 'auto'
  57379. : newSize;
  57380. };
  57381. Resizable.prototype.calculateNewMaxFromBoundary = function (maxWidth, maxHeight) {
  57382. var boundsByDirection = this.props.boundsByDirection;
  57383. var direction = this.state.direction;
  57384. var widthByDirection = boundsByDirection && hasDirection('left', direction);
  57385. var heightByDirection = boundsByDirection && hasDirection('top', direction);
  57386. var boundWidth;
  57387. var boundHeight;
  57388. if (this.props.bounds === 'parent') {
  57389. var parent_1 = this.parentNode;
  57390. if (parent_1) {
  57391. boundWidth = widthByDirection
  57392. ? this.resizableRight - this.parentLeft
  57393. : parent_1.offsetWidth + (this.parentLeft - this.resizableLeft);
  57394. boundHeight = heightByDirection
  57395. ? this.resizableBottom - this.parentTop
  57396. : parent_1.offsetHeight + (this.parentTop - this.resizableTop);
  57397. }
  57398. }
  57399. else if (this.props.bounds === 'window') {
  57400. if (this.window) {
  57401. boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft;
  57402. boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop;
  57403. }
  57404. }
  57405. else if (this.props.bounds) {
  57406. boundWidth = widthByDirection
  57407. ? this.resizableRight - this.targetLeft
  57408. : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft);
  57409. boundHeight = heightByDirection
  57410. ? this.resizableBottom - this.targetTop
  57411. : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop);
  57412. }
  57413. if (boundWidth && Number.isFinite(boundWidth)) {
  57414. maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth;
  57415. }
  57416. if (boundHeight && Number.isFinite(boundHeight)) {
  57417. maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight;
  57418. }
  57419. return { maxWidth: maxWidth, maxHeight: maxHeight };
  57420. };
  57421. Resizable.prototype.calculateNewSizeFromDirection = function (clientX, clientY) {
  57422. var scale = this.props.scale || 1;
  57423. var resizeRatio = this.props.resizeRatio || 1;
  57424. var _a = this.state, direction = _a.direction, original = _a.original;
  57425. var _b = this.props, lockAspectRatio = _b.lockAspectRatio, lockAspectRatioExtraHeight = _b.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _b.lockAspectRatioExtraWidth;
  57426. var newWidth = original.width;
  57427. var newHeight = original.height;
  57428. var extraHeight = lockAspectRatioExtraHeight || 0;
  57429. var extraWidth = lockAspectRatioExtraWidth || 0;
  57430. if (hasDirection('right', direction)) {
  57431. newWidth = original.width + ((clientX - original.x) * resizeRatio) / scale;
  57432. if (lockAspectRatio) {
  57433. newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
  57434. }
  57435. }
  57436. if (hasDirection('left', direction)) {
  57437. newWidth = original.width - ((clientX - original.x) * resizeRatio) / scale;
  57438. if (lockAspectRatio) {
  57439. newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
  57440. }
  57441. }
  57442. if (hasDirection('bottom', direction)) {
  57443. newHeight = original.height + ((clientY - original.y) * resizeRatio) / scale;
  57444. if (lockAspectRatio) {
  57445. newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
  57446. }
  57447. }
  57448. if (hasDirection('top', direction)) {
  57449. newHeight = original.height - ((clientY - original.y) * resizeRatio) / scale;
  57450. if (lockAspectRatio) {
  57451. newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
  57452. }
  57453. }
  57454. return { newWidth: newWidth, newHeight: newHeight };
  57455. };
  57456. Resizable.prototype.calculateNewSizeFromAspectRatio = function (newWidth, newHeight, max, min) {
  57457. var _a = this.props, lockAspectRatio = _a.lockAspectRatio, lockAspectRatioExtraHeight = _a.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a.lockAspectRatioExtraWidth;
  57458. var computedMinWidth = typeof min.width === 'undefined' ? 10 : min.width;
  57459. var computedMaxWidth = typeof max.width === 'undefined' || max.width < 0 ? newWidth : max.width;
  57460. var computedMinHeight = typeof min.height === 'undefined' ? 10 : min.height;
  57461. var computedMaxHeight = typeof max.height === 'undefined' || max.height < 0 ? newHeight : max.height;
  57462. var extraHeight = lockAspectRatioExtraHeight || 0;
  57463. var extraWidth = lockAspectRatioExtraWidth || 0;
  57464. if (lockAspectRatio) {
  57465. var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth;
  57466. var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth;
  57467. var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight;
  57468. var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight;
  57469. var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth);
  57470. var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth);
  57471. var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight);
  57472. var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight);
  57473. newWidth = lib_clamp(newWidth, lockedMinWidth, lockedMaxWidth);
  57474. newHeight = lib_clamp(newHeight, lockedMinHeight, lockedMaxHeight);
  57475. }
  57476. else {
  57477. newWidth = lib_clamp(newWidth, computedMinWidth, computedMaxWidth);
  57478. newHeight = lib_clamp(newHeight, computedMinHeight, computedMaxHeight);
  57479. }
  57480. return { newWidth: newWidth, newHeight: newHeight };
  57481. };
  57482. Resizable.prototype.setBoundingClientRect = function () {
  57483. // For parent boundary
  57484. if (this.props.bounds === 'parent') {
  57485. var parent_2 = this.parentNode;
  57486. if (parent_2) {
  57487. var parentRect = parent_2.getBoundingClientRect();
  57488. this.parentLeft = parentRect.left;
  57489. this.parentTop = parentRect.top;
  57490. }
  57491. }
  57492. // For target(html element) boundary
  57493. if (this.props.bounds && typeof this.props.bounds !== 'string') {
  57494. var targetRect = this.props.bounds.getBoundingClientRect();
  57495. this.targetLeft = targetRect.left;
  57496. this.targetTop = targetRect.top;
  57497. }
  57498. // For boundary
  57499. if (this.resizable) {
  57500. var _a = this.resizable.getBoundingClientRect(), left = _a.left, top_1 = _a.top, right = _a.right, bottom = _a.bottom;
  57501. this.resizableLeft = left;
  57502. this.resizableRight = right;
  57503. this.resizableTop = top_1;
  57504. this.resizableBottom = bottom;
  57505. }
  57506. };
  57507. Resizable.prototype.onResizeStart = function (event, direction) {
  57508. if (!this.resizable || !this.window) {
  57509. return;
  57510. }
  57511. var clientX = 0;
  57512. var clientY = 0;
  57513. if (event.nativeEvent && lib_isMouseEvent(event.nativeEvent)) {
  57514. clientX = event.nativeEvent.clientX;
  57515. clientY = event.nativeEvent.clientY;
  57516. }
  57517. else if (event.nativeEvent && lib_isTouchEvent(event.nativeEvent)) {
  57518. clientX = event.nativeEvent.touches[0].clientX;
  57519. clientY = event.nativeEvent.touches[0].clientY;
  57520. }
  57521. if (this.props.onResizeStart) {
  57522. if (this.resizable) {
  57523. var startResize = this.props.onResizeStart(event, direction, this.resizable);
  57524. if (startResize === false) {
  57525. return;
  57526. }
  57527. }
  57528. }
  57529. // Fix #168
  57530. if (this.props.size) {
  57531. if (typeof this.props.size.height !== 'undefined' && this.props.size.height !== this.state.height) {
  57532. this.setState({ height: this.props.size.height });
  57533. }
  57534. if (typeof this.props.size.width !== 'undefined' && this.props.size.width !== this.state.width) {
  57535. this.setState({ width: this.props.size.width });
  57536. }
  57537. }
  57538. // For lockAspectRatio case
  57539. this.ratio =
  57540. typeof this.props.lockAspectRatio === 'number' ? this.props.lockAspectRatio : this.size.width / this.size.height;
  57541. var flexBasis;
  57542. var computedStyle = this.window.getComputedStyle(this.resizable);
  57543. if (computedStyle.flexBasis !== 'auto') {
  57544. var parent_3 = this.parentNode;
  57545. if (parent_3) {
  57546. var dir = this.window.getComputedStyle(parent_3).flexDirection;
  57547. this.flexDir = dir.startsWith('row') ? 'row' : 'column';
  57548. flexBasis = computedStyle.flexBasis;
  57549. }
  57550. }
  57551. // For boundary
  57552. this.setBoundingClientRect();
  57553. this.bindEvents();
  57554. var state = {
  57555. original: {
  57556. x: clientX,
  57557. y: clientY,
  57558. width: this.size.width,
  57559. height: this.size.height,
  57560. },
  57561. isResizing: true,
  57562. backgroundStyle: lib_assign(lib_assign({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || 'auto' }),
  57563. direction: direction,
  57564. flexBasis: flexBasis,
  57565. };
  57566. this.setState(state);
  57567. };
  57568. Resizable.prototype.onMouseMove = function (event) {
  57569. var _this = this;
  57570. if (!this.state.isResizing || !this.resizable || !this.window) {
  57571. return;
  57572. }
  57573. if (this.window.TouchEvent && lib_isTouchEvent(event)) {
  57574. try {
  57575. event.preventDefault();
  57576. event.stopPropagation();
  57577. }
  57578. catch (e) {
  57579. // Ignore on fail
  57580. }
  57581. }
  57582. var _a = this.props, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, minWidth = _a.minWidth, minHeight = _a.minHeight;
  57583. var clientX = lib_isTouchEvent(event) ? event.touches[0].clientX : event.clientX;
  57584. var clientY = lib_isTouchEvent(event) ? event.touches[0].clientY : event.clientY;
  57585. var _b = this.state, direction = _b.direction, original = _b.original, width = _b.width, height = _b.height;
  57586. var parentSize = this.getParentSize();
  57587. var max = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight);
  57588. maxWidth = max.maxWidth;
  57589. maxHeight = max.maxHeight;
  57590. minWidth = max.minWidth;
  57591. minHeight = max.minHeight;
  57592. // Calculate new size
  57593. var _c = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c.newHeight, newWidth = _c.newWidth;
  57594. // Calculate max size from boundary settings
  57595. var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight);
  57596. if (this.props.snap && this.props.snap.x) {
  57597. newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap);
  57598. }
  57599. if (this.props.snap && this.props.snap.y) {
  57600. newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap);
  57601. }
  57602. // Calculate new size from aspect ratio
  57603. var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight });
  57604. newWidth = newSize.newWidth;
  57605. newHeight = newSize.newHeight;
  57606. if (this.props.grid) {
  57607. var newGridWidth = snap(newWidth, this.props.grid[0]);
  57608. var newGridHeight = snap(newHeight, this.props.grid[1]);
  57609. var gap = this.props.snapGap || 0;
  57610. newWidth = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth;
  57611. newHeight = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight;
  57612. }
  57613. var delta = {
  57614. width: newWidth - original.width,
  57615. height: newHeight - original.height,
  57616. };
  57617. if (width && typeof width === 'string') {
  57618. if (width.endsWith('%')) {
  57619. var percent = (newWidth / parentSize.width) * 100;
  57620. newWidth = percent + "%";
  57621. }
  57622. else if (width.endsWith('vw')) {
  57623. var vw = (newWidth / this.window.innerWidth) * 100;
  57624. newWidth = vw + "vw";
  57625. }
  57626. else if (width.endsWith('vh')) {
  57627. var vh = (newWidth / this.window.innerHeight) * 100;
  57628. newWidth = vh + "vh";
  57629. }
  57630. }
  57631. if (height && typeof height === 'string') {
  57632. if (height.endsWith('%')) {
  57633. var percent = (newHeight / parentSize.height) * 100;
  57634. newHeight = percent + "%";
  57635. }
  57636. else if (height.endsWith('vw')) {
  57637. var vw = (newHeight / this.window.innerWidth) * 100;
  57638. newHeight = vw + "vw";
  57639. }
  57640. else if (height.endsWith('vh')) {
  57641. var vh = (newHeight / this.window.innerHeight) * 100;
  57642. newHeight = vh + "vh";
  57643. }
  57644. }
  57645. var newState = {
  57646. width: this.createSizeForCssProperty(newWidth, 'width'),
  57647. height: this.createSizeForCssProperty(newHeight, 'height'),
  57648. };
  57649. if (this.flexDir === 'row') {
  57650. newState.flexBasis = newState.width;
  57651. }
  57652. else if (this.flexDir === 'column') {
  57653. newState.flexBasis = newState.height;
  57654. }
  57655. // For v18, update state sync
  57656. (0,external_ReactDOM_namespaceObject.flushSync)(function () {
  57657. _this.setState(newState);
  57658. });
  57659. if (this.props.onResize) {
  57660. this.props.onResize(event, direction, this.resizable, delta);
  57661. }
  57662. };
  57663. Resizable.prototype.onMouseUp = function (event) {
  57664. var _a = this.state, isResizing = _a.isResizing, direction = _a.direction, original = _a.original;
  57665. if (!isResizing || !this.resizable) {
  57666. return;
  57667. }
  57668. var delta = {
  57669. width: this.size.width - original.width,
  57670. height: this.size.height - original.height,
  57671. };
  57672. if (this.props.onResizeStop) {
  57673. this.props.onResizeStop(event, direction, this.resizable, delta);
  57674. }
  57675. if (this.props.size) {
  57676. this.setState(this.props.size);
  57677. }
  57678. this.unbindEvents();
  57679. this.setState({
  57680. isResizing: false,
  57681. backgroundStyle: lib_assign(lib_assign({}, this.state.backgroundStyle), { cursor: 'auto' }),
  57682. });
  57683. };
  57684. Resizable.prototype.updateSize = function (size) {
  57685. this.setState({ width: size.width, height: size.height });
  57686. };
  57687. Resizable.prototype.renderResizer = function () {
  57688. var _this = this;
  57689. var _a = this.props, enable = _a.enable, handleStyles = _a.handleStyles, handleClasses = _a.handleClasses, handleWrapperStyle = _a.handleWrapperStyle, handleWrapperClass = _a.handleWrapperClass, handleComponent = _a.handleComponent;
  57690. if (!enable) {
  57691. return null;
  57692. }
  57693. var resizers = Object.keys(enable).map(function (dir) {
  57694. if (enable[dir] !== false) {
  57695. return (external_React_.createElement(Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null));
  57696. }
  57697. return null;
  57698. });
  57699. // #93 Wrap the resize box in span (will not break 100% width/height)
  57700. return (external_React_.createElement("div", { className: handleWrapperClass, style: handleWrapperStyle }, resizers));
  57701. };
  57702. Resizable.prototype.render = function () {
  57703. var _this = this;
  57704. var extendsProps = Object.keys(this.props).reduce(function (acc, key) {
  57705. if (definedProps.indexOf(key) !== -1) {
  57706. return acc;
  57707. }
  57708. acc[key] = _this.props[key];
  57709. return acc;
  57710. }, {});
  57711. var style = lib_assign(lib_assign(lib_assign({ position: 'relative', userSelect: this.state.isResizing ? 'none' : 'auto' }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: 'border-box', flexShrink: 0 });
  57712. if (this.state.flexBasis) {
  57713. style.flexBasis = this.state.flexBasis;
  57714. }
  57715. var Wrapper = this.props.as || 'div';
  57716. return (external_React_.createElement(Wrapper, lib_assign({ ref: this.ref, style: style, className: this.props.className }, extendsProps),
  57717. this.state.isResizing && external_React_.createElement("div", { style: this.state.backgroundStyle }),
  57718. this.props.children,
  57719. this.renderResizer()));
  57720. };
  57721. Resizable.defaultProps = {
  57722. as: 'div',
  57723. onResizeStart: function () { },
  57724. onResize: function () { },
  57725. onResizeStop: function () { },
  57726. enable: {
  57727. top: true,
  57728. right: true,
  57729. bottom: true,
  57730. left: true,
  57731. topRight: true,
  57732. bottomRight: true,
  57733. bottomLeft: true,
  57734. topLeft: true,
  57735. },
  57736. style: {},
  57737. grid: [1, 1],
  57738. lockAspectRatio: false,
  57739. lockAspectRatioExtraWidth: 0,
  57740. lockAspectRatioExtraHeight: 0,
  57741. scale: 1,
  57742. resizeRatio: 1,
  57743. snapGap: 0,
  57744. };
  57745. return Resizable;
  57746. }(external_React_.PureComponent));
  57747. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/utils.js
  57748. /**
  57749. * External dependencies
  57750. */
  57751. /**
  57752. * WordPress dependencies
  57753. */
  57754. const {
  57755. clearTimeout: utils_clearTimeout,
  57756. setTimeout: utils_setTimeout
  57757. } = window;
  57758. const POSITIONS = {
  57759. bottom: 'bottom',
  57760. corner: 'corner'
  57761. };
  57762. /**
  57763. * Custom hook that manages resize listener events. It also provides a label
  57764. * based on current resize width x height values.
  57765. *
  57766. * @param props
  57767. * @param props.axis Only shows the label corresponding to the axis.
  57768. * @param props.fadeTimeout Duration (ms) before deactivating the resize label.
  57769. * @param props.onResize Callback when a resize occurs. Provides { width, height } callback.
  57770. * @param props.position Adjusts label value.
  57771. * @param props.showPx Whether to add `PX` to the label.
  57772. *
  57773. * @return Properties for hook.
  57774. */
  57775. function useResizeLabel(_ref) {
  57776. let {
  57777. axis,
  57778. fadeTimeout = 180,
  57779. onResize = external_lodash_namespaceObject.noop,
  57780. position = POSITIONS.bottom,
  57781. showPx = false
  57782. } = _ref;
  57783. /*
  57784. * The width/height values derive from this special useResizeAware hook.
  57785. * This custom hook uses injects an iFrame into the element, allowing it
  57786. * to tap into the onResize (window) callback events.
  57787. */
  57788. const [resizeListener, sizes] = react_resize_aware_dist_default()();
  57789. /*
  57790. * Indicates if the x/y axis is preferred.
  57791. * If set, we will avoid resetting the moveX and moveY values.
  57792. * This will allow for the preferred axis values to persist in the label.
  57793. */
  57794. const isAxisControlled = !!axis;
  57795. /*
  57796. * The moveX and moveY values are used to track whether the label should
  57797. * display width, height, or width x height.
  57798. */
  57799. const [moveX, setMoveX] = (0,external_wp_element_namespaceObject.useState)(false);
  57800. const [moveY, setMoveY] = (0,external_wp_element_namespaceObject.useState)(false);
  57801. /*
  57802. * Cached dimension values to check for width/height updates from the
  57803. * sizes property from useResizeAware()
  57804. */
  57805. const {
  57806. width,
  57807. height
  57808. } = sizes;
  57809. const heightRef = (0,external_wp_element_namespaceObject.useRef)(height);
  57810. const widthRef = (0,external_wp_element_namespaceObject.useRef)(width);
  57811. /*
  57812. * This timeout is used with setMoveX and setMoveY to determine of
  57813. * both width and height values have changed at (roughly) the same time.
  57814. */
  57815. const moveTimeoutRef = (0,external_wp_element_namespaceObject.useRef)();
  57816. const unsetMoveXY = () => {
  57817. /*
  57818. * If axis is controlled, we will avoid resetting the moveX and moveY values.
  57819. * This will allow for the preferred axis values to persist in the label.
  57820. */
  57821. if (isAxisControlled) return;
  57822. setMoveX(false);
  57823. setMoveY(false);
  57824. };
  57825. const debounceUnsetMoveXY = () => {
  57826. if (moveTimeoutRef.current) {
  57827. utils_clearTimeout(moveTimeoutRef.current);
  57828. }
  57829. moveTimeoutRef.current = utils_setTimeout(unsetMoveXY, fadeTimeout);
  57830. };
  57831. (0,external_wp_element_namespaceObject.useEffect)(() => {
  57832. /*
  57833. * On the initial render of useResizeAware, the height and width values are
  57834. * null. They are calculated then set using via an internal useEffect hook.
  57835. */
  57836. const isRendered = width !== null || height !== null;
  57837. if (!isRendered) return;
  57838. const didWidthChange = width !== widthRef.current;
  57839. const didHeightChange = height !== heightRef.current;
  57840. if (!didWidthChange && !didHeightChange) return;
  57841. /*
  57842. * After the initial render, the useResizeAware will set the first
  57843. * width and height values. We'll sync those values with our
  57844. * width and height refs. However, we shouldn't render our Tooltip
  57845. * label on this first cycle.
  57846. */
  57847. if (width && !widthRef.current && height && !heightRef.current) {
  57848. widthRef.current = width;
  57849. heightRef.current = height;
  57850. return;
  57851. }
  57852. /*
  57853. * After the first cycle, we can track width and height changes.
  57854. */
  57855. if (didWidthChange) {
  57856. setMoveX(true);
  57857. widthRef.current = width;
  57858. }
  57859. if (didHeightChange) {
  57860. setMoveY(true);
  57861. heightRef.current = height;
  57862. }
  57863. onResize({
  57864. width,
  57865. height
  57866. });
  57867. debounceUnsetMoveXY();
  57868. }, [width, height]);
  57869. const label = getSizeLabel({
  57870. axis,
  57871. height,
  57872. moveX,
  57873. moveY,
  57874. position,
  57875. showPx,
  57876. width
  57877. });
  57878. return {
  57879. label,
  57880. resizeListener
  57881. };
  57882. }
  57883. /**
  57884. * Gets the resize label based on width and height values (as well as recent changes).
  57885. *
  57886. * @param props
  57887. * @param props.axis Only shows the label corresponding to the axis.
  57888. * @param props.height Height value.
  57889. * @param props.moveX Recent width (x axis) changes.
  57890. * @param props.moveY Recent width (y axis) changes.
  57891. * @param props.position Adjusts label value.
  57892. * @param props.showPx Whether to add `PX` to the label.
  57893. * @param props.width Width value.
  57894. *
  57895. * @return The rendered label.
  57896. */
  57897. function getSizeLabel(_ref2) {
  57898. let {
  57899. axis,
  57900. height,
  57901. moveX = false,
  57902. moveY = false,
  57903. position = POSITIONS.bottom,
  57904. showPx = false,
  57905. width
  57906. } = _ref2;
  57907. if (!moveX && !moveY) return undefined;
  57908. /*
  57909. * Corner position...
  57910. * We want the label to appear like width x height.
  57911. */
  57912. if (position === POSITIONS.corner) {
  57913. return `${width} x ${height}`;
  57914. }
  57915. /*
  57916. * Other POSITIONS...
  57917. * The label will combine both width x height values if both
  57918. * values have recently been changed.
  57919. *
  57920. * Otherwise, only width or height will be displayed.
  57921. * The `PX` unit will be added, if specified by the `showPx` prop.
  57922. */
  57923. const labelUnit = showPx ? ' px' : '';
  57924. if (axis) {
  57925. if (axis === 'x' && moveX) {
  57926. return `${width}${labelUnit}`;
  57927. }
  57928. if (axis === 'y' && moveY) {
  57929. return `${height}${labelUnit}`;
  57930. }
  57931. }
  57932. if (moveX && moveY) {
  57933. return `${width} x ${height}`;
  57934. }
  57935. if (moveX) {
  57936. return `${width}${labelUnit}`;
  57937. }
  57938. if (moveY) {
  57939. return `${height}${labelUnit}`;
  57940. }
  57941. return undefined;
  57942. }
  57943. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js
  57944. function resize_tooltip_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  57945. /**
  57946. * External dependencies
  57947. */
  57948. /**
  57949. * Internal dependencies
  57950. */
  57951. const resize_tooltip_styles_Root = emotion_styled_base_browser_esm("div", true ? {
  57952. target: "ekdag503"
  57953. } : 0)( true ? {
  57954. name: "1cd7zoc",
  57955. styles: "bottom:0;box-sizing:border-box;left:0;pointer-events:none;position:absolute;right:0;top:0"
  57956. } : 0);
  57957. const TooltipWrapper = emotion_styled_base_browser_esm("div", true ? {
  57958. target: "ekdag502"
  57959. } : 0)( true ? {
  57960. name: "ajymcs",
  57961. styles: "align-items:center;box-sizing:border-box;display:inline-flex;justify-content:center;opacity:0;pointer-events:none;transition:opacity 120ms linear"
  57962. } : 0);
  57963. const resize_tooltip_styles_Tooltip = emotion_styled_base_browser_esm("div", true ? {
  57964. target: "ekdag501"
  57965. } : 0)("background:", COLORS.ui.border, ";border-radius:2px;box-sizing:border-box;font-size:12px;color:", COLORS.ui.textDark, ";padding:4px 8px;position:relative;" + ( true ? "" : 0)); // TODO: Resolve need to use &&& to increase specificity
  57966. // https://github.com/WordPress/gutenberg/issues/18483
  57967. const LabelText = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? {
  57968. target: "ekdag500"
  57969. } : 0)("&&&{color:", COLORS.ui.textDark, ";display:block;font-size:13px;line-height:1.4;white-space:nowrap;}" + ( true ? "" : 0));
  57970. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/label.js
  57971. /**
  57972. * External dependencies
  57973. */
  57974. /**
  57975. * WordPress dependencies
  57976. */
  57977. /**
  57978. * Internal dependencies
  57979. */
  57980. const CORNER_OFFSET = 4;
  57981. const CURSOR_OFFSET_TOP = CORNER_OFFSET * 2.5;
  57982. function resize_tooltip_label_Label(_ref, ref) {
  57983. let {
  57984. label,
  57985. position = POSITIONS.corner,
  57986. zIndex = 1000,
  57987. ...props
  57988. } = _ref;
  57989. const showLabel = !!label;
  57990. const isBottom = position === POSITIONS.bottom;
  57991. const isCorner = position === POSITIONS.corner;
  57992. if (!showLabel) return null;
  57993. let style = {
  57994. opacity: showLabel ? 1 : undefined,
  57995. zIndex
  57996. };
  57997. let labelStyle = {};
  57998. if (isBottom) {
  57999. style = { ...style,
  58000. position: 'absolute',
  58001. bottom: CURSOR_OFFSET_TOP * -1,
  58002. left: '50%',
  58003. transform: 'translate(-50%, 0)'
  58004. };
  58005. labelStyle = {
  58006. transform: `translate(0, 100%)`
  58007. };
  58008. }
  58009. if (isCorner) {
  58010. style = { ...style,
  58011. position: 'absolute',
  58012. top: CORNER_OFFSET,
  58013. right: (0,external_wp_i18n_namespaceObject.isRTL)() ? undefined : CORNER_OFFSET,
  58014. left: (0,external_wp_i18n_namespaceObject.isRTL)() ? CORNER_OFFSET : undefined
  58015. };
  58016. }
  58017. return (0,external_wp_element_namespaceObject.createElement)(TooltipWrapper, extends_extends({
  58018. "aria-hidden": "true",
  58019. className: "components-resizable-tooltip__tooltip-wrapper",
  58020. ref: ref,
  58021. style: style
  58022. }, props), (0,external_wp_element_namespaceObject.createElement)(resize_tooltip_styles_Tooltip, {
  58023. className: "components-resizable-tooltip__tooltip",
  58024. style: labelStyle
  58025. }, (0,external_wp_element_namespaceObject.createElement)(LabelText, {
  58026. as: "span"
  58027. }, label)));
  58028. }
  58029. const label_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(resize_tooltip_label_Label);
  58030. /* harmony default export */ var resize_tooltip_label = (label_ForwardedComponent);
  58031. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/index.js
  58032. /**
  58033. * External dependencies
  58034. */
  58035. /**
  58036. * WordPress dependencies
  58037. */
  58038. /**
  58039. * Internal dependencies
  58040. */
  58041. function ResizeTooltip(_ref, ref) {
  58042. let {
  58043. axis,
  58044. className,
  58045. fadeTimeout = 180,
  58046. isVisible = true,
  58047. labelRef,
  58048. onResize = external_lodash_namespaceObject.noop,
  58049. position = POSITIONS.bottom,
  58050. showPx = true,
  58051. zIndex = 1000,
  58052. ...props
  58053. } = _ref;
  58054. const {
  58055. label,
  58056. resizeListener
  58057. } = useResizeLabel({
  58058. axis,
  58059. fadeTimeout,
  58060. onResize,
  58061. showPx,
  58062. position
  58063. });
  58064. if (!isVisible) return null;
  58065. const classes = classnames_default()('components-resize-tooltip', className);
  58066. return (0,external_wp_element_namespaceObject.createElement)(resize_tooltip_styles_Root, extends_extends({
  58067. "aria-hidden": "true",
  58068. className: classes,
  58069. ref: ref
  58070. }, props), resizeListener, (0,external_wp_element_namespaceObject.createElement)(resize_tooltip_label, {
  58071. "aria-hidden": props['aria-hidden'],
  58072. label: label,
  58073. position: position,
  58074. ref: labelRef,
  58075. zIndex: zIndex
  58076. }));
  58077. }
  58078. const resize_tooltip_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(ResizeTooltip);
  58079. /* harmony default export */ var resize_tooltip = (resize_tooltip_ForwardedComponent);
  58080. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/index.js
  58081. /**
  58082. * WordPress dependencies
  58083. */
  58084. /**
  58085. * External dependencies
  58086. */
  58087. /**
  58088. * Internal dependencies
  58089. */
  58090. const HANDLE_CLASS_NAME = 'components-resizable-box__handle';
  58091. const SIDE_HANDLE_CLASS_NAME = 'components-resizable-box__side-handle';
  58092. const CORNER_HANDLE_CLASS_NAME = 'components-resizable-box__corner-handle';
  58093. const HANDLE_CLASSES = {
  58094. top: classnames_default()(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-top'),
  58095. right: classnames_default()(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-right'),
  58096. bottom: classnames_default()(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-bottom'),
  58097. left: classnames_default()(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-left'),
  58098. topLeft: classnames_default()(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-top', 'components-resizable-box__handle-left'),
  58099. topRight: classnames_default()(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-top', 'components-resizable-box__handle-right'),
  58100. bottomRight: classnames_default()(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-bottom', 'components-resizable-box__handle-right'),
  58101. bottomLeft: classnames_default()(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-bottom', 'components-resizable-box__handle-left')
  58102. }; // Removes the inline styles in the drag handles.
  58103. const HANDLE_STYLES_OVERRIDES = {
  58104. width: undefined,
  58105. height: undefined,
  58106. top: undefined,
  58107. right: undefined,
  58108. bottom: undefined,
  58109. left: undefined
  58110. };
  58111. const HANDLE_STYLES = {
  58112. top: HANDLE_STYLES_OVERRIDES,
  58113. right: HANDLE_STYLES_OVERRIDES,
  58114. bottom: HANDLE_STYLES_OVERRIDES,
  58115. left: HANDLE_STYLES_OVERRIDES,
  58116. topLeft: HANDLE_STYLES_OVERRIDES,
  58117. topRight: HANDLE_STYLES_OVERRIDES,
  58118. bottomRight: HANDLE_STYLES_OVERRIDES,
  58119. bottomLeft: HANDLE_STYLES_OVERRIDES
  58120. };
  58121. function ResizableBox(_ref, ref) {
  58122. let {
  58123. className,
  58124. children,
  58125. showHandle = true,
  58126. __experimentalShowTooltip: showTooltip = false,
  58127. __experimentalTooltipProps: tooltipProps = {},
  58128. ...props
  58129. } = _ref;
  58130. return (0,external_wp_element_namespaceObject.createElement)(Resizable, extends_extends({
  58131. className: classnames_default()('components-resizable-box__container', showHandle && 'has-show-handle', className),
  58132. handleClasses: HANDLE_CLASSES,
  58133. handleStyles: HANDLE_STYLES,
  58134. ref: ref
  58135. }, props), children, showTooltip && (0,external_wp_element_namespaceObject.createElement)(resize_tooltip, tooltipProps));
  58136. }
  58137. /* harmony default export */ var resizable_box = ((0,external_wp_element_namespaceObject.forwardRef)(ResizableBox));
  58138. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/responsive-wrapper/index.js
  58139. /**
  58140. * External dependencies
  58141. */
  58142. /**
  58143. * WordPress dependencies
  58144. */
  58145. function ResponsiveWrapper(_ref) {
  58146. let {
  58147. naturalWidth,
  58148. naturalHeight,
  58149. children,
  58150. isInline = false
  58151. } = _ref;
  58152. const [containerResizeListener, {
  58153. width: containerWidth
  58154. }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
  58155. if (external_wp_element_namespaceObject.Children.count(children) !== 1) {
  58156. return null;
  58157. }
  58158. const imageStyle = {
  58159. paddingBottom: naturalWidth < containerWidth ? naturalHeight : naturalHeight / naturalWidth * 100 + '%'
  58160. };
  58161. const TagName = isInline ? 'span' : 'div';
  58162. return (0,external_wp_element_namespaceObject.createElement)(TagName, {
  58163. className: "components-responsive-wrapper"
  58164. }, containerResizeListener, (0,external_wp_element_namespaceObject.createElement)(TagName, {
  58165. style: imageStyle
  58166. }), (0,external_wp_element_namespaceObject.cloneElement)(children, {
  58167. className: classnames_default()('components-responsive-wrapper__content', children.props.className)
  58168. }));
  58169. }
  58170. /* harmony default export */ var responsive_wrapper = (ResponsiveWrapper);
  58171. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/sandbox/index.js
  58172. /**
  58173. * WordPress dependencies
  58174. */
  58175. const observeAndResizeJS = `
  58176. ( function() {
  58177. var observer;
  58178. if ( ! window.MutationObserver || ! document.body || ! window.parent ) {
  58179. return;
  58180. }
  58181. function sendResize() {
  58182. var clientBoundingRect = document.body.getBoundingClientRect();
  58183. window.parent.postMessage( {
  58184. action: 'resize',
  58185. width: clientBoundingRect.width,
  58186. height: clientBoundingRect.height,
  58187. }, '*' );
  58188. }
  58189. observer = new MutationObserver( sendResize );
  58190. observer.observe( document.body, {
  58191. attributes: true,
  58192. attributeOldValue: false,
  58193. characterData: true,
  58194. characterDataOldValue: false,
  58195. childList: true,
  58196. subtree: true
  58197. } );
  58198. window.addEventListener( 'load', sendResize, true );
  58199. // Hack: Remove viewport unit styles, as these are relative
  58200. // the iframe root and interfere with our mechanism for
  58201. // determining the unconstrained page bounds.
  58202. function removeViewportStyles( ruleOrNode ) {
  58203. if( ruleOrNode.style ) {
  58204. [ 'width', 'height', 'minHeight', 'maxHeight' ].forEach( function( style ) {
  58205. if ( /^\\d+(vmin|vmax|vh|vw)$/.test( ruleOrNode.style[ style ] ) ) {
  58206. ruleOrNode.style[ style ] = '';
  58207. }
  58208. } );
  58209. }
  58210. }
  58211. Array.prototype.forEach.call( document.querySelectorAll( '[style]' ), removeViewportStyles );
  58212. Array.prototype.forEach.call( document.styleSheets, function( stylesheet ) {
  58213. Array.prototype.forEach.call( stylesheet.cssRules || stylesheet.rules, removeViewportStyles );
  58214. } );
  58215. document.body.style.position = 'absolute';
  58216. document.body.style.width = '100%';
  58217. document.body.setAttribute( 'data-resizable-iframe-connected', '' );
  58218. sendResize();
  58219. // Resize events can change the width of elements with 100% width, but we don't
  58220. // get an DOM mutations for that, so do the resize when the window is resized, too.
  58221. window.addEventListener( 'resize', sendResize, true );
  58222. } )();`;
  58223. const style = `
  58224. body {
  58225. margin: 0;
  58226. }
  58227. html,
  58228. body,
  58229. body > div,
  58230. body > div iframe {
  58231. width: 100%;
  58232. }
  58233. html.wp-has-aspect-ratio,
  58234. body.wp-has-aspect-ratio,
  58235. body.wp-has-aspect-ratio > div,
  58236. body.wp-has-aspect-ratio > div iframe {
  58237. height: 100%;
  58238. overflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */
  58239. }
  58240. body > div > * {
  58241. margin-top: 0 !important; /* Has to have !important to override inline styles. */
  58242. margin-bottom: 0 !important;
  58243. }
  58244. `;
  58245. function Sandbox(_ref) {
  58246. let {
  58247. html = '',
  58248. title = '',
  58249. type,
  58250. styles = [],
  58251. scripts = [],
  58252. onFocus
  58253. } = _ref;
  58254. const ref = (0,external_wp_element_namespaceObject.useRef)();
  58255. const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(0);
  58256. const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(0);
  58257. function isFrameAccessible() {
  58258. try {
  58259. return !!ref.current.contentDocument.body;
  58260. } catch (e) {
  58261. return false;
  58262. }
  58263. }
  58264. function trySandbox() {
  58265. let forceRerender = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  58266. if (!isFrameAccessible()) {
  58267. return;
  58268. }
  58269. const {
  58270. contentDocument,
  58271. ownerDocument
  58272. } = ref.current;
  58273. const {
  58274. body
  58275. } = contentDocument;
  58276. if (!forceRerender && null !== body.getAttribute('data-resizable-iframe-connected')) {
  58277. return;
  58278. } // Put the html snippet into a html document, and then write it to the iframe's document
  58279. // we can use this in the future to inject custom styles or scripts.
  58280. // Scripts go into the body rather than the head, to support embedded content such as Instagram
  58281. // that expect the scripts to be part of the body.
  58282. const htmlDoc = (0,external_wp_element_namespaceObject.createElement)("html", {
  58283. lang: ownerDocument.documentElement.lang,
  58284. className: type
  58285. }, (0,external_wp_element_namespaceObject.createElement)("head", null, (0,external_wp_element_namespaceObject.createElement)("title", null, title), (0,external_wp_element_namespaceObject.createElement)("style", {
  58286. dangerouslySetInnerHTML: {
  58287. __html: style
  58288. }
  58289. }), styles.map((rules, i) => (0,external_wp_element_namespaceObject.createElement)("style", {
  58290. key: i,
  58291. dangerouslySetInnerHTML: {
  58292. __html: rules
  58293. }
  58294. }))), (0,external_wp_element_namespaceObject.createElement)("body", {
  58295. "data-resizable-iframe-connected": "data-resizable-iframe-connected",
  58296. className: type
  58297. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  58298. dangerouslySetInnerHTML: {
  58299. __html: html
  58300. }
  58301. }), (0,external_wp_element_namespaceObject.createElement)("script", {
  58302. type: "text/javascript",
  58303. dangerouslySetInnerHTML: {
  58304. __html: observeAndResizeJS
  58305. }
  58306. }), scripts.map(src => (0,external_wp_element_namespaceObject.createElement)("script", {
  58307. key: src,
  58308. src: src
  58309. })))); // Writing the document like this makes it act in the same way as if it was
  58310. // loaded over the network, so DOM creation and mutation, script execution, etc.
  58311. // all work as expected.
  58312. contentDocument.open();
  58313. contentDocument.write('<!DOCTYPE html>' + (0,external_wp_element_namespaceObject.renderToString)(htmlDoc));
  58314. contentDocument.close();
  58315. }
  58316. (0,external_wp_element_namespaceObject.useEffect)(() => {
  58317. trySandbox();
  58318. function tryNoForceSandbox() {
  58319. trySandbox(false);
  58320. }
  58321. function checkMessageForResize(event) {
  58322. const iframe = ref.current; // Verify that the mounted element is the source of the message.
  58323. if (!iframe || iframe.contentWindow !== event.source) {
  58324. return;
  58325. } // Attempt to parse the message data as JSON if passed as string.
  58326. let data = event.data || {};
  58327. if ('string' === typeof data) {
  58328. try {
  58329. data = JSON.parse(data);
  58330. } catch (e) {}
  58331. } // Update the state only if the message is formatted as we expect,
  58332. // i.e. as an object with a 'resize' action.
  58333. if ('resize' !== data.action) {
  58334. return;
  58335. }
  58336. setWidth(data.width);
  58337. setHeight(data.height);
  58338. }
  58339. const {
  58340. ownerDocument
  58341. } = ref.current;
  58342. const {
  58343. defaultView
  58344. } = ownerDocument; // This used to be registered using <iframe onLoad={} />, but it made the iframe blank
  58345. // after reordering the containing block. See these two issues for more details:
  58346. // https://github.com/WordPress/gutenberg/issues/6146
  58347. // https://github.com/facebook/react/issues/18752
  58348. ref.current.addEventListener('load', tryNoForceSandbox, false);
  58349. defaultView.addEventListener('message', checkMessageForResize);
  58350. return () => {
  58351. var _ref$current;
  58352. (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.removeEventListener('load', tryNoForceSandbox, false);
  58353. defaultView.addEventListener('message', checkMessageForResize);
  58354. };
  58355. }, []);
  58356. (0,external_wp_element_namespaceObject.useEffect)(() => {
  58357. trySandbox();
  58358. }, [title, type, styles, scripts]);
  58359. (0,external_wp_element_namespaceObject.useEffect)(() => {
  58360. trySandbox(true);
  58361. }, [html]);
  58362. return (0,external_wp_element_namespaceObject.createElement)("iframe", {
  58363. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_compose_namespaceObject.useFocusableIframe)()]),
  58364. title: title,
  58365. className: "components-sandbox",
  58366. sandbox: "allow-scripts allow-same-origin allow-presentation",
  58367. onFocus: onFocus,
  58368. width: Math.ceil(width),
  58369. height: Math.ceil(height)
  58370. });
  58371. }
  58372. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/snackbar/index.js
  58373. /**
  58374. * External dependencies
  58375. */
  58376. /**
  58377. * WordPress dependencies
  58378. */
  58379. /**
  58380. * Internal dependencies
  58381. */
  58382. const NOTICE_TIMEOUT = 10000;
  58383. /** @typedef {import('@wordpress/element').WPElement} WPElement */
  58384. /**
  58385. * Custom hook which announces the message with the given politeness, if a
  58386. * valid message is provided.
  58387. *
  58388. * @param {string|WPElement} [message] Message to announce.
  58389. * @param {'polite'|'assertive'} politeness Politeness to announce.
  58390. */
  58391. function snackbar_useSpokenMessage(message, politeness) {
  58392. const spokenMessage = typeof message === 'string' ? message : (0,external_wp_element_namespaceObject.renderToString)(message);
  58393. (0,external_wp_element_namespaceObject.useEffect)(() => {
  58394. if (spokenMessage) {
  58395. (0,external_wp_a11y_namespaceObject.speak)(spokenMessage, politeness);
  58396. }
  58397. }, [spokenMessage, politeness]);
  58398. }
  58399. function Snackbar(_ref, ref) {
  58400. let {
  58401. className,
  58402. children,
  58403. spokenMessage = children,
  58404. politeness = 'polite',
  58405. actions = [],
  58406. onRemove = external_lodash_namespaceObject.noop,
  58407. icon = null,
  58408. explicitDismiss = false,
  58409. // onDismiss is a callback executed when the snackbar is dismissed.
  58410. // It is distinct from onRemove, which _looks_ like a callback but is
  58411. // actually the function to call to remove the snackbar from the UI.
  58412. onDismiss = external_lodash_namespaceObject.noop,
  58413. listRef
  58414. } = _ref;
  58415. onDismiss = onDismiss || external_lodash_namespaceObject.noop;
  58416. function dismissMe(event) {
  58417. if (event && event.preventDefault) {
  58418. event.preventDefault();
  58419. } // Prevent focus loss by moving it to the list element.
  58420. listRef.current.focus();
  58421. onDismiss();
  58422. onRemove();
  58423. }
  58424. function onActionClick(event, onClick) {
  58425. event.stopPropagation();
  58426. onRemove();
  58427. if (onClick) {
  58428. onClick(event);
  58429. }
  58430. }
  58431. snackbar_useSpokenMessage(spokenMessage, politeness); // Only set up the timeout dismiss if we're not explicitly dismissing.
  58432. (0,external_wp_element_namespaceObject.useEffect)(() => {
  58433. const timeoutHandle = setTimeout(() => {
  58434. if (!explicitDismiss) {
  58435. onDismiss();
  58436. onRemove();
  58437. }
  58438. }, NOTICE_TIMEOUT);
  58439. return () => clearTimeout(timeoutHandle);
  58440. }, [onDismiss, onRemove]);
  58441. const classes = classnames_default()(className, 'components-snackbar', {
  58442. 'components-snackbar-explicit-dismiss': !!explicitDismiss
  58443. });
  58444. if (actions && actions.length > 1) {
  58445. // We need to inform developers that snackbar only accepts 1 action.
  58446. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0; // return first element only while keeping it inside an array
  58447. actions = [actions[0]];
  58448. }
  58449. const snackbarContentClassnames = classnames_default()('components-snackbar__content', {
  58450. 'components-snackbar__content-with-icon': !!icon
  58451. });
  58452. return (0,external_wp_element_namespaceObject.createElement)("div", {
  58453. ref: ref,
  58454. className: classes,
  58455. onClick: !explicitDismiss ? dismissMe : external_lodash_namespaceObject.noop,
  58456. tabIndex: "0",
  58457. role: !explicitDismiss ? 'button' : '',
  58458. onKeyPress: !explicitDismiss ? dismissMe : external_lodash_namespaceObject.noop,
  58459. "aria-label": !explicitDismiss ? (0,external_wp_i18n_namespaceObject.__)('Dismiss this notice') : ''
  58460. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  58461. className: snackbarContentClassnames
  58462. }, icon && (0,external_wp_element_namespaceObject.createElement)("div", {
  58463. className: "components-snackbar__icon"
  58464. }, icon), children, actions.map((_ref2, index) => {
  58465. let {
  58466. label,
  58467. onClick,
  58468. url
  58469. } = _ref2;
  58470. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  58471. key: index,
  58472. href: url,
  58473. variant: "tertiary",
  58474. onClick: event => onActionClick(event, onClick),
  58475. className: "components-snackbar__action"
  58476. }, label);
  58477. }), explicitDismiss && (0,external_wp_element_namespaceObject.createElement)("span", {
  58478. role: "button",
  58479. "aria-label": "Dismiss this notice",
  58480. tabIndex: "0",
  58481. className: "components-snackbar__dismiss-button",
  58482. onClick: dismissMe,
  58483. onKeyPress: dismissMe
  58484. }, "\u2715")));
  58485. }
  58486. /* harmony default export */ var snackbar = ((0,external_wp_element_namespaceObject.forwardRef)(Snackbar));
  58487. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/snackbar/list.js
  58488. /**
  58489. * External dependencies
  58490. */
  58491. /**
  58492. * WordPress dependencies
  58493. */
  58494. /**
  58495. * Internal dependencies
  58496. */
  58497. const SNACKBAR_VARIANTS = {
  58498. init: {
  58499. height: 0,
  58500. opacity: 0
  58501. },
  58502. open: {
  58503. height: 'auto',
  58504. opacity: 1,
  58505. transition: {
  58506. height: {
  58507. stiffness: 1000,
  58508. velocity: -100
  58509. }
  58510. }
  58511. },
  58512. exit: {
  58513. opacity: 0,
  58514. transition: {
  58515. duration: 0.5
  58516. }
  58517. }
  58518. };
  58519. const SNACKBAR_REDUCE_MOTION_VARIANTS = {
  58520. init: false,
  58521. open: false,
  58522. exit: false
  58523. };
  58524. /**
  58525. * Renders a list of notices.
  58526. *
  58527. * @param {Object} $0 Props passed to the component.
  58528. * @param {Array} $0.notices Array of notices to render.
  58529. * @param {Function} $0.onRemove Function called when a notice should be removed / dismissed.
  58530. * @param {Object} $0.className Name of the class used by the component.
  58531. * @param {Object} $0.children Array of children to be rendered inside the notice list.
  58532. *
  58533. * @return {Object} The rendered notices list.
  58534. */
  58535. function SnackbarList(_ref) {
  58536. let {
  58537. notices,
  58538. className,
  58539. children,
  58540. onRemove = external_lodash_namespaceObject.noop
  58541. } = _ref;
  58542. const listRef = (0,external_wp_element_namespaceObject.useRef)();
  58543. const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  58544. className = classnames_default()('components-snackbar-list', className);
  58545. const removeNotice = notice => () => onRemove(notice.id);
  58546. return (0,external_wp_element_namespaceObject.createElement)("div", {
  58547. className: className,
  58548. tabIndex: -1,
  58549. ref: listRef
  58550. }, children, (0,external_wp_element_namespaceObject.createElement)(AnimatePresence, null, notices.map(notice => {
  58551. return (0,external_wp_element_namespaceObject.createElement)(motion.div, {
  58552. layout: !isReducedMotion // See https://www.framer.com/docs/animation/#layout-animations
  58553. ,
  58554. initial: 'init',
  58555. animate: 'open',
  58556. exit: 'exit',
  58557. key: notice.id,
  58558. variants: isReducedMotion ? SNACKBAR_REDUCE_MOTION_VARIANTS : SNACKBAR_VARIANTS
  58559. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  58560. className: "components-snackbar-list__notice-container"
  58561. }, (0,external_wp_element_namespaceObject.createElement)(snackbar, extends_extends({}, (0,external_lodash_namespaceObject.omit)(notice, ['content']), {
  58562. onRemove: removeNotice(notice),
  58563. listRef: listRef
  58564. }), notice.content)));
  58565. })));
  58566. }
  58567. /* harmony default export */ var snackbar_list = (SnackbarList);
  58568. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spinner/styles.js
  58569. function spinner_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  58570. /**
  58571. * External dependencies
  58572. */
  58573. /**
  58574. * Internal dependencies
  58575. */
  58576. const spinAnimation = emotion_react_browser_esm_keyframes`
  58577. from {
  58578. transform: rotate(0deg);
  58579. }
  58580. to {
  58581. transform: rotate(360deg);
  58582. }
  58583. `;
  58584. const StyledSpinner = emotion_styled_base_browser_esm("svg", true ? {
  58585. target: "e1bj2jdf2"
  58586. } : 0)("width:", config_values.spinnerSize, "px;height:", config_values.spinnerSize, "px;display:inline-block;margin:5px 11px 0;position:relative;color:var( --wp-admin-theme-color );overflow:visible;" + ( true ? "" : 0));
  58587. const commonPathProps = true ? {
  58588. name: "9s4963",
  58589. styles: "fill:transparent;stroke-width:1.5px"
  58590. } : 0;
  58591. const SpinnerTrack = emotion_styled_base_browser_esm("circle", true ? {
  58592. target: "e1bj2jdf1"
  58593. } : 0)(commonPathProps, ";stroke:", COLORS.gray[300], ";" + ( true ? "" : 0));
  58594. const SpinnerIndicator = emotion_styled_base_browser_esm("path", true ? {
  58595. target: "e1bj2jdf0"
  58596. } : 0)(commonPathProps, ";stroke:currentColor;stroke-linecap:round;transform-origin:50% 50%;animation:1.4s linear infinite both ", spinAnimation, ";" + ( true ? "" : 0));
  58597. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spinner/index.js
  58598. /**
  58599. * External dependencies
  58600. */
  58601. /**
  58602. * Internal dependencies
  58603. */
  58604. /**
  58605. * @typedef OwnProps
  58606. *
  58607. * @property {string} [className] Class name
  58608. */
  58609. /** @typedef {import('react').ComponentPropsWithoutRef<'svg'> & OwnProps} Props */
  58610. /**
  58611. * @param {Props} props
  58612. * @return {JSX.Element} Element
  58613. */
  58614. function Spinner(_ref) {
  58615. let {
  58616. className,
  58617. ...props
  58618. } = _ref;
  58619. return (0,external_wp_element_namespaceObject.createElement)(StyledSpinner, extends_extends({
  58620. className: classnames_default()('components-spinner', className),
  58621. viewBox: "0 0 100 100",
  58622. xmlns: "http://www.w3.org/2000/svg",
  58623. role: "presentation",
  58624. focusable: "false"
  58625. }, props), (0,external_wp_element_namespaceObject.createElement)(SpinnerTrack, {
  58626. cx: "50",
  58627. cy: "50",
  58628. r: "50",
  58629. vectorEffect: "non-scaling-stroke"
  58630. }), (0,external_wp_element_namespaceObject.createElement)(SpinnerIndicator, {
  58631. d: "m 50 0 a 50 50 0 0 1 50 50",
  58632. vectorEffect: "non-scaling-stroke"
  58633. }));
  58634. }
  58635. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/surface/component.js
  58636. /**
  58637. * Internal dependencies
  58638. */
  58639. /**
  58640. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
  58641. * @param {import('react').ForwardedRef<any>} forwardedRef
  58642. */
  58643. function component_Surface(props, forwardedRef) {
  58644. const surfaceProps = useSurface(props);
  58645. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, surfaceProps, {
  58646. ref: forwardedRef
  58647. }));
  58648. }
  58649. /**
  58650. * `Surface` is a core component that renders a primary background color.
  58651. *
  58652. * In the example below, notice how the `Surface` renders in white (or dark gray if in dark mode).
  58653. *
  58654. * ```jsx
  58655. * import {
  58656. * __experimentalSurface as Surface,
  58657. * __experimentalText as Text,
  58658. * } from '@wordpress/components';
  58659. *
  58660. * function Example() {
  58661. * return (
  58662. * <Surface>
  58663. * <Text>Code is Poetry</Text>
  58664. * </Surface>
  58665. * );
  58666. * }
  58667. * ```
  58668. */
  58669. const ConnectedSurface = contextConnect(component_Surface, 'Surface');
  58670. /* harmony default export */ var surface_component = (ConnectedSurface);
  58671. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tab-panel/index.js
  58672. /**
  58673. * External dependencies
  58674. */
  58675. /**
  58676. * WordPress dependencies
  58677. */
  58678. /**
  58679. * Internal dependencies
  58680. */
  58681. const TabButton = _ref => {
  58682. let {
  58683. tabId,
  58684. onClick,
  58685. children,
  58686. selected,
  58687. ...rest
  58688. } = _ref;
  58689. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  58690. role: "tab",
  58691. tabIndex: selected ? null : -1,
  58692. "aria-selected": selected,
  58693. id: tabId,
  58694. onClick: onClick
  58695. }, rest), children);
  58696. };
  58697. function TabPanel(_ref2) {
  58698. var _selectedTab$name;
  58699. let {
  58700. className,
  58701. children,
  58702. tabs,
  58703. initialTabName,
  58704. orientation = 'horizontal',
  58705. activeClass = 'is-active',
  58706. onSelect = external_lodash_namespaceObject.noop
  58707. } = _ref2;
  58708. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(TabPanel, 'tab-panel');
  58709. const [selected, setSelected] = (0,external_wp_element_namespaceObject.useState)(null);
  58710. const handleClick = tabKey => {
  58711. setSelected(tabKey);
  58712. onSelect(tabKey);
  58713. };
  58714. const onNavigate = (childIndex, child) => {
  58715. child.click();
  58716. };
  58717. const selectedTab = (0,external_lodash_namespaceObject.find)(tabs, {
  58718. name: selected
  58719. });
  58720. const selectedId = `${instanceId}-${(_selectedTab$name = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.name) !== null && _selectedTab$name !== void 0 ? _selectedTab$name : 'none'}`;
  58721. (0,external_wp_element_namespaceObject.useEffect)(() => {
  58722. const newSelectedTab = (0,external_lodash_namespaceObject.find)(tabs, {
  58723. name: selected
  58724. });
  58725. if (!newSelectedTab) {
  58726. setSelected(initialTabName || (tabs.length > 0 ? tabs[0].name : null));
  58727. }
  58728. }, [tabs]);
  58729. return (0,external_wp_element_namespaceObject.createElement)("div", {
  58730. className: className
  58731. }, (0,external_wp_element_namespaceObject.createElement)(navigable_container_menu, {
  58732. role: "tablist",
  58733. orientation: orientation,
  58734. onNavigate: onNavigate,
  58735. className: "components-tab-panel__tabs"
  58736. }, tabs.map(tab => (0,external_wp_element_namespaceObject.createElement)(TabButton, {
  58737. className: classnames_default()('components-tab-panel__tabs-item', tab.className, {
  58738. [activeClass]: tab.name === selected
  58739. }),
  58740. tabId: `${instanceId}-${tab.name}`,
  58741. "aria-controls": `${instanceId}-${tab.name}-view`,
  58742. selected: tab.name === selected,
  58743. key: tab.name,
  58744. onClick: (0,external_lodash_namespaceObject.partial)(handleClick, tab.name)
  58745. }, tab.title))), selectedTab && (0,external_wp_element_namespaceObject.createElement)("div", {
  58746. key: selectedId,
  58747. "aria-labelledby": selectedId,
  58748. role: "tabpanel",
  58749. id: `${selectedId}-view`,
  58750. className: "components-tab-panel__tab-content"
  58751. }, children(selectedTab)));
  58752. }
  58753. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text-control/index.js
  58754. /**
  58755. * WordPress dependencies
  58756. */
  58757. /**
  58758. * Internal dependencies
  58759. */
  58760. /**
  58761. * @typedef OwnProps
  58762. * @property {string} label Label for the control.
  58763. * @property {boolean} [hideLabelFromVision] Whether to accessibly hide the label.
  58764. * @property {string} value Value of the input.
  58765. * @property {string} [help] Optional help text for the control.
  58766. * @property {string} [className] Classname passed to BaseControl wrapper
  58767. * @property {(value: string) => void} onChange Handle changes.
  58768. * @property {string} [type='text'] Type of the input.
  58769. */
  58770. /** @typedef {OwnProps & import('react').ComponentProps<'input'>} Props */
  58771. /**
  58772. *
  58773. * @param {Props} props Props
  58774. * @param {import('react').ForwardedRef<HTMLInputElement>} ref
  58775. */
  58776. function TextControl(_ref, ref) {
  58777. let {
  58778. label,
  58779. hideLabelFromVision,
  58780. value,
  58781. help,
  58782. className,
  58783. onChange,
  58784. type = 'text',
  58785. ...props
  58786. } = _ref;
  58787. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(TextControl);
  58788. const id = `inspector-text-control-${instanceId}`;
  58789. const onChangeValue = (
  58790. /** @type {import('react').ChangeEvent<HTMLInputElement>} */
  58791. event) => onChange(event.target.value);
  58792. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  58793. label: label,
  58794. hideLabelFromVision: hideLabelFromVision,
  58795. id: id,
  58796. help: help,
  58797. className: className
  58798. }, (0,external_wp_element_namespaceObject.createElement)("input", extends_extends({
  58799. className: "components-text-control__input",
  58800. type: type,
  58801. id: id,
  58802. value: value,
  58803. onChange: onChangeValue,
  58804. "aria-describedby": !!help ? id + '__help' : undefined,
  58805. ref: ref
  58806. }, props)));
  58807. }
  58808. /* harmony default export */ var text_control = ((0,external_wp_element_namespaceObject.forwardRef)(TextControl));
  58809. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/input/base.js
  58810. /**
  58811. * External dependencies
  58812. */
  58813. /**
  58814. * Internal dependencies
  58815. */
  58816. const inputStyleNeutral = /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:0 0 0 transparent;transition:box-shadow 0.1s linear;border-radius:", config_values.radiusBlockUi, ";border:", config_values.borderWidth, " solid ", COLORS.ui.border, ";" + ( true ? "" : 0), true ? "" : 0);
  58817. const inputStyleFocus = /*#__PURE__*/emotion_react_browser_esm_css("border-color:var( --wp-admin-theme-color );box-shadow:0 0 0 calc( ", config_values.borderWidthFocus, " - ", config_values.borderWidth, " ) var( --wp-admin-theme-color );outline:2px solid transparent;" + ( true ? "" : 0), true ? "" : 0);
  58818. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/breakpoint-values.js
  58819. /* harmony default export */ var breakpoint_values = ({
  58820. huge: '1440px',
  58821. wide: '1280px',
  58822. 'x-large': '1080px',
  58823. large: '960px',
  58824. // admin sidebar auto folds
  58825. medium: '782px',
  58826. // Adminbar goes big.
  58827. small: '600px',
  58828. mobile: '480px',
  58829. 'zoomed-in': '280px'
  58830. });
  58831. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/breakpoint.js
  58832. /**
  58833. * Internal dependencies
  58834. */
  58835. /**
  58836. * @param {keyof breakpoints} point
  58837. * @return {string} Media query declaration.
  58838. */
  58839. const breakpoint = point => `@media (min-width: ${breakpoint_values[point]})`;
  58840. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/input/input-control.js
  58841. /**
  58842. * External dependencies
  58843. */
  58844. /**
  58845. * Internal dependencies
  58846. */
  58847. const inputControl = /*#__PURE__*/emotion_react_browser_esm_css("font-family:", font('default.fontFamily'), ";padding:6px 8px;", inputStyleNeutral, ";font-size:", font('mobileTextMinFontSize'), ";line-height:normal;", breakpoint('small'), "{font-size:", font('default.fontSize'), ";line-height:normal;}&:focus{", inputStyleFocus, ";}&::-webkit-input-placeholder{color:", COLORS.darkGray.placeholder, ";}&::-moz-placeholder{opacity:1;color:", COLORS.darkGray.placeholder, ";}&:-ms-input-placeholder{color:", COLORS.darkGray.placeholder, ";}.is-dark-theme &{&::-webkit-input-placeholder{color:", COLORS.lightGray.placeholder, ";}&::-moz-placeholder{opacity:1;color:", COLORS.lightGray.placeholder, ";}&:-ms-input-placeholder{color:", COLORS.lightGray.placeholder, ";}}" + ( true ? "" : 0), true ? "" : 0);
  58848. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/textarea-control/styles/textarea-control-styles.js
  58849. /**
  58850. * External dependencies
  58851. */
  58852. /**
  58853. * Internal dependencies
  58854. */
  58855. const StyledTextarea = emotion_styled_base_browser_esm("textarea", true ? {
  58856. target: "ebk7yr50"
  58857. } : 0)("width:100%;", inputControl, ";" + ( true ? "" : 0));
  58858. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/textarea-control/index.js
  58859. /**
  58860. * WordPress dependencies
  58861. */
  58862. /**
  58863. * Internal dependencies
  58864. */
  58865. function TextareaControl(_ref) {
  58866. let {
  58867. label,
  58868. hideLabelFromVision,
  58869. value,
  58870. help,
  58871. onChange,
  58872. rows = 4,
  58873. className,
  58874. ...props
  58875. } = _ref;
  58876. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(TextareaControl);
  58877. const id = `inspector-textarea-control-${instanceId}`;
  58878. const onChangeValue = event => onChange(event.target.value);
  58879. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  58880. label: label,
  58881. hideLabelFromVision: hideLabelFromVision,
  58882. id: id,
  58883. help: help,
  58884. className: className
  58885. }, (0,external_wp_element_namespaceObject.createElement)(StyledTextarea, extends_extends({
  58886. className: "components-textarea-control__input",
  58887. id: id,
  58888. rows: rows,
  58889. onChange: onChangeValue,
  58890. "aria-describedby": !!help ? id + '__help' : undefined,
  58891. value: value
  58892. }, props)));
  58893. }
  58894. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text-highlight/index.js
  58895. /**
  58896. * External dependencies
  58897. */
  58898. /**
  58899. * WordPress dependencies
  58900. */
  58901. const TextHighlight = _ref => {
  58902. let {
  58903. text = '',
  58904. highlight = ''
  58905. } = _ref;
  58906. const trimmedHighlightText = highlight.trim();
  58907. if (!trimmedHighlightText) {
  58908. return text;
  58909. }
  58910. const regex = new RegExp(`(${(0,external_lodash_namespaceObject.escapeRegExp)(trimmedHighlightText)})`, 'gi');
  58911. return (0,external_wp_element_namespaceObject.createInterpolateElement)(text.replace(regex, '<mark>$&</mark>'), {
  58912. mark: (0,external_wp_element_namespaceObject.createElement)("mark", null)
  58913. });
  58914. };
  58915. /* harmony default export */ var text_highlight = (TextHighlight);
  58916. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tip.js
  58917. /**
  58918. * WordPress dependencies
  58919. */
  58920. const tip = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  58921. xmlns: "http://www.w3.org/2000/svg",
  58922. viewBox: "0 0 24 24"
  58923. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  58924. d: "M12 15.8c-3.7 0-6.8-3-6.8-6.8s3-6.8 6.8-6.8c3.7 0 6.8 3 6.8 6.8s-3.1 6.8-6.8 6.8zm0-12C9.1 3.8 6.8 6.1 6.8 9s2.4 5.2 5.2 5.2c2.9 0 5.2-2.4 5.2-5.2S14.9 3.8 12 3.8zM8 17.5h8V19H8zM10 20.5h4V22h-4z"
  58925. }));
  58926. /* harmony default export */ var library_tip = (tip);
  58927. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tip/index.js
  58928. /**
  58929. * WordPress dependencies
  58930. */
  58931. /**
  58932. * @typedef Props
  58933. * @property {import('react').ReactNode} children Children to render in the tip.
  58934. */
  58935. /**
  58936. * @param {Props} props
  58937. * @return {JSX.Element} Element
  58938. */
  58939. function Tip(props) {
  58940. return (0,external_wp_element_namespaceObject.createElement)("div", {
  58941. className: "components-tip"
  58942. }, (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  58943. icon: library_tip
  58944. }), (0,external_wp_element_namespaceObject.createElement)("p", null, props.children));
  58945. }
  58946. /* harmony default export */ var build_module_tip = (Tip);
  58947. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-control/index.js
  58948. /**
  58949. * External dependencies
  58950. */
  58951. /**
  58952. * WordPress dependencies
  58953. */
  58954. /**
  58955. * Internal dependencies
  58956. */
  58957. function ToggleControl(_ref) {
  58958. let {
  58959. label,
  58960. checked,
  58961. help,
  58962. className,
  58963. onChange,
  58964. disabled
  58965. } = _ref;
  58966. function onChangeToggle(event) {
  58967. onChange(event.target.checked);
  58968. }
  58969. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleControl);
  58970. const id = `inspector-toggle-control-${instanceId}`;
  58971. let describedBy, helpLabel;
  58972. if (help) {
  58973. describedBy = id + '__help';
  58974. helpLabel = (0,external_lodash_namespaceObject.isFunction)(help) ? help(checked) : help;
  58975. }
  58976. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  58977. id: id,
  58978. help: helpLabel,
  58979. className: classnames_default()('components-toggle-control', className)
  58980. }, (0,external_wp_element_namespaceObject.createElement)(form_toggle, {
  58981. id: id,
  58982. checked: checked,
  58983. onChange: onChangeToggle,
  58984. "aria-describedby": describedBy,
  58985. disabled: disabled
  58986. }), (0,external_wp_element_namespaceObject.createElement)("label", {
  58987. htmlFor: id,
  58988. className: "components-toggle-control__label"
  58989. }, label));
  58990. }
  58991. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-icon/component.js
  58992. /**
  58993. * WordPress dependencies
  58994. */
  58995. /**
  58996. * Internal dependencies
  58997. */
  58998. function ToggleGroupControlOptionIcon(props) {
  58999. const {
  59000. icon,
  59001. ...restProps
  59002. } = props;
  59003. return (0,external_wp_element_namespaceObject.createElement)(toggle_group_control_option_base_component, restProps, (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  59004. icon: icon
  59005. }));
  59006. }
  59007. /**
  59008. * `ToggleGroupControlOptionIcon` is a form component which is meant to be used as a
  59009. * child of `ToggleGroupControl` and displays an icon.
  59010. *
  59011. * @example
  59012. * ```jsx
  59013. *
  59014. * import {
  59015. * __experimentalToggleGroupControl as ToggleGroupControl,
  59016. * __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,
  59017. * from '@wordpress/components';
  59018. * import { formatLowercase, formatUppercase } from '@wordpress/icons';
  59019. *
  59020. * function Example() {
  59021. * return (
  59022. * <ToggleGroupControl label="my label" value="vertical" isBlock>
  59023. * <ToggleGroupControlOptionIcon
  59024. * value="uppercase"
  59025. * icon={ formatUppercase }
  59026. * />
  59027. * <ToggleGroupControlOptionIcon
  59028. * value="lowercase"
  59029. * icon={ formatLowercase }
  59030. * />
  59031. * </ToggleGroupControl>
  59032. * );
  59033. * }
  59034. ** ```
  59035. */
  59036. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-ae468c11.js
  59037. // Automatically generated
  59038. var TOOLBAR_STATE_KEYS = ["baseId", "unstable_idCountRef", "unstable_virtual", "rtl", "orientation", "items", "groups", "currentId", "loop", "wrap", "shift", "unstable_moves", "unstable_hasActiveWidget", "unstable_includesBaseElement", "setBaseId", "registerItem", "unregisterItem", "registerGroup", "unregisterGroup", "move", "next", "previous", "up", "down", "first", "last", "sort", "unstable_setVirtual", "setRTL", "setOrientation", "setCurrentId", "setLoop", "setWrap", "setShift", "reset", "unstable_setIncludesBaseElement", "unstable_setHasActiveWidget"];
  59039. var TOOLBAR_KEYS = TOOLBAR_STATE_KEYS;
  59040. var TOOLBAR_ITEM_KEYS = TOOLBAR_KEYS;
  59041. var TOOLBAR_SEPARATOR_KEYS = (/* unused pure expression or super */ null && (TOOLBAR_ITEM_KEYS));
  59042. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Toolbar/ToolbarItem.js
  59043. var useToolbarItem = createHook({
  59044. name: "ToolbarItem",
  59045. compose: useCompositeItem,
  59046. keys: TOOLBAR_ITEM_KEYS
  59047. });
  59048. var ToolbarItem = createComponent({
  59049. as: "button",
  59050. memo: true,
  59051. useHook: useToolbarItem
  59052. });
  59053. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-context/index.js
  59054. /**
  59055. * WordPress dependencies
  59056. */
  59057. const ToolbarContext = (0,external_wp_element_namespaceObject.createContext)();
  59058. /* harmony default export */ var toolbar_context = (ToolbarContext);
  59059. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-item/index.js
  59060. /**
  59061. * External dependencies
  59062. */
  59063. /**
  59064. * WordPress dependencies
  59065. */
  59066. /**
  59067. * Internal dependencies
  59068. */
  59069. function toolbar_item_ToolbarItem(_ref, ref) {
  59070. let {
  59071. children,
  59072. as: Component,
  59073. ...props
  59074. } = _ref;
  59075. const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
  59076. if (typeof children !== 'function' && !Component) {
  59077. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
  59078. return null;
  59079. }
  59080. const allProps = { ...props,
  59081. ref,
  59082. 'data-toolbar-item': true
  59083. };
  59084. if (!accessibleToolbarState) {
  59085. if (Component) {
  59086. return (0,external_wp_element_namespaceObject.createElement)(Component, allProps, children);
  59087. }
  59088. return children(allProps);
  59089. }
  59090. return (0,external_wp_element_namespaceObject.createElement)(ToolbarItem, extends_extends({}, accessibleToolbarState, allProps, {
  59091. as: Component
  59092. }), children);
  59093. }
  59094. /* harmony default export */ var toolbar_item = ((0,external_wp_element_namespaceObject.forwardRef)(toolbar_item_ToolbarItem));
  59095. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-button/toolbar-button-container.js
  59096. const ToolbarButtonContainer = props => (0,external_wp_element_namespaceObject.createElement)("div", {
  59097. className: props.className
  59098. }, props.children);
  59099. /* harmony default export */ var toolbar_button_container = (ToolbarButtonContainer);
  59100. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-button/index.js
  59101. /**
  59102. * External dependencies
  59103. */
  59104. /**
  59105. * WordPress dependencies
  59106. */
  59107. /**
  59108. * Internal dependencies
  59109. */
  59110. function ToolbarButton(_ref, ref) {
  59111. let {
  59112. containerClassName,
  59113. className,
  59114. extraProps,
  59115. children,
  59116. title,
  59117. isActive,
  59118. isDisabled,
  59119. ...props
  59120. } = _ref;
  59121. const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
  59122. if (!accessibleToolbarState) {
  59123. return (0,external_wp_element_namespaceObject.createElement)(toolbar_button_container, {
  59124. className: containerClassName
  59125. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  59126. ref: ref,
  59127. icon: props.icon,
  59128. label: title,
  59129. shortcut: props.shortcut,
  59130. "data-subscript": props.subscript,
  59131. onClick: event => {
  59132. event.stopPropagation();
  59133. if (props.onClick) {
  59134. props.onClick(event);
  59135. }
  59136. },
  59137. className: classnames_default()('components-toolbar__control', className),
  59138. isPressed: isActive,
  59139. disabled: isDisabled,
  59140. "data-toolbar-item": true
  59141. }, extraProps, props), children));
  59142. } // ToobarItem will pass all props to the render prop child, which will pass
  59143. // all props to Button. This means that ToolbarButton has the same API as
  59144. // Button.
  59145. return (0,external_wp_element_namespaceObject.createElement)(toolbar_item, extends_extends({
  59146. className: classnames_default()('components-toolbar-button', className)
  59147. }, extraProps, props, {
  59148. ref: ref
  59149. }), toolbarItemProps => (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  59150. label: title,
  59151. isPressed: isActive,
  59152. disabled: isDisabled
  59153. }, toolbarItemProps), children));
  59154. }
  59155. /* harmony default export */ var toolbar_button = ((0,external_wp_element_namespaceObject.forwardRef)(ToolbarButton));
  59156. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-group/toolbar-group-container.js
  59157. const ToolbarGroupContainer = _ref => {
  59158. let {
  59159. className,
  59160. children,
  59161. ...props
  59162. } = _ref;
  59163. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({
  59164. className: className
  59165. }, props), children);
  59166. };
  59167. /* harmony default export */ var toolbar_group_container = (ToolbarGroupContainer);
  59168. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-group/toolbar-group-collapsed.js
  59169. /**
  59170. * WordPress dependencies
  59171. */
  59172. /**
  59173. * Internal dependencies
  59174. */
  59175. function ToolbarGroupCollapsed(_ref) {
  59176. let {
  59177. controls = [],
  59178. toggleProps,
  59179. ...props
  59180. } = _ref;
  59181. // It'll contain state if `ToolbarGroup` is being used within
  59182. // `<Toolbar label="label" />`
  59183. const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
  59184. const renderDropdownMenu = internalToggleProps => (0,external_wp_element_namespaceObject.createElement)(dropdown_menu, extends_extends({
  59185. controls: controls,
  59186. toggleProps: { ...internalToggleProps,
  59187. 'data-toolbar-item': true
  59188. }
  59189. }, props));
  59190. if (accessibleToolbarState) {
  59191. return (0,external_wp_element_namespaceObject.createElement)(toolbar_item, toggleProps, renderDropdownMenu);
  59192. }
  59193. return renderDropdownMenu(toggleProps);
  59194. }
  59195. /* harmony default export */ var toolbar_group_collapsed = (ToolbarGroupCollapsed);
  59196. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-group/index.js
  59197. /**
  59198. * External dependencies
  59199. */
  59200. /**
  59201. * WordPress dependencies
  59202. */
  59203. /**
  59204. * Internal dependencies
  59205. */
  59206. /**
  59207. * Renders a collapsible group of controls
  59208. *
  59209. * The `controls` prop accepts an array of sets. A set is an array of controls.
  59210. * Controls have the following shape:
  59211. *
  59212. * ```
  59213. * {
  59214. * icon: string,
  59215. * title: string,
  59216. * subscript: string,
  59217. * onClick: Function,
  59218. * isActive: boolean,
  59219. * isDisabled: boolean
  59220. * }
  59221. * ```
  59222. *
  59223. * For convenience it is also possible to pass only an array of controls. It is
  59224. * then assumed this is the only set.
  59225. *
  59226. * Either `controls` or `children` is required, otherwise this components
  59227. * renders nothing.
  59228. *
  59229. * @param {Object} props Component props.
  59230. * @param {Array} [props.controls] The controls to render in this toolbar.
  59231. * @param {WPElement} [props.children] Any other things to render inside the toolbar besides the controls.
  59232. * @param {string} [props.className] Class to set on the container div.
  59233. * @param {boolean} [props.isCollapsed] Turns ToolbarGroup into a dropdown menu.
  59234. * @param {string} [props.title] ARIA label for dropdown menu if is collapsed.
  59235. */
  59236. function ToolbarGroup(_ref) {
  59237. let {
  59238. controls = [],
  59239. children,
  59240. className,
  59241. isCollapsed,
  59242. title,
  59243. ...props
  59244. } = _ref;
  59245. // It'll contain state if `ToolbarGroup` is being used within
  59246. // `<Toolbar label="label" />`
  59247. const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
  59248. if ((!controls || !controls.length) && !children) {
  59249. return null;
  59250. }
  59251. const finalClassName = classnames_default()( // Unfortunately, there's legacy code referencing to `.components-toolbar`
  59252. // So we can't get rid of it
  59253. accessibleToolbarState ? 'components-toolbar-group' : 'components-toolbar', className); // Normalize controls to nested array of objects (sets of controls)
  59254. let controlSets = controls;
  59255. if (!Array.isArray(controlSets[0])) {
  59256. controlSets = [controlSets];
  59257. }
  59258. if (isCollapsed) {
  59259. return (0,external_wp_element_namespaceObject.createElement)(toolbar_group_collapsed, extends_extends({
  59260. label: title,
  59261. controls: controlSets,
  59262. className: finalClassName,
  59263. children: children
  59264. }, props));
  59265. }
  59266. return (0,external_wp_element_namespaceObject.createElement)(toolbar_group_container, extends_extends({
  59267. className: finalClassName
  59268. }, props), (0,external_lodash_namespaceObject.flatMap)(controlSets, (controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => (0,external_wp_element_namespaceObject.createElement)(toolbar_button, extends_extends({
  59269. key: [indexOfSet, indexOfControl].join(),
  59270. containerClassName: indexOfSet > 0 && indexOfControl === 0 ? 'has-left-divider' : null
  59271. }, control)))), children);
  59272. }
  59273. /* harmony default export */ var toolbar_group = (ToolbarGroup);
  59274. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Toolbar/ToolbarState.js
  59275. function useToolbarState(initialState) {
  59276. if (initialState === void 0) {
  59277. initialState = {};
  59278. }
  59279. var _useSealedState = useSealedState(initialState),
  59280. _useSealedState$orien = _useSealedState.orientation,
  59281. orientation = _useSealedState$orien === void 0 ? "horizontal" : _useSealedState$orien,
  59282. sealed = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(_useSealedState, ["orientation"]);
  59283. return useCompositeState(_objectSpread2({
  59284. orientation: orientation
  59285. }, sealed));
  59286. }
  59287. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Toolbar/Toolbar.js
  59288. var useToolbar = createHook({
  59289. name: "Toolbar",
  59290. compose: useComposite,
  59291. keys: TOOLBAR_KEYS,
  59292. useProps: function useProps(options, htmlProps) {
  59293. return _objectSpread2({
  59294. role: "toolbar",
  59295. "aria-orientation": options.orientation
  59296. }, htmlProps);
  59297. }
  59298. });
  59299. var Toolbar = createComponent({
  59300. as: "div",
  59301. useHook: useToolbar,
  59302. useCreateElement: function useCreateElement$1(type, props, children) {
  59303. false ? 0 : void 0;
  59304. return useCreateElement(type, props, children);
  59305. }
  59306. });
  59307. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar-container.js
  59308. /**
  59309. * External dependencies
  59310. */
  59311. /**
  59312. * WordPress dependencies
  59313. */
  59314. /**
  59315. * Internal dependencies
  59316. */
  59317. function ToolbarContainer(_ref, ref) {
  59318. let {
  59319. label,
  59320. ...props
  59321. } = _ref;
  59322. // https://reakit.io/docs/basic-concepts/#state-hooks
  59323. // Passing baseId for server side rendering (which includes snapshots)
  59324. // If an id prop is passed to Toolbar, toolbar items will use it as a base for their ids
  59325. const toolbarState = useToolbarState({
  59326. loop: true,
  59327. baseId: props.id,
  59328. rtl: (0,external_wp_i18n_namespaceObject.isRTL)()
  59329. });
  59330. return (// This will provide state for `ToolbarButton`'s
  59331. (0,external_wp_element_namespaceObject.createElement)(toolbar_context.Provider, {
  59332. value: toolbarState
  59333. }, (0,external_wp_element_namespaceObject.createElement)(Toolbar, extends_extends({
  59334. ref: ref,
  59335. "aria-label": label
  59336. }, toolbarState, props)))
  59337. );
  59338. }
  59339. /* harmony default export */ var toolbar_container = ((0,external_wp_element_namespaceObject.forwardRef)(ToolbarContainer));
  59340. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/index.js
  59341. /**
  59342. * External dependencies
  59343. */
  59344. /**
  59345. * WordPress dependencies
  59346. */
  59347. /**
  59348. * Internal dependencies
  59349. */
  59350. /**
  59351. * Renders a toolbar.
  59352. *
  59353. * To add controls, simply pass `ToolbarButton` components as children.
  59354. *
  59355. * @param {Object} props Component props.
  59356. * @param {string} [props.className] Class to set on the container div.
  59357. * @param {string} [props.label] ARIA label for toolbar container.
  59358. * @param {Object} ref React Element ref.
  59359. */
  59360. function toolbar_Toolbar(_ref, ref) {
  59361. let {
  59362. className,
  59363. label,
  59364. ...props
  59365. } = _ref;
  59366. if (!label) {
  59367. external_wp_deprecated_default()('Using Toolbar without label prop', {
  59368. since: '5.6',
  59369. alternative: 'ToolbarGroup component',
  59370. link: 'https://developer.wordpress.org/block-editor/components/toolbar/'
  59371. });
  59372. return (0,external_wp_element_namespaceObject.createElement)(toolbar_group, extends_extends({}, props, {
  59373. className: className
  59374. }));
  59375. } // `ToolbarGroup` already uses components-toolbar for compatibility reasons.
  59376. const finalClassName = classnames_default()('components-accessible-toolbar', className);
  59377. return (0,external_wp_element_namespaceObject.createElement)(toolbar_container, extends_extends({
  59378. className: finalClassName,
  59379. label: label,
  59380. ref: ref
  59381. }, props));
  59382. }
  59383. /* harmony default export */ var toolbar = ((0,external_wp_element_namespaceObject.forwardRef)(toolbar_Toolbar));
  59384. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-dropdown-menu/index.js
  59385. /**
  59386. * WordPress dependencies
  59387. */
  59388. /**
  59389. * Internal dependencies
  59390. */
  59391. function ToolbarDropdownMenu(props, ref) {
  59392. const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
  59393. if (!accessibleToolbarState) {
  59394. return (0,external_wp_element_namespaceObject.createElement)(dropdown_menu, props);
  59395. } // ToobarItem will pass all props to the render prop child, which will pass
  59396. // all props to the toggle of DropdownMenu. This means that ToolbarDropdownMenu
  59397. // has the same API as DropdownMenu.
  59398. return (0,external_wp_element_namespaceObject.createElement)(toolbar_item, extends_extends({
  59399. ref: ref
  59400. }, props.toggleProps), toolbarItemProps => (0,external_wp_element_namespaceObject.createElement)(dropdown_menu, extends_extends({}, props, {
  59401. popoverProps: {
  59402. isAlternate: true,
  59403. ...props.popoverProps
  59404. },
  59405. toggleProps: toolbarItemProps
  59406. })));
  59407. }
  59408. /* harmony default export */ var toolbar_dropdown_menu = ((0,external_wp_element_namespaceObject.forwardRef)(ToolbarDropdownMenu));
  59409. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/styles.js
  59410. function tools_panel_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  59411. /**
  59412. * External dependencies
  59413. */
  59414. /**
  59415. * Internal dependencies
  59416. */
  59417. const toolsPanelGrid = {
  59418. spacing: /*#__PURE__*/emotion_react_browser_esm_css("column-gap:", space(4), ";row-gap:", space(6), ";" + ( true ? "" : 0), true ? "" : 0),
  59419. item: {
  59420. fullWidth: true ? {
  59421. name: "18iuzk9",
  59422. styles: "grid-column:1/-1"
  59423. } : 0
  59424. }
  59425. };
  59426. const ToolsPanel = /*#__PURE__*/emotion_react_browser_esm_css(toolsPanelGrid.spacing, ";border-top:", config_values.borderWidth, " solid ", COLORS.gray[300], ";margin-top:-1px;padding:", space(4), ";" + ( true ? "" : 0), true ? "" : 0);
  59427. /**
  59428. * Items injected into a ToolsPanel via a virtual bubbling slot will require
  59429. * an inner dom element to be injected. The following rule allows for the
  59430. * CSS grid display to be re-established.
  59431. */
  59432. const ToolsPanelWithInnerWrapper = columns => {
  59433. return /*#__PURE__*/emotion_react_browser_esm_css(">div:not( :first-of-type ){display:grid;grid-template-columns:", `repeat( ${columns}, 1fr )`, ";", toolsPanelGrid.spacing, " ", toolsPanelGrid.item.fullWidth, ";}" + ( true ? "" : 0), true ? "" : 0);
  59434. };
  59435. const ToolsPanelHiddenInnerWrapper = true ? {
  59436. name: "huufmu",
  59437. styles: ">div:not( :first-of-type ){display:none;}"
  59438. } : 0;
  59439. const ToolsPanelHeader = /*#__PURE__*/emotion_react_browser_esm_css(toolsPanelGrid.item.fullWidth, " gap:", space(2), ";.components-dropdown-menu{margin:", space(-1), " 0;line-height:0;}&&&& .components-dropdown-menu__toggle{padding:0;min-width:", space(6), ";}" + ( true ? "" : 0), true ? "" : 0);
  59440. const ToolsPanelHeading = true ? {
  59441. name: "1pmxm02",
  59442. styles: "font-size:inherit;font-weight:500;line-height:normal;&&{margin:0;}"
  59443. } : 0;
  59444. const ToolsPanelItem = /*#__PURE__*/emotion_react_browser_esm_css(toolsPanelGrid.item.fullWidth, "&>div,&>fieldset{padding-bottom:0;margin-bottom:0;max-width:100%;}&& ", base_control_styles_Wrapper, "{margin-bottom:0;", StyledField, ":last-child{margin-bottom:0;}}", StyledHelp, "{margin-bottom:0;}&& ", LabelWrapper, "{label{line-height:1.4em;}}.components-custom-select-control__label,", StyledLabel, "{line-height:1.4em;}" + ( true ? "" : 0), true ? "" : 0);
  59445. const ToolsPanelItemPlaceholder = true ? {
  59446. name: "eivff4",
  59447. styles: "display:none"
  59448. } : 0;
  59449. const styles_DropdownMenu = true ? {
  59450. name: "16gsvie",
  59451. styles: "min-width:200px"
  59452. } : 0;
  59453. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/context.js
  59454. /**
  59455. * WordPress dependencies
  59456. */
  59457. /**
  59458. * Internal dependencies
  59459. */
  59460. const context_noop = () => undefined;
  59461. const ToolsPanelContext = (0,external_wp_element_namespaceObject.createContext)({
  59462. menuItems: {
  59463. default: {},
  59464. optional: {}
  59465. },
  59466. hasMenuItems: false,
  59467. isResetting: false,
  59468. shouldRenderPlaceholderItems: false,
  59469. registerPanelItem: context_noop,
  59470. deregisterPanelItem: context_noop,
  59471. flagItemCustomization: context_noop,
  59472. areAllOptionalControlsHidden: true
  59473. });
  59474. const useToolsPanelContext = () => (0,external_wp_element_namespaceObject.useContext)(ToolsPanelContext);
  59475. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-header/hook.js
  59476. /**
  59477. * WordPress dependencies
  59478. */
  59479. /**
  59480. * Internal dependencies
  59481. */
  59482. function useToolsPanelHeader(props) {
  59483. const {
  59484. className,
  59485. ...otherProps
  59486. } = useContextSystem(props, 'ToolsPanelHeader');
  59487. const cx = useCx();
  59488. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  59489. return cx(ToolsPanelHeader, className);
  59490. }, [className, cx]);
  59491. const dropdownMenuClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  59492. return cx(styles_DropdownMenu);
  59493. }, [cx]);
  59494. const headingClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  59495. return cx(ToolsPanelHeading);
  59496. }, [cx]);
  59497. const {
  59498. menuItems,
  59499. hasMenuItems,
  59500. areAllOptionalControlsHidden
  59501. } = useToolsPanelContext();
  59502. return { ...otherProps,
  59503. areAllOptionalControlsHidden,
  59504. dropdownMenuClassName,
  59505. hasMenuItems,
  59506. headingClassName,
  59507. menuItems,
  59508. className: classes
  59509. };
  59510. }
  59511. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-header/component.js
  59512. /**
  59513. * External dependencies
  59514. */
  59515. /**
  59516. * WordPress dependencies
  59517. */
  59518. /**
  59519. * Internal dependencies
  59520. */
  59521. const tools_panel_header_component_noop = () => {};
  59522. const DefaultControlsGroup = _ref => {
  59523. let {
  59524. items,
  59525. onClose,
  59526. toggleItem
  59527. } = _ref;
  59528. if (!items.length) {
  59529. return null;
  59530. }
  59531. return (0,external_wp_element_namespaceObject.createElement)(menu_group, null, items.map(_ref2 => {
  59532. let [label, hasValue] = _ref2;
  59533. const icon = hasValue ? library_reset : library_check;
  59534. const itemLabel = hasValue ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control being reset e.g. "Padding".
  59535. (0,external_wp_i18n_namespaceObject.__)('Reset %s'), label) : undefined;
  59536. return (0,external_wp_element_namespaceObject.createElement)(menu_item, {
  59537. key: label,
  59538. icon: icon,
  59539. isSelected: true,
  59540. disabled: !hasValue,
  59541. label: itemLabel,
  59542. onClick: () => {
  59543. toggleItem(label);
  59544. onClose();
  59545. },
  59546. role: "menuitemcheckbox"
  59547. }, label);
  59548. }));
  59549. };
  59550. const OptionalControlsGroup = _ref3 => {
  59551. let {
  59552. items,
  59553. onClose,
  59554. toggleItem
  59555. } = _ref3;
  59556. if (!items.length) {
  59557. return null;
  59558. }
  59559. return (0,external_wp_element_namespaceObject.createElement)(menu_group, null, items.map(_ref4 => {
  59560. let [label, isSelected] = _ref4;
  59561. const itemLabel = isSelected ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control being hidden and reset e.g. "Padding".
  59562. (0,external_wp_i18n_namespaceObject.__)('Hide and reset %s'), label) : (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control to display e.g. "Padding".
  59563. (0,external_wp_i18n_namespaceObject.__)('Show %s'), label);
  59564. return (0,external_wp_element_namespaceObject.createElement)(menu_item, {
  59565. key: label,
  59566. icon: isSelected && library_check,
  59567. isSelected: isSelected,
  59568. label: itemLabel,
  59569. onClick: () => {
  59570. toggleItem(label);
  59571. onClose();
  59572. },
  59573. role: "menuitemcheckbox"
  59574. }, label);
  59575. }));
  59576. };
  59577. const component_ToolsPanelHeader = (props, forwardedRef) => {
  59578. const {
  59579. areAllOptionalControlsHidden,
  59580. dropdownMenuClassName,
  59581. hasMenuItems,
  59582. headingClassName,
  59583. label: labelText,
  59584. menuItems,
  59585. resetAll,
  59586. toggleItem,
  59587. ...headerProps
  59588. } = useToolsPanelHeader(props);
  59589. if (!labelText) {
  59590. return null;
  59591. }
  59592. const defaultItems = Object.entries((menuItems === null || menuItems === void 0 ? void 0 : menuItems.default) || {});
  59593. const optionalItems = Object.entries((menuItems === null || menuItems === void 0 ? void 0 : menuItems.optional) || {});
  59594. const dropDownMenuIcon = areAllOptionalControlsHidden ? library_plus : more_vertical;
  59595. const dropDownMenuLabelText = areAllOptionalControlsHidden ? (0,external_wp_i18n_namespaceObject._x)('View and add options', 'Button label to reveal tool panel options') : (0,external_wp_i18n_namespaceObject._x)('View options', 'Button label to reveal tool panel options');
  59596. return (0,external_wp_element_namespaceObject.createElement)(h_stack_component, extends_extends({}, headerProps, {
  59597. ref: forwardedRef
  59598. }), (0,external_wp_element_namespaceObject.createElement)(heading_component, {
  59599. level: 2,
  59600. className: headingClassName
  59601. }, labelText), hasMenuItems && (0,external_wp_element_namespaceObject.createElement)(dropdown_menu, {
  59602. icon: dropDownMenuIcon,
  59603. label: dropDownMenuLabelText,
  59604. menuProps: {
  59605. className: dropdownMenuClassName
  59606. },
  59607. toggleProps: {
  59608. isSmall: true
  59609. }
  59610. }, _ref5 => {
  59611. let {
  59612. onClose = tools_panel_header_component_noop
  59613. } = _ref5;
  59614. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(DefaultControlsGroup, {
  59615. items: defaultItems,
  59616. onClose: onClose,
  59617. toggleItem: toggleItem
  59618. }), (0,external_wp_element_namespaceObject.createElement)(OptionalControlsGroup, {
  59619. items: optionalItems,
  59620. onClose: onClose,
  59621. toggleItem: toggleItem
  59622. }), (0,external_wp_element_namespaceObject.createElement)(menu_group, null, (0,external_wp_element_namespaceObject.createElement)(menu_item, {
  59623. variant: 'tertiary',
  59624. onClick: () => {
  59625. resetAll();
  59626. onClose();
  59627. }
  59628. }, (0,external_wp_i18n_namespaceObject.__)('Reset all'))));
  59629. }));
  59630. };
  59631. const ConnectedToolsPanelHeader = contextConnect(component_ToolsPanelHeader, 'ToolsPanelHeader');
  59632. /* harmony default export */ var tools_panel_header_component = (ConnectedToolsPanelHeader);
  59633. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel/hook.js
  59634. /**
  59635. * WordPress dependencies
  59636. */
  59637. /**
  59638. * Internal dependencies
  59639. */
  59640. const DEFAULT_COLUMNS = 2;
  59641. const generateMenuItems = _ref => {
  59642. let {
  59643. panelItems,
  59644. shouldReset,
  59645. currentMenuItems
  59646. } = _ref;
  59647. const menuItems = {
  59648. default: {},
  59649. optional: {}
  59650. };
  59651. panelItems.forEach(_ref2 => {
  59652. var _currentMenuItems$gro;
  59653. let {
  59654. hasValue,
  59655. isShownByDefault,
  59656. label
  59657. } = _ref2;
  59658. const group = isShownByDefault ? 'default' : 'optional'; // If a menu item for this label already exists, do not overwrite its value.
  59659. // This can cause default controls that have been flagged as customized to
  59660. // lose their value.
  59661. const existingItemValue = currentMenuItems === null || currentMenuItems === void 0 ? void 0 : (_currentMenuItems$gro = currentMenuItems[group]) === null || _currentMenuItems$gro === void 0 ? void 0 : _currentMenuItems$gro[label];
  59662. const value = existingItemValue !== undefined ? existingItemValue : hasValue();
  59663. menuItems[group][label] = shouldReset ? false : value;
  59664. });
  59665. return menuItems;
  59666. };
  59667. const isMenuItemTypeEmpty = obj => obj && Object.keys(obj).length === 0;
  59668. function useToolsPanel(props) {
  59669. const {
  59670. className,
  59671. resetAll,
  59672. panelId,
  59673. hasInnerWrapper,
  59674. shouldRenderPlaceholderItems,
  59675. __experimentalFirstVisibleItemClass,
  59676. __experimentalLastVisibleItemClass,
  59677. ...otherProps
  59678. } = useContextSystem(props, 'ToolsPanel');
  59679. const isResetting = (0,external_wp_element_namespaceObject.useRef)(false);
  59680. const wasResetting = isResetting.current; // `isResetting` is cleared via this hook to effectively batch together
  59681. // the resetAll task. Without this, the flag is cleared after the first
  59682. // control updates and forces a rerender with subsequent controls then
  59683. // believing they need to reset, unfortunately using stale data.
  59684. (0,external_wp_element_namespaceObject.useEffect)(() => {
  59685. if (wasResetting) {
  59686. isResetting.current = false;
  59687. }
  59688. }, [wasResetting]); // Allow panel items to register themselves.
  59689. const [panelItems, setPanelItems] = (0,external_wp_element_namespaceObject.useState)([]);
  59690. const registerPanelItem = (0,external_wp_element_namespaceObject.useCallback)(item => {
  59691. setPanelItems(items => {
  59692. const newItems = [...items]; // If an item with this label has already been registered, remove it
  59693. // first. This can happen when an item is moved between the default
  59694. // and optional groups.
  59695. const existingIndex = newItems.findIndex(oldItem => oldItem.label === item.label);
  59696. if (existingIndex !== -1) {
  59697. newItems.splice(existingIndex, 1);
  59698. }
  59699. return [...newItems, item];
  59700. });
  59701. }, [setPanelItems]); // Panels need to deregister on unmount to avoid orphans in menu state.
  59702. // This is an issue when panel items are being injected via SlotFills.
  59703. const deregisterPanelItem = (0,external_wp_element_namespaceObject.useCallback)(label => {
  59704. // When switching selections between components injecting matching
  59705. // controls, e.g. both panels have a "padding" control, the
  59706. // deregistration of the first panel doesn't occur until after the
  59707. // registration of the next.
  59708. setPanelItems(items => {
  59709. const newItems = [...items];
  59710. const index = newItems.findIndex(item => item.label === label);
  59711. if (index !== -1) {
  59712. newItems.splice(index, 1);
  59713. }
  59714. return newItems;
  59715. });
  59716. }, [setPanelItems]); // Manage and share display state of menu items representing child controls.
  59717. const [menuItems, setMenuItems] = (0,external_wp_element_namespaceObject.useState)({
  59718. default: {},
  59719. optional: {}
  59720. }); // Setup menuItems state as panel items register themselves.
  59721. (0,external_wp_element_namespaceObject.useEffect)(() => {
  59722. setMenuItems(prevState => {
  59723. const items = generateMenuItems({
  59724. panelItems,
  59725. shouldReset: false,
  59726. currentMenuItems: prevState
  59727. });
  59728. return items;
  59729. });
  59730. }, [generateMenuItems, panelItems, setMenuItems]); // Force a menu item to be checked.
  59731. // This is intended for use with default panel items. They are displayed
  59732. // separately to optional items and have different display states,
  59733. // we need to update that when their value is customized.
  59734. const flagItemCustomization = (0,external_wp_element_namespaceObject.useCallback)(function (label) {
  59735. let group = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
  59736. setMenuItems(items => {
  59737. const newState = { ...items,
  59738. [group]: { ...items[group],
  59739. [label]: true
  59740. }
  59741. };
  59742. return newState;
  59743. });
  59744. }, [setMenuItems]); // Whether all optional menu items are hidden or not must be tracked
  59745. // in order to later determine if the panel display is empty and handle
  59746. // conditional display of a plus icon to indicate the presence of further
  59747. // menu items.
  59748. const [areAllOptionalControlsHidden, setAreAllOptionalControlsHidden] = (0,external_wp_element_namespaceObject.useState)(false);
  59749. (0,external_wp_element_namespaceObject.useEffect)(() => {
  59750. if (isMenuItemTypeEmpty(menuItems === null || menuItems === void 0 ? void 0 : menuItems.default) && !isMenuItemTypeEmpty(menuItems === null || menuItems === void 0 ? void 0 : menuItems.optional)) {
  59751. const allControlsHidden = !Object.entries(menuItems.optional).some(_ref3 => {
  59752. let [, isSelected] = _ref3;
  59753. return isSelected;
  59754. });
  59755. setAreAllOptionalControlsHidden(allControlsHidden);
  59756. }
  59757. }, [menuItems, setAreAllOptionalControlsHidden]);
  59758. const cx = useCx();
  59759. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  59760. const wrapperStyle = hasInnerWrapper && ToolsPanelWithInnerWrapper(DEFAULT_COLUMNS);
  59761. const emptyStyle = isMenuItemTypeEmpty(menuItems === null || menuItems === void 0 ? void 0 : menuItems.default) && areAllOptionalControlsHidden && ToolsPanelHiddenInnerWrapper;
  59762. return cx(ToolsPanel, wrapperStyle, emptyStyle, className);
  59763. }, [areAllOptionalControlsHidden, className, cx, hasInnerWrapper, menuItems]); // Toggle the checked state of a menu item which is then used to determine
  59764. // display of the item within the panel.
  59765. const toggleItem = (0,external_wp_element_namespaceObject.useCallback)(label => {
  59766. const currentItem = panelItems.find(item => item.label === label);
  59767. if (!currentItem) {
  59768. return;
  59769. }
  59770. const menuGroup = currentItem.isShownByDefault ? 'default' : 'optional';
  59771. const newMenuItems = { ...menuItems,
  59772. [menuGroup]: { ...menuItems[menuGroup],
  59773. [label]: !menuItems[menuGroup][label]
  59774. }
  59775. };
  59776. setMenuItems(newMenuItems);
  59777. }, [menuItems, panelItems, setMenuItems]); // Resets display of children and executes resetAll callback if available.
  59778. const resetAllItems = (0,external_wp_element_namespaceObject.useCallback)(() => {
  59779. if (typeof resetAll === 'function') {
  59780. isResetting.current = true; // Collect available reset filters from panel items.
  59781. const filters = [];
  59782. panelItems.forEach(item => {
  59783. if (item.resetAllFilter) {
  59784. filters.push(item.resetAllFilter);
  59785. }
  59786. });
  59787. resetAll(filters);
  59788. } // Turn off display of all non-default items.
  59789. const resetMenuItems = generateMenuItems({
  59790. panelItems,
  59791. shouldReset: true
  59792. });
  59793. setMenuItems(resetMenuItems);
  59794. }, [generateMenuItems, isResetting.current, panelItems, resetAll, setMenuItems]); // Assist ItemGroup styling when there are potentially hidden placeholder
  59795. // items by identifying first & last items that are toggled on for display.
  59796. const getFirstVisibleItemLabel = items => {
  59797. const optionalItems = menuItems.optional || {};
  59798. const firstItem = items.find(item => item.isShownByDefault || !!optionalItems[item.label]);
  59799. return firstItem === null || firstItem === void 0 ? void 0 : firstItem.label;
  59800. };
  59801. const firstDisplayedItem = getFirstVisibleItemLabel(panelItems);
  59802. const lastDisplayedItem = getFirstVisibleItemLabel([...panelItems].reverse());
  59803. const panelContext = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  59804. areAllOptionalControlsHidden,
  59805. deregisterPanelItem,
  59806. firstDisplayedItem,
  59807. flagItemCustomization,
  59808. hasMenuItems: !!panelItems.length,
  59809. isResetting: isResetting.current,
  59810. lastDisplayedItem,
  59811. menuItems,
  59812. panelId,
  59813. registerPanelItem,
  59814. shouldRenderPlaceholderItems,
  59815. __experimentalFirstVisibleItemClass,
  59816. __experimentalLastVisibleItemClass
  59817. }), [areAllOptionalControlsHidden, deregisterPanelItem, firstDisplayedItem, flagItemCustomization, isResetting.current, lastDisplayedItem, menuItems, panelId, panelItems, registerPanelItem, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);
  59818. return { ...otherProps,
  59819. panelContext,
  59820. resetAllItems,
  59821. toggleItem,
  59822. className: classes
  59823. };
  59824. }
  59825. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel/component.js
  59826. /**
  59827. * External dependencies
  59828. */
  59829. /**
  59830. * Internal dependencies
  59831. */
  59832. const component_ToolsPanel = (props, forwardedRef) => {
  59833. const {
  59834. children,
  59835. label,
  59836. panelContext,
  59837. resetAllItems,
  59838. toggleItem,
  59839. ...toolsPanelProps
  59840. } = useToolsPanel(props);
  59841. return (0,external_wp_element_namespaceObject.createElement)(grid_component, extends_extends({}, toolsPanelProps, {
  59842. columns: 2,
  59843. ref: forwardedRef
  59844. }), (0,external_wp_element_namespaceObject.createElement)(ToolsPanelContext.Provider, {
  59845. value: panelContext
  59846. }, (0,external_wp_element_namespaceObject.createElement)(tools_panel_header_component, {
  59847. label: label,
  59848. resetAll: resetAllItems,
  59849. toggleItem: toggleItem
  59850. }), children));
  59851. };
  59852. const ConnectedToolsPanel = contextConnect(component_ToolsPanel, 'ToolsPanel');
  59853. /* harmony default export */ var tools_panel_component = (ConnectedToolsPanel);
  59854. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-item/hook.js
  59855. /**
  59856. * WordPress dependencies
  59857. */
  59858. /**
  59859. * Internal dependencies
  59860. */
  59861. function useToolsPanelItem(props) {
  59862. var _menuItems$menuGroup, _menuItems$menuGroup2;
  59863. const {
  59864. className,
  59865. hasValue,
  59866. isShownByDefault,
  59867. label,
  59868. panelId,
  59869. resetAllFilter,
  59870. onDeselect,
  59871. onSelect,
  59872. ...otherProps
  59873. } = useContextSystem(props, 'ToolsPanelItem');
  59874. const {
  59875. panelId: currentPanelId,
  59876. menuItems,
  59877. registerPanelItem,
  59878. deregisterPanelItem,
  59879. flagItemCustomization,
  59880. isResetting,
  59881. shouldRenderPlaceholderItems: shouldRenderPlaceholder,
  59882. firstDisplayedItem,
  59883. lastDisplayedItem,
  59884. __experimentalFirstVisibleItemClass,
  59885. __experimentalLastVisibleItemClass
  59886. } = useToolsPanelContext();
  59887. const hasValueCallback = (0,external_wp_element_namespaceObject.useCallback)(hasValue, [panelId]);
  59888. const resetAllFilterCallback = (0,external_wp_element_namespaceObject.useCallback)(resetAllFilter, [panelId]);
  59889. const previousPanelId = (0,external_wp_compose_namespaceObject.usePrevious)(currentPanelId);
  59890. const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null; // Registering the panel item allows the panel to include it in its
  59891. // automatically generated menu and determine its initial checked status.
  59892. (0,external_wp_element_namespaceObject.useEffect)(() => {
  59893. if (hasMatchingPanel && previousPanelId !== null) {
  59894. registerPanelItem({
  59895. hasValue: hasValueCallback,
  59896. isShownByDefault,
  59897. label,
  59898. resetAllFilter: resetAllFilterCallback,
  59899. panelId
  59900. });
  59901. }
  59902. return () => {
  59903. if (previousPanelId === null && !!currentPanelId || currentPanelId === panelId) {
  59904. deregisterPanelItem(label);
  59905. }
  59906. };
  59907. }, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, resetAllFilterCallback]);
  59908. const isValueSet = hasValue();
  59909. const wasValueSet = (0,external_wp_compose_namespaceObject.usePrevious)(isValueSet); // If this item represents a default control it will need to notify the
  59910. // panel when a custom value has been set.
  59911. (0,external_wp_element_namespaceObject.useEffect)(() => {
  59912. if (isShownByDefault && isValueSet && !wasValueSet) {
  59913. flagItemCustomization(label);
  59914. }
  59915. }, [isValueSet, wasValueSet, isShownByDefault, label]); // Note: `label` is used as a key when building menu item state in
  59916. // `ToolsPanel`.
  59917. const menuGroup = isShownByDefault ? 'default' : 'optional';
  59918. const isMenuItemChecked = menuItems === null || menuItems === void 0 ? void 0 : (_menuItems$menuGroup = menuItems[menuGroup]) === null || _menuItems$menuGroup === void 0 ? void 0 : _menuItems$menuGroup[label];
  59919. const wasMenuItemChecked = (0,external_wp_compose_namespaceObject.usePrevious)(isMenuItemChecked); // Determine if the panel item's corresponding menu is being toggled and
  59920. // trigger appropriate callback if it is.
  59921. (0,external_wp_element_namespaceObject.useEffect)(() => {
  59922. if (isResetting || !hasMatchingPanel) {
  59923. return;
  59924. }
  59925. if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {
  59926. onSelect === null || onSelect === void 0 ? void 0 : onSelect();
  59927. }
  59928. if (!isMenuItemChecked && wasMenuItemChecked) {
  59929. onDeselect === null || onDeselect === void 0 ? void 0 : onDeselect();
  59930. }
  59931. }, [hasMatchingPanel, isMenuItemChecked, isResetting, isValueSet, wasMenuItemChecked]); // The item is shown if it is a default control regardless of whether it
  59932. // has a value. Optional items are shown when they are checked or have
  59933. // a value.
  59934. const isShown = isShownByDefault ? (menuItems === null || menuItems === void 0 ? void 0 : (_menuItems$menuGroup2 = menuItems[menuGroup]) === null || _menuItems$menuGroup2 === void 0 ? void 0 : _menuItems$menuGroup2[label]) !== undefined : isMenuItemChecked;
  59935. const cx = useCx();
  59936. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  59937. const placeholderStyle = shouldRenderPlaceholder && !isShown && ToolsPanelItemPlaceholder;
  59938. const firstItemStyle = firstDisplayedItem === label && __experimentalFirstVisibleItemClass;
  59939. const lastItemStyle = lastDisplayedItem === label && __experimentalLastVisibleItemClass;
  59940. return cx(ToolsPanelItem, placeholderStyle, className, firstItemStyle, lastItemStyle);
  59941. }, [isShown, shouldRenderPlaceholder, className, cx, firstDisplayedItem, lastDisplayedItem, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);
  59942. return { ...otherProps,
  59943. isShown,
  59944. shouldRenderPlaceholder,
  59945. className: classes
  59946. };
  59947. }
  59948. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-item/component.js
  59949. /**
  59950. * External dependencies
  59951. */
  59952. /**
  59953. * Internal dependencies
  59954. */
  59955. // This wraps controls to be conditionally displayed within a tools panel. It
  59956. // prevents props being applied to HTML elements that would make them invalid.
  59957. const component_ToolsPanelItem = (props, forwardedRef) => {
  59958. const {
  59959. children,
  59960. isShown,
  59961. shouldRenderPlaceholder,
  59962. ...toolsPanelItemProps
  59963. } = useToolsPanelItem(props);
  59964. if (!isShown) {
  59965. return shouldRenderPlaceholder ? (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, toolsPanelItemProps, {
  59966. ref: forwardedRef
  59967. })) : null;
  59968. }
  59969. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, toolsPanelItemProps, {
  59970. ref: forwardedRef
  59971. }), children);
  59972. };
  59973. const ConnectedToolsPanelItem = contextConnect(component_ToolsPanelItem, 'ToolsPanelItem');
  59974. /* harmony default export */ var tools_panel_item_component = (ConnectedToolsPanelItem);
  59975. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index-context.js
  59976. /**
  59977. * WordPress dependencies
  59978. */
  59979. const RovingTabIndexContext = (0,external_wp_element_namespaceObject.createContext)();
  59980. const useRovingTabIndexContext = () => (0,external_wp_element_namespaceObject.useContext)(RovingTabIndexContext);
  59981. const RovingTabIndexProvider = RovingTabIndexContext.Provider;
  59982. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index.js
  59983. /**
  59984. * WordPress dependencies
  59985. */
  59986. /**
  59987. * Internal dependencies
  59988. */
  59989. /**
  59990. * Provider for adding roving tab index behaviors to tree grid structures.
  59991. *
  59992. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
  59993. *
  59994. * @param {Object} props Component props.
  59995. * @param {WPElement} props.children Children to be rendered
  59996. */
  59997. function RovingTabIndex(_ref) {
  59998. let {
  59999. children
  60000. } = _ref;
  60001. const [lastFocusedElement, setLastFocusedElement] = (0,external_wp_element_namespaceObject.useState)(); // Use `useMemo` to avoid creation of a new object for the providerValue
  60002. // on every render. Only create a new object when the `lastFocusedElement`
  60003. // value changes.
  60004. const providerValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  60005. lastFocusedElement,
  60006. setLastFocusedElement
  60007. }), [lastFocusedElement]);
  60008. return (0,external_wp_element_namespaceObject.createElement)(RovingTabIndexProvider, {
  60009. value: providerValue
  60010. }, children);
  60011. }
  60012. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/index.js
  60013. /**
  60014. * External dependencies
  60015. */
  60016. /**
  60017. * WordPress dependencies
  60018. */
  60019. /**
  60020. * Internal dependencies
  60021. */
  60022. /**
  60023. * Return focusables in a row element, excluding those from other branches
  60024. * nested within the row.
  60025. *
  60026. * @param {Element} rowElement The DOM element representing the row.
  60027. *
  60028. * @return {?Array} The array of focusables in the row.
  60029. */
  60030. function getRowFocusables(rowElement) {
  60031. const focusablesInRow = external_wp_dom_namespaceObject.focus.focusable.find(rowElement, {
  60032. sequential: true
  60033. });
  60034. if (!focusablesInRow || !focusablesInRow.length) {
  60035. return;
  60036. }
  60037. return focusablesInRow.filter(focusable => {
  60038. return focusable.closest('[role="row"]') === rowElement;
  60039. });
  60040. }
  60041. /**
  60042. * Renders both a table and tbody element, used to create a tree hierarchy.
  60043. *
  60044. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
  60045. * @param {Object} props Component props.
  60046. * @param {WPElement} props.children Children to be rendered.
  60047. * @param {Function} props.onExpandRow Callback to fire when row is expanded.
  60048. * @param {Function} props.onCollapseRow Callback to fire when row is collapsed.
  60049. * @param {Function} props.onFocusRow Callback to fire when moving focus to a different row.
  60050. * @param {Object} ref A ref to the underlying DOM table element.
  60051. */
  60052. function TreeGrid(_ref, ref) {
  60053. let {
  60054. children,
  60055. onExpandRow = () => {},
  60056. onCollapseRow = () => {},
  60057. onFocusRow = () => {},
  60058. ...props
  60059. } = _ref;
  60060. const onKeyDown = (0,external_wp_element_namespaceObject.useCallback)(event => {
  60061. const {
  60062. keyCode,
  60063. metaKey,
  60064. ctrlKey,
  60065. altKey
  60066. } = event; // The shift key is intentionally absent from the following list,
  60067. // to enable shift + up/down to select items from the list.
  60068. const hasModifierKeyPressed = metaKey || ctrlKey || altKey;
  60069. if (hasModifierKeyPressed || !(0,external_lodash_namespaceObject.includes)([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT, external_wp_keycodes_namespaceObject.HOME, external_wp_keycodes_namespaceObject.END], keyCode)) {
  60070. return;
  60071. } // The event will be handled, stop propagation.
  60072. event.stopPropagation();
  60073. const {
  60074. activeElement
  60075. } = document;
  60076. const {
  60077. currentTarget: treeGridElement
  60078. } = event;
  60079. if (!treeGridElement.contains(activeElement)) {
  60080. return;
  60081. } // Calculate the columnIndex of the active element.
  60082. const activeRow = activeElement.closest('[role="row"]');
  60083. const focusablesInRow = getRowFocusables(activeRow);
  60084. const currentColumnIndex = focusablesInRow.indexOf(activeElement);
  60085. const canExpandCollapse = 0 === currentColumnIndex;
  60086. const cannotFocusNextColumn = canExpandCollapse && activeRow.getAttribute('aria-expanded') === 'false' && keyCode === external_wp_keycodes_namespaceObject.RIGHT;
  60087. if ((0,external_lodash_namespaceObject.includes)([external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT], keyCode)) {
  60088. // Calculate to the next element.
  60089. let nextIndex;
  60090. if (keyCode === external_wp_keycodes_namespaceObject.LEFT) {
  60091. nextIndex = Math.max(0, currentColumnIndex - 1);
  60092. } else {
  60093. nextIndex = Math.min(currentColumnIndex + 1, focusablesInRow.length - 1);
  60094. } // Focus is at the left most column.
  60095. if (canExpandCollapse) {
  60096. if (keyCode === external_wp_keycodes_namespaceObject.LEFT) {
  60097. var _activeRow$getAttribu, _getRowFocusables, _getRowFocusables$;
  60098. // Left:
  60099. // If a row is focused, and it is expanded, collapses the current row.
  60100. if (activeRow.getAttribute('aria-expanded') === 'true') {
  60101. onCollapseRow(activeRow);
  60102. event.preventDefault();
  60103. return;
  60104. } // If a row is focused, and it is collapsed, moves to the parent row (if there is one).
  60105. const level = Math.max(parseInt((_activeRow$getAttribu = activeRow === null || activeRow === void 0 ? void 0 : activeRow.getAttribute('aria-level')) !== null && _activeRow$getAttribu !== void 0 ? _activeRow$getAttribu : 1, 10) - 1, 1);
  60106. const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
  60107. let parentRow = activeRow;
  60108. const currentRowIndex = rows.indexOf(activeRow);
  60109. for (let i = currentRowIndex; i >= 0; i--) {
  60110. if (parseInt(rows[i].getAttribute('aria-level'), 10) === level) {
  60111. parentRow = rows[i];
  60112. break;
  60113. }
  60114. }
  60115. (_getRowFocusables = getRowFocusables(parentRow)) === null || _getRowFocusables === void 0 ? void 0 : (_getRowFocusables$ = _getRowFocusables[0]) === null || _getRowFocusables$ === void 0 ? void 0 : _getRowFocusables$.focus();
  60116. }
  60117. if (keyCode === external_wp_keycodes_namespaceObject.RIGHT) {
  60118. // Right:
  60119. // If a row is focused, and it is collapsed, expands the current row.
  60120. if (activeRow.getAttribute('aria-expanded') === 'false') {
  60121. onExpandRow(activeRow);
  60122. event.preventDefault();
  60123. return;
  60124. } // If a row is focused, and it is expanded, focuses the rightmost cell in the row.
  60125. const focusableItems = getRowFocusables(activeRow);
  60126. if (focusableItems.length > 0) {
  60127. var _focusableItems;
  60128. (_focusableItems = focusableItems[focusableItems.length - 1]) === null || _focusableItems === void 0 ? void 0 : _focusableItems.focus();
  60129. }
  60130. } // Prevent key use for anything else. For example, Voiceover
  60131. // will start reading text on continued use of left/right arrow
  60132. // keys.
  60133. event.preventDefault();
  60134. return;
  60135. } // Focus the next element. If at most left column and row is collapsed, moving right is not allowed as this will expand. However, if row is collapsed, moving left is allowed.
  60136. if (cannotFocusNextColumn) {
  60137. return;
  60138. }
  60139. focusablesInRow[nextIndex].focus(); // Prevent key use for anything else. This ensures Voiceover
  60140. // doesn't try to handle key navigation.
  60141. event.preventDefault();
  60142. } else if ((0,external_lodash_namespaceObject.includes)([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN], keyCode)) {
  60143. // Calculate the rowIndex of the next row.
  60144. const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
  60145. const currentRowIndex = rows.indexOf(activeRow);
  60146. let nextRowIndex;
  60147. if (keyCode === external_wp_keycodes_namespaceObject.UP) {
  60148. nextRowIndex = Math.max(0, currentRowIndex - 1);
  60149. } else {
  60150. nextRowIndex = Math.min(currentRowIndex + 1, rows.length - 1);
  60151. } // Focus is either at the top or bottom edge of the grid. Do nothing.
  60152. if (nextRowIndex === currentRowIndex) {
  60153. // Prevent key use for anything else. For example, Voiceover
  60154. // will start navigating horizontally when reaching the vertical
  60155. // bounds of a table.
  60156. event.preventDefault();
  60157. return;
  60158. } // Get the focusables in the next row.
  60159. const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]); // If for some reason there are no focusables in the next row, do nothing.
  60160. if (!focusablesInNextRow || !focusablesInNextRow.length) {
  60161. // Prevent key use for anything else. For example, Voiceover
  60162. // will still focus text when using arrow keys, while this
  60163. // component should limit navigation to focusables.
  60164. event.preventDefault();
  60165. return;
  60166. } // Try to focus the element in the next row that's at a similar column to the activeElement.
  60167. const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
  60168. focusablesInNextRow[nextIndex].focus(); // Let consumers know the row that was originally focused,
  60169. // and the row that is now in focus.
  60170. onFocusRow(event, activeRow, rows[nextRowIndex]); // Prevent key use for anything else. This ensures Voiceover
  60171. // doesn't try to handle key navigation.
  60172. event.preventDefault();
  60173. } else if ((0,external_lodash_namespaceObject.includes)([external_wp_keycodes_namespaceObject.HOME, external_wp_keycodes_namespaceObject.END], keyCode)) {
  60174. // Calculate the rowIndex of the next row.
  60175. const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
  60176. const currentRowIndex = rows.indexOf(activeRow);
  60177. let nextRowIndex;
  60178. if (keyCode === external_wp_keycodes_namespaceObject.HOME) {
  60179. nextRowIndex = 0;
  60180. } else {
  60181. nextRowIndex = rows.length - 1;
  60182. } // Focus is either at the top or bottom edge of the grid. Do nothing.
  60183. if (nextRowIndex === currentRowIndex) {
  60184. // Prevent key use for anything else. For example, Voiceover
  60185. // will start navigating horizontally when reaching the vertical
  60186. // bounds of a table.
  60187. event.preventDefault();
  60188. return;
  60189. } // Get the focusables in the next row.
  60190. const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]); // If for some reason there are no focusables in the next row, do nothing.
  60191. if (!focusablesInNextRow || !focusablesInNextRow.length) {
  60192. // Prevent key use for anything else. For example, Voiceover
  60193. // will still focus text when using arrow keys, while this
  60194. // component should limit navigation to focusables.
  60195. event.preventDefault();
  60196. return;
  60197. } // Try to focus the element in the next row that's at a similar column to the activeElement.
  60198. const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
  60199. focusablesInNextRow[nextIndex].focus(); // Let consumers know the row that was originally focused,
  60200. // and the row that is now in focus.
  60201. onFocusRow(event, activeRow, rows[nextRowIndex]); // Prevent key use for anything else. This ensures Voiceover
  60202. // doesn't try to handle key navigation.
  60203. event.preventDefault();
  60204. }
  60205. }, [onExpandRow, onCollapseRow, onFocusRow]);
  60206. /* Disable reason: A treegrid is implemented using a table element. */
  60207. /* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
  60208. return (0,external_wp_element_namespaceObject.createElement)(RovingTabIndex, null, (0,external_wp_element_namespaceObject.createElement)("table", extends_extends({}, props, {
  60209. role: "treegrid",
  60210. onKeyDown: onKeyDown,
  60211. ref: ref
  60212. }), (0,external_wp_element_namespaceObject.createElement)("tbody", null, children)));
  60213. /* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */
  60214. }
  60215. /* harmony default export */ var tree_grid = ((0,external_wp_element_namespaceObject.forwardRef)(TreeGrid));
  60216. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/row.js
  60217. /**
  60218. * WordPress dependencies
  60219. */
  60220. function TreeGridRow(_ref, ref) {
  60221. let {
  60222. children,
  60223. level,
  60224. positionInSet,
  60225. setSize,
  60226. isExpanded,
  60227. ...props
  60228. } = _ref;
  60229. return (// Disable reason: Due to an error in the ARIA 1.1 specification, the
  60230. // aria-posinset and aria-setsize properties are not supported on row
  60231. // elements. This is being corrected in ARIA 1.2. Consequently, the
  60232. // linting rule fails when validating this markup.
  60233. //
  60234. // eslint-disable-next-line jsx-a11y/role-supports-aria-props
  60235. (0,external_wp_element_namespaceObject.createElement)("tr", extends_extends({}, props, {
  60236. ref: ref,
  60237. role: "row",
  60238. "aria-level": level,
  60239. "aria-posinset": positionInSet,
  60240. "aria-setsize": setSize,
  60241. "aria-expanded": isExpanded
  60242. }), children)
  60243. );
  60244. }
  60245. /* harmony default export */ var tree_grid_row = ((0,external_wp_element_namespaceObject.forwardRef)(TreeGridRow));
  60246. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index-item.js
  60247. /**
  60248. * WordPress dependencies
  60249. */
  60250. /**
  60251. * Internal dependencies
  60252. */
  60253. /* harmony default export */ var roving_tab_index_item = ((0,external_wp_element_namespaceObject.forwardRef)(function RovingTabIndexItem(_ref, forwardedRef) {
  60254. let {
  60255. children,
  60256. as: Component,
  60257. ...props
  60258. } = _ref;
  60259. const localRef = (0,external_wp_element_namespaceObject.useRef)();
  60260. const ref = forwardedRef || localRef;
  60261. const {
  60262. lastFocusedElement,
  60263. setLastFocusedElement
  60264. } = useRovingTabIndexContext();
  60265. let tabIndex;
  60266. if (lastFocusedElement) {
  60267. tabIndex = lastFocusedElement === ref.current ? 0 : -1;
  60268. }
  60269. const onFocus = event => setLastFocusedElement(event.target);
  60270. const allProps = {
  60271. ref,
  60272. tabIndex,
  60273. onFocus,
  60274. ...props
  60275. };
  60276. if (typeof children === 'function') {
  60277. return children(allProps);
  60278. }
  60279. return (0,external_wp_element_namespaceObject.createElement)(Component, allProps, children);
  60280. }));
  60281. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/item.js
  60282. /**
  60283. * WordPress dependencies
  60284. */
  60285. /**
  60286. * Internal dependencies
  60287. */
  60288. /* harmony default export */ var tree_grid_item = ((0,external_wp_element_namespaceObject.forwardRef)(function TreeGridItem(_ref, ref) {
  60289. let {
  60290. children,
  60291. ...props
  60292. } = _ref;
  60293. return (0,external_wp_element_namespaceObject.createElement)(roving_tab_index_item, extends_extends({
  60294. ref: ref
  60295. }, props), children);
  60296. }));
  60297. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/cell.js
  60298. /**
  60299. * WordPress dependencies
  60300. */
  60301. /**
  60302. * Internal dependencies
  60303. */
  60304. /* harmony default export */ var cell = ((0,external_wp_element_namespaceObject.forwardRef)(function TreeGridCell(_ref, ref) {
  60305. let {
  60306. children,
  60307. withoutGridItem = false,
  60308. ...props
  60309. } = _ref;
  60310. return (0,external_wp_element_namespaceObject.createElement)("td", extends_extends({}, props, {
  60311. role: "gridcell"
  60312. }), withoutGridItem ? children : (0,external_wp_element_namespaceObject.createElement)(tree_grid_item, {
  60313. ref: ref
  60314. }, children));
  60315. }));
  60316. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/isolated-event-container/index.js
  60317. /**
  60318. * WordPress dependencies
  60319. */
  60320. function stopPropagation(event) {
  60321. event.stopPropagation();
  60322. }
  60323. /* harmony default export */ var isolated_event_container = ((0,external_wp_element_namespaceObject.forwardRef)((_ref, ref) => {
  60324. let {
  60325. children,
  60326. ...props
  60327. } = _ref;
  60328. external_wp_deprecated_default()('wp.components.IsolatedEventContainer', {
  60329. since: '5.7'
  60330. }); // Disable reason: this stops certain events from propagating outside of the component.
  60331. // - onMouseDown is disabled as this can cause interactions with other DOM elements.
  60332. /* eslint-disable jsx-a11y/no-static-element-interactions */
  60333. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({}, props, {
  60334. ref: ref,
  60335. onMouseDown: stopPropagation
  60336. }), children);
  60337. /* eslint-enable jsx-a11y/no-static-element-interactions */
  60338. }));
  60339. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/z-stack/styles.js
  60340. function z_stack_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
  60341. /**
  60342. * External dependencies
  60343. */
  60344. /**
  60345. * Internal dependencies
  60346. */
  60347. const ZStackView = emotion_styled_base_browser_esm("div", true ? {
  60348. target: "ebn2ljm1"
  60349. } : 0)( true ? {
  60350. name: "5ob2ly",
  60351. styles: "display:flex;position:relative"
  60352. } : 0);
  60353. const ZStackChildView = emotion_styled_base_browser_esm("div", true ? {
  60354. target: "ebn2ljm0"
  60355. } : 0)(_ref => {
  60356. let {
  60357. isLayered,
  60358. offsetAmount
  60359. } = _ref;
  60360. return isLayered ? /*#__PURE__*/emotion_react_browser_esm_css(rtl({
  60361. marginLeft: offsetAmount
  60362. })(), true ? "" : 0, true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css(rtl({
  60363. right: offsetAmount * -1
  60364. })(), true ? "" : 0, true ? "" : 0);
  60365. }, " ", _ref2 => {
  60366. let {
  60367. isLayered
  60368. } = _ref2;
  60369. return isLayered ? positionAbsolute : positionRelative;
  60370. }, " ", _ref3 => {
  60371. let {
  60372. zIndex
  60373. } = _ref3;
  60374. return /*#__PURE__*/emotion_react_browser_esm_css({
  60375. zIndex
  60376. }, true ? "" : 0, true ? "" : 0);
  60377. }, ";" + ( true ? "" : 0));
  60378. const positionAbsolute = true ? {
  60379. name: "a4hmbt",
  60380. styles: "position:absolute"
  60381. } : 0;
  60382. const positionRelative = true ? {
  60383. name: "bjn8wh",
  60384. styles: "position:relative"
  60385. } : 0;
  60386. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/z-stack/component.js
  60387. /**
  60388. * External dependencies
  60389. */
  60390. /**
  60391. * WordPress dependencies
  60392. */
  60393. /**
  60394. * Internal dependencies
  60395. */
  60396. function ZStack(props, forwardedRef) {
  60397. const {
  60398. children,
  60399. className,
  60400. isLayered = true,
  60401. isReversed = false,
  60402. offset = 0,
  60403. ...otherProps
  60404. } = useContextSystem(props, 'ZStack');
  60405. const validChildren = getValidChildren(children);
  60406. const childrenLastIndex = validChildren.length - 1;
  60407. const clonedChildren = validChildren.map((child, index) => {
  60408. const zIndex = isReversed ? childrenLastIndex - index : index;
  60409. const offsetAmount = offset * index;
  60410. const key = (0,external_wp_element_namespaceObject.isValidElement)(child) ? child.key : index;
  60411. return (0,external_wp_element_namespaceObject.createElement)(ZStackChildView, {
  60412. isLayered: isLayered,
  60413. offsetAmount: offsetAmount,
  60414. zIndex: zIndex,
  60415. key: key
  60416. }, child);
  60417. });
  60418. return (0,external_wp_element_namespaceObject.createElement)(ZStackView, extends_extends({}, otherProps, {
  60419. className: className,
  60420. ref: forwardedRef
  60421. }), clonedChildren);
  60422. }
  60423. /* harmony default export */ var z_stack_component = (contextConnect(ZStack, 'ZStack'));
  60424. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/navigate-regions/index.js
  60425. /**
  60426. * WordPress dependencies
  60427. */
  60428. const defaultShortcuts = {
  60429. previous: [{
  60430. modifier: 'ctrlShift',
  60431. character: '`'
  60432. }, {
  60433. modifier: 'access',
  60434. character: 'p'
  60435. }],
  60436. next: [{
  60437. modifier: 'ctrl',
  60438. character: '`'
  60439. }, {
  60440. modifier: 'access',
  60441. character: 'n'
  60442. }]
  60443. };
  60444. function useNavigateRegions() {
  60445. let shortcuts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultShortcuts;
  60446. const ref = (0,external_wp_element_namespaceObject.useRef)();
  60447. const [isFocusingRegions, setIsFocusingRegions] = (0,external_wp_element_namespaceObject.useState)(false);
  60448. function focusRegion(offset) {
  60449. const regions = Array.from(ref.current.querySelectorAll('[role="region"]'));
  60450. if (!regions.length) {
  60451. return;
  60452. }
  60453. let nextRegion = regions[0];
  60454. const selectedIndex = regions.indexOf(ref.current.ownerDocument.activeElement);
  60455. if (selectedIndex !== -1) {
  60456. let nextIndex = selectedIndex + offset;
  60457. nextIndex = nextIndex === -1 ? regions.length - 1 : nextIndex;
  60458. nextIndex = nextIndex === regions.length ? 0 : nextIndex;
  60459. nextRegion = regions[nextIndex];
  60460. }
  60461. nextRegion.focus();
  60462. setIsFocusingRegions(true);
  60463. }
  60464. const clickRef = (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
  60465. function onClick() {
  60466. setIsFocusingRegions(false);
  60467. }
  60468. element.addEventListener('click', onClick);
  60469. return () => {
  60470. element.removeEventListener('click', onClick);
  60471. };
  60472. }, [setIsFocusingRegions]);
  60473. return {
  60474. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, clickRef]),
  60475. className: isFocusingRegions ? 'is-focusing-regions' : '',
  60476. onKeyDown(event) {
  60477. if (shortcuts.previous.some(_ref => {
  60478. let {
  60479. modifier,
  60480. character
  60481. } = _ref;
  60482. return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character);
  60483. })) {
  60484. focusRegion(-1);
  60485. } else if (shortcuts.next.some(_ref2 => {
  60486. let {
  60487. modifier,
  60488. character
  60489. } = _ref2;
  60490. return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character);
  60491. })) {
  60492. focusRegion(1);
  60493. }
  60494. }
  60495. };
  60496. }
  60497. /* harmony default export */ var navigate_regions = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(Component => _ref3 => {
  60498. let {
  60499. shortcuts,
  60500. ...props
  60501. } = _ref3;
  60502. return (0,external_wp_element_namespaceObject.createElement)("div", useNavigateRegions(shortcuts), (0,external_wp_element_namespaceObject.createElement)(Component, props));
  60503. }, 'navigateRegions'));
  60504. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-constrained-tabbing/index.js
  60505. /**
  60506. * WordPress dependencies
  60507. */
  60508. const withConstrainedTabbing = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => function ComponentWithConstrainedTabbing(props) {
  60509. const ref = (0,external_wp_compose_namespaceObject.useConstrainedTabbing)();
  60510. return (0,external_wp_element_namespaceObject.createElement)("div", {
  60511. ref: ref,
  60512. tabIndex: "-1"
  60513. }, (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, props));
  60514. }, 'withConstrainedTabbing');
  60515. /* harmony default export */ var with_constrained_tabbing = (withConstrainedTabbing);
  60516. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-fallback-styles/index.js
  60517. /**
  60518. * External dependencies
  60519. */
  60520. /**
  60521. * WordPress dependencies
  60522. */
  60523. /* harmony default export */ var with_fallback_styles = (mapNodeToProps => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => {
  60524. return class extends external_wp_element_namespaceObject.Component {
  60525. constructor() {
  60526. super(...arguments);
  60527. this.nodeRef = this.props.node;
  60528. this.state = {
  60529. fallbackStyles: undefined,
  60530. grabStylesCompleted: false
  60531. };
  60532. this.bindRef = this.bindRef.bind(this);
  60533. }
  60534. bindRef(node) {
  60535. if (!node) {
  60536. return;
  60537. }
  60538. this.nodeRef = node;
  60539. }
  60540. componentDidMount() {
  60541. this.grabFallbackStyles();
  60542. }
  60543. componentDidUpdate() {
  60544. this.grabFallbackStyles();
  60545. }
  60546. grabFallbackStyles() {
  60547. const {
  60548. grabStylesCompleted,
  60549. fallbackStyles
  60550. } = this.state;
  60551. if (this.nodeRef && !grabStylesCompleted) {
  60552. const newFallbackStyles = mapNodeToProps(this.nodeRef, this.props);
  60553. if (!(0,external_lodash_namespaceObject.isEqual)(newFallbackStyles, fallbackStyles)) {
  60554. this.setState({
  60555. fallbackStyles: newFallbackStyles,
  60556. grabStylesCompleted: !!(0,external_lodash_namespaceObject.every)(newFallbackStyles)
  60557. });
  60558. }
  60559. }
  60560. }
  60561. render() {
  60562. const wrappedComponent = (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, extends_extends({}, this.props, this.state.fallbackStyles));
  60563. return this.props.node ? wrappedComponent : (0,external_wp_element_namespaceObject.createElement)("div", {
  60564. ref: this.bindRef
  60565. }, " ", wrappedComponent, " ");
  60566. }
  60567. };
  60568. }, 'withFallbackStyles'));
  60569. ;// CONCATENATED MODULE: external ["wp","hooks"]
  60570. var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
  60571. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-filters/index.js
  60572. /**
  60573. * External dependencies
  60574. */
  60575. /**
  60576. * WordPress dependencies
  60577. */
  60578. const ANIMATION_FRAME_PERIOD = 16;
  60579. /**
  60580. * Creates a higher-order component which adds filtering capability to the
  60581. * wrapped component. Filters get applied when the original component is about
  60582. * to be mounted. When a filter is added or removed that matches the hook name,
  60583. * the wrapped component re-renders.
  60584. *
  60585. * @param {string} hookName Hook name exposed to be used by filters.
  60586. *
  60587. * @return {Function} Higher-order component factory.
  60588. */
  60589. function withFilters(hookName) {
  60590. return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => {
  60591. const namespace = 'core/with-filters/' + hookName;
  60592. /**
  60593. * The component definition with current filters applied. Each instance
  60594. * reuse this shared reference as an optimization to avoid excessive
  60595. * calls to `applyFilters` when many instances exist.
  60596. *
  60597. * @type {?Component}
  60598. */
  60599. let FilteredComponent;
  60600. /**
  60601. * Initializes the FilteredComponent variable once, if not already
  60602. * assigned. Subsequent calls are effectively a noop.
  60603. */
  60604. function ensureFilteredComponent() {
  60605. if (FilteredComponent === undefined) {
  60606. FilteredComponent = (0,external_wp_hooks_namespaceObject.applyFilters)(hookName, OriginalComponent);
  60607. }
  60608. }
  60609. class FilteredComponentRenderer extends external_wp_element_namespaceObject.Component {
  60610. constructor() {
  60611. super(...arguments);
  60612. ensureFilteredComponent();
  60613. }
  60614. componentDidMount() {
  60615. FilteredComponentRenderer.instances.push(this); // If there were previously no mounted instances for components
  60616. // filtered on this hook, add the hook handler.
  60617. if (FilteredComponentRenderer.instances.length === 1) {
  60618. (0,external_wp_hooks_namespaceObject.addAction)('hookRemoved', namespace, onHooksUpdated);
  60619. (0,external_wp_hooks_namespaceObject.addAction)('hookAdded', namespace, onHooksUpdated);
  60620. }
  60621. }
  60622. componentWillUnmount() {
  60623. FilteredComponentRenderer.instances = (0,external_lodash_namespaceObject.without)(FilteredComponentRenderer.instances, this); // If this was the last of the mounted components filtered on
  60624. // this hook, remove the hook handler.
  60625. if (FilteredComponentRenderer.instances.length === 0) {
  60626. (0,external_wp_hooks_namespaceObject.removeAction)('hookRemoved', namespace);
  60627. (0,external_wp_hooks_namespaceObject.removeAction)('hookAdded', namespace);
  60628. }
  60629. }
  60630. render() {
  60631. return (0,external_wp_element_namespaceObject.createElement)(FilteredComponent, this.props);
  60632. }
  60633. }
  60634. FilteredComponentRenderer.instances = [];
  60635. /**
  60636. * Updates the FilteredComponent definition, forcing a render for each
  60637. * mounted instance. This occurs a maximum of once per animation frame.
  60638. */
  60639. const throttledForceUpdate = (0,external_lodash_namespaceObject.debounce)(() => {
  60640. // Recreate the filtered component, only after delay so that it's
  60641. // computed once, even if many filters added.
  60642. FilteredComponent = (0,external_wp_hooks_namespaceObject.applyFilters)(hookName, OriginalComponent); // Force each instance to render.
  60643. FilteredComponentRenderer.instances.forEach(instance => {
  60644. instance.forceUpdate();
  60645. });
  60646. }, ANIMATION_FRAME_PERIOD);
  60647. /**
  60648. * When a filter is added or removed for the matching hook name, each
  60649. * mounted instance should re-render with the new filters having been
  60650. * applied to the original component.
  60651. *
  60652. * @param {string} updatedHookName Name of the hook that was updated.
  60653. */
  60654. function onHooksUpdated(updatedHookName) {
  60655. if (updatedHookName === hookName) {
  60656. throttledForceUpdate();
  60657. }
  60658. }
  60659. return FilteredComponentRenderer;
  60660. }, 'withFilters');
  60661. }
  60662. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-return/index.js
  60663. /**
  60664. * WordPress dependencies
  60665. */
  60666. /**
  60667. * Returns true if the given object is component-like. An object is component-
  60668. * like if it is an instance of wp.element.Component, or is a function.
  60669. *
  60670. * @param {*} object Object to test.
  60671. *
  60672. * @return {boolean} Whether object is component-like.
  60673. */
  60674. function isComponentLike(object) {
  60675. return object instanceof external_wp_element_namespaceObject.Component || typeof object === 'function';
  60676. }
  60677. /**
  60678. * Higher Order Component used to be used to wrap disposable elements like
  60679. * sidebars, modals, dropdowns. When mounting the wrapped component, we track a
  60680. * reference to the current active element so we know where to restore focus
  60681. * when the component is unmounted.
  60682. *
  60683. * @param {(WPComponent|Object)} options The component to be enhanced with
  60684. * focus return behavior, or an object
  60685. * describing the component and the
  60686. * focus return characteristics.
  60687. *
  60688. * @return {Function} Higher Order Component with the focus restauration behaviour.
  60689. */
  60690. /* harmony default export */ var with_focus_return = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(options => {
  60691. const HoC = function () {
  60692. let {
  60693. onFocusReturn
  60694. } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  60695. return WrappedComponent => {
  60696. const WithFocusReturn = props => {
  60697. const ref = (0,external_wp_compose_namespaceObject.useFocusReturn)(onFocusReturn);
  60698. return (0,external_wp_element_namespaceObject.createElement)("div", {
  60699. ref: ref
  60700. }, (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, props));
  60701. };
  60702. return WithFocusReturn;
  60703. };
  60704. };
  60705. if (isComponentLike(options)) {
  60706. const WrappedComponent = options;
  60707. return HoC()(WrappedComponent);
  60708. }
  60709. return HoC(options);
  60710. }, 'withFocusReturn'));
  60711. const with_focus_return_Provider = _ref => {
  60712. let {
  60713. children
  60714. } = _ref;
  60715. external_wp_deprecated_default()('wp.components.FocusReturnProvider component', {
  60716. since: '5.7',
  60717. hint: 'This provider is not used anymore. You can just remove it from your codebase'
  60718. });
  60719. return children;
  60720. };
  60721. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-notices/index.js
  60722. /**
  60723. * External dependencies
  60724. */
  60725. /**
  60726. * WordPress dependencies
  60727. */
  60728. /**
  60729. * Internal dependencies
  60730. */
  60731. /**
  60732. * Override the default edit UI to include notices if supported.
  60733. *
  60734. * @param {WPComponent} OriginalComponent Original component.
  60735. *
  60736. * @return {WPComponent} Wrapped component.
  60737. */
  60738. /* harmony default export */ var with_notices = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => {
  60739. function Component(props, ref) {
  60740. const [noticeList, setNoticeList] = (0,external_wp_element_namespaceObject.useState)([]);
  60741. const noticeOperations = (0,external_wp_element_namespaceObject.useMemo)(() => {
  60742. /**
  60743. * Function passed down as a prop that adds a new notice.
  60744. *
  60745. * @param {Object} notice Notice to add.
  60746. */
  60747. const createNotice = notice => {
  60748. const noticeToAdd = notice.id ? notice : { ...notice,
  60749. id: esm_browser_v4()
  60750. };
  60751. setNoticeList(current => [...current, noticeToAdd]);
  60752. };
  60753. return {
  60754. createNotice,
  60755. /**
  60756. * Function passed as a prop that adds a new error notice.
  60757. *
  60758. * @param {string} msg Error message of the notice.
  60759. */
  60760. createErrorNotice: msg => {
  60761. createNotice({
  60762. status: 'error',
  60763. content: msg
  60764. });
  60765. },
  60766. /**
  60767. * Removes a notice by id.
  60768. *
  60769. * @param {string} id Id of the notice to remove.
  60770. */
  60771. removeNotice: id => {
  60772. setNoticeList(current => current.filter(notice => notice.id !== id));
  60773. },
  60774. /**
  60775. * Removes all notices
  60776. */
  60777. removeAllNotices: () => {
  60778. setNoticeList([]);
  60779. }
  60780. };
  60781. }, []);
  60782. const propsOut = { ...props,
  60783. noticeList,
  60784. noticeOperations,
  60785. noticeUI: noticeList.length > 0 && (0,external_wp_element_namespaceObject.createElement)(list, {
  60786. className: "components-with-notices-ui",
  60787. notices: noticeList,
  60788. onRemove: noticeOperations.removeNotice
  60789. })
  60790. };
  60791. return isForwardRef ? (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, extends_extends({}, propsOut, {
  60792. ref: ref
  60793. })) : (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, propsOut);
  60794. }
  60795. let isForwardRef;
  60796. const {
  60797. render
  60798. } = OriginalComponent; // Returns a forwardRef if OriginalComponent appears to be a forwardRef.
  60799. if (typeof render === 'function') {
  60800. isForwardRef = true;
  60801. return (0,external_wp_element_namespaceObject.forwardRef)(Component);
  60802. }
  60803. return Component;
  60804. }));
  60805. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/index.js
  60806. // Primitives.
  60807. // Components.
  60808. // Higher-Order Components.
  60809. }();
  60810. (window.wp = window.wp || {}).components = __webpack_exports__;
  60811. /******/ })()
  60812. ;